Updated Spanish translation
[anjuta-git-plugin.git] / libanjuta / anjuta-command.c
blobaa99b44ae1a884251fe27af5693bf5c55dfb9127
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 * anjuta
4 * Copyright (C) James Liggett 2007 <jrliggett@cox.net>
5 *
6 * anjuta is free software.
7 *
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)
11 * any later version.
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
29 gchar *error_message;
32 enum
34 DATA_ARRIVED,
35 COMMAND_FINISHED,
37 LAST_SIGNAL
41 static guint anjuta_command_signals[LAST_SIGNAL] = { 0 };
43 G_DEFINE_TYPE (AnjutaCommand, anjuta_command, G_TYPE_OBJECT);
45 static void
46 anjuta_command_init (AnjutaCommand *self)
48 self->priv = g_new0 (AnjutaCommandPriv, 1);
51 static void
52 anjuta_command_finalize (GObject *object)
54 AnjutaCommand *self;
56 self = ANJUTA_COMMAND (object);
58 g_free (self->priv->error_message);
59 g_free (self->priv);
61 G_OBJECT_CLASS (anjuta_command_parent_class)->finalize (object);
64 static void
65 anjuta_command_class_init (AnjutaCommandClass *klass)
67 GObjectClass* object_class = G_OBJECT_CLASS (klass);
69 object_class->finalize = anjuta_command_finalize;
71 klass->run = NULL;
72 klass->start = NULL;
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),
81 G_SIGNAL_RUN_FIRST,
83 NULL, NULL,
84 g_cclosure_marshal_VOID__VOID,
85 G_TYPE_NONE,
86 0);
88 anjuta_command_signals[COMMAND_FINISHED] =
89 g_signal_new ("command-finished",
90 G_OBJECT_CLASS_TYPE (klass),
91 G_SIGNAL_RUN_FIRST,
93 NULL, NULL,
94 g_cclosure_marshal_VOID__UINT ,
95 G_TYPE_NONE, 1,
96 G_TYPE_UINT);
99 void
100 anjuta_command_start (AnjutaCommand *self)
102 ANJUTA_COMMAND_GET_CLASS (self)->start (self);
105 void
106 anjuta_command_notify_data_arrived (AnjutaCommand *self)
108 ANJUTA_COMMAND_GET_CLASS (self)->notify_data_arrived (self);
111 void
112 anjuta_command_notify_complete (AnjutaCommand *self, guint return_code)
114 ANJUTA_COMMAND_GET_CLASS (self)->notify_complete (self, return_code);
117 void
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);
126 gchar *
127 anjuta_command_get_error_message (AnjutaCommand *self)
129 return g_strdup (self->priv->error_message);