[nautilus-actions] Define NactIPrefs interface to manage GConf preferences
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Define NactIPrefs interface to manage GConf preferences
- Date: Tue, 14 Jul 2009 18:48:25 +0000 (UTC)
commit 01d91dff938687366e742ebad08bb748ff8e5013
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Jun 30 23:26:36 2009 +0200
Define NactIPrefs interface to manage GConf preferences
ChangeLog | 7 +
src/nact/Makefile.am | 4 +-
src/nact/base-window.c | 2 -
src/nact/nact-action-conditions-editor.c | 27 +++-
src/nact/nact-imenu-item.c | 2 +-
src/nact/nact-import-export.c | 3 +-
src/nact/{nact-prefs.c => nact-iprefs.c} | 274 +++++++++++++++++++++++++++++-
src/nact/{nact-prefs.h => nact-iprefs.h} | 42 ++++-
src/nact/nact-main-window.c | 25 +++-
src/nact/nact-window.c | 74 ++++++++-
src/nact/nact-window.h | 3 +
src/nact/nautilus-actions-config.ui | 4 -
12 files changed, 442 insertions(+), 25 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38119fe..d73c411 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,13 @@
* src/nact/nact-utils.c:
* src/nact/nact-utils.h: Removed files.
+ * src/nact/nact-prefs.c:
+ * src/nact/nact-prefs.h: Renamed as nact-iprefs.{c,h}.
+ Define NactIPrefs interface, to be implemented by NactWindows
+ which wish use GConf preferences.
+
+ * src/nact/Makefile.am: Updated accordingly.
+
* src/nact/nautilus-actions-config.ui:
Add LegendDialog window.
Remove all embedded action handlers (as I don't want pollute my
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index 08e4470..f1763e2 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -54,6 +54,8 @@ nautilus_actions_config_SOURCES = \
nact-iactions-list.h \
nact-imenu-item.c \
nact-imenu-item.h \
+ nact-iprefs.c \
+ nact-iprefs.h \
nact-iprofile-conditions.c \
nact-iprofile-conditions.h \
nact-main.c \
@@ -61,8 +63,6 @@ nautilus_actions_config_SOURCES = \
nact-main-window.h \
nact-profile-conditions-editor.c \
nact-profile-conditions-editor.h \
- nact-prefs.c \
- nact-prefs.h \
nact-import-export.c \
nact-import-export.h \
nact-window.c \
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 9b41e54..344d360 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -270,7 +270,6 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
- g_debug( "%s: gtk_main_level=%d", thisfn, gtk_main_level());
if( is_main_window( BASE_WINDOW( window ))){
gtk_main_quit ();
gtk_widget_destroy( GTK_WIDGET( self->private->toplevel_widget ));
@@ -279,7 +278,6 @@ instance_dispose( GObject *window )
gtk_widget_hide_all( GTK_WIDGET( self->private->toplevel_widget ));
}
-
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->dispose( window );
}
diff --git a/src/nact/nact-action-conditions-editor.c b/src/nact/nact-action-conditions-editor.c
index c4ecd29..4befe8f 100644
--- a/src/nact/nact-action-conditions-editor.c
+++ b/src/nact/nact-action-conditions-editor.c
@@ -40,6 +40,7 @@
#include "nact-action-conditions-editor.h"
#include "nact-imenu-item.h"
#include "nact-iprofile-conditions.h"
+#include "nact-iprefs.h"
#include "nact-main-window.h"
/* private class data
@@ -68,6 +69,7 @@ static void instance_finalize( GObject *dialog );
static NactActionConditionsEditor *action_conditions_editor_new( BaseApplication *application );
+static gchar *do_get_iprefs_window_id( NactWindow *window );
static gchar *do_get_dialog_name( BaseWindow *dialog );
static void on_initial_load_dialog( BaseWindow *dialog );
static void on_runtime_init_dialog( BaseWindow *dialog );
@@ -156,6 +158,9 @@ class_init( NactActionConditionsEditorClass *klass )
base_class->all_widgets_showed = on_all_widgets_showed;
base_class->dialog_response = on_dialog_response;
base_class->get_toplevel_name = do_get_dialog_name;
+
+ NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class->get_iprefs_window_id = do_get_iprefs_window_id;
}
static void
@@ -293,6 +298,12 @@ nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data
}
static gchar *
+do_get_iprefs_window_id( NactWindow *window )
+{
+ return( g_strdup( "action-conditions-editor" ));
+}
+
+static gchar *
do_get_dialog_name( BaseWindow *dialog )
{
/*g_debug( "nact_action_conditions_editor_do_get_dialog_name" );*/
@@ -303,8 +314,13 @@ static void
on_initial_load_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_action_conditions_editor_on_initial_load_dialog";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ /* call parent class at the very beginning */
+ if( BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel ){
+ BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel( dialog );
+ }
+
+ g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
NactActionConditionsEditor *window = NACT_ACTION_CONDITIONS_EDITOR( dialog );
@@ -318,8 +334,13 @@ static void
on_runtime_init_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_action_conditions_editor_on_runtime_init_dialog";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ /* call parent class at the very beginning */
+ if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
+ BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( dialog );
+ }
+
+ g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
NactActionConditionsEditor *window = NACT_ACTION_CONDITIONS_EDITOR( dialog );
@@ -404,6 +425,8 @@ on_all_widgets_showed( BaseWindow *dialog )
gtk_notebook_set_current_page( notebook, 0 );
nact_imenu_item_all_widgets_showed( NACT_WINDOW( dialog ));
+
+ nact_iprefs_position_window( NACT_WINDOW( dialog ));
}
static gboolean
diff --git a/src/nact/nact-imenu-item.c b/src/nact/nact-imenu-item.c
index ee080dc..c1eef7b 100644
--- a/src/nact/nact-imenu-item.c
+++ b/src/nact/nact-imenu-item.c
@@ -171,7 +171,7 @@ nact_imenu_item_runtime_init( NactWindow *dialog, NAAction *action )
g_free( tooltip );
GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuIconComboBoxEntry" );
- g_debug( "%s: icon_widget=%p, child=%p", thisfn, icon_widget, GTK_BIN( icon_widget )->child );
+ /*g_debug( "%s: icon_widget=%p, child=%p", thisfn, icon_widget, GTK_BIN( icon_widget )->child );*/
nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "changed", G_CALLBACK( on_icon_changed ));
gchar *icon = na_action_get_icon( action );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
diff --git a/src/nact/nact-import-export.c b/src/nact/nact-import-export.c
index b0fa6ee..c732319 100644
--- a/src/nact/nact-import-export.c
+++ b/src/nact/nact-import-export.c
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include <glib.h>
#include <gtk/gtk.h>
+
#include <glade/glade-xml.h>
#include <common/nautilus-actions-config.h>
#include <common/nautilus-actions-config-schema-reader.h>
@@ -40,7 +41,7 @@
#include <common/nautilus-actions-config-gconf-writer.h>
/*#include "nact-utils.h"*/
#include "nact-import-export.h"
-#include "nact-prefs.h"
+/*#include "nact-prefs.h"*/
#include "old-nact.h"
/* gui callback functions */
diff --git a/src/nact/nact-prefs.c b/src/nact/nact-iprefs.c
similarity index 70%
rename from src/nact/nact-prefs.c
rename to src/nact/nact-iprefs.c
index 1dcaad0..358c32e 100644
--- a/src/nact/nact-prefs.c
+++ b/src/nact/nact-iprefs.c
@@ -28,9 +28,281 @@
* ... and many others (see AUTHORS)
*/
+
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
+#include "nact-iprefs.h"
+
+/* private interface data
+ */
+struct NactIPrefsInterfacePrivate {
+ GConfClient *client;
+};
+
+/* GConf general information
+ */
+#define NA_GCONF_PREFS_PATH NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR "/preferences"
+
+static GType register_type( void );
+static void interface_base_init( NactIPrefsInterface *klass );
+static void interface_base_finalize( NactIPrefsInterface *klass );
+
+static gchar *v_get_iprefs_window_id( NactWindow *window );
+
+static GSList *read_key_listint( NactWindow *window, const gchar *key );
+static void write_key_listint( NactWindow *window, const gchar *key, GSList *list );
+static void listint_to_position( NactWindow *window, GSList *list, gint *x, gint *y, gint *width, gint *height );
+static GSList *position_to_listint( NactWindow *window, gint x, gint y, gint width, gint height );
+static void free_listint( GSList *list );
+
+GType
+nact_iprefs_get_type( void )
+{
+ static GType iface_type = 0;
+
+ if( !iface_type ){
+ iface_type = register_type();
+ }
+
+ return( iface_type );
+}
+
+static GType
+register_type( void )
+{
+ static const gchar *thisfn = "nact_iprefs_register_type";
+ g_debug( "%s", thisfn );
+
+ static const GTypeInfo info = {
+ sizeof( NactIPrefsInterface ),
+ ( GBaseInitFunc ) interface_base_init,
+ ( GBaseFinalizeFunc ) interface_base_finalize,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIPrefs", &info, 0 );
+
+ g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
+
+ return( type );
+}
+
+static void
+interface_base_init( NactIPrefsInterface *klass )
+{
+ static const gchar *thisfn = "nact_iprefs_interface_base_init";
+ static gboolean initialized = FALSE;
+
+ if( !initialized ){
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ klass->private = g_new0( NactIPrefsInterfacePrivate, 1 );
+
+ klass->private->client = gconf_client_get_default();
+
+ klass->get_iprefs_window_id = NULL;
+
+ initialized = TRUE;
+ }
+}
+
+static void
+interface_base_finalize( NactIPrefsInterface *klass )
+{
+ static const gchar *thisfn = "nact_iprefs_interface_base_finalize";
+ static gboolean finalized = FALSE ;
+
+ if( !finalized ){
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ g_free( klass->private );
+
+ finalized = TRUE;
+ }
+}
+
+/**
+ * Position the specified window on the screen.
+ *
+ * @window: this NactWindow-derived window.
+ *
+ * @code: the IPrefs identifiant of the window
+ *
+ * A window position is stored as a list of integers "x,y,width,height".
+ */
+void
+nact_iprefs_position_window( NactWindow *window )
+{
+ static const gchar *thisfn = "nact_iprefs_position_window";
+
+ gchar *key = v_get_iprefs_window_id( window );
+ if( key ){
+
+ GSList *list = read_key_listint( window, key );
+ if( list ){
+
+ gint x=0, y=0, width=0, height=0;
+ listint_to_position( window, list, &x, &y, &width, &height );
+ g_debug( "%s: key=%s, x=%d, y=%d, width=%d, height=%d", thisfn, key, x, y, width, height );
+ free_listint( list );
+
+ GtkWindow *toplevel = base_window_get_toplevel_widget( BASE_WINDOW( window ));
+ gtk_window_move( toplevel, x, y );
+ gtk_window_resize( toplevel, width, height );
+ }
+ g_free( key );
+ }
+}
+
+/**
+ * Save the position of the specified window.
+ *
+ * @window: this NactWindow-derived window.
+ *
+ * @code: the IPrefs identifiant of the window
+ */
+void
+nact_iprefs_save_window_position( NactWindow *window )
+{
+ static const gchar *thisfn = "nact_iprefs_save_window_position";
+
+ gchar *key = v_get_iprefs_window_id( window );
+ if( key ){
+ gint x, y, width, height;
+
+ GtkWindow *toplevel = base_window_get_toplevel_widget( BASE_WINDOW( window ));
+ gtk_window_get_position( toplevel, &x, &y );
+ gtk_window_get_size( toplevel, &width, &height );
+ g_debug( "%s: key=%s, x=%d, y=%d, width=%d, height=%d", thisfn, key, x, y, width, height );
+
+ GSList *list = position_to_listint( window, x, y, width, height );
+ write_key_listint( window, key, list );
+ free_listint( list );
+ g_free( key );
+ }
+}
+
+static gchar *
+v_get_iprefs_window_id( NactWindow *window )
+{
+ g_assert( NACT_IS_IPREFS( window ));
+
+ if( NACT_IPREFS_GET_INTERFACE( window )->get_iprefs_window_id ){
+ return( NACT_IPREFS_GET_INTERFACE( window )->get_iprefs_window_id( window ));
+ }
+
+ return( NULL );
+}
+
+/*
+ * returns a list of GConfValue
+ */
+static GSList *
+read_key_listint( NactWindow *window, const gchar *key )
+{
+ static const gchar *thisfn = "nact_iprefs_read_key_listint";
+ GError *error = NULL;
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+
+ GSList *list = gconf_client_get_list(
+ NACT_IPREFS_GET_INTERFACE( window )->private->client, path, GCONF_VALUE_INT, &error );
+
+ if( error ){
+ g_warning( "%s: %s", thisfn, error->message );
+ g_error_free( error );
+ list = NULL;
+ }
+
+ g_free( path );
+ return( list );
+}
+
+static void
+write_key_listint( NactWindow *window, const gchar *key, GSList *list )
+{
+ static const gchar *thisfn = "nact_iprefs_write_key_listint";
+ GError *error = NULL;
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+
+ gconf_client_set_list(
+ NACT_IPREFS_GET_INTERFACE( window )->private->client, path, GCONF_VALUE_INT, list, &error );
+
+ if( error ){
+ g_warning( "%s: %s", thisfn, error->message );
+ g_error_free( error );
+ list = NULL;
+ }
+
+ g_free( path );
+}
+
+/*
+ * extract the position of the window from the list of GConfValue
+ */
+static void
+listint_to_position( NactWindow *window, GSList *list, gint *x, gint *y, gint *width, gint *height )
+{
+ g_assert( x );
+ g_assert( y );
+ g_assert( width );
+ g_assert( height );
+ GSList *il;
+ int i;
+
+ for( il=list, i=0 ; il ; il=il->next, i+=1 ){
+ switch( i ){
+ case 0:
+ *x = GPOINTER_TO_INT( il->data );
+ break;
+ case 1:
+ *y = GPOINTER_TO_INT( il->data );
+ break;
+ case 2:
+ *width = GPOINTER_TO_INT( il->data );
+ break;
+ case 3:
+ *height = GPOINTER_TO_INT( il->data );
+ break;
+ }
+ }
+}
+
+static GSList *
+position_to_listint( NactWindow *window, gint x, gint y, gint width, gint height )
+{
+ GSList *list = NULL;
+
+ list = g_slist_append( list, GINT_TO_POINTER( x ));
+ list = g_slist_append( list, GINT_TO_POINTER( y ));
+ list = g_slist_append( list, GINT_TO_POINTER( width ));
+ list = g_slist_append( list, GINT_TO_POINTER( height ));
+
+ return( list );
+}
+
+/*
+ * free the list of int
+ */
+static void
+free_listint( GSList *list )
+{
+ /*GSList *il;
+ for( il = list ; il ; il = il->next ){
+ GConfValue *value = ( GConfValue * ) il->data;
+ gconf_value_free( value );
+ }*/
+ g_slist_free( list );
+}
+
+/* ... */
#include <glib/gi18n.h>
-#include "nact-prefs.h"
/* List of gconf keys */
#define PREFS_SCHEMES "nact_schemes_list"
diff --git a/src/nact/nact-prefs.h b/src/nact/nact-iprefs.h
similarity index 75%
rename from src/nact/nact-prefs.h
rename to src/nact/nact-iprefs.h
index 09932fc..bad0417 100644
--- a/src/nact/nact-prefs.h
+++ b/src/nact/nact-iprefs.h
@@ -31,12 +31,46 @@
#ifndef __NACT_PREFS_H__
#define __NACT_PREFS_H__
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
+/*
+ * NactIPrefs interface definition.
+ *
+ * This interface should be implemented by all dialogs which wish take
+ * benefit of preferences management.
+ */
+
+#include <glib-object.h>
+
+#include "nact-window.h"
G_BEGIN_DECLS
+#define NACT_IPREFS_TYPE ( nact_iprefs_get_type())
+#define NACT_IPREFS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IPREFS_TYPE, NactIPrefs ))
+#define NACT_IS_IPREFS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IPREFS_TYPE ))
+#define NACT_IPREFS_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IPREFS_TYPE, NactIPrefsInterface ))
+
+typedef struct NactIPrefs NactIPrefs;
+
+typedef struct NactIPrefsInterfacePrivate NactIPrefsInterfacePrivate;
+
+typedef struct {
+ GTypeInterface parent;
+ NactIPrefsInterfacePrivate *private;
+
+ /* api */
+ gchar * ( *get_iprefs_window_id )( NactWindow *window );
+}
+ NactIPrefsInterface;
+
+GType nact_iprefs_get_type( void );
+
+void nact_iprefs_position_window( NactWindow *window );
+void nact_iprefs_save_window_position( NactWindow *window );
+
+/* .. */
+#include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
+
typedef struct _NactPreferences NactPreferences;
struct _NactPreferences {
@@ -102,4 +136,4 @@ void nact_prefs_save_preferences (void);
G_END_DECLS
-#endif /* __NACT_PREFS_H__ */
+#endif /* __NACT_IPREFS_H__ */
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index c48e5a3..9608022 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -47,6 +47,7 @@
#include "nact-action-conditions-editor.h"
#include "nact-action-profiles-editor.h"
#include "nact-iactions-list.h"
+#include "nact-iprefs.h"
#include "nact-main-window.h"
/* private class data
@@ -70,6 +71,7 @@ static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *application );
static void instance_finalize( GObject *application );
+static gchar *get_iprefs_window_id( NactWindow *window );
static gchar *get_toplevel_name( BaseWindow *window );
static void on_initial_load_toplevel( BaseWindow *window );
static void on_runtime_init_toplevel( BaseWindow *window );
@@ -163,6 +165,9 @@ class_init( NactMainWindowClass *klass )
base_class->runtime_init_toplevel = on_runtime_init_toplevel;
base_class->dialog_response = on_dialog_response;
base_class->get_toplevel_name = get_toplevel_name;
+
+ NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class->get_iprefs_window_id = get_iprefs_window_id;
}
static void
@@ -247,6 +252,12 @@ nact_main_window_new( GObject *application )
}
static gchar *
+get_iprefs_window_id( NactWindow *window )
+{
+ return( g_strdup( "main-window" ));
+}
+
+static gchar *
get_toplevel_name( BaseWindow *window )
{
return( g_strdup( "ActionsDialog" ));
@@ -256,8 +267,13 @@ static void
on_initial_load_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "nact_main_window_on_initial_load_toplevel";
- g_debug( "%s: window=%p", thisfn, window );
+ /* call parent class at the very beginning */
+ if( BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel ){
+ BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel( window );
+ }
+
+ g_debug( "%s: window=%p", thisfn, window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
/*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
@@ -268,8 +284,13 @@ static void
on_runtime_init_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "nact_main_window_on_runtime_init_toplevel";
- g_debug( "%s: window=%p", thisfn, window );
+ /* call parent class at the very beginning */
+ if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
+ BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( window );
+ }
+
+ g_debug( "%s: window=%p", thisfn, window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
/*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 5929abe..5b934bd 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -39,6 +39,7 @@
#include <common/na-iio-provider.h>
#include "nact-application.h"
+#include "nact-iprefs.h"
#include "nact-window.h"
/* private class data
@@ -63,11 +64,16 @@ typedef struct {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactWindowClass *klass );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
+static GType register_type( void );
+static void class_init( NactWindowClass *klass );
+static void iprefs_iface_init( NactIPrefsInterface *iface );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
+
+static gchar *v_get_iprefs_window_id( NactWindow *window );
+
+static void on_runtime_init_toplevel( BaseWindow *window );
GType
nact_window_get_type( void )
@@ -101,7 +107,19 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- return( g_type_register_static( BASE_WINDOW_TYPE, "NactWindow", &info, 0 ));
+ GType type = g_type_register_static( BASE_WINDOW_TYPE, "NactWindow", &info, 0 );
+
+ /* implement IPrefs interface
+ */
+ static const GInterfaceInfo prefs_iface_info = {
+ ( GInterfaceInitFunc ) iprefs_iface_init,
+ NULL,
+ NULL
+ };
+
+ g_type_add_interface_static( type, NACT_IPREFS_TYPE, &prefs_iface_info );
+
+ return( type );
}
static void
@@ -117,6 +135,20 @@ class_init( NactWindowClass *klass )
object_class->finalize = instance_finalize;
klass->private = g_new0( NactWindowClassPrivate, 1 );
+
+ klass->get_iprefs_window_id = v_get_iprefs_window_id;
+
+ BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class->runtime_init_toplevel = on_runtime_init_toplevel;
+}
+
+static void
+iprefs_iface_init( NactIPrefsInterface *iface )
+{
+ static const gchar *thisfn = "nact_window_iprefs_iface_init";
+ g_debug( "%s: iface=%p", thisfn, iface );
+
+ iface->get_iprefs_window_id = v_get_iprefs_window_id;
}
static void
@@ -147,6 +179,8 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
+ nact_iprefs_save_window_position( NACT_WINDOW( window ));
+
GSList *is;
for( is = self->private->signals ; is ; is = is->next ){
NactWindowRecordedSignal *str = ( NactWindowRecordedSignal * ) is->data;
@@ -178,6 +212,34 @@ instance_finalize( GObject *window )
}
}
+static gchar *
+v_get_iprefs_window_id( NactWindow *window )
+{
+ g_assert( NACT_IS_IPREFS( window ));
+
+ if( NACT_WINDOW_GET_CLASS( window )->get_iprefs_window_id ){
+ return( NACT_WINDOW_GET_CLASS( window )->get_iprefs_window_id( window ));
+ }
+
+ return( NULL );
+}
+
+static void
+on_runtime_init_toplevel( BaseWindow *window )
+{
+ static const gchar *thisfn = "nact_window_on_runtime_init_toplevel";
+
+ /* call parent class at the very beginning */
+ if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
+ BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( window );
+ }
+
+ g_debug( "%s: window=%p", thisfn, window );
+ g_assert( NACT_IS_WINDOW( window ));
+
+ nact_iprefs_position_window( NACT_WINDOW( window ));
+}
+
/**
* Returns a pointer to the list of actions.
*/
diff --git a/src/nact/nact-window.h b/src/nact/nact-window.h
index bfd27d8..705bb63 100644
--- a/src/nact/nact-window.h
+++ b/src/nact/nact-window.h
@@ -64,6 +64,9 @@ typedef struct NactWindowClassPrivate NactWindowClassPrivate;
typedef struct {
BaseWindowClass parent;
NactWindowClassPrivate *private;
+
+ /* api */
+ gchar * ( *get_iprefs_window_id )( NactWindow *window );
}
NactWindowClass;
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index 51ab7f0..b817dde 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -256,11 +256,7 @@
</action-widgets>
</object>
<object class="GtkDialog" id="EditActionDialogExt">
- <property name="width_request">500</property>
- <property name="height_request">430</property>
- <property name="title" translatable="yes">Nautilus Action Editor</property>
<property name="modal">True</property>
- <property name="window_position">center-always</property>
<property name="default_width">400</property>
<property name="default_height">430</property>
<property name="type_hint">dialog</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]