[nautilus-actions] Prevent a default scheme to be inserted twice



commit d9ad3d5485420b2c2c5b280d95cfc82bbc9b6d04
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jul 28 19:32:06 2010 +0200

    Prevent a default scheme to be inserted twice

 ChangeLog                         |    6 ++++++
 src/nact/nact-add-scheme-dialog.c |   15 ++++++++++++++-
 src/nact/nact-ischemes-tab.c      |    2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 48c244a..29eb8f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-07-28 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-add-scheme-dialog.c:
+	Prevent a default scheme to be inserted twice.
+
+	* src/nact/nact-ischemes-tab.c:
+	Use the current list of rows instead of the current schemes list.
+
 	* src/nact/nact-match-list.c:
 	Prevent a standard filter to be inserted twice.
 
diff --git a/src/nact/nact-add-scheme-dialog.c b/src/nact/nact-add-scheme-dialog.c
index cff20dd..bf8ebc7 100644
--- a/src/nact/nact-add-scheme-dialog.c
+++ b/src/nact/nact-add-scheme-dialog.c
@@ -73,6 +73,7 @@ static gboolean on_button_press_event( GtkWidget *widget, GdkEventButton *event,
 static void     on_cancel_clicked( GtkButton *button, NactAddSchemeDialog *editor );
 static void     on_ok_clicked( GtkButton *button, NactAddSchemeDialog *editor );
 static void     on_selection_changed( const gchar *scheme, gboolean used, NactAddSchemeDialog *dialog );
+static void     try_for_send_ok( NactAddSchemeDialog *dialog );
 static void     send_ok( NactAddSchemeDialog *dialog );
 static void     validate_dialog( NactAddSchemeDialog *editor );
 static gboolean base_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
@@ -363,7 +364,7 @@ on_button_press_event( GtkWidget *widget, GdkEventButton *event, NactAddSchemeDi
 
 	/* double-click of left button */
 	if( event->type == GDK_2BUTTON_PRESS && event->button == 1 ){
-		send_ok( dialog );
+		try_for_send_ok( dialog );
 		stop = TRUE;
 	}
 
@@ -398,6 +399,18 @@ on_selection_changed( const gchar *scheme, gboolean used, NactAddSchemeDialog *d
 }
 
 static void
+try_for_send_ok( NactAddSchemeDialog *dialog )
+{
+	GtkWidget *button;
+
+	button = base_window_get_widget( BASE_WINDOW( dialog ), "OKButton" );
+
+	if( gtk_widget_get_sensitive( button )){
+		send_ok( dialog );
+	}
+}
+
+static void
 send_ok( NactAddSchemeDialog *dialog )
 {
 	GtkWindow *toplevel = base_window_get_toplevel( BASE_WINDOW( dialog ));
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index 3a61dd9..6bc9755 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -241,7 +241,7 @@ on_add_from_defaults( GtkButton *button, BaseWindow *window )
 	context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), NULL );
 	g_return_if_fail( context );
 
-	schemes = na_object_get_schemes( context );
+	schemes = nact_match_list_get_rows( window, ITAB_NAME );
 	new_scheme = nact_add_scheme_dialog_run( window, schemes );
 	na_core_utils_slist_free( schemes );
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]