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-checkout-files-dialog.h"
28 on_checkout_files_command_finished (AnjutaCommand
*command
, guint return_code
,
33 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
,
36 anjuta_status (status
, _("Git: Files checked out."), 5);
38 git_report_errors (command
, return_code
);
40 g_object_unref (command
);
45 on_checkout_files_dialog_response (GtkDialog
*dialog
, gint response_id
,
48 GtkWidget
*checkout_status_view
;
49 GList
*selected_paths
;
50 GitCheckoutFilesCommand
*checkout_files_command
;
52 if (response_id
== GTK_RESPONSE_OK
)
54 checkout_status_view
= glade_xml_get_widget (data
->gxml
, "checkout_status_view");
55 selected_paths
= anjuta_vcs_status_tree_view_get_selected (ANJUTA_VCS_STATUS_TREE_VIEW (checkout_status_view
));
56 checkout_files_command
= git_checkout_files_command_new (data
->plugin
->project_root_directory
,
59 git_command_free_path_list (selected_paths
);
61 g_signal_connect (G_OBJECT (checkout_files_command
), "command-finished",
62 G_CALLBACK (on_checkout_files_command_finished
),
65 anjuta_command_start (ANJUTA_COMMAND (checkout_files_command
));
68 gtk_widget_destroy (GTK_WIDGET (dialog
));
69 git_ui_data_free (data
);
73 checkout_files_dialog (Git
*plugin
)
77 GtkWidget
*checkout_select_all_button
;
78 GtkWidget
*checkout_clear_button
;
79 GtkWidget
*checkout_status_view
;
80 GtkWidget
*checkout_status_progress_bar
;
81 GitStatusCommand
*status_command
;
84 gxml
= glade_xml_new (GLADE_FILE
, "checkout_files_dialog", NULL
);
86 dialog
= glade_xml_get_widget (gxml
, "checkout_files_dialog");
87 checkout_select_all_button
= glade_xml_get_widget (gxml
, "checkout_select_all_button");
88 checkout_clear_button
= glade_xml_get_widget (gxml
, "checkout_clear_button");
89 checkout_status_view
= glade_xml_get_widget (gxml
, "checkout_status_view");
90 checkout_status_progress_bar
= glade_xml_get_widget (gxml
, "checkout_status_progress_bar");
92 status_command
= git_status_command_new (plugin
->project_root_directory
,
93 GIT_STATUS_SECTION_NOT_UPDATED
);
95 g_signal_connect (G_OBJECT (checkout_select_all_button
), "clicked",
96 G_CALLBACK (git_select_all_status_items
),
97 checkout_status_view
);
99 g_signal_connect (G_OBJECT (checkout_clear_button
), "clicked",
100 G_CALLBACK (git_clear_all_status_selections
),
101 checkout_status_view
);
103 git_pulse_progress_bar (GTK_PROGRESS_BAR (checkout_status_progress_bar
));
105 g_signal_connect (G_OBJECT (status_command
), "command-finished",
106 G_CALLBACK (git_cancel_data_arrived_signal_disconnect
),
107 checkout_status_view
);
109 g_signal_connect (G_OBJECT (status_command
), "command-finished",
110 G_CALLBACK (git_hide_pulse_progress_bar
),
111 checkout_status_progress_bar
);
113 g_signal_connect (G_OBJECT (status_command
), "command-finished",
114 G_CALLBACK (on_git_command_finished
),
117 g_signal_connect (G_OBJECT (status_command
), "data-arrived",
118 G_CALLBACK (on_git_status_command_data_arrived
),
119 checkout_status_view
);
121 g_object_weak_ref (G_OBJECT (checkout_status_view
),
122 (GWeakNotify
) git_disconnect_data_arrived_signals
,
125 anjuta_command_start (ANJUTA_COMMAND (status_command
));
127 data
= git_ui_data_new (plugin
, gxml
);
129 g_signal_connect(G_OBJECT (dialog
), "response",
130 G_CALLBACK (on_checkout_files_dialog_response
),
133 gtk_widget_show_all (dialog
);
137 on_menu_git_checkout_files (GtkAction
*action
, Git
*plugin
)
139 checkout_files_dialog (plugin
);