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-remove-dialog.h"
28 on_remove_command_finished (AnjutaCommand
*command
, guint return_code
,
33 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
,
36 anjuta_status (status
, _("Git: File removed."), 5);
38 report_errors (command
, return_code
);
40 g_object_unref (command
);
45 on_remove_dialog_response (GtkDialog
*dialog
, gint response_id
,
48 GtkWidget
*remove_file_chooser_button
;
49 GtkWidget
*force_check
;
51 const gchar
*relative_filename
;
52 GitRemoveCommand
*remove_command
;
54 if (response_id
== GTK_RESPONSE_OK
)
56 remove_file_chooser_button
= glade_xml_get_widget (data
->gxml
,
57 "remove_file_chooser_button");
58 force_check
= glade_xml_get_widget (data
->gxml
, "force_check");
59 filename
= gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (remove_file_chooser_button
));
61 if (check_input (GTK_WIDGET (dialog
), remove_file_chooser_button
, filename
,
62 _("Please select a file.")))
64 relative_filename
= get_relative_path (filename
,
65 data
->plugin
->project_root_directory
);
66 remove_command
= git_remove_command_new_path (data
->plugin
->project_root_directory
,
68 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (force_check
)));
73 g_signal_connect (G_OBJECT (remove_command
), "command-finished",
74 G_CALLBACK (on_remove_command_finished
),
77 anjuta_command_start (ANJUTA_COMMAND (remove_command
));
83 gtk_widget_destroy (GTK_WIDGET (dialog
));
84 git_ui_data_free (data
);
88 remove_dialog (Git
*plugin
, const gchar
*filename
)
92 GtkWidget
*remove_file_chooser_button
;
95 gxml
= glade_xml_new (GLADE_FILE
, "remove_dialog", NULL
);
97 dialog
= glade_xml_get_widget (gxml
, "remove_dialog");
98 remove_file_chooser_button
= glade_xml_get_widget (gxml
, "remove_file_chooser_button");
100 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (remove_file_chooser_button
),
103 data
= git_ui_data_new (plugin
, gxml
);
105 g_signal_connect(G_OBJECT (dialog
), "response",
106 G_CALLBACK (on_remove_dialog_response
),
109 gtk_widget_show_all (dialog
);
113 on_menu_git_remove (GtkAction
*action
, Git
*plugin
)
115 remove_dialog (plugin
, plugin
->current_editor_filename
);