1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2008 <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 "git-raw-output-command.h"
27 struct _GitRawOutputCommandPriv
32 G_DEFINE_TYPE (GitRawOutputCommand
, git_raw_output_command
, GIT_TYPE_COMMAND
);
35 git_raw_output_command_init (GitRawOutputCommand
*self
)
37 self
->priv
= g_new0 (GitRawOutputCommandPriv
, 1);
38 self
->priv
->output_queue
= g_queue_new ();
42 git_raw_output_command_finalize (GObject
*object
)
44 GitRawOutputCommand
*self
;
45 GList
*current_output
;
47 self
= GIT_RAW_OUTPUT_COMMAND (object
);
49 current_output
= self
->priv
->output_queue
->head
;
51 while (current_output
)
53 g_free (current_output
->data
);
54 current_output
= g_list_next (current_output
);
57 g_queue_free (self
->priv
->output_queue
);
60 G_OBJECT_CLASS (git_raw_output_command_parent_class
)->finalize (object
);
64 git_raw_output_command_handle_output (GitCommand
*git_command
,
67 GitRawOutputCommand
*self
;
69 self
= GIT_RAW_OUTPUT_COMMAND (git_command
);
71 g_queue_push_tail (self
->priv
->output_queue
, g_strdup (output
));
72 anjuta_command_notify_data_arrived (ANJUTA_COMMAND (git_command
));
76 git_raw_output_command_class_init (GitRawOutputCommandClass
*klass
)
78 GObjectClass
* object_class
= G_OBJECT_CLASS (klass
);
79 GitCommandClass
* parent_class
= GIT_COMMAND_CLASS (klass
);
81 object_class
->finalize
= git_raw_output_command_finalize
;
82 parent_class
->output_handler
= git_raw_output_command_handle_output
;
86 git_raw_output_command_get_output (GitRawOutputCommand
*self
)
88 return self
->priv
->output_queue
;