[nautilus-actions] Review NactISchemesTab page



commit 3c65c86c45c879533840a5655f8b5102071cdc1c
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jun 16 21:13:40 2010 +0200

    Review NactISchemesTab page

 ChangeLog                    |    2 +
 src/nact/nact-ischemes-tab.c |   60 ++++++++++++++---------------------------
 2 files changed, 23 insertions(+), 39 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eaf36b0..06c292c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-06-16 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-ischemes-tab.c: Review NactISchemesTab page.
+
 	* src/nact/nact-ifolders-tab.c: Review NactIFoldersTab page.
 
 	* src/nact/nact-ibasenames-tab.c: Review NactIBasenamesTab page.
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index f09c21d..eca15a6 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -37,6 +37,7 @@
 #include <api/na-core-utils.h>
 #include <api/na-object-api.h>
 
+#include "nact-gtk-utils.h"
 #include "nact-main-tab.h"
 #include "nact-match-list.h"
 #include "nact-add-scheme-dialog.h"
@@ -57,9 +58,9 @@ static GType   register_type( void );
 static void    interface_base_init( NactISchemesTabInterface *klass );
 static void    interface_base_finalize( NactISchemesTabInterface *klass );
 
-static void    on_add_from_defaults( GtkButton *button, BaseWindow *window );
 static void    on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected );
 
+static void    on_add_from_defaults( GtkButton *button, BaseWindow *window );
 static GSList *get_schemes( void *context );
 static void    set_schemes( void *context, GSList *filters );
 
@@ -217,56 +218,37 @@ nact_ischemes_tab_dispose( NactISchemesTab *instance )
 }
 
 static void
-on_add_from_defaults( GtkButton *button, BaseWindow *window )
+on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected )
 {
-	GSList *schemes;
-	gchar *new_scheme;
-	NAObjectItem *item;
-	NAObjectProfile *profile;
 	NAIContext *context;
+	gboolean editable;
+	GtkWidget *button;
 
-	g_object_get(
-			G_OBJECT( window ),
-			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
-			NULL );
-
-	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
-
-	if( context ){
-		schemes = na_object_get_schemes( context );
-		new_scheme = nact_add_scheme_dialog_run( window, schemes );
-		na_core_utils_slist_free( schemes );
+	nact_match_list_on_selection_changed( window, ITAB_NAME, count_selected );
 
-		if( new_scheme ){
-			nact_match_list_insert_row( window, ITAB_NAME, new_scheme, FALSE, FALSE );
-			g_free( new_scheme );
-		}
-	}
+	context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), &editable );
+	button = base_window_get_widget( window, "AddFromDefaultButton" );
+	nact_gtk_utils_set_editable( GTK_OBJECT( button ), editable );
 }
 
 static void
-on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected )
+on_add_from_defaults( GtkButton *button, BaseWindow *window )
 {
-	NAObjectItem *item;
-	NAObjectProfile *profile;
-	gboolean editable;
+	GSList *schemes;
+	gchar *new_scheme;
 	NAIContext *context;
-	GtkWidget *button;
-
-	g_object_get(
-			G_OBJECT( window ),
-			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
-			TAB_UPDATABLE_PROP_EDITABLE, &editable,
-			NULL );
 
-	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
+	context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), NULL );
+	g_return_if_fail( context );
 
-	button = base_window_get_widget( window, "AddFromDefaultButton" );
-	gtk_widget_set_sensitive( button, editable );
+	schemes = na_object_get_schemes( context );
+	new_scheme = nact_add_scheme_dialog_run( window, schemes );
+	na_core_utils_slist_free( schemes );
 
-	nact_match_list_on_selection_changed( window, ITAB_NAME, count_selected );
+	if( new_scheme ){
+		nact_match_list_insert_row( window, ITAB_NAME, new_scheme, FALSE, FALSE );
+		g_free( new_scheme );
+	}
 }
 
 static GSList *



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