[nautilus-actions] Refactoring: update NactPreferencesEditor class
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Refactoring: update NactPreferencesEditor class
- Date: Fri, 19 Feb 2010 02:29:13 +0000 (UTC)
commit bce61100f2a25ce02d85932ab596c2d9a4e5442b
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Feb 17 21:36:03 2010 +0100
Refactoring: update NactPreferencesEditor class
ChangeLog | 9 ++
src/core/na-iprefs.c | 167 +++---------------------------------
src/core/na-iprefs.h | 8 +--
src/nact/nact-assistant-export.c | 2 +-
src/nact/nact-export-ask.c | 2 +-
src/nact/nact-export-format.c | 40 +++++++--
src/nact/nact-export-format.h | 9 ++-
src/nact/nact-preferences-editor.c | 119 +++++++++++---------------
src/nact/nact-preferences.ui | 70 +---------------
9 files changed, 113 insertions(+), 313 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 459f6a3..1e4809b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-02-17 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-iprefs.c:
+ * src/core/na-iprefs.h:
+ * src/nact/nact-assistant-export.c:
+ * src/nact/nact-export-ask.c:
+ * src/nact/nact-export-format.c:
+ * src/nact/nact-export-format.h:
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-preferences.ui: Update NactPreferencesEditor class.
+
* src/nact/base-iprefs.c:
* src/nact/base-iprefs.h:
* src/nact/nact-main-window.c:
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index 63f558d..2599e61 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -59,6 +59,8 @@ static GType register_type( void );
static void interface_base_init( NAIPrefsInterface *klass );
static void interface_base_finalize( NAIPrefsInterface *klass );
+static void write_string( NAIPrefs *instance, const gchar *name, const gchar *value );
+
GType
na_iprefs_get_type( void )
{
@@ -133,53 +135,6 @@ interface_base_finalize( NAIPrefsInterface *klass )
}
/**
- * na_iprefs_get_level_zero_items:
- * @instance: this #NAIPrefs interface instance.
- *
- * Returns: the ordered list of UUID's of items which are to be
- * displayed at level zero of the hierarchy.
- *
- * The returned list should be na_utils_free_string_list() by the caller.
- */
-/*
-GSList *
-na_iprefs_get_level_zero_items( NAIPrefs *instance )
-{
- static const gchar *thisfn = "na_iprefs_get_level_zero_items";
- GSList *level_zero = NULL;
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
- g_return_val_if_fail( NA_IS_IPREFS( instance ), NULL );
-
- if( st_initialized && !st_finalized ){
-
- level_zero = na_iprefs_read_string_list( instance, IPREFS_LEVEL_ZERO_ITEMS, NULL );
- }
-
- return( level_zero );
-}
-*/
-
-/**
- * na_iprefs_set_level_zero_items:
- * @instance: this #NAIPrefs interface instance.
- * @order: the ordered #GSList of item UUIDs.
- *
- * Writes the order and the content of the level-zero UUID's.
- */
-/*
-void
-na_iprefs_set_level_zero_items( NAIPrefs *instance, GSList *order )
-{
- g_return_if_fail( NA_IS_IPREFS( instance ));
-
- if( st_initialized && !st_finalized ){
-
- na_iprefs_write_string_list( instance, IPREFS_LEVEL_ZERO_ITEMS, order );
- }
-}*/
-
-/**
* na_iprefs_get_order_mode:
* @instance: this #NAIPrefs interface instance.
*
@@ -225,7 +180,6 @@ na_iprefs_get_order_mode( NAIPrefs *instance )
* Writes the current status of 'alphabetical order' to the GConf
* preference system.
*/
-/*
void
na_iprefs_set_order_mode( NAIPrefs *instance, gint mode )
{
@@ -237,110 +191,12 @@ na_iprefs_set_order_mode( NAIPrefs *instance, gint mode )
order_str = gconf_enum_to_string( order_mode_table, mode );
- na_iprefs_write_string(
+ write_string(
instance,
IPREFS_DISPLAY_ALPHABETICAL_ORDER,
order_str ? order_str : DEFAULT_ORDER_MODE_STR );
}
-}*/
-
-/**
- * na_iprefs_should_add_about_item:
- * @instance: this #NAIPrefs interface instance.
- *
- * Returns: #TRUE if an "About Nautilus Actions" item should be added to
- * the first level of Nautilus context submenus (if any), #FALSE else.
- *
- * Note: this function returns a suitable default value if the key is
- * not found in GConf preferences.
- *
- * Note: please take care of keeping the default value synchronized with
- * those defined in schemas.
- */
-#if 0
-gboolean
-na_iprefs_should_add_about_item( NAIPrefs *instance )
-{
- gboolean about = FALSE;
-
- g_return_val_if_fail( NA_IS_IPREFS( instance ), FALSE );
-
- if( st_initialized && !st_finalized ){
-
- about = na_iprefs_read_bool( instance, IPREFS_ADD_ABOUT_ITEM, TRUE );
- }
-
- return( about );
}
-#endif
-
-/**
- * na_iprefs_set_add_about_item:
- * @instance: this #NAIPrefs interface instance.
- * @enabled: the new value to be written.
- *
- * Writes the new value to the GConf preference system.
- */
-/*
-void
-na_iprefs_set_add_about_item( NAIPrefs *instance, gboolean enabled )
-{
- g_return_if_fail( NA_IS_IPREFS( instance ));
-
- if( st_initialized && !st_finalized ){
-
- na_iprefs_write_bool( instance, IPREFS_ADD_ABOUT_ITEM, enabled );
- }
-}*/
-
-/**
- * na_iprefs_should_create_root_menu:
- * @instance: this #NAIPrefs interface instance.
- *
- * Returns: #TRUE if a root submenu should be created in the Nautilus
- * context menus, #FALSE else.
- *
- * Note: this function returns a suitable default value if the key is
- * not found in GConf preferences.
- *
- * Note: please take care of keeping the default value synchronized with
- * those defined in schemas.
- */
-#if 0
-gboolean
-na_iprefs_should_create_root_menu( NAIPrefs *instance )
-{
- gboolean create = FALSE;
-
- g_return_val_if_fail( NA_IS_IPREFS( instance ), FALSE );
-
- if( st_initialized && !st_finalized ){
-
- create = na_iprefs_read_bool( instance, IPREFS_CREATE_ROOT_MENU, FALSE );
- }
-
- return( create );
-}
-#endif
-
-/**
- * na_iprefs_set_create_root_menu:
- * @instance: this #NAIPrefs interface instance.
- * @enabled: the new value to be written.
- *
- * Writes the new value to the GConf preference system.
- */
-/*
-void
-na_iprefs_set_create_root_menu( NAIPrefs *instance, gboolean enabled )
-{
- g_return_if_fail( NA_IS_IPREFS( instance ));
-
- if( st_initialized && !st_finalized ){
-
- na_iprefs_write_bool( instance, IPREFS_CREATE_ROOT_MENU, enabled );
- }
-}*/
/**
* na_iprefs_get_gconf_client:
@@ -460,8 +316,7 @@ na_iprefs_read_string_list( const NAIPrefs *instance, const gchar *name, const g
return( list );
}
-#if O
-/**
+/*
* na_iprefs_write_string:
* @instance: this #NAIPrefs interface instance.
* @name: the preference key.
@@ -469,18 +324,20 @@ na_iprefs_read_string_list( const NAIPrefs *instance, const gchar *name, const g
*
* Writes the value as the given GConf preference.
*/
-void
-na_iprefs_write_string( NAIPrefs *instance, const gchar *name, const gchar *value )
+static void
+write_string( NAIPrefs *instance, const gchar *name, const gchar *value )
{
gchar *path;
g_return_if_fail( NA_IS_IPREFS( instance ));
- path = gconf_concat_dir_and_key( NA_GCONF_PREFS_PATH, name );
- na_gconf_utils_write_string( na_iprefs_get_gconf_client( instance ), path, value, NULL );
- g_free( path );
+ if( st_initialized && !st_finalized ){
+
+ path = gconf_concat_dir_and_key( IPREFS_GCONF_PREFS_PATH, name );
+ na_gconf_utils_write_string( na_iprefs_get_gconf_client( instance ), path, value, NULL );
+ g_free( path );
+ }
}
-#endif
/**
* na_iprefs_write_string_list
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index cd9c2df..2dc1adc 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -122,13 +122,7 @@ enum {
GType na_iprefs_get_type( void );
gint na_iprefs_get_order_mode( NAIPrefs *instance );
-/*void na_iprefs_set_order_mode( NAIPrefs *instance, gint mode );*/
-
-/*gboolean na_iprefs_should_add_about_item( NAIPrefs *instance );*/
-/*void na_iprefs_set_add_about_item( NAIPrefs *instance, gboolean enabled );*/
-
-/*gboolean na_iprefs_should_create_root_menu( NAIPrefs *instance );*/
-/*void na_iprefs_set_create_root_menu( NAIPrefs *instance, gboolean enabled );*/
+void na_iprefs_set_order_mode( NAIPrefs *instance, gint mode );
GConfClient *na_iprefs_get_gconf_client ( const NAIPrefs *instance );
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index b1d68e1..e5811c6 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -587,7 +587,7 @@ get_export_format( NactAssistantExport *window )
GQuark format;
container = base_window_get_widget( BASE_WINDOW( window ), "AssistantExportFormatVBox" );
- format = nact_export_format_get_select( container );
+ format = nact_export_format_get_selected( container );
return( format );
}
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index 684d58d..284e4ff 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -380,7 +380,7 @@ get_format( NactExportAsk *editor )
gboolean keep;
container = base_window_get_widget( BASE_WINDOW( editor ), "ExportFormatAskVBox" );
- export_format = nact_export_format_get_select( container );
+ export_format = nact_export_format_get_selected( container );
button = base_window_get_widget( BASE_WINDOW( editor ), "AskKeepChoiceButton" );
keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
diff --git a/src/nact/nact-export-format.c b/src/nact/nact-export-format.c
index d73daac..366eb50 100755
--- a/src/nact/nact-export-format.c
+++ b/src/nact/nact-export-format.c
@@ -37,6 +37,7 @@
#include <core/na-exporter.h>
#include <core/na-export-format.h>
+#include "nact-iprefs.h"
#include "nact-export-format.h"
#define EXPORT_FORMAT_PROP_QUARK_ID "nact-export-format-prop-quark-id"
@@ -57,7 +58,9 @@ typedef struct {
}
NactExportFormatStr;
-static void draw_in_vbox( const NAExportFormat *format, GtkWidget *vbox, guint mode );
+static const NAExporterStr ask_str = { NULL, ASKME_LABEL, ASKME_LABEL, ASKME_DESCRIPTION };
+
+static void draw_in_vbox( const NAExportFormat *format, GtkWidget *vbox, guint mode, gint id );
static void select_default_iter( GtkWidget *widget, NactExportFormatStr *str );
static void get_selected_iter( GtkWidget *widget, NactExportFormatStr *str );
static void get_label_iter( GtkWidget *widget, NactExportFormatStr *str );
@@ -73,15 +76,33 @@ static void get_label_iter( GtkWidget *widget, NactExportFormatStr *str );
void
nact_export_format_display( const NAPivot *pivot, GtkWidget *vbox, guint mode )
{
+ static const gchar *thisfn = "nact_export_format_display";
GList *formats, *ifmt;
+ NAExportFormat *format;
formats = na_exporter_get_formats( pivot );
for( ifmt = formats ; ifmt ; ifmt = ifmt->next ){
- draw_in_vbox( NA_EXPORT_FORMAT( ifmt->data ), vbox, mode );
+ draw_in_vbox( NA_EXPORT_FORMAT( ifmt->data ), vbox, mode, -1 );
}
na_exporter_free_formats( formats );
+
+ switch( mode ){
+
+ case EXPORT_FORMAT_DISPLAY_PREFERENCES:
+ case EXPORT_FORMAT_DISPLAY_ASSISTANT:
+ format = na_export_format_new( &ask_str, NULL );
+ draw_in_vbox( format, vbox, mode, IPREFS_EXPORT_FORMAT_ASK );
+ g_object_unref( format );
+ break;
+
+ case EXPORT_FORMAT_DISPLAY_ASK:
+ break;
+
+ default:
+ g_warning( "%s: mode=%d: unknown mode", thisfn, mode );
+ }
}
/*
@@ -94,9 +115,8 @@ nact_export_format_display( const NAPivot *pivot, GtkWidget *vbox, guint mode )
* | | +- description
*/
static void
-draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
+draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode, gint id )
{
- static const gchar *thisfn = "nact_export_format_draw_in_vbox";
static GtkRadioButton *first_button = NULL;
GtkVBox *vbox;
gchar *description;
@@ -106,6 +126,7 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
GtkLabel *radio_label;
gchar *markup, *label;
GtkLabel *desc_label;
+ GQuark quark_id;
vbox = GTK_VBOX( gtk_vbox_new( FALSE, 0 ));
gtk_box_pack_start( GTK_BOX( container ), GTK_WIDGET( vbox ), FALSE, TRUE, 0 );
@@ -129,6 +150,7 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
switch( mode ){
case EXPORT_FORMAT_DISPLAY_ASK:
+ case EXPORT_FORMAT_DISPLAY_PREFERENCES:
label = na_export_format_get_ask_label( format );
markup = g_markup_printf_escaped( "%s", label );
break;
@@ -137,9 +159,6 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
label = na_export_format_get_label( format );
markup = g_markup_printf_escaped( "<b>%s</b>", label );
break;
-
- default:
- g_warning( "%s: mode=%d: unknown mode", thisfn, mode );
}
if( markup ){
gtk_label_set_markup( radio_label, markup );
@@ -162,7 +181,8 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
break;
}
- g_object_set_data( G_OBJECT( vbox ), EXPORT_FORMAT_PROP_QUARK_ID, GUINT_TO_POINTER( na_export_format_get_id( format )));
+ quark_id = ( id == -1 ) ? na_export_format_get_quark( format ) : id;
+ g_object_set_data( G_OBJECT( vbox ), EXPORT_FORMAT_PROP_QUARK_ID, GUINT_TO_POINTER( quark_id ));
g_object_set_data( G_OBJECT( vbox ), EXPORT_FORMAT_PROP_BUTTON, button );
g_object_set_data( G_OBJECT( vbox ), EXPORT_FORMAT_PROP_LABEL, radio_label );
g_object_set_data( G_OBJECT( vbox ), EXPORT_FORMAT_PROP_DESCRIPTION, desc_label );
@@ -209,13 +229,13 @@ select_default_iter( GtkWidget *widget, NactExportFormatStr *str )
}
/**
- * nact_export_format_get_select:
+ * nact_export_format_get_selected:
* @container: the #GtkVBox in which the display has been drawn.
*
* Returns: the currently selected value, as a #GQuark.
*/
GQuark
-nact_export_format_get_select( const GtkWidget *container )
+nact_export_format_get_selected( const GtkWidget *container )
{
GQuark format;
NactExportFormatStr *str;
diff --git a/src/nact/nact-export-format.h b/src/nact/nact-export-format.h
index 3f2dc8c..5774543 100644
--- a/src/nact/nact-export-format.h
+++ b/src/nact/nact-export-format.h
@@ -57,11 +57,18 @@ enum {
* propose the 'Ask me' choice
*/
EXPORT_FORMAT_DISPLAY_ASSISTANT,
+
+ /* preferences editor
+ * display the assistant short label
+ * do not display the full description
+ * propose the 'Ask me' choice
+ */
+ EXPORT_FORMAT_DISPLAY_PREFERENCES,
};
void nact_export_format_display( const NAPivot *pivot, GtkWidget *container, guint mode );
void nact_export_format_select( const GtkWidget *container, GQuark format );
-GQuark nact_export_format_get_select( const GtkWidget *container );
+GQuark nact_export_format_get_selected( const GtkWidget *container );
gchar *nact_export_format_get_label ( const GtkWidget *container, GQuark format );
gchar *nact_export_format_get_description( const GtkWidget *container, GQuark format );
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 8e616c5..281bb0b 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -34,10 +34,9 @@
#include <glib/gi18n.h>
-#include <runtime/na-iprefs.h>
-
-#include "base-iprefs.h"
#include "nact-application.h"
+#include "nact-iprefs.h"
+#include "nact-export-format.h"
#include "nact-schemes-list.h"
#include "nact-providers-list.h"
#include "nact-preferences-editor.h"
@@ -64,9 +63,9 @@ static void instance_finalize( GObject *dialog );
static NactPreferencesEditor *preferences_editor_new( BaseWindow *parent );
-static gchar *base_get_iprefs_window_id( BaseWindow *window );
-static gchar *base_get_dialog_name( BaseWindow *window );
-static gchar *base_get_ui_filename( BaseWindow *dialog );
+static gchar *base_get_iprefs_window_id( const BaseWindow *window );
+static gchar *base_get_dialog_name( const BaseWindow *window );
+static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactPreferencesEditor *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactPreferencesEditor *editor, gpointer user_data );
@@ -247,19 +246,19 @@ nact_preferences_editor_run( BaseWindow *parent )
}
static gchar *
-base_get_iprefs_window_id( BaseWindow *window )
+base_get_iprefs_window_id( const BaseWindow *window )
{
return( g_strdup( "preferences-editor" ));
}
static gchar *
-base_get_dialog_name( BaseWindow *window )
+base_get_dialog_name( const BaseWindow *window )
{
return( g_strdup( "PreferencesDialog" ));
}
static gchar *
-base_get_ui_filename( BaseWindow *dialog )
+base_get_ui_filename( const BaseWindow *dialog )
{
return( g_strdup( PKGDATADIR "/nact-preferences.ui" ));
}
@@ -268,11 +267,19 @@ static void
on_base_initial_load_dialog( NactPreferencesEditor *editor, gpointer user_data )
{
static const gchar *thisfn = "nact_preferences_editor_on_initial_load_dialog";
+ NactApplication *application;
+ NAUpdater *updater;
+ GtkWidget *container;
GtkTreeView *listview;
g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
g_return_if_fail( NACT_IS_PREFERENCES_EDITOR( editor ));
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+ updater = nact_application_get_updater( application );
+ container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
+ nact_export_format_display( NA_PIVOT( updater ), container, EXPORT_FORMAT_DISPLAY_PREFERENCES );
+
listview = GTK_TREE_VIEW( base_window_get_widget( BASE_WINDOW( editor ), "SchemesTreeView" ));
nact_schemes_list_create_model( listview, FALSE );
@@ -285,12 +292,14 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
{
static const gchar *thisfn = "nact_preferences_editor_on_runtime_init_dialog";
NactApplication *application;
- NAPivot *pivot;
+ NAUpdater *updater;
gint order_mode;
gboolean add_about_item;
gboolean create_root_menu;
gboolean relabel;
- gint import_mode, export_format;
+ gint import_mode;
+ GQuark export_format;
+ GtkWidget *container;
GtkWidget *button;
gboolean esc_quit, esc_confirm;
GtkTreeView *listview;
@@ -298,11 +307,11 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- pivot = nact_application_get_pivot( application );
+ updater = nact_application_get_updater( application );
/* first tab: runtime preferences
*/
- order_mode = na_iprefs_get_order_mode( NA_IPREFS( pivot ));
+ order_mode = na_iprefs_get_order_mode( NA_IPREFS( updater ));
switch( order_mode ){
case IPREFS_ORDER_ALPHA_ASCENDING:
button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaAscButton" );
@@ -319,25 +328,25 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
}
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
- create_root_menu = na_iprefs_should_create_root_menu( NA_IPREFS( pivot ));
+ create_root_menu = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_CREATE_ROOT_MENU, FALSE );
button = base_window_get_widget( BASE_WINDOW( editor ), "CreateRootMenuButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), create_root_menu );
- add_about_item = na_iprefs_should_add_about_item( NA_IPREFS( pivot ));
+ add_about_item = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_ADD_ABOUT_ITEM, TRUE );
button = base_window_get_widget( BASE_WINDOW( editor ), "AddAboutButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), add_about_item );
/* second tab: ui preferences
*/
- relabel = na_iprefs_read_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_MENUS, FALSE );
+ relabel = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_RELABEL_MENUS, FALSE );
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelMenuButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
- relabel = na_iprefs_read_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_ACTIONS, FALSE );
+ relabel = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_RELABEL_ACTIONS, FALSE );
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelActionButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
- relabel = na_iprefs_read_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_PROFILES, FALSE );
+ relabel = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_RELABEL_PROFILES, FALSE );
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelProfileButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
@@ -349,16 +358,16 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
"toggled",
G_CALLBACK( on_esc_quit_toggled ));
- esc_quit = na_iprefs_read_bool( NA_IPREFS( pivot ), IPREFS_ASSIST_ESC_QUIT, TRUE );
+ esc_quit = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_ASSIST_ESC_QUIT, TRUE );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), esc_quit );
- esc_confirm = na_iprefs_read_bool( NA_IPREFS( pivot ), IPREFS_ASSIST_ESC_CONFIRM, TRUE );
+ esc_confirm = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_ASSIST_ESC_CONFIRM, TRUE );
button = base_window_get_widget( BASE_WINDOW( editor ), "EscConfirmButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), esc_confirm );
/* third tab: import tool
*/
- import_mode = na_iprefs_get_import_mode( NA_IPREFS( pivot ), IPREFS_IMPORT_ACTIONS_IMPORT_MODE );
+ import_mode = nact_iprefs_get_import_mode( BASE_WINDOW( editor ), IPREFS_IMPORT_ITEMS_IMPORT_MODE );
switch( import_mode ){
case IPREFS_IMPORT_ASK:
button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsAskButton" );
@@ -381,26 +390,9 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
/* fourth tab: export tool
*/
- export_format = na_iprefs_get_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT );
- switch( export_format ){
- case IPREFS_EXPORT_FORMAT_ASK:
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportAskButton" );
- break;
-
- case IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2:
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV2Button" );
- break;
-
- case IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1:
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV1Button" );
- break;
-
- case IPREFS_EXPORT_FORMAT_GCONF_ENTRY:
- default:
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfDumpButton" );
- break;
- }
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
+ export_format = nact_iprefs_get_export_format( BASE_WINDOW( editor ), IPREFS_EXPORT_FORMAT );
+ container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
+ nact_export_format_select( container, export_format );
/* fifth tab: default schemes
*/
@@ -469,16 +461,18 @@ static void
save_preferences( NactPreferencesEditor *editor )
{
NactApplication *application;
- NAPivot *pivot;
+ NAUpdater *updater;
GtkWidget *button;
gint order_mode;
gboolean enabled;
gboolean relabel;
- gint import_mode, export_format;
+ gint import_mode;
+ GtkWidget *container;
+ GQuark export_format;
gboolean esc_quit, esc_confirm;
application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- pivot = nact_application_get_pivot( application );
+ updater = nact_application_get_updater( application );
/* first tab: runtime preferences
*/
@@ -497,37 +491,37 @@ save_preferences( NactPreferencesEditor *editor )
}
}
}
- na_iprefs_set_order_mode( NA_IPREFS( pivot ), order_mode );
+ na_iprefs_set_order_mode( NA_IPREFS( updater ), order_mode );
button = base_window_get_widget( BASE_WINDOW( editor ), "CreateRootMenuButton" );
enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_set_create_root_menu( NA_IPREFS( pivot ), enabled );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_CREATE_ROOT_MENU, enabled );
button = base_window_get_widget( BASE_WINDOW( editor ), "AddAboutButton" );
enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_set_add_about_item( NA_IPREFS( pivot ), enabled );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_ADD_ABOUT_ITEM, enabled );
/* second tab: runtime preferences
*/
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelMenuButton" );
relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_MENUS, relabel );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_RELABEL_MENUS, relabel );
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelActionButton" );
relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_ACTIONS, relabel );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_RELABEL_ACTIONS, relabel );
button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelProfileButton" );
relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_PROFILES, relabel );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_RELABEL_PROFILES, relabel );
button = base_window_get_widget( BASE_WINDOW( editor ), "EscCloseButton" );
esc_quit = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_ASSIST_ESC_QUIT, esc_quit );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_ASSIST_ESC_QUIT, esc_quit );
button = base_window_get_widget( BASE_WINDOW( editor ), "EscConfirmButton" );
esc_confirm = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_ASSIST_ESC_CONFIRM, esc_confirm );
+ nact_iprefs_write_bool( BASE_WINDOW( editor ), IPREFS_ASSIST_ESC_CONFIRM, esc_confirm );
/* third tab: import tool
*/
@@ -546,26 +540,13 @@ save_preferences( NactPreferencesEditor *editor )
}
}
}
- na_iprefs_set_import_mode( NA_IPREFS( pivot ), IPREFS_IMPORT_ACTIONS_IMPORT_MODE, import_mode );
+ nact_iprefs_set_import_mode( BASE_WINDOW( editor ), IPREFS_IMPORT_ITEMS_IMPORT_MODE, import_mode );
/* fourth tab: export tool
*/
- export_format = IPREFS_EXPORT_FORMAT_GCONF_ENTRY;
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV1Button" );
- if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
- export_format = IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1;
- } else {
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV2Button" );
- if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
- export_format = IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2;
- } else {
- button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportAskButton" );
- if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
- export_format = IPREFS_EXPORT_FORMAT_ASK;
- }
- }
- }
- na_iprefs_set_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT, export_format );
+ container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
+ export_format = nact_export_format_get_selected( container );
+ nact_iprefs_set_export_format( BASE_WINDOW( editor ), IPREFS_EXPORT_FORMAT, export_format );
/* fifth tab: list of default schemes
*/
diff --git a/src/nact/nact-preferences.ui b/src/nact/nact-preferences.ui
index f079e93..5e0f1c0 100644
--- a/src/nact/nact-preferences.ui
+++ b/src/nact/nact-preferences.ui
@@ -516,79 +516,11 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox42">
+ <object class="GtkVBox" id="PreferencesExportFormatVBox">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
- <child>
- <object class="GtkRadioButton" id="PrefsExportGConfSchemaV1Button">
- <property name="label" translatable="yes">Export as a _full GConf schema</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">This used to be the historical export format.
-The exported file may later be imported via :
-- Import assistant of the Nautilus Actions Configuration Tool,
-- or via the gconftool-2 --import-schema-file command-line tool.</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="PrefsExportGConfSchemaV2Button">
- <property name="label" translatable="yes">Export as a _light GConf schema</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">The exported file may later be imported via :
-- Import assistant of the Nautilus Actions Configuration Tool,
-- or via the gconftool-2 --import-schema-file command-line tool.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">PrefsExportGConfSchemaV1Button</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="PrefsExportGConfDumpButton">
- <property name="label" translatable="yes">Export as a GConf _dump file</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">This should be the preferred format for newly exported actions.
-The exported file may later be imported via :
-- Import assistant of the Nautilus Actions Configuration Tool,
-- or via the gconftool-2 --load command-line tool.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">PrefsExportGConfSchemaV1Button</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="PrefsExportAskButton">
- <property name="label" translatable="yes">_Ask me</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">You will be asked each time an action is about to be exported.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">PrefsExportGConfSchemaV1Button</property>
- </object>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]