Integrate removing files with the file manager
[anjuta-git-plugin.git] / plugins / subversion / subversion-resolve-dialog.c
blob6ee20d9beb722ee83feffa6ca06e2c7eede87e00
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 "subversion-resolve-dialog.h"
27 static void
28 on_resolve_command_finished (AnjutaCommand *command, guint return_code,
29 Subversion *plugin)
31 AnjutaStatus *status;
33 status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell,
34 NULL);
36 anjuta_status (status, _("Subversion: Resolve complete."), 5);
38 report_errors (command, return_code);
40 svn_resolve_command_destroy (SVN_RESOLVE_COMMAND (command));
43 static void
44 on_subversion_resolve_response (GtkDialog *dialog, gint response,
45 SubversionData *data)
47 SvnResolveCommand *resolve_command;
48 GtkWidget *resolve_status_view;
49 GList *selected_paths;
51 if (response == GTK_RESPONSE_OK)
53 resolve_status_view = glade_xml_get_widget (data->gxml,
54 "resolve_status_view");
55 selected_paths = anjuta_vcs_status_tree_view_get_selected (ANJUTA_VCS_STATUS_TREE_VIEW (resolve_status_view));
56 resolve_command = svn_resolve_command_new (selected_paths, TRUE);
58 svn_command_free_path_list (selected_paths);
60 g_signal_connect (G_OBJECT (resolve_command), "data-arrived",
61 G_CALLBACK (on_command_info_arrived),
62 data->plugin);
64 g_signal_connect (G_OBJECT (resolve_command), "command-finished",
65 G_CALLBACK (on_resolve_command_finished),
66 data->plugin);
68 create_message_view (data->plugin);
70 anjuta_command_start (ANJUTA_COMMAND (resolve_command));
73 subversion_data_free (data);
74 gtk_widget_destroy (GTK_WIDGET (dialog));
77 static void
78 subversion_resolve_dialog (GtkAction *action, Subversion *plugin)
80 GladeXML *gxml;
81 GtkWidget *subversion_resolve;
82 GtkWidget *resolve_select_all_button;
83 GtkWidget *resolve_clear_button;
84 GtkWidget *resolve_status_view;
85 GtkWidget *resolve_status_progress_bar;
86 SvnStatusCommand *status_command;
87 SubversionData *data;
89 gxml = glade_xml_new (GLADE_FILE, "subversion_resolve", NULL);
91 subversion_resolve = glade_xml_get_widget (gxml,
92 "subversion_resolve");
93 resolve_select_all_button = glade_xml_get_widget (gxml,
94 "resolve_select_all_button");
95 resolve_clear_button = glade_xml_get_widget (gxml,
96 "resolve_clear_button");
97 resolve_status_view = glade_xml_get_widget (gxml,
98 "resolve_status_view");
99 resolve_status_progress_bar = glade_xml_get_widget (gxml,
100 "resolve_status_progress_bar");
102 status_command = svn_status_command_new (plugin->project_root_dir, TRUE,
103 FALSE);
105 data = subversion_data_new (plugin, gxml);
107 g_signal_connect (G_OBJECT (subversion_resolve), "response",
108 G_CALLBACK (on_subversion_resolve_response),
109 data);
111 g_signal_connect (G_OBJECT (resolve_select_all_button), "clicked",
112 G_CALLBACK (select_all_status_items),
113 resolve_status_view);
115 g_signal_connect (G_OBJECT (resolve_clear_button), "clicked",
116 G_CALLBACK (clear_all_status_selections),
117 resolve_status_view);
119 g_signal_connect (G_OBJECT (status_command), "data-arrived",
120 G_CALLBACK (on_status_command_data_arrived),
121 resolve_status_view);
123 pulse_progress_bar (GTK_PROGRESS_BAR (resolve_status_progress_bar));
125 g_signal_connect (G_OBJECT (status_command), "command-finished",
126 G_CALLBACK (cancel_data_arrived_signal_disconnect),
127 resolve_status_view);
129 g_signal_connect (G_OBJECT (status_command), "command_finished",
130 G_CALLBACK (hide_pulse_progress_bar),
131 resolve_status_progress_bar);
133 g_signal_connect (G_OBJECT (status_command), "command-finished",
134 G_CALLBACK (on_status_command_finished),
135 resolve_status_view);
137 g_object_weak_ref (G_OBJECT (resolve_status_view),
138 (GWeakNotify) disconnect_data_arrived_signals,
139 status_command);
141 anjuta_command_start (ANJUTA_COMMAND (status_command));
143 gtk_dialog_run (GTK_DIALOG (subversion_resolve));
146 void
147 on_menu_subversion_resolve (GtkAction *action, Subversion *plugin)
149 subversion_resolve_dialog (action, plugin);