anjuta r3482 - in trunk: . plugins/subversion
- From: naba svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r3482 - in trunk: . plugins/subversion
- Date: Wed, 16 Jan 2008 22:18:15 +0000 (GMT)
Author: naba
Date: Wed Jan 16 22:18:15 2008
New Revision: 3482
URL: http://svn.gnome.org/viewvc/anjuta?rev=3482&view=rev
Log:
* plugins/subversion/subversion-add-dialog.c:
(on_subversion_add_response):
* plugins/subversion/subversion-copy-dialog.c:
(on_subversion_copy_response):
* plugins/subversion/subversion-diff-dialog.c:
(on_subversion_diff_response):
* plugins/subversion/subversion-merge-dialog.c:
(on_subversion_merge_response):
* plugins/subversion/subversion-remove-dialog.c:
(on_subversion_remove_response):
* plugins/subversion/subversion-switch-dialog.c:
(on_subversion_switch_response):
* plugins/subversion/subversion-ui-utils.c: (check_input):
* plugins/subversion/subversion-ui-utils.h:
* plugins/subversion/subversion-update-dialog.c:
(on_subversion_update_response):
If the user doesn\'t enter any data for path or revision fields in certain SVN
plugin dialogs, libsvn throws assertion failures and kills Anjuta. To avoid
this, the validity of path and revision input data are checked before the
command gets executed.
Modified:
trunk/ChangeLog
trunk/plugins/subversion/subversion-add-dialog.c
trunk/plugins/subversion/subversion-copy-dialog.c
trunk/plugins/subversion/subversion-diff-dialog.c
trunk/plugins/subversion/subversion-merge-dialog.c
trunk/plugins/subversion/subversion-remove-dialog.c
trunk/plugins/subversion/subversion-switch-dialog.c
trunk/plugins/subversion/subversion-ui-utils.c
trunk/plugins/subversion/subversion-ui-utils.h
trunk/plugins/subversion/subversion-update-dialog.c
Modified: trunk/plugins/subversion/subversion-add-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-add-dialog.c (original)
+++ trunk/plugins/subversion/subversion-add-dialog.c Wed Jan 16 22:18:15 2008
@@ -59,8 +59,11 @@
const gchar* filename = gtk_entry_get_text(GTK_ENTRY(fileentry));
SvnAddCommand *add_command;
- if (!check_filename(dialog, filename))
+ if (!check_input (GTK_WIDGET (dialog),
+ fileentry, _("Please enter a path.")))
+ {
break;
+ }
add_command = svn_add_command_new ((gchar *) filename,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(force)),
Modified: trunk/plugins/subversion/subversion-copy-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-copy-dialog.c (original)
+++ trunk/plugins/subversion/subversion-copy-dialog.c Wed Jan 16 22:18:15 2008
@@ -180,6 +180,18 @@
dest_path = gtk_editable_get_chars (GTK_EDITABLE (copy_dest_entry),
0, -1);
+ if (!check_input (GTK_WIDGET (dialog), copy_source_entry,
+ _("Please enter a source path.")))
+ {
+ return;
+ }
+
+ if (!check_input (GTK_WIDGET (dialog), copy_dest_entry,
+ _("Please enter a destination path.")))
+ {
+ return;
+ }
+
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (copy_working_copy_radio)))
revision = SVN_COPY_REVISION_WORKING;
@@ -190,6 +202,13 @@
{
copy_revision_entry = glade_xml_get_widget (data->gxml,
"copy_revision_entry");
+
+ if (!check_input (GTK_WIDGET (dialog), copy_revision_entry,
+ _("Please enter a revision.")))
+ {
+ return;
+ }
+
revision_text = gtk_editable_get_chars (GTK_EDITABLE (copy_revision_entry),
0, -1);
revision = atol (revision_text);
@@ -201,9 +220,6 @@
create_message_view (data->plugin);
- g_print ("Source path: %s\n", source_path);
- g_print ("Destination path: %s\n", dest_path);
-
copy_command = svn_copy_command_new (source_path, revision, dest_path,
log);
Modified: trunk/plugins/subversion/subversion-diff-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-diff-dialog.c (original)
+++ trunk/plugins/subversion/subversion-diff-dialog.c Wed Jan 16 22:18:15 2008
@@ -60,8 +60,11 @@
revision_text = gtk_entry_get_text (GTK_ENTRY (diff_revision_entry));
revision = atol (revision_text);
- if (!check_filename(dialog, path))
- break;
+ if (!check_input (GTK_WIDGET (dialog), diff_path_entry,
+ _("Please enter a path.")))
+ {
+ break;
+ }
docman = anjuta_shell_get_interface (ANJUTA_PLUGIN (data->plugin)->shell,
IAnjutaDocumentManager, NULL);
Modified: trunk/plugins/subversion/subversion-merge-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-merge-dialog.c (original)
+++ trunk/plugins/subversion/subversion-merge-dialog.c Wed Jan 16 22:18:15 2008
@@ -89,6 +89,24 @@
merge_dry_run_check = glade_xml_get_widget (data->gxml,
"merge_dry_run_check");
+ if (!check_input (GTK_WIDGET (dialog), merge_first_path_entry,
+ _("Please enter the first path.")))
+ {
+ return;
+ }
+
+ if (!check_input (GTK_WIDGET (dialog), merge_second_path_entry,
+ _("Please enter the second path.")))
+ {
+ return;
+ }
+
+ if (!check_input (GTK_WIDGET (dialog), merge_working_copy_path_entry,
+ _("Please enter a working copy path.")))
+ {
+ return;
+ }
+
first_path = gtk_entry_get_text (GTK_ENTRY (merge_first_path_entry));
second_path = gtk_entry_get_text (GTK_ENTRY (merge_second_path_entry));
working_copy_path = gtk_entry_get_text (GTK_ENTRY (merge_working_copy_path_entry));
@@ -96,6 +114,13 @@
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (merge_start_revision_radio)))
{
start_revision_text = gtk_entry_get_text (GTK_ENTRY (merge_start_revision_entry));
+
+ if (!check_input (GTK_WIDGET (dialog), merge_start_revision_entry,
+ _("Please enter the start revision.")))
+ {
+ return;
+ }
+
start_revision = atol (start_revision_text);
}
else
@@ -104,6 +129,13 @@
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (merge_end_revision_radio)))
{
end_revision_text = gtk_entry_get_text (GTK_ENTRY (merge_end_revision_entry));
+
+ if (!check_input (GTK_WIDGET (dialog), merge_end_revision_entry,
+ _("Please enter the end revision.")))
+ {
+ return;
+ }
+
end_revision = atol (end_revision_text);
}
else
Modified: trunk/plugins/subversion/subversion-remove-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-remove-dialog.c (original)
+++ trunk/plugins/subversion/subversion-remove-dialog.c Wed Jan 16 22:18:15 2008
@@ -94,8 +94,11 @@
"remove_log_view");
log = get_log_from_textview (remove_log_view);
- if (!check_filename(dialog, filename))
+ if (!check_input (GTK_WIDGET (dialog),
+ fileentry, _("Please enter a path.")))
+ {
break;
+ }
remove_command = svn_remove_command_new ((gchar *) filename, log,
Modified: trunk/plugins/subversion/subversion-switch-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-switch-dialog.c (original)
+++ trunk/plugins/subversion/subversion-switch-dialog.c Wed Jan 16 22:18:15 2008
@@ -96,6 +96,18 @@
branch_url = gtk_editable_get_chars (GTK_EDITABLE (switch_url_entry),
0, -1);
+ if (!check_input (GTK_WIDGET (dialog), switch_working_copy_entry,
+ _("Please enter a working copy path.")))
+ {
+ return;
+ }
+
+ if (!check_input (GTK_WIDGET (dialog), switch_url_entry,
+ _("Please enter a branch/tag URL.")))
+ {
+ return;
+ }
+
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (switch_head_revision_radio)))
revision = SVN_SWITCH_REVISION_HEAD;
@@ -103,6 +115,13 @@
{
switch_revision_entry = glade_xml_get_widget (data->gxml,
"switch_revision_entry");
+
+ if (!check_input (GTK_WIDGET (dialog), switch_revision_entry,
+ _("Please enter a revision.")))
+ {
+ return;
+ }
+
revision_text = gtk_editable_get_chars (GTK_EDITABLE (switch_revision_entry),
0, -1);
revision = atol (revision_text);
Modified: trunk/plugins/subversion/subversion-ui-utils.c
==============================================================================
--- trunk/plugins/subversion/subversion-ui-utils.c (original)
+++ trunk/plugins/subversion/subversion-ui-utils.c Wed Jan 16 22:18:15 2008
@@ -77,18 +77,35 @@
}
gboolean
-check_filename(GtkDialog* dialog, const gchar* filename)
+check_input (GtkWidget *parent, GtkWidget *entry, const gchar *error_message)
{
- if (!strlen(filename))
+ gchar *input;
+ gboolean ret;
+ GtkWidget *dialog;
+
+ input = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
+
+ if (strlen (input) > 0)
+ ret = TRUE;
+ else
{
- GtkWidget* dlg = gtk_message_dialog_new(GTK_WINDOW(dialog),
- GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE, _("Please enter a filename!"));
- gtk_dialog_run(GTK_DIALOG(dlg));
- gtk_widget_destroy(dlg);
- return FALSE;
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ error_message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ gtk_window_set_focus (GTK_WINDOW (parent), entry);
+
+ ret = FALSE;
}
- return TRUE;
+
+ g_free (input);
+
+ return ret;
}
gchar *
Modified: trunk/plugins/subversion/subversion-ui-utils.h
==============================================================================
--- trunk/plugins/subversion/subversion-ui-utils.h (original)
+++ trunk/plugins/subversion/subversion-ui-utils.h Wed Jan 16 22:18:15 2008
@@ -44,7 +44,8 @@
SubversionData* subversion_data_new (Subversion* plugin, GladeXML* gxml);
void subversion_data_free (SubversionData* data);
void create_message_view (Subversion* plugin);
-gboolean check_filename (GtkDialog* dialog, const gchar* filename);
+gboolean check_input (GtkWidget *parent, GtkWidget *entry,
+ const gchar *error_message);
gchar *get_log_from_textview (GtkWidget* textview);
guint status_bar_progress_pulse (Subversion *plugin, gchar *text);
void clear_status_bar_progress_pulse (guint timer_id);
Modified: trunk/plugins/subversion/subversion-update-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-update-dialog.c (original)
+++ trunk/plugins/subversion/subversion-update-dialog.c Wed Jan 16 22:18:15 2008
@@ -62,8 +62,11 @@
revisionentry = glade_xml_get_widget(data->gxml, "subversion_revision");
revision = gtk_entry_get_text(GTK_ENTRY(revisionentry));
- if (!check_filename(dialog, filename))
- break;
+ if (!check_input (GTK_WIDGET (dialog),
+ fileentry, _("Please enter a path.")))
+ {
+ break;
+ }
update_command = svn_update_command_new ((gchar *) filename,
(gchar *) revision,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]