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-ignore-dialog.h"
28 on_ignore_dialog_response (GtkDialog
*dialog
, gint response_id
,
31 GtkWidget
*ignore_status_view
;
32 GList
*selected_paths
;
33 GitIgnoreCommand
*ignore_command
;
35 if (response_id
== GTK_RESPONSE_OK
)
37 ignore_status_view
= glade_xml_get_widget (data
->gxml
, "ignore_status_view");
38 selected_paths
= anjuta_vcs_status_tree_view_get_selected (ANJUTA_VCS_STATUS_TREE_VIEW (ignore_status_view
));
39 ignore_command
= git_ignore_command_new_list (data
->plugin
->project_root_directory
,
42 git_command_free_path_list (selected_paths
);
44 g_signal_connect (G_OBJECT (ignore_command
), "command-finished",
45 G_CALLBACK (on_git_command_finished
),
48 anjuta_command_start (ANJUTA_COMMAND (ignore_command
));
51 gtk_widget_destroy (GTK_WIDGET (dialog
));
52 git_ui_data_free (data
);
56 ignore_dialog (Git
*plugin
)
60 GtkWidget
*ignore_select_all_button
;
61 GtkWidget
*ignore_clear_button
;
62 GtkWidget
*ignore_status_view
;
63 GtkWidget
*ignore_status_progress_bar
;
64 GitStatusCommand
*status_command
;
67 gxml
= glade_xml_new (GLADE_FILE
, "ignore_dialog", NULL
);
69 dialog
= glade_xml_get_widget (gxml
, "ignore_dialog");
70 ignore_select_all_button
= glade_xml_get_widget (gxml
, "ignore_select_all_button");
71 ignore_clear_button
= glade_xml_get_widget (gxml
, "ignore_clear_button");
72 ignore_status_view
= glade_xml_get_widget (gxml
, "ignore_status_view");
73 ignore_status_progress_bar
= glade_xml_get_widget (gxml
, "ignore_status_progress_bar");
75 status_command
= git_status_command_new (plugin
->project_root_directory
,
76 GIT_STATUS_SECTION_UNTRACKED
);
78 g_signal_connect (G_OBJECT (ignore_select_all_button
), "clicked",
79 G_CALLBACK (git_select_all_status_items
),
82 g_signal_connect (G_OBJECT (ignore_clear_button
), "clicked",
83 G_CALLBACK (git_clear_all_status_selections
),
86 git_pulse_progress_bar (GTK_PROGRESS_BAR (ignore_status_progress_bar
));
88 g_signal_connect (G_OBJECT (status_command
), "command-finished",
89 G_CALLBACK (git_cancel_data_arrived_signal_disconnect
),
92 g_signal_connect (G_OBJECT (status_command
), "command-finished",
93 G_CALLBACK (git_hide_pulse_progress_bar
),
94 ignore_status_progress_bar
);
96 g_signal_connect (G_OBJECT (status_command
), "command-finished",
97 G_CALLBACK (on_git_command_finished
),
100 g_signal_connect (G_OBJECT (status_command
), "data-arrived",
101 G_CALLBACK (on_git_status_command_data_arrived
),
104 g_object_weak_ref (G_OBJECT (ignore_status_view
),
105 (GWeakNotify
) git_disconnect_data_arrived_signals
,
108 anjuta_command_start (ANJUTA_COMMAND (status_command
));
110 data
= git_ui_data_new (plugin
, gxml
);
112 g_signal_connect(G_OBJECT (dialog
), "response",
113 G_CALLBACK (on_ignore_dialog_response
),
116 gtk_widget_show_all (dialog
);
120 on_menu_git_ignore (GtkAction
*action
, Git
*plugin
)
122 ignore_dialog (plugin
);