1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2007 <jrliggett@cox.net>
6 * Portions based on the original Subversion plugin
7 * Copyright (C) Johannes Schmid 2005
9 * anjuta is free software.
11 * You may redistribute it and/or modify it under the terms of the
12 * GNU General Public License, as published by the Free Software
13 * Foundation; either version 2 of the License, or (at your option)
16 * anjuta is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with anjuta. If not, write to:
23 * The Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor
25 * Boston, MA 02110-1301, USA.
28 #include "subversion-update-dialog.h"
31 on_update_command_finished (AnjutaCommand
*command
, guint return_code
,
36 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
,
39 anjuta_status (status
, _("Subversion: Update complete."), 5);
41 report_errors (command
, return_code
);
43 svn_update_command_destroy (SVN_UPDATE_COMMAND (command
));
47 on_subversion_update_response(GtkDialog
* dialog
, gint response
, SubversionData
* data
)
53 const gchar
* revision
;
56 GtkWidget
* revisionentry
;
57 GtkWidget
* fileentry
= glade_xml_get_widget(data
->gxml
, "subversion_filename");
58 const gchar
* filename
= g_strdup(gtk_entry_get_text(GTK_ENTRY(fileentry
)));
59 SvnUpdateCommand
*update_command
;
61 norecurse
= glade_xml_get_widget(data
->gxml
, "subversion_norecurse");
62 revisionentry
= glade_xml_get_widget(data
->gxml
, "subversion_revision");
63 revision
= gtk_entry_get_text(GTK_ENTRY(revisionentry
));
65 if (!check_input (GTK_WIDGET (dialog
),
66 fileentry
, _("Please enter a path.")))
71 update_command
= svn_update_command_new ((gchar
*) filename
,
73 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(norecurse
)));
74 create_message_view (data
->plugin
);
76 g_signal_connect (G_OBJECT (update_command
), "command-finished",
77 G_CALLBACK (on_update_command_finished
),
80 g_signal_connect (G_OBJECT (update_command
), "data-arrived",
81 G_CALLBACK (on_command_info_arrived
),
84 anjuta_command_start (ANJUTA_COMMAND (update_command
));
86 subversion_data_free(data
);
87 gtk_widget_destroy(GTK_WIDGET(dialog
));
92 gtk_widget_destroy(GTK_WIDGET(dialog
));
93 subversion_data_free(data
);
100 subversion_update_dialog (GtkAction
* action
, Subversion
* plugin
, gchar
*filename
)
104 GtkWidget
* fileentry
;
106 SubversionData
* data
;
108 gxml
= glade_xml_new(GLADE_FILE
, "subversion_update", NULL
);
110 dialog
= glade_xml_get_widget(gxml
, "subversion_update");
111 fileentry
= glade_xml_get_widget(gxml
, "subversion_filename");
113 gtk_entry_set_text(GTK_ENTRY(fileentry
), filename
);
115 project
= glade_xml_get_widget(gxml
, "subversion_project");
116 g_object_set_data (G_OBJECT (project
), "fileentry", fileentry
);
117 g_signal_connect(G_OBJECT(project
), "toggled",
118 G_CALLBACK(on_whole_project_toggled
), plugin
);
119 init_whole_project(plugin
, project
, !filename
);
121 data
= subversion_data_new(plugin
, gxml
);
122 g_signal_connect(G_OBJECT(dialog
), "response",
123 G_CALLBACK(on_subversion_update_response
), data
);
125 gtk_widget_show(dialog
);
129 on_menu_subversion_update (GtkAction
* action
, Subversion
* plugin
)
131 subversion_update_dialog(action
, plugin
, NULL
);
135 on_fm_subversion_update (GtkAction
* action
, Subversion
* plugin
)
137 subversion_update_dialog(action
, plugin
, plugin
->fm_current_filename
);