[nautilus-actions] Remove BaseWindow::get_ui_filename() virtual method
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Remove BaseWindow::get_ui_filename() virtual method
- Date: Mon, 24 Jan 2011 19:41:11 +0000 (UTC)
commit 229b84fc5b54e9cf9eff5bc70abccbbe37c23cd4
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jan 22 19:15:39 2011 +0100
Remove BaseWindow::get_ui_filename() virtual method
ChangeLog | 10 ++++++++++
src/nact/base-window.c | 24 +++++++-----------------
src/nact/base-window.h | 16 ----------------
src/nact/nact-add-capability-dialog.c | 17 +++++++----------
src/nact/nact-add-scheme-dialog.c | 17 +++++++----------
src/nact/nact-assistant-export.c | 17 +++++++----------
src/nact/nact-export-ask.c | 17 +++++++----------
src/nact/nact-icon-chooser.c | 17 +++++++----------
src/nact/nact-preferences-editor.c | 20 +++++++++-----------
9 files changed, 61 insertions(+), 94 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3338225..e93b253 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
2011-01-22 Pierre Wieser <pwieser trychlos org>
* src/nact/base-window.c:
+ * src/nact/base-window.h (get_ui_filename): Removed virtual function.
+
+ * src/nact/nact-add-capability-dialog.c:
+ * src/nact/nact-add-scheme-dialog.c:
+ * src/nact/nact-assistant-export.c:
+ * src/nact/nact-export-ask.c:
+ * src/nact/nact-icon-chooser.c:
+ * src/nact/nact-preferences-editor.c: Updated accordingly.
+
+ * src/nact/base-window.c:
* src/nact/base-window.h:
Revert commits dfb26ec5, 1991b3b7 and 4d0c43bb due to new virtual method
handling paradigm.
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index f0a7854..09f14ea 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -252,7 +252,6 @@ class_init( BaseWindowClass *klass )
klass->delete_event = window_do_delete_event;
klass->get_toplevel_name = NULL;
klass->get_iprefs_window_id = NULL;
- klass->get_ui_filename = NULL;
klass->is_willing_to_quit = NULL;
/**
@@ -610,6 +609,8 @@ setup_builder( const BaseWindow *window )
GError *error = NULL;
gchar *msg;
+ ret = TRUE;
+
/* allocate a dedicated BaseBuilder or use the common one
*/
if( window->private->has_own_builder ){
@@ -619,28 +620,17 @@ setup_builder( const BaseWindow *window )
window->private->builder = base_application_get_builder( window->private->application );
}
- /* use the xml ui filename provided as a construction property
- * or ask the window for it
- */
- if(( !window->private->xmlui_filename || !g_utf8_strlen( window->private->xmlui_filename, -1 )) &&
- BASE_WINDOW_GET_CLASS( window )->get_ui_filename ){
-
- g_free( window->private->xmlui_filename );
- window->private->xmlui_filename = BASE_WINDOW_GET_CLASS( window )->get_ui_filename( window );
- }
-
/* load the XML definition from the UI file
*/
- ret = FALSE;
- if( window->private->xmlui_filename && g_utf8_strlen( window->private->xmlui_filename, -1 )){
- if( base_builder_add_from_file( window->private->builder, window->private->xmlui_filename, &error )){
- ret = TRUE;
- } else {
+ if( window->private->xmlui_filename &&
+ g_utf8_strlen( window->private->xmlui_filename, -1 ) &&
+ !base_builder_add_from_file( window->private->builder, window->private->xmlui_filename, &error )){
+
msg = g_strdup_printf( _( "Unable to load %s UI XML definition: %s" ), window->private->xmlui_filename, error->message );
base_window_display_error_dlg( NULL, thisfn, msg );
g_free( msg );
g_error_free( error );
- }
+ ret = FALSE;
}
return( ret );
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index 8fe92ce..588da03 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -101,7 +101,6 @@ typedef struct _BaseWindowClassPrivate BaseWindowClassPrivate;
* @delete_event:
* @get_toplevel_name:
* @get_iprefs_window_id:
- * @get_ui_filename:
* @is_willing_to_quit: asks if the window is willing to quit
*
* This defines the virtual method a derived class may, should or must implement.
@@ -197,21 +196,6 @@ typedef struct {
gchar * ( *get_iprefs_window_id ) ( const BaseWindow *window );
/**
- * get_ui_filename:
- * @window: this #BaseWindow instance.
- *
- * Asks the derived class for the filename of the XML definition of
- * the user interface for this window. This XML definition must be
- * suitable in order to be loaded via GtkBuilder.
- *
- * Defaults to application UI filename.
- *
- * Returns: the filename of the XML definition, to be g_free() by
- * the caller.
- */
- gchar * ( *get_ui_filename ) ( const BaseWindow *window );
-
- /**
* is_willing_to_quit:
* @window: this #BaseWindow instance.
*
diff --git a/src/nact/nact-add-capability-dialog.c b/src/nact/nact-add-capability-dialog.c
index 1231b67..91ead62 100644
--- a/src/nact/nact-add-capability-dialog.c
+++ b/src/nact/nact-add-capability-dialog.c
@@ -80,7 +80,9 @@ static CapabilityTextStruct st_caps[] = {
{ NULL },
};
-static GObjectClass *st_parent_class = NULL;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-add-capability.ui";
+
+static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactAddCapabilityDialogClass *klass );
@@ -92,7 +94,6 @@ static NactAddCapabilityDialog *add_capability_dialog_new( BaseWindow *parent );
static gchar *base_get_iprefs_window_id( const BaseWindow *window );
static gchar *base_get_dialog_name( const BaseWindow *window );
-static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactAddCapabilityDialog *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactAddCapabilityDialog *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactAddCapabilityDialog *editor, gpointer user_data );
@@ -167,7 +168,6 @@ class_init( NactAddCapabilityDialogClass *klass )
base_class->dialog_response = base_dialog_response;
base_class->get_toplevel_name = base_get_dialog_name;
base_class->get_iprefs_window_id = base_get_iprefs_window_id;
- base_class->get_ui_filename = base_get_ui_filename;
}
static void
@@ -264,7 +264,10 @@ instance_finalize( GObject *dialog )
static NactAddCapabilityDialog *
add_capability_dialog_new( BaseWindow *parent )
{
- return( g_object_new( NACT_ADD_CAPABILITY_DIALOG_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ return( g_object_new( NACT_ADD_CAPABILITY_DIALOG_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
}
/**
@@ -313,12 +316,6 @@ base_get_dialog_name( const BaseWindow *window )
return( g_strdup( "AddCapabilityDialog" ));
}
-static gchar *
-base_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-add-capability.ui" ));
-}
-
static void
on_base_initial_load_dialog( NactAddCapabilityDialog *dialog, gpointer user_data )
{
diff --git a/src/nact/nact-add-scheme-dialog.c b/src/nact/nact-add-scheme-dialog.c
index d9c5fb6..29f72ed 100644
--- a/src/nact/nact-add-scheme-dialog.c
+++ b/src/nact/nact-add-scheme-dialog.c
@@ -55,7 +55,9 @@ struct _NactAddSchemeDialogPrivate {
gchar *scheme;
};
-static GObjectClass *st_parent_class = NULL;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-add-scheme.ui";
+
+static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactAddSchemeDialogClass *klass );
@@ -67,7 +69,6 @@ static NactAddSchemeDialog *add_scheme_dialog_new( BaseWindow *parent );
static gchar *base_get_iprefs_window_id( const BaseWindow *window );
static gchar *base_get_dialog_name( const BaseWindow *window );
-static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactAddSchemeDialog *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactAddSchemeDialog *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactAddSchemeDialog *editor, gpointer user_data );
@@ -138,7 +139,6 @@ class_init( NactAddSchemeDialogClass *klass )
base_class->dialog_response = base_dialog_response;
base_class->get_toplevel_name = base_get_dialog_name;
base_class->get_iprefs_window_id = base_get_iprefs_window_id;
- base_class->get_ui_filename = base_get_ui_filename;
}
static void
@@ -235,7 +235,10 @@ instance_finalize( GObject *dialog )
static NactAddSchemeDialog *
add_scheme_dialog_new( BaseWindow *parent )
{
- return( g_object_new( NACT_ADD_SCHEME_DIALOG_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ return( g_object_new( NACT_ADD_SCHEME_DIALOG_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
}
/**
@@ -284,12 +287,6 @@ base_get_dialog_name( const BaseWindow *window )
return( g_strdup( "AddSchemeDialog" ));
}
-static gchar *
-base_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-add-scheme.ui" ));
-}
-
static void
on_base_initial_load_dialog( NactAddSchemeDialog *dialog, gpointer user_data )
{
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index 44d5055..dbeff61 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -94,7 +94,9 @@ typedef struct {
}
ExportStruct;
-static BaseAssistantClass *st_parent_class = NULL;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-assistant-export.ui";
+
+static BaseAssistantClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactAssistantExportClass *klass );
@@ -107,7 +109,6 @@ static NactAssistantExport *assist_new( BaseWindow *parent );
static gchar *window_get_iprefs_window_id( const BaseWindow *window );
static gchar *window_get_toplevel_name( const BaseWindow *dialog );
-static gchar *window_get_ui_filename( const BaseWindow *dialog );
static void on_initial_load_dialog( NactAssistantExport *dialog, gpointer user_data );
static void on_runtime_init_dialog( NactAssistantExport *dialog, gpointer user_data );
@@ -208,7 +209,6 @@ class_init( NactAssistantExportClass *klass )
base_class = BASE_WINDOW_CLASS( klass );
base_class->get_iprefs_window_id = window_get_iprefs_window_id;
base_class->get_toplevel_name = window_get_toplevel_name;
- base_class->get_ui_filename = window_get_ui_filename;
assist_class = BASE_ASSISTANT_CLASS( klass );
assist_class->apply = assistant_apply;
@@ -305,7 +305,10 @@ instance_finalize( GObject *window )
static NactAssistantExport *
assist_new( BaseWindow *parent )
{
- return( g_object_new( NACT_ASSISTANT_EXPORT_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ return( g_object_new( NACT_ASSISTANT_EXPORT_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
}
/**
@@ -336,12 +339,6 @@ window_get_toplevel_name( const BaseWindow *dialog )
return( g_strdup( "ExportAssistant" ));
}
-static gchar *
-window_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-assistant-export.ui" ));
-}
-
static void
on_initial_load_dialog( NactAssistantExport *dialog, gpointer user_data )
{
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index 7bd37a5..e8c0f24 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -63,7 +63,9 @@ struct _NactExportAskPrivate {
gboolean keep_last_choice_mandatory;
};
-static BaseDialogClass *st_parent_class = NULL;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-assistant-export.ui";
+
+static BaseDialogClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactExportAskClass *klass );
@@ -75,7 +77,6 @@ static NactExportAsk *export_ask_new( BaseWindow *parent );
static gchar *base_get_iprefs_window_id( const BaseWindow *window );
static gchar *base_get_dialog_name( const BaseWindow *window );
-static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactExportAsk *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactExportAsk *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactExportAsk *editor, gpointer user_data );
@@ -143,7 +144,6 @@ class_init( NactExportAskClass *klass )
base_class->dialog_response = base_dialog_response;
base_class->get_toplevel_name = base_get_dialog_name;
base_class->get_iprefs_window_id = base_get_iprefs_window_id;
- base_class->get_ui_filename = base_get_ui_filename;
}
static void
@@ -231,7 +231,10 @@ instance_finalize( GObject *dialog )
static NactExportAsk *
export_ask_new( BaseWindow *parent )
{
- return( g_object_new( NACT_EXPORT_ASK_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ return( g_object_new( NACT_EXPORT_ASK_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
}
/**
@@ -319,12 +322,6 @@ base_get_dialog_name( const BaseWindow *window )
return( g_strdup( "ExportAskDialog" ));
}
-static gchar *
-base_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-assistant-export.ui" ));
-}
-
static void
on_base_initial_load_dialog( NactExportAsk *editor, gpointer user_data )
{
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index 9a88580..91d9efe 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -89,7 +89,9 @@ enum {
THEME_ICON_N_COLUMN
};
-static BaseDialogClass *st_parent_class = NULL;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-icon-chooser.ui";
+
+static BaseDialogClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactIconChooserClass *klass );
@@ -101,7 +103,6 @@ static NactIconChooser *icon_chooser_new( BaseWindow *parent );
static gchar *base_get_iprefs_window_id( const BaseWindow *window );
static gchar *base_get_dialog_name( const BaseWindow *window );
-static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactIconChooser *editor, gpointer user_data );
static void do_initialize_themed_icons( NactIconChooser *editor );
static void do_initialize_icons_by_path( NactIconChooser *editor );
@@ -183,7 +184,6 @@ class_init( NactIconChooserClass *klass )
base_class->dialog_response = base_dialog_response;
base_class->get_toplevel_name = base_get_dialog_name;
base_class->get_iprefs_window_id = base_get_iprefs_window_id;
- base_class->get_ui_filename = base_get_ui_filename;
}
static void
@@ -286,7 +286,10 @@ instance_finalize( GObject *dialog )
static NactIconChooser *
icon_chooser_new( BaseWindow *parent )
{
- return( g_object_new( NACT_ICON_CHOOSER_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ return( g_object_new( NACT_ICON_CHOOSER_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
}
/**
@@ -341,12 +344,6 @@ base_get_dialog_name( const BaseWindow *window )
return( g_strdup( "IconChooserDialog" ));
}
-static gchar *
-base_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-icon-chooser.ui" ));
-}
-
static void
on_base_initial_load_dialog( NactIconChooser *editor, gpointer user_data )
{
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index c289701..2407da9 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -90,8 +90,10 @@ struct _NactPreferencesEditorPrivate {
/* sixth tab: i/o providers */
};
-static GObjectClass *st_parent_class = NULL;
-static guint st_last_tab = 0;
+static const gchar *st_xmlui_filename = PKGDATADIR "/nact-preferences.ui";
+
+static GObjectClass *st_parent_class = NULL;
+static guint st_last_tab = 0;
static GType register_type( void );
static void class_init( NactPreferencesEditorClass *klass );
@@ -103,7 +105,6 @@ static NactPreferencesEditor *preferences_editor_new( BaseWindow *parent );
static gchar *base_get_iprefs_window_id( const BaseWindow *window );
static gchar *base_get_dialog_name( const BaseWindow *window );
-static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactPreferencesEditor *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactPreferencesEditor *editor, gpointer user_data );
@@ -199,7 +200,6 @@ class_init( NactPreferencesEditorClass *klass )
base_class->dialog_response = base_dialog_response;
base_class->get_toplevel_name = base_get_dialog_name;
base_class->get_iprefs_window_id = base_get_iprefs_window_id;
- base_class->get_ui_filename = base_get_ui_filename;
}
static void
@@ -292,7 +292,11 @@ preferences_editor_new( BaseWindow *parent )
NASettings *settings;
gboolean are_locked, mandatory;
- editor = NACT_PREFERENCES_EDITOR( g_object_new( NACT_PREFERENCES_EDITOR_TYPE, BASE_PROP_PARENT, parent, NULL ));
+ editor = NACT_PREFERENCES_EDITOR(
+ g_object_new( NACT_PREFERENCES_EDITOR_TYPE,
+ BASE_PROP_PARENT, parent,
+ BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
+ NULL ));
application = NACT_APPLICATION( base_window_get_application( parent ));
updater = nact_application_get_updater( application );
@@ -339,12 +343,6 @@ base_get_dialog_name( const BaseWindow *window )
return( g_strdup( "PreferencesDialog" ));
}
-static gchar *
-base_get_ui_filename( const BaseWindow *dialog )
-{
- return( g_strdup( PKGDATADIR "/nact-preferences.ui" ));
-}
-
static void
on_base_initial_load_dialog( NactPreferencesEditor *editor, gpointer user_data )
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]