1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2007 <jrliggett@cox.net>
6 * anjuta is free software.
8 * You may redistribute it and/or modify it under the terms of the
9 * GNU General Public License, as published by the Free Software
10 * Foundation; either version 2 of the License, or (at your option)
13 * anjuta is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with anjuta. If not, write to:
20 * The Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02110-1301, USA.
25 #include "anjuta-command.h"
27 struct _AnjutaCommandPriv
41 static guint anjuta_command_signals
[LAST_SIGNAL
] = { 0 };
43 G_DEFINE_TYPE (AnjutaCommand
, anjuta_command
, G_TYPE_OBJECT
);
46 anjuta_command_init (AnjutaCommand
*self
)
48 self
->priv
= g_new0 (AnjutaCommandPriv
, 1);
52 anjuta_command_finalize (GObject
*object
)
56 self
= ANJUTA_COMMAND (object
);
58 g_free (self
->priv
->error_message
);
61 G_OBJECT_CLASS (anjuta_command_parent_class
)->finalize (object
);
65 anjuta_command_class_init (AnjutaCommandClass
*klass
)
67 GObjectClass
* object_class
= G_OBJECT_CLASS (klass
);
69 object_class
->finalize
= anjuta_command_finalize
;
73 klass
->notify_data_arrived
= NULL
;
74 klass
->notify_complete
= NULL
;
75 klass
->set_error_message
= anjuta_command_set_error_message
;
76 klass
->get_error_message
= anjuta_command_get_error_message
;
78 anjuta_command_signals
[DATA_ARRIVED
] =
79 g_signal_new ("data-arrived",
80 G_OBJECT_CLASS_TYPE (klass
),
84 g_cclosure_marshal_VOID__VOID
,
88 anjuta_command_signals
[COMMAND_FINISHED
] =
89 g_signal_new ("command-finished",
90 G_OBJECT_CLASS_TYPE (klass
),
94 g_cclosure_marshal_VOID__UINT
,
100 anjuta_command_start (AnjutaCommand
*self
)
102 ANJUTA_COMMAND_GET_CLASS (self
)->start (self
);
106 anjuta_command_notify_data_arrived (AnjutaCommand
*self
)
108 ANJUTA_COMMAND_GET_CLASS (self
)->notify_data_arrived (self
);
112 anjuta_command_notify_complete (AnjutaCommand
*self
, guint return_code
)
114 ANJUTA_COMMAND_GET_CLASS (self
)->notify_complete (self
, return_code
);
118 anjuta_command_set_error_message (AnjutaCommand
*self
, gchar
*error_message
)
120 if (self
->priv
->error_message
)
121 g_free (error_message
);
123 self
->priv
->error_message
= g_strdup (error_message
);
127 anjuta_command_get_error_message (AnjutaCommand
*self
)
129 return g_strdup (self
->priv
->error_message
);