1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2007 <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 "subversion-resolve-dialog.h"
28 on_resolve_command_finished (AnjutaCommand
*command
, guint return_code
,
33 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
,
36 anjuta_status (status
, _("Subversion: Resolve complete."), 5);
38 report_errors (command
, return_code
);
40 svn_resolve_command_destroy (SVN_RESOLVE_COMMAND (command
));
44 on_subversion_resolve_response (GtkDialog
*dialog
, gint response
,
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
),
64 g_signal_connect (G_OBJECT (resolve_command
), "command-finished",
65 G_CALLBACK (on_resolve_command_finished
),
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
));
78 subversion_resolve_dialog (GtkAction
*action
, Subversion
*plugin
)
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
;
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
,
105 data
= subversion_data_new (plugin
, gxml
);
107 g_signal_connect (G_OBJECT (subversion_resolve
), "response",
108 G_CALLBACK (on_subversion_resolve_response
),
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
,
141 anjuta_command_start (ANJUTA_COMMAND (status_command
));
143 gtk_dialog_run (GTK_DIALOG (subversion_resolve
));
147 on_menu_subversion_resolve (GtkAction
*action
, Subversion
*plugin
)
149 subversion_resolve_dialog (action
, plugin
);