[nautilus-actions] General review of main notebook interfaces
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] General review of main notebook interfaces
- Date: Thu, 12 Jan 2012 23:22:54 +0000 (UTC)
commit acc20024cb3a86a08dd1e2ddecd6a3e0cfea83a6
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jan 12 20:15:19 2012 +0100
General review of main notebook interfaces
ChangeLog | 28 +++++
src/nact/nact-iaction-tab.c | 239 ++++++++++++++++++++++++++-----------
src/nact/nact-iaction-tab.h | 17 +--
src/nact/nact-ibasenames-tab.c | 170 ++++++++++++++++++--------
src/nact/nact-ibasenames-tab.h | 13 +--
src/nact/nact-icapabilities-tab.c | 98 ++++++++++-----
src/nact/nact-icapabilities-tab.h | 15 +--
src/nact/nact-icommand-tab.c | 227 ++++++++++++++++++++++--------------
src/nact/nact-icommand-tab.h | 15 +--
src/nact/nact-ienvironment-tab.c | 222 ++++++++++++++++++++++------------
src/nact/nact-ienvironment-tab.h | 13 +--
src/nact/nact-iexecution-tab.c | 143 ++++++++++++++---------
src/nact/nact-iexecution-tab.h | 13 +--
src/nact/nact-ifolders-tab.c | 93 ++++++++++-----
src/nact/nact-ifolders-tab.h | 15 +--
src/nact/nact-imimetypes-tab.c | 109 +++++++++++------
src/nact/nact-imimetypes-tab.h | 13 +--
src/nact/nact-iproperties-tab.c | 145 +++++++++++++++-------
src/nact/nact-iproperties-tab.h | 15 +--
src/nact/nact-ischemes-tab.c | 93 ++++++++++-----
src/nact/nact-ischemes-tab.h | 15 +--
src/nact/nact-main-window.c | 171 +++++++++++----------------
src/nact/nact-main-window.h | 12 +-
23 files changed, 1184 insertions(+), 710 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c44fdf2..4e7cdb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,33 @@
2012-01-12 Pierre Wieser <pwieser trychlos org>
+ General review of notebook interfaces:
+ - connect to BaseWindow signals instead of calling public functions
+ - define GObject standard GType macro names
+ - host private data in only one structure attached to the instance.
+
+ * src/nact/nact-iaction-tab.c:
+ * src/nact/nact-iaction-tab.h:
+ * src/nact/nact-ibasenames-tab.c:
+ * src/nact/nact-ibasenames-tab.h:
+ * src/nact/nact-icapabilities-tab.c:
+ * src/nact/nact-icapabilities-tab.h:
+ * src/nact/nact-icommand-tab.c:
+ * src/nact/nact-icommand-tab.h:
+ * src/nact/nact-ienvironment-tab.c:
+ * src/nact/nact-ienvironment-tab.h:
+ * src/nact/nact-iexecution-tab.c:
+ * src/nact/nact-iexecution-tab.h:
+ * src/nact/nact-ifolders-tab.c:
+ * src/nact/nact-ifolders-tab.h:
+ * src/nact/nact-imimetypes-tab.c:
+ * src/nact/nact-imimetypes-tab.h:
+ * src/nact/nact-iproperties-tab.c:
+ * src/nact/nact-iproperties-tab.h:
+ * src/nact/nact-ischemes-tab.c:
+ * src/nact/nact-ischemes-tab.h:
+ * src/nact/nact-main-window.c:
+ * src/nact/nact-main-window.h: Updated accordingly.
+
* src/nact/nact-main-window.c (class_init):
Make property labels translatable.
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index c9cb642..678b42d 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -54,34 +54,48 @@ struct _NactIActionTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
-/* IActionTab properties, set against the GObject instance
+/* Context identifier, set against the menubar
*/
-#define IACTION_TAB_PROP_STATUS_CONTEXT "nact-iaction-tab-status-context"
-
-static guint st_initializations = 0; /* interface initialisation count */
-static gboolean st_on_selection_change = FALSE;
-
-static GType register_type( void );
-static void interface_base_init( NactIActionTabInterface *klass );
-static void interface_base_finalize( NactIActionTabInterface *klass );
-
-static void on_tree_view_content_changed( NactIActionTab *instance, NAObject *object, gpointer user_data );
-static void on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpointer user_data );
-
-static void on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void on_target_location_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label );
-static void on_label_changed( GtkEntry *entry, NactIActionTab *instance );
-static void set_label_label( NactIActionTab *instance, const gchar *color );
-static void on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void toolbar_same_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
-static void setup_toolbar_label( NactIActionTab *instance, NAObjectItem *item, const gchar *label );
-static void on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance );
-static void toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
-static void on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
-static void on_icon_browse( GtkButton *button, NactIActionTab *instance );
-static void on_icon_changed( GtkEntry *entry, NactIActionTab *instance );
+#define IACTION_TAB_CONTEXT "nact-iaction-tab-context"
+
+/* data set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+}
+ IActionData;
+
+#define IACTION_TAB_PROP_DATA "nact-iaction-tab-data"
+
+static guint st_initializations = 0; /* interface initialisation count */
+
+static GType register_type( void );
+static void interface_base_init( NactIActionTabInterface *klass );
+static void interface_base_finalize( NactIActionTabInterface *klass );
+
+static void on_base_initialize_gtk( NactIActionTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactIActionTab *instance, gpointer user_data );
+
+static void on_tree_view_content_changed( NactIActionTab *instance, NAObject *object, gpointer user_data );
+static void on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpointer user_data );
+
+static void on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void on_target_location_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label );
+static void on_label_changed( GtkEntry *entry, NactIActionTab *instance );
+static void set_label_label( NactIActionTab *instance, const gchar *color );
+static void on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void toolbar_same_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
+static void setup_toolbar_label( NactIActionTab *instance, NAObjectItem *item, const gchar *label );
+static void on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance );
+static void toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
+static void on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
+static void on_icon_browse( GtkButton *button, NactIActionTab *instance );
+static void on_icon_changed( GtkEntry *entry, NactIActionTab *instance );
+
+static IActionData *get_iaction_data( NactIActionTab *instance );
+static void on_instance_finalized( gpointer user_data, NactIActionTab *instance );
GType
nact_iaction_tab_get_type( void )
@@ -152,6 +166,43 @@ interface_base_finalize( NactIActionTabInterface *klass )
}
}
+/**
+ * nact_iaction_tab_init:
+ * @instance: this #NactIActionTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
+void
+nact_iaction_tab_init( NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_init";
+ IActionData *data;
+
+ g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_iaction_data( instance );
+ data->on_selection_change = FALSE;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
/*
* GTK_ICON_SIZE_MENU : 16x16
* GTK_ICON_SIZE_SMALL_TOOLBAR: 18x18
@@ -166,10 +217,10 @@ interface_base_finalize( NactIActionTabInterface *klass )
* Starting with 3.1.0, the ComboBox is replaced with a GtkEntry (thanks to new
* Icon Chooser).
*/
-void
-nact_iaction_tab_initial_load_toplevel( NactIActionTab *instance )
+static void
+on_base_initialize_gtk( NactIActionTab *instance, GtkWindow *toplevel, void *user_data )
{
- static const gchar *thisfn = "nact_iaction_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_iaction_tab_on_base_initialize_gtk";
GtkFrame *frame;
GtkButton *button;
gint size;
@@ -186,7 +237,11 @@ nact_iaction_tab_initial_load_toplevel( NactIActionTab *instance )
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" ));
frame = GTK_FRAME( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconFrame" ));
@@ -203,22 +258,31 @@ nact_iaction_tab_initial_load_toplevel( NactIActionTab *instance )
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
}
-void
-nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
+static void
+on_base_initialize_window( NactIActionTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_iaction_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_iaction_tab_on_base_initialize_window";
GtkWidget *label_widget, *tooltip_widget, *icon_entry;
GtkWidget *button;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
- base_window_signal_connect( BASE_WINDOW( instance ),
- G_OBJECT( instance ), MAIN_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_main_selection_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ MAIN_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_main_selection_changed ));
- base_window_signal_connect( BASE_WINDOW( instance ),
- G_OBJECT( instance ), MAIN_SIGNAL_ITEM_UPDATED, G_CALLBACK( on_tree_view_content_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ MAIN_SIGNAL_ITEM_UPDATED,
+ G_CALLBACK( on_tree_view_content_changed ));
button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" );
base_window_signal_connect(
@@ -284,26 +348,6 @@ nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
G_CALLBACK( on_icon_browse ));
}
-void
-nact_iaction_tab_all_widgets_showed( NactIActionTab *instance )
-{
- static const gchar *thisfn = "nact_iaction_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-void
-nact_iaction_tab_dispose( NactIActionTab *instance )
-{
- static const gchar *thisfn = "nact_iaction_tab_dispose";
-
- g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
/**
* nact_iaction_tab_has_label:
* @window: this #NactIActionTab instance.
@@ -359,6 +403,7 @@ on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpoi
gchar *label, *tooltip, *icon;
GtkButton *icon_button;
GtkToggleButton *toggle;
+ IActionData *data;
g_return_if_fail( BASE_IS_WINDOW( instance ));
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
@@ -369,10 +414,11 @@ on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpoi
( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
( void * ) selected_items, count_selected );
+ data = get_iaction_data( instance );
enable_tab = ( count_selected == 1 );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ACTION, enable_tab );
- st_on_selection_change = TRUE;
+ data->on_selection_change = TRUE;
g_object_get(
G_OBJECT( instance ),
@@ -458,7 +504,7 @@ on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpoi
icon_button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" ));
base_gtk_utils_set_editable( G_OBJECT( icon_button ), editable );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
}
static void
@@ -468,10 +514,13 @@ on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
NAObjectItem *item;
gboolean is_target;
gboolean editable;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p (%s)",
thisfn,
( void * ) button,
@@ -510,10 +559,13 @@ on_target_location_toggled( GtkToggleButton *button, NactIActionTab *instance )
NAObjectItem *item;
gboolean is_target;
gboolean editable;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p (%s)",
thisfn,
( void * ) button,
@@ -555,7 +607,7 @@ check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label )
nact_main_statusbar_hide_status(
NACT_MAIN_WINDOW( instance ),
- IACTION_TAB_PROP_STATUS_CONTEXT );
+ IACTION_TAB_CONTEXT );
set_label_label( instance, "black" );
@@ -569,7 +621,7 @@ check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label )
/* i18n: status bar message when the action label is empty */
nact_main_statusbar_display_status(
NACT_MAIN_WINDOW( instance ),
- IACTION_TAB_PROP_STATUS_CONTEXT,
+ IACTION_TAB_CONTEXT,
_( "Caution: a label is mandatory for the action or the menu." ));
set_label_label( instance, "red" );
@@ -582,10 +634,13 @@ on_label_changed( GtkEntry *entry, NactIActionTab *instance )
static const gchar *thisfn = "nact_iaction_tab_on_label_changed";
NAObjectItem *item;
const gchar *label;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: entry=%p, instance=%p (%s)",
thisfn,
( void * ) entry,
@@ -637,10 +692,13 @@ on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
NAObjectAction *item;
gboolean is_target;
gboolean editable;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p (%s)",
thisfn,
( void * ) button,
@@ -683,10 +741,13 @@ on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance
gboolean editable;
gchar *label;
GtkWidget *label_widget;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p (%s)",
thisfn,
( void * ) button,
@@ -763,10 +824,13 @@ on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance )
static const gchar *thisfn = "nact_iaction_tab_on_toolbar_label_changed";
NAObjectItem *item;
const gchar *label;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: entry=%p, instance=%p (%s)",
thisfn,
( void * ) entry,
@@ -804,10 +868,13 @@ on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance )
{
static const gchar *thisfn = "nact_iaction_tab_on_tooltip_changed";
NAObjectItem *item;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
- if( !st_on_selection_change ){
+ data = get_iaction_data( instance );
+
+ if( !data->on_selection_change ){
g_debug( "%s: entry=%p, instance=%p (%s)",
thisfn,
( void * ) entry,
@@ -867,6 +934,7 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
GtkImage *image;
NAObjectItem *item;
gchar *icon_name;
+ IActionData *data;
g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
@@ -876,6 +944,7 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
icon_name = NULL;
+ data = get_iaction_data( instance );
g_object_get(
G_OBJECT( instance ),
@@ -883,7 +952,7 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
NULL );
if( item ){
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
icon_name = g_strdup( gtk_entry_get_text( icon_entry ));
na_object_set_icon( item, icon_name );
g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, MAIN_DATA_ICON );
@@ -900,3 +969,31 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
base_gtk_utils_render( icon_name, image, GTK_ICON_SIZE_SMALL_TOOLBAR );
g_free( icon_name );
}
+
+static IActionData *
+get_iaction_data( NactIActionTab *instance )
+{
+ IActionData *data;
+
+ data = ( IActionData * ) g_object_get_data( G_OBJECT( instance ), IACTION_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( IActionData, 1 );
+ g_object_set_data( G_OBJECT( instance ), IACTION_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_instance_finalized";
+ IActionData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ data = get_iaction_data( instance );
+
+ g_free( data );
+}
diff --git a/src/nact/nact-iaction-tab.h b/src/nact/nact-iaction-tab.h
index 01da5ee..611c8a6 100644
--- a/src/nact/nact-iaction-tab.h
+++ b/src/nact/nact-iaction-tab.h
@@ -47,10 +47,10 @@
G_BEGIN_DECLS
-#define NACT_IACTION_TAB_TYPE ( nact_iaction_tab_get_type())
-#define NACT_IACTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IACTION_TAB_TYPE, NactIActionTab ))
-#define NACT_IS_IACTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IACTION_TAB_TYPE ))
-#define NACT_IACTION_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IACTION_TAB_TYPE, NactIActionTabInterface ))
+#define NACT_TYPE_IACTION_TAB ( nact_iaction_tab_get_type())
+#define NACT_IACTION_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IACTION_TAB, NactIActionTab ))
+#define NACT_IS_IACTION_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IACTION_TAB ))
+#define NACT_IACTION_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IACTION_TAB, NactIActionTabInterface ))
typedef struct _NactIActionTab NactIActionTab;
typedef struct _NactIActionTabInterfacePrivate NactIActionTabInterfacePrivate;
@@ -62,14 +62,11 @@ typedef struct {
}
NactIActionTabInterface;
-GType nact_iaction_tab_get_type( void );
+GType nact_iaction_tab_get_type ( void );
-void nact_iaction_tab_initial_load_toplevel( NactIActionTab *instance );
-void nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance );
-void nact_iaction_tab_all_widgets_showed ( NactIActionTab *instance );
-void nact_iaction_tab_dispose ( NactIActionTab *instance );
+void nact_iaction_tab_init ( NactIActionTab *instance );
-gboolean nact_iaction_tab_has_label ( NactIActionTab *instance );
+gboolean nact_iaction_tab_has_label( NactIActionTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-ibasenames-tab.c b/src/nact/nact-ibasenames-tab.c
index 66bdf8d..f5f8c00 100644
--- a/src/nact/nact-ibasenames-tab.c
+++ b/src/nact/nact-ibasenames-tab.c
@@ -47,20 +47,36 @@ struct _NactIBasenamesTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
+/* the identifier of this notebook page in the Match dialog
+ */
#define ITAB_NAME "basenames"
+/* data set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+}
+ IBasenamesData;
+
+#define IBASENAMES_TAB_PROP_DATA "nact-ibasenames-tab-data"
+
static guint st_initializations = 0; /* interface initialization count */
-static gboolean st_on_selection_change = FALSE;
-static GType register_type( void );
-static void interface_base_init( NactIBasenamesTabInterface *klass );
-static void interface_base_finalize( NactIBasenamesTabInterface *klass );
+static GType register_type( void );
+static void interface_base_init( NactIBasenamesTabInterface *klass );
+static void interface_base_finalize( NactIBasenamesTabInterface *klass );
-static void on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data );
+static void on_base_initialize_gtk( NactIBasenamesTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactIBasenamesTab *instance, gpointer user_data );
-static void on_matchcase_toggled( GtkToggleButton *button, BaseWindow *window );
-static GSList *get_basenames( void *context );
-static void set_basenames( void *context, GSList *filters );
+static void on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data );
+
+static void on_matchcase_toggled( GtkToggleButton *button, BaseWindow *window );
+static GSList *get_basenames( void *context );
+static void set_basenames( void *context, GSList *filters );
+
+static IBasenamesData *get_ibasenames_data( NactIBasenamesTab *instance );
+static void on_instance_finalized( gpointer user_data, NactIBasenamesTab *instance );
GType
nact_ibasenames_tab_get_type( void )
@@ -131,21 +147,62 @@ interface_base_finalize( NactIBasenamesTabInterface *klass )
}
}
-/**
- * nact_ibasenames_tab_initial_load:
+/*
+ * nact_ibasenames_tab_init:
+ * @instance: this #NactIBasenamesTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
+void
+nact_ibasenames_tab_init( NactIBasenamesTab *instance )
+{
+ static const gchar *thisfn = "nact_ibasenames_tab_init";
+ IBasenamesData *data;
+
+ g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_ibasenames_data( instance );
+ data->on_selection_change = FALSE;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+/*
+ * on_base_initialize_gtk:
* @window: this #NactIBasenamesTab instance.
*
* Initializes the tab widget at initial load.
*/
-void
-nact_ibasenames_tab_initial_load_toplevel( NactIBasenamesTab *instance )
+static void
+on_base_initialize_gtk( NactIBasenamesTab *instance, GtkWindow *toplevel, void *user_data )
{
- static const gchar *thisfn = "nact_ibasenames_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_ibasenames_tab_on_base_initialize_gtk";
GtkWidget *list, *add, *remove;
g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
list = base_window_get_widget( BASE_WINDOW( instance ), "BasenamesTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddBasenameButton" );
@@ -163,22 +220,25 @@ nact_ibasenames_tab_initial_load_toplevel( NactIBasenamesTab *instance )
_( "Basename filter" ), TRUE );
}
-/**
- * nact_ibasenames_tab_runtime_init:
+/*
+ * on_base_initialize_window:
* @window: this #NactIBasenamesTab instance.
*
* Initializes the tab widget at each time the widget will be displayed.
* Connect signals and setup runtime values.
*/
-void
-nact_ibasenames_tab_runtime_init_toplevel( NactIBasenamesTab *instance )
+static void
+on_base_initialize_window( NactIBasenamesTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_ibasenames_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_ibasenames_tab_on_base_initialize_window";
GtkWidget *button;
g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -196,34 +256,6 @@ nact_ibasenames_tab_runtime_init_toplevel( NactIBasenamesTab *instance )
nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
}
-void
-nact_ibasenames_tab_all_widgets_showed( NactIBasenamesTab *instance )
-{
- static const gchar *thisfn = "nact_ibasenames_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-/**
- * nact_ibasenames_tab_dispose:
- * @window: this #NactIBasenamesTab instance.
- *
- * Called at instance_dispose time.
- */
-void
-nact_ibasenames_tab_dispose( NactIBasenamesTab *instance )
-{
- static const gchar *thisfn = "nact_ibasenames_tab_dispose";
-
- g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
-}
-
static void
on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data )
{
@@ -232,6 +264,7 @@ on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer u
gboolean editable;
GtkToggleButton *matchcase_button;
gboolean matchcase;
+ IBasenamesData *data;
count_selected = g_list_length( selected_items );
@@ -239,7 +272,9 @@ on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer u
MAIN_PROP_CONTEXT, &context, MAIN_PROP_EDITABLE, &editable,
NULL );
- st_on_selection_change = TRUE;
+ data = get_ibasenames_data( NACT_IBASENAMES_TAB( window ));
+
+ data->on_selection_change = TRUE;
nact_match_list_on_selection_changed( window, ITAB_NAME, count_selected );
@@ -248,7 +283,7 @@ on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer u
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( matchcase_button ), matchcase );
base_gtk_utils_set_editable( G_OBJECT( matchcase_button ), editable );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
}
static void
@@ -257,8 +292,11 @@ on_matchcase_toggled( GtkToggleButton *button, BaseWindow *window )
NAIContext *context;
gboolean editable;
gboolean matchcase;
+ IBasenamesData *data;
- if( !st_on_selection_change ){
+ data = get_ibasenames_data( NACT_IBASENAMES_TAB( window ));
+
+ if( !data->on_selection_change ){
g_object_get( G_OBJECT( window ),
MAIN_PROP_CONTEXT, &context, MAIN_PROP_EDITABLE, &editable,
NULL );
@@ -290,3 +328,33 @@ set_basenames( void *context, GSList *filters )
{
na_object_set_basenames( context, filters );
}
+
+static IBasenamesData *
+get_ibasenames_data( NactIBasenamesTab *instance )
+{
+ IBasenamesData *data;
+
+ data = ( IBasenamesData * ) g_object_get_data( G_OBJECT( instance ), IBASENAMES_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( IBasenamesData, 1 );
+ g_object_set_data( G_OBJECT( instance ), IBASENAMES_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactIBasenamesTab *instance )
+{
+ static const gchar *thisfn = "nact_ibasenames_tab_on_instance_finalized";
+ IBasenamesData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ data = get_ibasenames_data( instance );
+
+ nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+
+ g_free( data );
+}
diff --git a/src/nact/nact-ibasenames-tab.h b/src/nact/nact-ibasenames-tab.h
index 9d5b793..50438ec 100644
--- a/src/nact/nact-ibasenames-tab.h
+++ b/src/nact/nact-ibasenames-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_IBASENAMES_TAB_TYPE ( nact_ibasenames_tab_get_type())
-#define NACT_IBASENAMES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IBASENAMES_TAB_TYPE, NactIBasenamesTab ))
-#define NACT_IS_IBASENAMES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IBASENAMES_TAB_TYPE ))
-#define NACT_IBASENAMES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IBASENAMES_TAB_TYPE, NactIBasenamesTabInterface ))
+#define NACT_TYPE_IBASENAMES_TAB ( nact_ibasenames_tab_get_type())
+#define NACT_IBASENAMES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IBASENAMES_TAB, NactIBasenamesTab ))
+#define NACT_IS_IBASENAMES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IBASENAMES_TAB ))
+#define NACT_IBASENAMES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IBASENAMES_TAB, NactIBasenamesTabInterface ))
typedef struct _NactIBasenamesTab NactIBasenamesTab;
typedef struct _NactIBasenamesTabInterfacePrivate NactIBasenamesTabInterfacePrivate;
@@ -61,10 +61,7 @@ typedef struct {
GType nact_ibasenames_tab_get_type( void );
-void nact_ibasenames_tab_initial_load_toplevel( NactIBasenamesTab *instance );
-void nact_ibasenames_tab_runtime_init_toplevel( NactIBasenamesTab *instance );
-void nact_ibasenames_tab_all_widgets_showed ( NactIBasenamesTab *instance );
-void nact_ibasenames_tab_dispose ( NactIBasenamesTab *instance );
+void nact_ibasenames_tab_init ( NactIBasenamesTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-icapabilities-tab.c b/src/nact/nact-icapabilities-tab.c
index 8dc9244..e2ca817 100644
--- a/src/nact/nact-icapabilities-tab.c
+++ b/src/nact/nact-icapabilities-tab.c
@@ -56,12 +56,17 @@ static GType register_type( void );
static void interface_base_init( NactICapabilitiesTabInterface *klass );
static void interface_base_finalize( NactICapabilitiesTabInterface *klass );
+static void on_base_initialize_gtk( NactICapabilitiesTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactICapabilitiesTab *instance, gpointer user_data );
+
static void on_main_selection_changed( NactICapabilitiesTab *instance, GList *selected_items, gpointer user_data );
static void on_add_clicked( GtkButton *button, BaseWindow *window );
static GSList *get_capabilities( NAIContext *context );
static void set_capabilities( NAIContext *context, GSList *list );
+static void on_instance_finalized( gpointer user_data, NactICapabilitiesTab *instance );
+
GType
nact_icapabilities_tab_get_type( void )
{
@@ -131,15 +136,52 @@ interface_base_finalize( NactICapabilitiesTabInterface *klass )
}
}
+/**
+ * nact_icapabilities_tab_init:
+ * @instance: this #NactICapabilitiesTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
void
-nact_icapabilities_tab_initial_load_toplevel( NactICapabilitiesTab *instance )
+nact_icapabilities_tab_init( NactICapabilitiesTab *instance )
+{
+ static const gchar *thisfn = "nact_icapabilities_tab_init";
+
+ g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+static void
+on_base_initialize_gtk( NactICapabilitiesTab *instance, GtkWindow *toplevel, void *user_data )
{
- static const gchar *thisfn = "nact_icapabilities_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_icapabilities_tab_on_base_initialize_gtk";
GtkWidget *list, *add, *remove;
g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
list = base_window_get_widget( BASE_WINDOW( instance ), "CapabilitiesTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddCapabilityButton" );
@@ -155,41 +197,25 @@ nact_icapabilities_tab_initial_load_toplevel( NactICapabilitiesTab *instance )
_( "Capability filter" ), FALSE );
}
-void
-nact_icapabilities_tab_runtime_init_toplevel( NactICapabilitiesTab *instance )
+static void
+on_base_initialize_window( NactICapabilitiesTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_icapabilities_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_icapabilities_tab_on_base_initialize_window";
g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
- base_window_signal_connect( BASE_WINDOW( instance ),
- G_OBJECT( instance ), MAIN_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_main_selection_changed ));
-}
-
-void
-nact_icapabilities_tab_all_widgets_showed( NactICapabilitiesTab *instance )
-{
- static const gchar *thisfn = "nact_icapabilities_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-void
-nact_icapabilities_tab_dispose( NactICapabilitiesTab *instance )
-{
- static const gchar *thisfn = "nact_icapabilities_tab_dispose";
-
- g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ MAIN_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_main_selection_changed ));
}
static void
@@ -231,3 +257,13 @@ set_capabilities( NAIContext *context, GSList *list )
{
na_object_set_capabilities( context, list );
}
+
+static void
+on_instance_finalized( gpointer user_data, NactICapabilitiesTab *instance )
+{
+ static const gchar *thisfn = "nact_icapabilities_tab_on_instance_finalized";
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+}
diff --git a/src/nact/nact-icapabilities-tab.h b/src/nact/nact-icapabilities-tab.h
index 312af52..965c0fb 100644
--- a/src/nact/nact-icapabilities-tab.h
+++ b/src/nact/nact-icapabilities-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_ICAPABILITIES_TAB_TYPE ( nact_icapabilities_tab_get_type())
-#define NACT_ICAPABILITIES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_ICAPABILITIES_TAB_TYPE, NactICapabilitiesTab ))
-#define NACT_IS_ICAPABILITIES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_ICAPABILITIES_TAB_TYPE ))
-#define NACT_ICAPABILITIES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_ICAPABILITIES_TAB_TYPE, NactICapabilitiesTabInterface ))
+#define NACT_TYPE_ICAPABILITIES_TAB ( nact_icapabilities_tab_get_type())
+#define NACT_ICAPABILITIES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_ICAPABILITIES_TAB, NactICapabilitiesTab ))
+#define NACT_IS_ICAPABILITIES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_ICAPABILITIES_TAB ))
+#define NACT_ICAPABILITIES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_ICAPABILITIES_TAB, NactICapabilitiesTabInterface ))
typedef struct _NactICapabilitiesTab NactICapabilitiesTab;
typedef struct _NactICapabilitiesTabInterfacePrivate NactICapabilitiesTabInterfacePrivate;
@@ -59,12 +59,9 @@ typedef struct {
}
NactICapabilitiesTabInterface;
-GType nact_icapabilities_tab_get_type( void );
+GType nact_icapabilities_tab_get_type( void );
-void nact_icapabilities_tab_initial_load_toplevel( NactICapabilitiesTab *instance );
-void nact_icapabilities_tab_runtime_init_toplevel( NactICapabilitiesTab *instance );
-void nact_icapabilities_tab_all_widgets_showed ( NactICapabilitiesTab *instance );
-void nact_icapabilities_tab_dispose ( NactICapabilitiesTab *instance );
+void nact_icapabilities_tab_init ( NactICapabilitiesTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index d38e71b..6871312 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -59,37 +59,50 @@ struct _NactICommandTabInterfacePrivate {
/* a data set in the LegendDialog GObject
*/
#define ICOMMAND_TAB_LEGEND_VISIBLE "nact-icommand-tab-legend-dialog-visible"
-#define ICOMMAND_TAB_STATUSBAR_CONTEXT "nact-icommand-tab-statusbar-context"
+
+/* data set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+ NATokens *tokens;
+}
+ ICommandData;
+
+#define ICOMMAND_TAB_PROP_DATA "nact-icommand-tab-data"
static guint st_initializations = 0; /* interface initialization count */
-static gboolean st_on_selection_change = FALSE;
static NATokens *st_tokens = NULL;
-static GType register_type( void );
-static void interface_base_init( NactICommandTabInterface *klass );
-static void interface_base_finalize( NactICommandTabInterface *klass );
-
-static void on_tree_view_content_changed( NactICommandTab *instance, NAObject *object, gpointer user_data );
-static void on_main_selection_changed( NactICommandTab *instance, GList *selected_items, gpointer user_data );
-
-static GtkWidget *get_label_entry( NactICommandTab *instance );
-static GtkButton *get_legend_button( NactICommandTab *instance );
-static GtkWindow *get_legend_dialog( NactICommandTab *instance );
-static GtkWidget *get_parameters_entry( NactICommandTab *instance );
-static GtkButton *get_path_button( NactICommandTab *instance );
-static GtkWidget *get_path_entry( NactICommandTab *instance );
-static void legend_dialog_show( NactICommandTab *instance );
-static void legend_dialog_hide( NactICommandTab *instance );
-static void on_label_changed( GtkEntry *entry, NactICommandTab *instance );
-static void on_legend_clicked( GtkButton *button, NactICommandTab *instance );
-static gboolean on_legend_dialog_deleted( GtkWidget *dialog, GdkEvent *event, NactICommandTab *instance );
-static void on_parameters_changed( GtkEntry *entry, NactICommandTab *instance );
-static void on_path_browse( GtkButton *button, NactICommandTab *instance );
-static void on_path_changed( GtkEntry *entry, NactICommandTab *instance );
-static void on_wdir_browse( GtkButton *button, NactICommandTab *instance );
-static void on_wdir_changed( GtkEntry *entry, NactICommandTab *instance );
-static gchar *parse_parameters( NactICommandTab *instance );
-static void update_example_label( NactICommandTab *instance, NAObjectProfile *profile );
+static GType register_type( void );
+static void interface_base_init( NactICommandTabInterface *klass );
+static void interface_base_finalize( NactICommandTabInterface *klass );
+
+static void on_base_initialize_window( NactICommandTab *instance, gpointer user_data );
+
+static void on_tree_view_content_changed( NactICommandTab *instance, NAObject *object, gpointer user_data );
+static void on_main_selection_changed( NactICommandTab *instance, GList *selected_items, gpointer user_data );
+
+static GtkWidget *get_label_entry( NactICommandTab *instance );
+static GtkButton *get_legend_button( NactICommandTab *instance );
+static GtkWindow *get_legend_dialog( NactICommandTab *instance );
+static GtkWidget *get_parameters_entry( NactICommandTab *instance );
+static GtkButton *get_path_button( NactICommandTab *instance );
+static GtkWidget *get_path_entry( NactICommandTab *instance );
+static void legend_dialog_show( NactICommandTab *instance );
+static void legend_dialog_hide( NactICommandTab *instance );
+static void on_label_changed( GtkEntry *entry, NactICommandTab *instance );
+static void on_legend_clicked( GtkButton *button, NactICommandTab *instance );
+static gboolean on_legend_dialog_deleted( GtkWidget *dialog, GdkEvent *event, NactICommandTab *instance );
+static void on_parameters_changed( GtkEntry *entry, NactICommandTab *instance );
+static void on_path_browse( GtkButton *button, NactICommandTab *instance );
+static void on_path_changed( GtkEntry *entry, NactICommandTab *instance );
+static void on_wdir_browse( GtkButton *button, NactICommandTab *instance );
+static void on_wdir_changed( GtkEntry *entry, NactICommandTab *instance );
+static gchar *parse_parameters( NactICommandTab *instance );
+static void update_example_label( NactICommandTab *instance, NAObjectProfile *profile );
+
+static ICommandData *get_icommand_data( NactICommandTab *instance );
+static void on_instance_finalized( gpointer user_data, NactICommandTab *instance );
GType
nact_icommand_tab_get_type( void )
@@ -160,24 +173,36 @@ interface_base_finalize( NactICommandTabInterface *klass )
}
}
-/**
- * nact_icommand_tab_initial_load:
- * @window: this #NactICommandTab instance.
- *
- * Initializes the tab widget at initial load.
+/*
+ * nact_icommand_tab_init:
+ * @instance: this #NactICommandTab instance.
*
- * The GConf preference keys used in this tab were misnamed from v1.11.1
- * up to and including v1.12.0. Starting with v1.12.1, these are migrated
- * here, so that the normal code only makes use of 'good' keys.
+ * Initialize the interface
+ * Connect to #BaseWindow signals
*/
void
-nact_icommand_tab_initial_load_toplevel( NactICommandTab *instance )
+nact_icommand_tab_init( NactICommandTab *instance )
{
- static const gchar *thisfn = "nact_icommand_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_icommand_tab_init";
+ ICommandData *data;
g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_icommand_data( instance );
+ data->on_selection_change = FALSE;
+ data->tokens = NULL;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
}
/**
@@ -187,17 +212,21 @@ nact_icommand_tab_initial_load_toplevel( NactICommandTab *instance )
* Initializes the tab widget at each time the widget will be displayed.
* Connect signals and setup runtime values.
*/
-void
-nact_icommand_tab_runtime_init_toplevel( NactICommandTab *instance )
+static void
+on_base_initialize_window( NactICommandTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_icommand_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_icommand_tab_on_base_initialize_window";
GtkWindow *legend_dialog;
GtkWidget *label_entry, *path_entry, *parameters_entry, *wdir_entry;
GtkButton *path_button, *legend_button, *wdir_button;
+ ICommandData *data;
g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
label_entry = get_label_entry( instance );
base_window_signal_connect(
@@ -255,49 +284,25 @@ nact_icommand_tab_runtime_init_toplevel( NactICommandTab *instance )
"clicked",
G_CALLBACK( on_wdir_browse ));
- base_window_signal_connect( BASE_WINDOW( instance ),
- G_OBJECT( instance ), MAIN_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_main_selection_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ MAIN_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_main_selection_changed ));
- base_window_signal_connect( BASE_WINDOW( instance ),
- G_OBJECT( instance ), MAIN_SIGNAL_ITEM_UPDATED, G_CALLBACK( on_tree_view_content_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ MAIN_SIGNAL_ITEM_UPDATED,
+ G_CALLBACK( on_tree_view_content_changed ));
/* allocate a static fake NATokens object which will be used to build
- * the example label - this object will be unreffed on dispose
+ * the example label - this object will be g_object_unref() on instance
+ * finalization
*/
- if( !st_tokens ){
- st_tokens = na_tokens_new_for_example();
- }
-}
-
-void
-nact_icommand_tab_all_widgets_showed( NactICommandTab *instance )
-{
- static const gchar *thisfn = "nact_icommand_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-/**
- * nact_icommand_tab_dispose:
- * @window: this #NactICommandTab instance.
- *
- * Called at instance_dispose time.
- */
-void
-nact_icommand_tab_dispose( NactICommandTab *instance )
-{
- static const gchar *thisfn = "nact_icommand_tab_dispose";
-
- g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- legend_dialog_hide( instance );
-
- if( st_tokens ){
- g_object_unref( st_tokens );
+ data = get_icommand_data( instance );
+ if( !data->tokens ){
+ data->tokens = na_tokens_new_for_example();
}
}
@@ -328,6 +333,7 @@ on_main_selection_changed( NactICommandTab *instance, GList *selected_items, gpo
gchar *label, *path, *parameters, *wdir;
GtkButton *path_button, *wdir_button;
GtkButton *legend_button;
+ ICommandData *data;
g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
@@ -342,10 +348,11 @@ on_main_selection_changed( NactICommandTab *instance, GList *selected_items, gpo
MAIN_PROP_EDITABLE, &editable,
NULL );
+ data = get_icommand_data( instance );
enable_tab = ( profile != NULL );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
- st_on_selection_change = TRUE;
+ data->on_selection_change = TRUE;
label_entry = get_label_entry( instance );
label = profile ? na_object_get_label( profile ) : g_strdup( "" );
@@ -392,7 +399,7 @@ on_main_selection_changed( NactICommandTab *instance, GList *selected_items, gpo
gtk_widget_set_sensitive( GTK_WIDGET( wdir_button ), profile != NULL );
base_gtk_utils_set_editable( G_OBJECT( wdir_button ), editable );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
}
static GtkWidget *
@@ -480,8 +487,11 @@ on_label_changed( GtkEntry *entry, NactICommandTab *instance )
{
NAObjectProfile *profile;
const gchar *label;
+ ICommandData *data;
+
+ data = get_icommand_data( instance );
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
g_object_get(
G_OBJECT( instance ),
MAIN_PROP_PROFILE, &profile,
@@ -518,8 +528,11 @@ static void
on_parameters_changed( GtkEntry *entry, NactICommandTab *instance )
{
NAObjectProfile *profile;
+ ICommandData *data;
- if( !st_on_selection_change ){
+ data = get_icommand_data( instance );
+
+ if( !data->on_selection_change ){
g_object_get(
G_OBJECT( instance ),
MAIN_PROP_PROFILE, &profile,
@@ -546,8 +559,11 @@ static void
on_path_changed( GtkEntry *entry, NactICommandTab *instance )
{
NAObjectProfile *profile;
+ ICommandData *data;
+
+ data = get_icommand_data( instance );
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
g_object_get(
G_OBJECT( instance ),
MAIN_PROP_PROFILE, &profile,
@@ -584,8 +600,11 @@ static void
on_wdir_changed( GtkEntry *entry, NactICommandTab *instance )
{
NAObjectProfile *profile;
+ ICommandData *data;
- if( !st_on_selection_change ){
+ data = get_icommand_data( instance );
+
+ if( !data->on_selection_change ){
g_object_get(
G_OBJECT( instance ),
MAIN_PROP_PROFILE, &profile,
@@ -645,3 +664,37 @@ update_example_label( NactICommandTab *instance, NAObjectProfile *profile )
gtk_label_set_label( GTK_LABEL( example_widget ), newlabel );
g_free( newlabel );
}
+
+static ICommandData *
+get_icommand_data( NactICommandTab *instance )
+{
+ ICommandData *data;
+
+ data = ( ICommandData * ) g_object_get_data( G_OBJECT( instance ), ICOMMAND_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( ICommandData, 1 );
+ g_object_set_data( G_OBJECT( instance ), ICOMMAND_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactICommandTab *instance )
+{
+ static const gchar *thisfn = "nact_icommand_tab_on_instance_finalized";
+ ICommandData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ legend_dialog_hide( instance );
+
+ data = get_icommand_data( instance );
+
+ if( data->tokens ){
+ g_object_unref( data->tokens );
+ }
+
+ g_free( data );
+}
diff --git a/src/nact/nact-icommand-tab.h b/src/nact/nact-icommand-tab.h
index 1e550ab..38b206a 100644
--- a/src/nact/nact-icommand-tab.h
+++ b/src/nact/nact-icommand-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_ICOMMAND_TAB_TYPE ( nact_icommand_tab_get_type())
-#define NACT_ICOMMAND_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_ICOMMAND_TAB_TYPE, NactICommandTab ))
-#define NACT_IS_ICOMMAND_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_ICOMMAND_TAB_TYPE ))
-#define NACT_ICOMMAND_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_ICOMMAND_TAB_TYPE, NactICommandTabInterface ))
+#define NACT_TYPE_ICOMMAND_TAB ( nact_icommand_tab_get_type())
+#define NACT_ICOMMAND_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_ICOMMAND_TAB, NactICommandTab ))
+#define NACT_IS_ICOMMAND_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_ICOMMAND_TAB ))
+#define NACT_ICOMMAND_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_ICOMMAND_TAB, NactICommandTabInterface ))
typedef struct _NactICommandTab NactICommandTab;
typedef struct _NactICommandTabInterfacePrivate NactICommandTabInterfacePrivate;
@@ -59,12 +59,9 @@ typedef struct {
}
NactICommandTabInterface;
-GType nact_icommand_tab_get_type( void );
+GType nact_icommand_tab_get_type( void );
-void nact_icommand_tab_initial_load_toplevel( NactICommandTab *instance );
-void nact_icommand_tab_runtime_init_toplevel( NactICommandTab *instance );
-void nact_icommand_tab_all_widgets_showed ( NactICommandTab *instance );
-void nact_icommand_tab_dispose ( NactICommandTab *instance );
+void nact_icommand_tab_init ( NactICommandTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-ienvironment-tab.c b/src/nact/nact-ienvironment-tab.c
index 3f47043..e6aa4f9 100644
--- a/src/nact/nact-ienvironment-tab.c
+++ b/src/nact/nact-ienvironment-tab.c
@@ -84,38 +84,52 @@ enum {
N_COLUMN
};
-static guint st_initializations = 0; /* interface initialization count */
-static gboolean st_on_selection_change = FALSE;
-
-static GType register_type( void );
-static void interface_base_init( NactIEnvironmentTabInterface *klass );
-static void interface_base_finalize( NactIEnvironmentTabInterface *klass );
-
-static void on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items, gpointer user_data );
-
-static void on_selcount_ope_changed( GtkComboBox *combo, NactIEnvironmentTab *instance );
-static void on_selcount_int_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
-static void on_selection_count_changed( NactIEnvironmentTab *instance );
-static void on_show_always_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
-static void on_only_show_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
-static void on_do_not_show_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
-static void on_desktop_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window );
-static void on_try_exec_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
-static void on_try_exec_browse( GtkButton *button, NactIEnvironmentTab *instance );
-static void on_show_if_registered_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
-static void on_show_if_true_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
-static void on_show_if_running_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
-static void on_show_if_running_browse( GtkButton *button, NactIEnvironmentTab *instance );
-
-static void init_selection_count_combobox( NactIEnvironmentTab *instance );
-static gchar *get_selection_count_selection( NactIEnvironmentTab *instance );
-static void set_selection_count_selection( NactIEnvironmentTab *instance, const gchar *ope, const gchar *uint );
-static void dispose_selection_count_combobox( NactIEnvironmentTab *instance );
-
-static void init_desktop_listview( NactIEnvironmentTab *instance );
-static void raz_desktop_listview( NactIEnvironmentTab *instance );
-static void setup_desktop_listview( NactIEnvironmentTab *instance, GSList *show );
-static void dispose_desktop_listview( NactIEnvironmentTab *instance );
+/* Pseudo-property, set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+}
+ IEnvironData;
+
+#define IENVIRON_TAB_PROP_DATA "nact-ienviron-tab-data"
+
+static guint st_initializations = 0; /* interface initialization count */
+
+static GType register_type( void );
+static void interface_base_init( NactIEnvironmentTabInterface *klass );
+static void interface_base_finalize( NactIEnvironmentTabInterface *klass );
+
+static void on_base_initialize_gtk( NactIEnvironmentTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactIEnvironmentTab *instance, gpointer user_data );
+
+static void on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items, gpointer user_data );
+
+static void on_selcount_ope_changed( GtkComboBox *combo, NactIEnvironmentTab *instance );
+static void on_selcount_int_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
+static void on_selection_count_changed( NactIEnvironmentTab *instance );
+static void on_show_always_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
+static void on_only_show_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
+static void on_do_not_show_toggled( GtkToggleButton *togglebutton, NactIEnvironmentTab *instance );
+static void on_desktop_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window );
+static void on_try_exec_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
+static void on_try_exec_browse( GtkButton *button, NactIEnvironmentTab *instance );
+static void on_show_if_registered_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
+static void on_show_if_true_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
+static void on_show_if_running_changed( GtkEntry *entry, NactIEnvironmentTab *instance );
+static void on_show_if_running_browse( GtkButton *button, NactIEnvironmentTab *instance );
+
+static void init_selection_count_combobox( NactIEnvironmentTab *instance );
+static gchar *get_selection_count_selection( NactIEnvironmentTab *instance );
+static void set_selection_count_selection( NactIEnvironmentTab *instance, const gchar *ope, const gchar *uint );
+static void dispose_selection_count_combobox( NactIEnvironmentTab *instance );
+
+static void init_desktop_listview( NactIEnvironmentTab *instance );
+static void raz_desktop_listview( NactIEnvironmentTab *instance );
+static void setup_desktop_listview( NactIEnvironmentTab *instance, GSList *show );
+static void dispose_desktop_listview( NactIEnvironmentTab *instance );
+
+static IEnvironData *get_ienviron_data( NactIEnvironmentTab *instance );
+static void on_instance_finalized( gpointer user_data, NactIEnvironmentTab *instance );
GType
nact_ienvironment_tab_get_type( void )
@@ -187,35 +201,76 @@ interface_base_finalize( NactIEnvironmentTabInterface *klass )
}
/**
- * nact_ienvironment_tab_initial_load:
+ * nact_ienvironment_tab_init:
+ * @instance: this #NactIEnvironmentTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
+void
+nact_ienvironment_tab_init( NactIEnvironmentTab *instance )
+{
+ static const gchar *thisfn = "nact_ienvironment_tab_init";
+ IEnvironData *data;
+
+ g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_ienviron_data( instance );
+ data->on_selection_change = FALSE;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+/*
+ * on_base_initialize_gtk:
* @window: this #NactIEnvironmentTab instance.
*
* Initializes the tab widget at initial load.
*/
-void
-nact_ienvironment_tab_initial_load_toplevel( NactIEnvironmentTab *instance )
+static void
+on_base_initialize_gtk( NactIEnvironmentTab *instance, GtkWindow *toplevel, void *user_data )
{
- static const gchar *thisfn = "nact_ienvironment_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_ienvironment_tab_on_base_initialize_gtk";
g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
init_selection_count_combobox( instance );
init_desktop_listview( instance );
}
-/**
- * nact_ienvironment_tab_runtime_init:
+/*
+ * on_base_initialize_window:
* @window: this #NactIEnvironmentTab instance.
*
* Initializes the tab widget at each time the widget will be displayed.
* Connect signals and setup runtime values.
*/
-void
-nact_ienvironment_tab_runtime_init_toplevel( NactIEnvironmentTab *instance )
+static void
+on_base_initialize_window( NactIEnvironmentTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_ienvironment_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_ienvironment_tab_on_base_initialize_window";
GtkTreeView *listview;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -226,7 +281,10 @@ nact_ienvironment_tab_runtime_init_toplevel( NactIEnvironmentTab *instance )
g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -326,37 +384,6 @@ nact_ienvironment_tab_runtime_init_toplevel( NactIEnvironmentTab *instance )
G_CALLBACK( on_show_if_running_browse ));
}
-void
-nact_ienvironment_tab_all_widgets_showed( NactIEnvironmentTab *instance )
-{
- static const gchar *thisfn = "nact_ienvironment_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-/**
- * nact_ienvironment_tab_dispose:
- * @window: this #NactIEnvironmentTab instance.
- *
- * Called at instance_dispose time.
- */
-void
-nact_ienvironment_tab_dispose( NactIEnvironmentTab *instance )
-{
- static const gchar *thisfn = "nact_ienvironment_tab_dispose";
-
- g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- st_on_selection_change = TRUE;
-
- dispose_selection_count_combobox( instance );
- dispose_desktop_listview( instance );
-}
-
static void
on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items, gpointer user_data )
{
@@ -373,6 +400,7 @@ on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items,
GtkWidget *browse_button;
GSList *desktops;
gchar *text;
+ IEnvironData *data;
g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( instance ));
@@ -385,10 +413,11 @@ on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items,
MAIN_PROP_CONTEXT, &context, MAIN_PROP_EDITABLE, &editable,
NULL );
+ data = get_ienviron_data( instance );
enable_tab = ( context != NULL );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ENVIRONMENT, enable_tab );
- st_on_selection_change = TRUE;
+ data->on_selection_change = TRUE;
/* selection count
*/
@@ -479,7 +508,7 @@ on_main_selection_changed( NactIEnvironmentTab *instance, GList *selected_items,
browse_button = base_window_get_widget( BASE_WINDOW( instance ), "ShowIfRunningButton" );
base_gtk_utils_set_editable( G_OBJECT( browse_button ), editable );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
path = gtk_tree_path_new_first();
if( path ){
@@ -506,8 +535,11 @@ on_selection_count_changed( NactIEnvironmentTab *instance )
{
NAIContext *context;
gchar *selcount;
+ IEnvironData *data;
+
+ data = get_ienviron_data( instance );
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
g_object_get( G_OBJECT( instance ), MAIN_PROP_CONTEXT, &context, NULL );
if( context ){
@@ -668,10 +700,13 @@ on_desktop_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *wi
gboolean state;
gchar *desktop;
GtkWidget *show_button;
+ IEnvironData *data;
g_debug( "%s: renderer=%p, path=%s, window=%p", thisfn, ( void * ) renderer, path, ( void * ) window );
- if( !st_on_selection_change ){
+ data = get_ienviron_data( NACT_IENVIRONMENT_TAB( window ));
+
+ if( !data->on_selection_change ){
g_object_get( G_OBJECT( window ),
MAIN_PROP_CONTEXT, &context, MAIN_PROP_EDITABLE, &editable,
NULL );
@@ -993,3 +1028,34 @@ dispose_desktop_listview( NactIEnvironmentTab *instance )
gtk_tree_selection_unselect_all( selection );
gtk_list_store_clear( GTK_LIST_STORE( model ));
}
+
+static IEnvironData *
+get_ienviron_data( NactIEnvironmentTab *instance )
+{
+ IEnvironData *data;
+
+ data = ( IEnvironData * ) g_object_get_data( G_OBJECT( instance ), IENVIRON_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( IEnvironData, 1 );
+ g_object_set_data( G_OBJECT( instance ), IENVIRON_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactIEnvironmentTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_instance_finalized";
+ IEnvironData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ data = get_ienviron_data( instance );
+ data->on_selection_change = TRUE;
+ dispose_selection_count_combobox( instance );
+ dispose_desktop_listview( instance );
+
+ g_free( data );
+}
diff --git a/src/nact/nact-ienvironment-tab.h b/src/nact/nact-ienvironment-tab.h
index 32b8437..5ea5144 100644
--- a/src/nact/nact-ienvironment-tab.h
+++ b/src/nact/nact-ienvironment-tab.h
@@ -48,10 +48,10 @@
G_BEGIN_DECLS
-#define NACT_IENVIRONMENT_TAB_TYPE ( nact_ienvironment_tab_get_type())
-#define NACT_IENVIRONMENT_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IENVIRONMENT_TAB_TYPE, NactIEnvironmentTab ))
-#define NACT_IS_IENVIRONMENT_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IENVIRONMENT_TAB_TYPE ))
-#define NACT_IENVIRONMENT_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IENVIRONMENT_TAB_TYPE, NactIEnvironmentTabInterface ))
+#define NACT_TYPE_IENVIRONMENT_TAB ( nact_ienvironment_tab_get_type())
+#define NACT_IENVIRONMENT_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IENVIRONMENT_TAB, NactIEnvironmentTab ))
+#define NACT_IS_IENVIRONMENT_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IENVIRONMENT_TAB ))
+#define NACT_IENVIRONMENT_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IENVIRONMENT_TAB, NactIEnvironmentTabInterface ))
typedef struct _NactIEnvironmentTab NactIEnvironmentTab;
typedef struct _NactIEnvironmentTabInterfacePrivate NactIEnvironmentTabInterfacePrivate;
@@ -65,10 +65,7 @@ typedef struct {
GType nact_ienvironment_tab_get_type( void );
-void nact_ienvironment_tab_initial_load_toplevel( NactIEnvironmentTab *instance );
-void nact_ienvironment_tab_runtime_init_toplevel( NactIEnvironmentTab *instance );
-void nact_ienvironment_tab_all_widgets_showed ( NactIEnvironmentTab *instance );
-void nact_ienvironment_tab_dispose ( NactIEnvironmentTab *instance );
+void nact_ienvironment_tab_init ( NactIEnvironmentTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-iexecution-tab.c b/src/nact/nact-iexecution-tab.c
index cc5f55d..e44defd 100644
--- a/src/nact/nact-iexecution-tab.c
+++ b/src/nact/nact-iexecution-tab.c
@@ -46,23 +46,36 @@ struct _NactIExecutionTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
-static guint st_initializations = 0; /* interface initialization count */
-static gboolean st_on_selection_change = FALSE;
+/* data set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+}
+ IExecutionData;
+
+#define IEXECUTION_TAB_PROP_DATA "nact-iexecution-tab-data"
+
+static guint st_initializations = 0; /* interface initialization count */
-static GType register_type( void );
-static void interface_base_init( NactIExecutionTabInterface *klass );
-static void interface_base_finalize( NactIExecutionTabInterface *klass );
+static GType register_type( void );
+static void interface_base_init( NactIExecutionTabInterface *klass );
+static void interface_base_finalize( NactIExecutionTabInterface *klass );
-static void on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, gpointer user_data );
+static void on_base_initialize_window( NactIExecutionTab *instance, gpointer user_data );
-static void on_normal_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
-static void on_terminal_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
-static void on_embedded_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
-static void on_display_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
-static void execution_mode_toggle( NactIExecutionTab *instance, GtkToggleButton *togglebutton, GCallback cb, const gchar *mode );
-static void on_startup_notify_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
-static void on_startup_class_changed( GtkEntry *entry, NactIExecutionTab *instance );
-static void on_execute_as_changed( GtkEntry *entry, NactIExecutionTab *instance );
+static void on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, gpointer user_data );
+
+static void on_normal_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
+static void on_terminal_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
+static void on_embedded_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
+static void on_display_mode_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
+static void execution_mode_toggle( NactIExecutionTab *instance, GtkToggleButton *togglebutton, GCallback cb, const gchar *mode );
+static void on_startup_notify_toggled( GtkToggleButton *togglebutton, NactIExecutionTab *instance );
+static void on_startup_class_changed( GtkEntry *entry, NactIExecutionTab *instance );
+static void on_execute_as_changed( GtkEntry *entry, NactIExecutionTab *instance );
+
+static IExecutionData *get_iexecution_data( NactIExecutionTab *instance );
+static void on_instance_finalized( gpointer user_data, NactIExecutionTab *instance );
GType
nact_iexecution_tab_get_type( void )
@@ -134,36 +147,54 @@ interface_base_finalize( NactIExecutionTabInterface *klass )
}
/**
- * nact_iexecution_tab_initial_load:
- * @window: this #NactIExecutionTab instance.
+ * nact_iexecution_tab_init:
+ * @instance: this #NactIExecutionTab instance.
*
- * Initializes the tab widget at initial load.
+ * Initialize the interface
+ * Connect to #BaseWindow signals
*/
void
-nact_iexecution_tab_initial_load_toplevel( NactIExecutionTab *instance )
+nact_iexecution_tab_init( NactIExecutionTab *instance )
{
- static const gchar *thisfn = "nact_iexecution_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_iexecution_tab_init";
+ IExecutionData *data;
g_return_if_fail( NACT_IS_IEXECUTION_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_iexecution_data( instance );
+ data->on_selection_change = FALSE;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
}
-/**
- * nact_iexecution_tab_runtime_init:
+/*
+ * on_base_initialize_window:
* @window: this #NactIExecutionTab instance.
*
* Initializes the tab widget at each time the widget will be displayed.
* Connect signals and setup runtime values.
*/
-void
-nact_iexecution_tab_runtime_init_toplevel( NactIExecutionTab *instance )
+static void
+on_base_initialize_window( NactIExecutionTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_iexecution_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_iexecution_tab_on_base_initialize_window";
g_return_if_fail( NACT_IS_IEXECUTION_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -214,32 +245,6 @@ nact_iexecution_tab_runtime_init_toplevel( NactIExecutionTab *instance )
G_CALLBACK( on_execute_as_changed ));
}
-void
-nact_iexecution_tab_all_widgets_showed( NactIExecutionTab *instance )
-{
- static const gchar *thisfn = "nact_iexecution_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IEXECUTION_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-/**
- * nact_iexecution_tab_dispose:
- * @window: this #NactIExecutionTab instance.
- *
- * Called at instance_dispose time.
- */
-void
-nact_iexecution_tab_dispose( NactIExecutionTab *instance )
-{
- static const gchar *thisfn = "nact_iexecution_tab_dispose";
-
- g_return_if_fail( NACT_IS_IEXECUTION_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
static void
on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, gpointer user_data )
{
@@ -253,6 +258,7 @@ on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, g
GtkWidget *notify_check, *frame;
gchar *class, *user;
GtkWidget *entry;
+ IExecutionData *data;
g_return_if_fail( NACT_IS_IEXECUTION_TAB( instance ));
@@ -267,10 +273,11 @@ on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, g
MAIN_PROP_EDITABLE, &editable,
NULL );
+ data = get_iexecution_data( instance );
enable_tab = ( profile != NULL );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_EXECUTION, enable_tab );
- st_on_selection_change = TRUE;
+ data->on_selection_change = TRUE;
normal_toggle = base_window_get_widget( BASE_WINDOW( instance ), "ExecutionModeNormal" );
terminal_toggle = base_window_get_widget( BASE_WINDOW( instance ), "ExecutionModeTerminal" );
@@ -329,7 +336,7 @@ on_main_selection_changed( NactIExecutionTab *instance, GList *selected_items, g
base_gtk_utils_set_editable( G_OBJECT( entry ), editable );
g_free( user );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
}
static void
@@ -456,3 +463,31 @@ on_execute_as_changed( GtkEntry *entry, NactIExecutionTab *instance )
g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, 0 );
}
}
+
+static IExecutionData *
+get_iexecution_data( NactIExecutionTab *instance )
+{
+ IExecutionData *data;
+
+ data = ( IExecutionData * ) g_object_get_data( G_OBJECT( instance ), IEXECUTION_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( IExecutionData, 1 );
+ g_object_set_data( G_OBJECT( instance ), IEXECUTION_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactIExecutionTab *instance )
+{
+ static const gchar *thisfn = "nact_iexecution_tab_on_instance_finalized";
+ IExecutionData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ data = get_iexecution_data( instance );
+
+ g_free( data );
+}
diff --git a/src/nact/nact-iexecution-tab.h b/src/nact/nact-iexecution-tab.h
index 13ab90f..d524804 100644
--- a/src/nact/nact-iexecution-tab.h
+++ b/src/nact/nact-iexecution-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_IEXECUTION_TAB_TYPE ( nact_iexecution_tab_get_type())
-#define NACT_IEXECUTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IEXECUTION_TAB_TYPE, NactIExecutionTab ))
-#define NACT_IS_IEXECUTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IEXECUTION_TAB_TYPE ))
-#define NACT_IEXECUTION_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IEXECUTION_TAB_TYPE, NactIExecutionTabInterface ))
+#define NACT_TYPE_IEXECUTION_TAB ( nact_iexecution_tab_get_type())
+#define NACT_IEXECUTION_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IEXECUTION_TAB, NactIExecutionTab ))
+#define NACT_IS_IEXECUTION_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IEXECUTION_TAB ))
+#define NACT_IEXECUTION_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IEXECUTION_TAB, NactIExecutionTabInterface ))
typedef struct _NactIExecutionTab NactIExecutionTab;
typedef struct _NactIExecutionTabInterfacePrivate NactIExecutionTabInterfacePrivate;
@@ -61,10 +61,7 @@ typedef struct {
GType nact_iexecution_tab_get_type( void );
-void nact_iexecution_tab_initial_load_toplevel( NactIExecutionTab *instance );
-void nact_iexecution_tab_runtime_init_toplevel( NactIExecutionTab *instance );
-void nact_iexecution_tab_all_widgets_showed ( NactIExecutionTab *instance );
-void nact_iexecution_tab_dispose ( NactIExecutionTab *instance );
+void nact_iexecution_tab_init ( NactIExecutionTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-ifolders-tab.c b/src/nact/nact-ifolders-tab.c
index 2bba521..bc1f241 100644
--- a/src/nact/nact-ifolders-tab.c
+++ b/src/nact/nact-ifolders-tab.c
@@ -53,6 +53,8 @@ struct _NactIFoldersTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
+/* the identifier of this notebook page in the Match dialog
+ */
#define ITAB_NAME "folders"
static guint st_initializations = 0; /* interface initialization count */
@@ -61,12 +63,17 @@ static GType register_type( void );
static void interface_base_init( NactIFoldersTabInterface *klass );
static void interface_base_finalize( NactIFoldersTabInterface *klass );
+static void on_base_initialize_gtk( NactIFoldersTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactIFoldersTab *instance, gpointer user_data );
+
static void on_main_selection_changed( NactIFoldersTab *instance, GList *selected_items, gpointer user_data );
static void on_browse_folder_clicked( GtkButton *button, BaseWindow *window );
static GSList *get_folders( void *context );
static void set_folders( void *context, GSList *filters );
+static void on_instance_finalized( gpointer user_data, NactIFoldersTab *instance );
+
GType
nact_ifolders_tab_get_type( void )
{
@@ -136,15 +143,52 @@ interface_base_finalize( NactIFoldersTabInterface *klass )
}
}
+/**
+ * nact_ifolders_tab_init:
+ * @instance: this #NactIFoldersTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
void
-nact_ifolders_tab_initial_load_toplevel( NactIFoldersTab *instance )
+nact_ifolders_tab_init( NactIFoldersTab *instance )
{
- static const gchar *thisfn = "nact_ifolders_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_ifolders_tab_init";
+
+ g_return_if_fail( NACT_IS_IFOLDERS_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+static void
+on_base_initialize_gtk( NactIFoldersTab *instance, GtkWindow *toplevel, void *user_data )
+{
+ static const gchar *thisfn = "nact_ifolders_tab_on_base_initialize_gtk";
GtkWidget *list, *add, *remove;
g_return_if_fail( NACT_IS_IFOLDERS_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
list = base_window_get_widget( BASE_WINDOW( instance ), "FoldersTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddFolderButton" );
@@ -162,15 +206,18 @@ nact_ifolders_tab_initial_load_toplevel( NactIFoldersTab *instance )
_( "Folder filter" ), TRUE );
}
-void
-nact_ifolders_tab_runtime_init_toplevel( NactIFoldersTab *instance )
+static void
+on_base_initialize_window( NactIFoldersTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_ifolders_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_ifolders_tab_on_base_initialize_window";
GtkWidget *button;
g_return_if_fail( NACT_IS_IFOLDERS_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -188,28 +235,6 @@ nact_ifolders_tab_runtime_init_toplevel( NactIFoldersTab *instance )
G_CALLBACK( on_browse_folder_clicked ));
}
-void
-nact_ifolders_tab_all_widgets_showed( NactIFoldersTab *instance )
-{
- static const gchar *thisfn = "nact_ifolders_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IFOLDERS_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-void
-nact_ifolders_tab_dispose( NactIFoldersTab *instance )
-{
- static const gchar *thisfn = "nact_ifolders_tab_dispose";
-
- g_return_if_fail( NACT_IS_IFOLDERS_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
-}
-
static void
on_main_selection_changed( NactIFoldersTab *instance, GList *selected_items, gpointer user_data )
{
@@ -309,3 +334,13 @@ set_folders( void *context, GSList *filters )
{
na_object_set_folders( context, filters );
}
+
+static void
+on_instance_finalized( gpointer user_data, NactIFoldersTab *instance )
+{
+ static const gchar *thisfn = "nact_ifolders_tab_on_instance_finalized";
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+}
diff --git a/src/nact/nact-ifolders-tab.h b/src/nact/nact-ifolders-tab.h
index a2887d5..1c1aa31 100644
--- a/src/nact/nact-ifolders-tab.h
+++ b/src/nact/nact-ifolders-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_IFOLDERS_TAB_TYPE ( nact_ifolders_tab_get_type())
-#define NACT_IFOLDERS_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IFOLDERS_TAB_TYPE, NactIFoldersTab ))
-#define NACT_IS_IFOLDERS_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IFOLDERS_TAB_TYPE ))
-#define NACT_IFOLDERS_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IFOLDERS_TAB_TYPE, NactIFoldersTabInterface ))
+#define NACT_TYPE_IFOLDERS_TAB ( nact_ifolders_tab_get_type())
+#define NACT_IFOLDERS_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IFOLDERS_TAB, NactIFoldersTab ))
+#define NACT_IS_IFOLDERS_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IFOLDERS_TAB ))
+#define NACT_IFOLDERS_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IFOLDERS_TAB, NactIFoldersTabInterface ))
typedef struct _NactIFoldersTab NactIFoldersTab;
typedef struct _NactIFoldersTabInterfacePrivate NactIFoldersTabInterfacePrivate;
@@ -59,12 +59,9 @@ typedef struct {
}
NactIFoldersTabInterface;
-GType nact_ifolders_tab_get_type( void );
+GType nact_ifolders_tab_get_type( void );
-void nact_ifolders_tab_initial_load_toplevel( NactIFoldersTab *instance );
-void nact_ifolders_tab_runtime_init_toplevel( NactIFoldersTab *instance );
-void nact_ifolders_tab_all_widgets_showed ( NactIFoldersTab *instance );
-void nact_ifolders_tab_dispose ( NactIFoldersTab *instance );
+void nact_ifolders_tab_init ( NactIFoldersTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-imimetypes-tab.c b/src/nact/nact-imimetypes-tab.c
index 47733d2..25cc3d6 100644
--- a/src/nact/nact-imimetypes-tab.c
+++ b/src/nact/nact-imimetypes-tab.c
@@ -46,6 +46,8 @@ struct _NactIMimetypesTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
+/* the identifier of this notebook page in the Match dialog
+ */
#define ITAB_NAME "mimetypes"
static guint st_initializations = 0; /* interface initialization count */
@@ -54,11 +56,16 @@ static GType register_type( void );
static void interface_base_init( NactIMimetypesTabInterface *klass );
static void interface_base_finalize( NactIMimetypesTabInterface *klass );
+static void on_base_initialize_gtk( NactIMimetypesTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactIMimetypesTab *instance, gpointer user_data );
+
static void on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data );
static GSList *get_mimetypes( void *context );
static void set_mimetypes( void *context, GSList *filters );
+static void on_instance_finalized( gpointer user_data, NactIMimetypesTab *instance );
+
GType
nact_imimetypes_tab_get_type( void )
{
@@ -128,21 +135,58 @@ interface_base_finalize( NactIMimetypesTabInterface *klass )
}
}
-/**
- * nact_imimetypes_tab_initial_load:
+/*
+ * nact_imimetypes_tab_init:
+ * @instance: this #NactIMimetypesTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
+void
+nact_imimetypes_tab_init( NactIMimetypesTab *instance )
+{
+ static const gchar *thisfn = "nact_imimetypes_tab_init";
+
+ g_return_if_fail( NACT_IS_IMIMETYPES_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+/*
+ * on_base_initialize_gtk:
* @window: this #NactIMimetypesTab instance.
*
* Initializes the tab widget at initial load.
*/
-void
-nact_imimetypes_tab_initial_load_toplevel( NactIMimetypesTab *instance )
+static void
+on_base_initialize_gtk( NactIMimetypesTab *instance, GtkWindow *toplevel, void *user_data )
{
- static const gchar *thisfn = "nact_imimetypes_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_imimetypes_tab_on_base_initialize_gtk";
GtkWidget *list, *add, *remove;
g_return_if_fail( NACT_IS_IMIMETYPES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
list = base_window_get_widget( BASE_WINDOW( instance ), "MimetypesTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddMimetypeButton" );
@@ -160,21 +204,24 @@ nact_imimetypes_tab_initial_load_toplevel( NactIMimetypesTab *instance )
_( "Mimetype filter" ), TRUE );
}
-/**
- * nact_imimetypes_tab_runtime_init:
+/*
+ * on_base_initialize_window:
* @window: this #NactIMimetypesTab instance.
*
* Initializes the tab widget at each time the widget will be displayed.
* Connect signals and setup runtime values.
*/
-void
-nact_imimetypes_tab_runtime_init_toplevel( NactIMimetypesTab *instance )
+static void
+on_base_initialize_window( NactIMimetypesTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_imimetypes_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_imimetypes_tab_on_base_initialize_window";
g_return_if_fail( NACT_IS_IMIMETYPES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -185,34 +232,6 @@ nact_imimetypes_tab_runtime_init_toplevel( NactIMimetypesTab *instance )
nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
}
-void
-nact_imimetypes_tab_all_widgets_showed( NactIMimetypesTab *instance )
-{
- static const gchar *thisfn = "nact_imimetypes_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IMIMETYPES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-/**
- * nact_imimetypes_tab_dispose:
- * @window: this #NactIMimetypesTab instance.
- *
- * Called at instance_dispose time.
- */
-void
-nact_imimetypes_tab_dispose( NactIMimetypesTab *instance )
-{
- static const gchar *thisfn = "nact_imimetypes_tab_dispose";
-
- g_return_if_fail( NACT_IS_IMIMETYPES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
-}
-
static void
on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data )
{
@@ -230,3 +249,13 @@ set_mimetypes( void *context, GSList *filters )
{
na_object_set_mimetypes( context, filters );
}
+
+static void
+on_instance_finalized( gpointer user_data, NactIMimetypesTab *instance )
+{
+ static const gchar *thisfn = "nact_imimetypes_tab_on_instance_finalized";
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+}
diff --git a/src/nact/nact-imimetypes-tab.h b/src/nact/nact-imimetypes-tab.h
index 5e22072..626bfd2 100644
--- a/src/nact/nact-imimetypes-tab.h
+++ b/src/nact/nact-imimetypes-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_IMIMETYPES_TAB_TYPE ( nact_imimetypes_tab_get_type())
-#define NACT_IMIMETYPES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IMIMETYPES_TAB_TYPE, NactIMimetypesTab ))
-#define NACT_IS_IMIMETYPES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IMIMETYPES_TAB_TYPE ))
-#define NACT_IMIMETYPES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IMIMETYPES_TAB_TYPE, NactIMimetypesTabInterface ))
+#define NACT_TYPE_IMIMETYPES_TAB ( nact_imimetypes_tab_get_type())
+#define NACT_IMIMETYPES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IMIMETYPES_TAB, NactIMimetypesTab ))
+#define NACT_IS_IMIMETYPES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IMIMETYPES_TAB ))
+#define NACT_IMIMETYPES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IMIMETYPES_TAB, NactIMimetypesTabInterface ))
typedef struct _NactIMimetypesTab NactIMimetypesTab;
typedef struct _NactIMimetypesTabInterfacePrivate NactIMimetypesTabInterfacePrivate;
@@ -61,10 +61,7 @@ typedef struct {
GType nact_imimetypes_tab_get_type( void );
-void nact_imimetypes_tab_initial_load_toplevel( NactIMimetypesTab *instance );
-void nact_imimetypes_tab_runtime_init_toplevel( NactIMimetypesTab *instance );
-void nact_imimetypes_tab_all_widgets_showed ( NactIMimetypesTab *instance );
-void nact_imimetypes_tab_dispose ( NactIMimetypesTab *instance );
+void nact_imimetypes_tab_init ( NactIMimetypesTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-iproperties-tab.c b/src/nact/nact-iproperties-tab.c
index c54a26e..c6ea614 100644
--- a/src/nact/nact-iproperties-tab.c
+++ b/src/nact/nact-iproperties-tab.c
@@ -53,23 +53,36 @@ struct _NactIPropertiesTabInterfacePrivate {
/* i18n: label of the push button when there is not yet any shortcut */
#define NO_SHORTCUT N_( "None" )
-static guint st_initializations = 0; /* interface initialization count */
-static gboolean st_on_selection_change = FALSE;
+/* data set against the instance
+ */
+typedef struct {
+ gboolean on_selection_change;
+}
+ IPropertiesData;
+
+#define IPROPERTIES_TAB_PROP_DATA "nact-iproperties-tab-data"
+
+static guint st_initializations = 0; /* interface initialization count */
+
+static GType register_type( void );
+static void interface_base_init( NactIPropertiesTabInterface *klass );
+static void interface_base_finalize( NactIPropertiesTabInterface *klass );
+
+static void on_base_initialize_window( NactIPropertiesTab *instance, gpointer user_data );
-static GType register_type( void );
-static void interface_base_init( NactIPropertiesTabInterface *klass );
-static void interface_base_finalize( NactIPropertiesTabInterface *klass );
+static void on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items, gpointer user_data );
+static void on_main_item_updated( NactIPropertiesTab *instance, NAObjectItem *item, guint data, gpointer user_data );
-static void on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items, gpointer user_data );
-static void on_main_item_updated( NactIPropertiesTab *instance, NAObjectItem *item, guint data, gpointer user_data );
+static GtkButton *get_enabled_button( NactIPropertiesTab *instance );
+static void on_enabled_toggled( GtkToggleButton *button, NactIPropertiesTab *instance );
+static void on_readonly_toggled( GtkToggleButton *button, NactIPropertiesTab *instance );
+static void on_description_changed( GtkTextBuffer *buffer, NactIPropertiesTab *instance );
+static void on_shortcut_clicked( GtkButton *button, NactIPropertiesTab *instance );
-static GtkButton *get_enabled_button( NactIPropertiesTab *instance );
-static void on_enabled_toggled( GtkToggleButton *button, NactIPropertiesTab *instance );
-static void on_readonly_toggled( GtkToggleButton *button, NactIPropertiesTab *instance );
-static void on_description_changed( GtkTextBuffer *buffer, NactIPropertiesTab *instance );
-static void on_shortcut_clicked( GtkButton *button, NactIPropertiesTab *instance );
+static void display_provider_name( NactIPropertiesTab *instance, NAObjectItem *item );
-static void display_provider_name( NactIPropertiesTab *instance, NAObjectItem *item );
+static IPropertiesData *get_iproperties_data( NactIPropertiesTab *instance );
+static void on_instance_finalized( gpointer user_data, NactIPropertiesTab *instance );
GType
nact_iproperties_tab_get_type( void )
@@ -140,27 +153,51 @@ interface_base_finalize( NactIPropertiesTabInterface *klass )
}
}
+/**
+ * nact_iproperties_tab_init:
+ * @instance: this #NactIPropertiesTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
void
-nact_iproperties_tab_initial_load_toplevel( NactIPropertiesTab *instance )
+nact_iproperties_tab_init( NactIPropertiesTab *instance )
{
- static const gchar *thisfn = "nact_iproperties_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_iproperties_tab_init";
+ IPropertiesData *data;
g_return_if_fail( NACT_IS_IPROPERTIES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ data = get_iproperties_data( instance );
+ data->on_selection_change = FALSE;
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
}
-void
-nact_iproperties_tab_runtime_init_toplevel( NactIPropertiesTab *instance )
+static void
+on_base_initialize_window( NactIPropertiesTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_iproperties_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_iproperties_tab_on_base_initialize_window";
GtkButton *enabled_button;
GtkWidget *label_widget;
GtkTextBuffer *buffer;
g_return_if_fail( NACT_IS_IPROPERTIES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -202,26 +239,6 @@ nact_iproperties_tab_runtime_init_toplevel( NactIPropertiesTab *instance )
G_CALLBACK( on_readonly_toggled ));
}
-void
-nact_iproperties_tab_all_widgets_showed( NactIPropertiesTab *instance )
-{
- static const gchar *thisfn = "nact_iproperties_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_IPROPERTIES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-void
-nact_iproperties_tab_dispose( NactIPropertiesTab *instance )
-{
- static const gchar *thisfn = "nact_iproperties_tab_dispose";
-
- g_return_if_fail( NACT_IS_IPROPERTIES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
static void
on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items, gpointer user_data )
{
@@ -238,6 +255,7 @@ on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items,
GtkToggleButton *readonly_button;
GtkTextBuffer *buffer;
gchar *label, *shortcut;
+ IPropertiesData *data;
g_return_if_fail( BASE_IS_WINDOW( instance ));
g_return_if_fail( NACT_IS_IPROPERTIES_TAB( instance ));
@@ -254,10 +272,11 @@ on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items,
g_return_if_fail( !item || NA_IS_OBJECT_ITEM( item ));
+ data = get_iproperties_data( instance );
enable_tab = ( count_selected == 1 );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_PROPERTIES, enable_tab );
- st_on_selection_change = TRUE;
+ data->on_selection_change = TRUE;
notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( instance ), "MainNotebook" ));
page = gtk_notebook_get_nth_page( notebook, TAB_ACTION );
@@ -311,7 +330,7 @@ on_main_selection_changed( NactIPropertiesTab *instance, GList *selected_items,
display_provider_name( instance, item );
- st_on_selection_change = FALSE;
+ data->on_selection_change = FALSE;
}
static void
@@ -339,10 +358,13 @@ on_enabled_toggled( GtkToggleButton *button, NactIPropertiesTab *instance )
NAObjectItem *item;
gboolean enabled;
gboolean editable;
+ IPropertiesData *data;
+
+ data = get_iproperties_data( instance );
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p, on_selection_change=%s",
- thisfn, ( void * ) button, ( void * ) instance, st_on_selection_change ? "True":"False" );
+ thisfn, ( void * ) button, ( void * ) instance, data->on_selection_change ? "True":"False" );
g_object_get(
G_OBJECT( instance ),
@@ -386,10 +408,13 @@ on_readonly_toggled( GtkToggleButton *button, NactIPropertiesTab *instance )
{
static const gchar *thisfn = "nact_iproperties_tab_on_readonly_toggled";
gboolean active;
+ IPropertiesData *data;
+
+ data = get_iproperties_data( instance );
- if( !st_on_selection_change ){
+ if( !data->on_selection_change ){
g_debug( "%s: button=%p, instance=%p, on_selection_change=%s",
- thisfn, ( void * ) button, ( void * ) instance, st_on_selection_change ? "True":"False" );
+ thisfn, ( void * ) button, ( void * ) instance, data->on_selection_change ? "True":"False" );
active = gtk_toggle_button_get_active( button );
@@ -503,3 +528,31 @@ display_provider_name( NactIPropertiesTab *instance, NAObjectItem *item )
g_free( label );
gtk_widget_set_sensitive( label_widget, item != NULL );
}
+
+static IPropertiesData *
+get_iproperties_data( NactIPropertiesTab *instance )
+{
+ IPropertiesData *data;
+
+ data = ( IPropertiesData * ) g_object_get_data( G_OBJECT( instance ), IPROPERTIES_TAB_PROP_DATA );
+
+ if( !data ){
+ data = g_new0( IPropertiesData, 1 );
+ g_object_set_data( G_OBJECT( instance ), IPROPERTIES_TAB_PROP_DATA, data );
+ }
+
+ return( data );
+}
+
+static void
+on_instance_finalized( gpointer user_data, NactIPropertiesTab *instance )
+{
+ static const gchar *thisfn = "nact_iproperties_tab_on_instance_finalized";
+ IPropertiesData *data;
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ data = get_iproperties_data( instance );
+
+ g_free( data );
+}
diff --git a/src/nact/nact-iproperties-tab.h b/src/nact/nact-iproperties-tab.h
index 020031e..80fbc48 100644
--- a/src/nact/nact-iproperties-tab.h
+++ b/src/nact/nact-iproperties-tab.h
@@ -46,10 +46,10 @@
G_BEGIN_DECLS
-#define NACT_IPROPERTIES_TAB_TYPE ( nact_iproperties_tab_get_type())
-#define NACT_IPROPERTIES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IPROPERTIES_TAB_TYPE, NactIPropertiesTab ))
-#define NACT_IS_IPROPERTIES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IPROPERTIES_TAB_TYPE ))
-#define NACT_IPROPERTIES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IPROPERTIES_TAB_TYPE, NactIPropertiesTabInterface ))
+#define NACT_TYPE_IPROPERTIES_TAB ( nact_iproperties_tab_get_type())
+#define NACT_IPROPERTIES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_IPROPERTIES_TAB, NactIPropertiesTab ))
+#define NACT_IS_IPROPERTIES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_IPROPERTIES_TAB ))
+#define NACT_IPROPERTIES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_IPROPERTIES_TAB, NactIPropertiesTabInterface ))
typedef struct _NactIPropertiesTab NactIPropertiesTab;
typedef struct _NactIPropertiesTabInterfacePrivate NactIPropertiesTabInterfacePrivate;
@@ -61,12 +61,9 @@ typedef struct {
}
NactIPropertiesTabInterface;
-GType nact_iproperties_tab_get_type( void );
+GType nact_iproperties_tab_get_type( void );
-void nact_iproperties_tab_initial_load_toplevel( NactIPropertiesTab *instance );
-void nact_iproperties_tab_runtime_init_toplevel( NactIPropertiesTab *instance );
-void nact_iproperties_tab_all_widgets_showed ( NactIPropertiesTab *instance );
-void nact_iproperties_tab_dispose ( NactIPropertiesTab *instance );
+void nact_iproperties_tab_init ( NactIPropertiesTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index 1603e7d..d813a0c 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -49,6 +49,8 @@ struct _NactISchemesTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
+/* the identifier of this notebook page in the Match dialog
+ */
#define ITAB_NAME "schemes"
static guint st_initializations = 0; /* interface initialization count */
@@ -57,12 +59,17 @@ static GType register_type( void );
static void interface_base_init( NactISchemesTabInterface *klass );
static void interface_base_finalize( NactISchemesTabInterface *klass );
+static void on_base_initialize_gtk( NactISchemesTab *instance, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactISchemesTab *instance, gpointer user_data );
+
static void on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data );
static void on_add_from_defaults( GtkButton *button, BaseWindow *window );
static GSList *get_schemes( void *context );
static void set_schemes( void *context, GSList *filters );
+static void on_instance_finalized( gpointer user_data, NactISchemesTab *instance );
+
GType
nact_ischemes_tab_get_type( void )
{
@@ -132,15 +139,52 @@ interface_base_finalize( NactISchemesTabInterface *klass )
}
}
+/**
+ * nact_ischemes_tab_init:
+ * @instance: this #NactISchemesTab instance.
+ *
+ * Initialize the interface
+ * Connect to #BaseWindow signals
+ */
void
-nact_ischemes_tab_initial_load_toplevel( NactISchemesTab *instance )
+nact_ischemes_tab_init( NactISchemesTab *instance )
{
- static const gchar *thisfn = "nact_ischemes_tab_initial_load_toplevel";
+ static const gchar *thisfn = "nact_ischemes_tab_init";
+
+ g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
+
+ g_debug( "%s: instance=%p (%s)",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( instance ),
+ G_OBJECT( instance ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
+}
+
+static void
+on_base_initialize_gtk( NactISchemesTab *instance, GtkWindow *toplevel, void *user_data )
+{
+ static const gchar *thisfn = "nact_ischemes_tab_on_base_initialize_gtk";
GtkWidget *list, *add, *remove;
g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), toplevel=%p, user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) toplevel,
+ ( void * ) user_data );
list = base_window_get_widget( BASE_WINDOW( instance ), "SchemesTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddSchemeButton" );
@@ -158,15 +202,18 @@ nact_ischemes_tab_initial_load_toplevel( NactISchemesTab *instance )
_( "Scheme filter" ), TRUE );
}
-void
-nact_ischemes_tab_runtime_init_toplevel( NactISchemesTab *instance )
+static void
+on_base_initialize_window( NactISchemesTab *instance, void *user_data )
{
- static const gchar *thisfn = "nact_ischemes_tab_runtime_init_toplevel";
+ static const gchar *thisfn = "nact_ischemes_tab_on_base_initialize_window";
GtkWidget *button;
g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+ g_debug( "%s: instance=%p (%s), user_data=%p",
+ thisfn,
+ ( void * ) instance, G_OBJECT_TYPE_NAME( instance ),
+ ( void * ) user_data );
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -184,28 +231,6 @@ nact_ischemes_tab_runtime_init_toplevel( NactISchemesTab *instance )
G_CALLBACK( on_add_from_defaults ));
}
-void
-nact_ischemes_tab_all_widgets_showed( NactISchemesTab *instance )
-{
- static const gchar *thisfn = "nact_ischemes_tab_all_widgets_showed";
-
- g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-}
-
-void
-nact_ischemes_tab_dispose( NactISchemesTab *instance )
-{
- static const gchar *thisfn = "nact_ischemes_tab_dispose";
-
- g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
-
- g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
-
- nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
-}
-
static void
on_main_selection_changed( BaseWindow *window, GList *selected_items, gpointer user_data )
{
@@ -254,3 +279,13 @@ set_schemes( void *context, GSList *filters )
{
na_object_set_schemes( context, filters );
}
+
+static void
+on_instance_finalized( gpointer user_data, NactISchemesTab *instance )
+{
+ static const gchar *thisfn = "nact_ischemes_tab_on_instance_finalized";
+
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
+
+ nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
+}
diff --git a/src/nact/nact-ischemes-tab.h b/src/nact/nact-ischemes-tab.h
index 4199838..4cfa396 100644
--- a/src/nact/nact-ischemes-tab.h
+++ b/src/nact/nact-ischemes-tab.h
@@ -44,10 +44,10 @@
G_BEGIN_DECLS
-#define NACT_ISCHEMES_TAB_TYPE ( nact_ischemes_tab_get_type())
-#define NACT_ISCHEMES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_ISCHEMES_TAB_TYPE, NactISchemesTab ))
-#define NACT_IS_ISCHEMES_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_ISCHEMES_TAB_TYPE ))
-#define NACT_ISCHEMES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_ISCHEMES_TAB_TYPE, NactISchemesTabInterface ))
+#define NACT_TYPE_ISCHEMES_TAB ( nact_ischemes_tab_get_type())
+#define NACT_ISCHEMES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NACT_TYPE_ISCHEMES_TAB, NactISchemesTab ))
+#define NACT_IS_ISCHEMES_TAB( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NACT_TYPE_ISCHEMES_TAB ))
+#define NACT_ISCHEMES_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_TYPE_ISCHEMES_TAB, NactISchemesTabInterface ))
typedef struct _NactISchemesTab NactISchemesTab;
typedef struct _NactISchemesTabInterfacePrivate NactISchemesTabInterfacePrivate;
@@ -59,12 +59,9 @@ typedef struct {
}
NactISchemesTabInterface;
-GType nact_ischemes_tab_get_type( void );
+GType nact_ischemes_tab_get_type( void );
-void nact_ischemes_tab_initial_load_toplevel( NactISchemesTab *instance );
-void nact_ischemes_tab_runtime_init_toplevel( NactISchemesTab *instance );
-void nact_ischemes_tab_all_widgets_showed ( NactISchemesTab *instance );
-void nact_ischemes_tab_dispose ( NactISchemesTab *instance );
+void nact_ischemes_tab_init ( NactISchemesTab *instance );
G_END_DECLS
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 5c7e823..df51ac7 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -179,9 +179,9 @@ static void instance_constructed( GObject *application );
static void instance_dispose( GObject *application );
static void instance_finalize( GObject *application );
-static void on_base_initialize_gtk_toplevel( NactMainWindow *window, GtkWindow *toplevel, gpointer user_data );
-static void on_base_initialize_base_window( NactMainWindow *window, gpointer user_data );
-static void on_base_all_widgets_showed( NactMainWindow *window, gpointer user_data );
+static void on_base_initialize_gtk( NactMainWindow *window, GtkWindow *toplevel, gpointer user_data );
+static void on_base_initialize_window( NactMainWindow *window, gpointer user_data );
+static void on_base_show_widgets( NactMainWindow *window, gpointer user_data );
static void on_block_items_changed_timeout( NactMainWindow *window );
static void on_tree_view_modified_status_changed( NactMainWindow *window, gboolean is_modified, gpointer user_data );
@@ -298,25 +298,25 @@ register_type( void )
type = g_type_register_static( BASE_TYPE_WINDOW, "NactMainWindow", &info, 0 );
- g_type_add_interface_static( type, NACT_IACTION_TAB_TYPE, &iaction_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IACTION_TAB, &iaction_tab_iface_info );
- g_type_add_interface_static( type, NACT_ICOMMAND_TAB_TYPE, &icommand_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_ICOMMAND_TAB, &icommand_tab_iface_info );
- g_type_add_interface_static( type, NACT_IBASENAMES_TAB_TYPE, &ibasenames_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IBASENAMES_TAB, &ibasenames_tab_iface_info );
- g_type_add_interface_static( type, NACT_IMIMETYPES_TAB_TYPE, &imimetypes_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IMIMETYPES_TAB, &imimetypes_tab_iface_info );
- g_type_add_interface_static( type, NACT_IFOLDERS_TAB_TYPE, &ifolders_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IFOLDERS_TAB, &ifolders_tab_iface_info );
- g_type_add_interface_static( type, NACT_ISCHEMES_TAB_TYPE, &ischemes_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_ISCHEMES_TAB, &ischemes_tab_iface_info );
- g_type_add_interface_static( type, NACT_ICAPABILITIES_TAB_TYPE, &icapabilities_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_ICAPABILITIES_TAB, &icapabilities_tab_iface_info );
- g_type_add_interface_static( type, NACT_IENVIRONMENT_TAB_TYPE, &ienvironment_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IENVIRONMENT_TAB, &ienvironment_tab_iface_info );
- g_type_add_interface_static( type, NACT_IEXECUTION_TAB_TYPE, &iexecution_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IEXECUTION_TAB, &iexecution_tab_iface_info );
- g_type_add_interface_static( type, NACT_IPROPERTIES_TAB_TYPE, &iproperties_tab_iface_info );
+ g_type_add_interface_static( type, NACT_TYPE_IPROPERTIES_TAB, &iproperties_tab_iface_info );
return( type );
}
@@ -559,28 +559,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
priv->pivot_timeout.handler = ( NATimeoutFunc ) on_block_items_changed_timeout;
priv->pivot_timeout.user_data = self;
priv->pivot_timeout.source_id = 0;
-
- /* last connect to BaseWindow signals
- * so that convenience objects instanciated later will have this same signal
- * triggered after the one of NactMainWindow
- */
- base_window_signal_connect(
- BASE_WINDOW( self ),
- G_OBJECT( self ),
- BASE_SIGNAL_INITIALIZE_GTK,
- G_CALLBACK( on_base_initialize_gtk_toplevel ));
-
- base_window_signal_connect(
- BASE_WINDOW( self ),
- G_OBJECT( self ),
- BASE_SIGNAL_INITIALIZE_WINDOW,
- G_CALLBACK( on_base_initialize_base_window ));
-
- base_window_signal_connect(
- BASE_WINDOW( self ),
- G_OBJECT( self ),
- BASE_SIGNAL_SHOW_WIDGETS,
- G_CALLBACK( on_base_all_widgets_showed ));
}
static void
@@ -679,6 +657,28 @@ instance_constructed( GObject *window )
g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
+ /* connect to BaseWindow signals
+ * so that convenience objects instanciated later will have this same signal
+ * triggered after the one of NactMainWindow
+ */
+ base_window_signal_connect(
+ BASE_WINDOW( window ),
+ G_OBJECT( window ),
+ BASE_SIGNAL_INITIALIZE_GTK,
+ G_CALLBACK( on_base_initialize_gtk ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( window ),
+ G_OBJECT( window ),
+ BASE_SIGNAL_INITIALIZE_WINDOW,
+ G_CALLBACK( on_base_initialize_window ));
+
+ base_window_signal_connect(
+ BASE_WINDOW( window ),
+ G_OBJECT( window ),
+ BASE_SIGNAL_SHOW_WIDGETS,
+ G_CALLBACK( on_base_show_widgets ));
+
/* monitor the items stored on the disk for modifications
* outside of this application
*/
@@ -703,6 +703,19 @@ instance_constructed( GObject *window )
*/
priv->menubar = nact_menubar_new( BASE_WINDOW( window ));
priv->clipboard = nact_clipboard_new( BASE_WINDOW( window ));
+
+ /* initialize the notebook interfaces
+ */
+ nact_iaction_tab_init( NACT_IACTION_TAB( window ));
+ nact_icommand_tab_init( NACT_ICOMMAND_TAB( window ));
+ nact_ibasenames_tab_init( NACT_IBASENAMES_TAB( window ));
+ nact_imimetypes_tab_init( NACT_IMIMETYPES_TAB( window ));
+ nact_ifolders_tab_init( NACT_IFOLDERS_TAB( window ));
+ nact_ischemes_tab_init( NACT_ISCHEMES_TAB( window ));
+ nact_icapabilities_tab_init( NACT_ICAPABILITIES_TAB( window ));
+ nact_ienvironment_tab_init( NACT_IENVIRONMENT_TAB( window ));
+ nact_iexecution_tab_init( NACT_IEXECUTION_TAB( window ));
+ nact_iproperties_tab_init( NACT_IPROPERTIES_TAB( window ));
}
}
@@ -732,17 +745,6 @@ instance_dispose( GObject *window )
pos = gtk_paned_get_position( GTK_PANED( pane ));
na_settings_set_uint( NA_IPREFS_MAIN_PANED, pos );
- nact_iaction_tab_dispose( NACT_IACTION_TAB( window ));
- nact_icommand_tab_dispose( NACT_ICOMMAND_TAB( window ));
- nact_ibasenames_tab_dispose( NACT_IBASENAMES_TAB( window ));
- nact_imimetypes_tab_dispose( NACT_IMIMETYPES_TAB( window ));
- nact_ifolders_tab_dispose( NACT_IFOLDERS_TAB( window ));
- nact_ischemes_tab_dispose( NACT_ISCHEMES_TAB( window ));
- nact_icapabilities_tab_dispose( NACT_ICAPABILITIES_TAB( window ));
- nact_ienvironment_tab_dispose( NACT_IENVIRONMENT_TAB( window ));
- nact_iexecution_tab_dispose( NACT_IEXECUTION_TAB( window ));
- nact_iproperties_tab_dispose( NACT_IPROPERTIES_TAB( window ));
-
/* unref items view at last as gtk_tree_model_store_clear() will
* finalize all objects, thus invaliditing all our references
*/
@@ -785,7 +787,7 @@ nact_main_window_new( const NactApplication *application )
g_return_val_if_fail( NACT_IS_APPLICATION( application ), NULL );
- window = g_object_new( NACT_MAIN_WINDOW_TYPE,
+ window = g_object_new( NACT_TYPE_MAIN_WINDOW,
BASE_PROP_APPLICATION, application,
BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
BASE_PROP_TOPLEVEL_NAME, st_toplevel_name,
@@ -807,9 +809,9 @@ nact_main_window_new( const NactApplication *application )
* is the same than quitting the application
*/
static void
-on_base_initialize_gtk_toplevel( NactMainWindow *window, GtkWindow *toplevel, gpointer user_data )
+on_base_initialize_gtk( NactMainWindow *window, GtkWindow *toplevel, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_base_initialize_gtk_toplevel";
+ static const gchar *thisfn = "nact_main_window_on_base_initialize_gtk";
GtkWidget *tree_parent;
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
@@ -823,36 +825,31 @@ on_base_initialize_gtk_toplevel( NactMainWindow *window, GtkWindow *toplevel, gp
tree_parent = base_window_get_widget( BASE_WINDOW( window ), "MainVBox" );
g_debug( "%s: tree_parent=%p (%s)", thisfn, ( void * ) tree_parent, G_OBJECT_TYPE_NAME( tree_parent ));
window->private->items_view = nact_tree_view_new(
- BASE_WINDOW( window ), GTK_CONTAINER( tree_parent ),
- "ActionsList", TREE_MODE_EDITION );
-
- base_window_signal_connect( BASE_WINDOW( window ),
- G_OBJECT( window ), TREE_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_tree_view_selection_changed ));
+ BASE_WINDOW( window ),
+ GTK_CONTAINER( tree_parent ),
+ "ActionsList",
+ TREE_MODE_EDITION );
- base_window_signal_connect( BASE_WINDOW( window ),
- G_OBJECT( window ), TREE_SIGNAL_MODIFIED_STATUS_CHANGED, G_CALLBACK( on_tree_view_modified_status_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( window ),
+ G_OBJECT( window ),
+ TREE_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_tree_view_selection_changed ));
- /* then initialize notebook
- */
- nact_iaction_tab_initial_load_toplevel( NACT_IACTION_TAB( window ));
- nact_icommand_tab_initial_load_toplevel( NACT_ICOMMAND_TAB( window ));
- nact_ibasenames_tab_initial_load_toplevel( NACT_IBASENAMES_TAB( window ));
- nact_imimetypes_tab_initial_load_toplevel( NACT_IMIMETYPES_TAB( window ));
- nact_ifolders_tab_initial_load_toplevel( NACT_IFOLDERS_TAB( window ));
- nact_ischemes_tab_initial_load_toplevel( NACT_ISCHEMES_TAB( window ));
- nact_icapabilities_tab_initial_load_toplevel( NACT_ICAPABILITIES_TAB( window ));
- nact_ienvironment_tab_initial_load_toplevel( NACT_IENVIRONMENT_TAB( window ));
- nact_iexecution_tab_initial_load_toplevel( NACT_IEXECUTION_TAB( window ));
- nact_iproperties_tab_initial_load_toplevel( NACT_IPROPERTIES_TAB( window ));
+ base_window_signal_connect(
+ BASE_WINDOW( window ),
+ G_OBJECT( window ),
+ TREE_SIGNAL_MODIFIED_STATUS_CHANGED,
+ G_CALLBACK( on_tree_view_modified_status_changed ));
nact_main_statusbar_initialize_gtk_toplevel( window );
}
}
static void
-on_base_initialize_base_window( NactMainWindow *window, gpointer user_data )
+on_base_initialize_window( NactMainWindow *window, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_base_initialize_base_window";
+ static const gchar *thisfn = "nact_main_window_on_base_initialize_window";
guint pos;
GtkWidget *pane;
NactApplication *application;
@@ -868,17 +865,6 @@ on_base_initialize_base_window( NactMainWindow *window, gpointer user_data )
gtk_paned_set_position( GTK_PANED( pane ), pos );
}
- nact_iaction_tab_runtime_init_toplevel( NACT_IACTION_TAB( window ));
- nact_icommand_tab_runtime_init_toplevel( NACT_ICOMMAND_TAB( window ));
- nact_ibasenames_tab_runtime_init_toplevel( NACT_IBASENAMES_TAB( window ));
- nact_imimetypes_tab_runtime_init_toplevel( NACT_IMIMETYPES_TAB( window ));
- nact_ifolders_tab_runtime_init_toplevel( NACT_IFOLDERS_TAB( window ));
- nact_ischemes_tab_runtime_init_toplevel( NACT_ISCHEMES_TAB( window ));
- nact_icapabilities_tab_runtime_init_toplevel( NACT_ICAPABILITIES_TAB( window ));
- nact_ienvironment_tab_runtime_init_toplevel( NACT_IENVIRONMENT_TAB( window ));
- nact_iexecution_tab_runtime_init_toplevel( NACT_IEXECUTION_TAB( window ));
- nact_iproperties_tab_runtime_init_toplevel( NACT_IPROPERTIES_TAB( window ));
-
/* terminate the application by clicking the top right [X] button
*/
base_window_signal_connect(
@@ -899,34 +885,17 @@ on_base_initialize_base_window( NactMainWindow *window, gpointer user_data )
}
static void
-on_base_all_widgets_showed( NactMainWindow *window, gpointer user_data )
+on_base_show_widgets( NactMainWindow *window, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_base_all_widgets_showed";
+ static const gchar *thisfn = "nact_main_window_on_base_show_widgets";
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
- g_return_if_fail( NACT_IS_IACTION_TAB( window ));
- g_return_if_fail( NACT_IS_ICOMMAND_TAB( window ));
- g_return_if_fail( NACT_IS_IBASENAMES_TAB( window ));
- g_return_if_fail( NACT_IS_IMIMETYPES_TAB( window ));
- g_return_if_fail( NACT_IS_IFOLDERS_TAB( window ));
- g_return_if_fail( NACT_IS_ISCHEMES_TAB( window ));
- g_return_if_fail( NACT_IS_IENVIRONMENT_TAB( window ));
g_return_if_fail( NACT_IS_IEXECUTION_TAB( window ));
g_return_if_fail( NACT_IS_IPROPERTIES_TAB( window ));
if( !window->private->dispose_has_run ){
- g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
- nact_iaction_tab_all_widgets_showed( NACT_IACTION_TAB( window ));
- nact_icommand_tab_all_widgets_showed( NACT_ICOMMAND_TAB( window ));
- nact_ibasenames_tab_all_widgets_showed( NACT_IBASENAMES_TAB( window ));
- nact_imimetypes_tab_all_widgets_showed( NACT_IMIMETYPES_TAB( window ));
- nact_ifolders_tab_all_widgets_showed( NACT_IFOLDERS_TAB( window ));
- nact_ischemes_tab_all_widgets_showed( NACT_ISCHEMES_TAB( window ));
- nact_icapabilities_tab_all_widgets_showed( NACT_ICAPABILITIES_TAB( window ));
- nact_ienvironment_tab_all_widgets_showed( NACT_IENVIRONMENT_TAB( window ));
- nact_iexecution_tab_all_widgets_showed( NACT_IEXECUTION_TAB( window ));
- nact_iproperties_tab_all_widgets_showed( NACT_IPROPERTIES_TAB( window ));
+ g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
load_or_reload_items( window );
}
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index 250b9f9..9e7c116 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -250,12 +250,12 @@
G_BEGIN_DECLS
-#define NACT_MAIN_WINDOW_TYPE ( nact_main_window_get_type())
-#define NACT_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_MAIN_WINDOW_TYPE, NactMainWindow ))
-#define NACT_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_MAIN_WINDOW_TYPE, NactMainWindowClass ))
-#define NACT_IS_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_MAIN_WINDOW_TYPE ))
-#define NACT_IS_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_MAIN_WINDOW_TYPE ))
-#define NACT_MAIN_WINDOW_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_MAIN_WINDOW_TYPE, NactMainWindowClass ))
+#define NACT_TYPE_MAIN_WINDOW ( nact_main_window_get_type())
+#define NACT_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_TYPE_MAIN_WINDOW, NactMainWindow ))
+#define NACT_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_TYPE_MAIN_WINDOW, NactMainWindowClass ))
+#define NACT_IS_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_TYPE_MAIN_WINDOW ))
+#define NACT_IS_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_TYPE_MAIN_WINDOW ))
+#define NACT_MAIN_WINDOW_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_TYPE_MAIN_WINDOW, NactMainWindowClass ))
typedef struct _NactMainWindowPrivate NactMainWindowPrivate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]