[nautilus-actions] rename BaseWindow initialization time properties



commit df62235381219351ddae3345de4c04fbd608adb9
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jan 21 11:59:43 2011 +0100

    rename BaseWindow initialization time properties
    
    + src/nact/nact-add-capability-dialog.c:
    + src/nact/nact-add-scheme-dialog.c:
    + src/nact/nact-assistant-export.c:
    + src/nact/nact-assistant-import.c:
    + src/nact/nact-confirm-logout.c:
    + src/nact/nact-export-ask.c:
    + src/nact/nact-icon-chooser.c:
    + src/nact/nact-main-window.c:
    + src/nact/nact-preferences-editor.c: Updated accordingly.

 ChangeLog                             |   13 +++
 src/nact/base-window.c                |  159 ++++++++++++++++++---------------
 src/nact/base-window.h                |   14 ++-
 src/nact/nact-add-capability-dialog.c |    2 +-
 src/nact/nact-add-scheme-dialog.c     |    2 +-
 src/nact/nact-assistant-export.c      |    4 +-
 src/nact/nact-assistant-import.c      |    6 +-
 src/nact/nact-confirm-logout.c        |    2 +-
 src/nact/nact-export-ask.c            |    2 +-
 src/nact/nact-icon-chooser.c          |    2 +-
 src/nact/nact-main-window.c           |    2 +-
 src/nact/nact-preferences-editor.c    |    2 +-
 12 files changed, 121 insertions(+), 89 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 55e96aa..872d5d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-01-21 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/base-window.c:
+	* src/nact/base-window.h: Rename initialization properties.
+
+	* src/nact/nact-add-capability-dialog.c:
+	* src/nact/nact-add-scheme-dialog.c:
+	* src/nact/nact-assistant-export.c:
+	* src/nact/nact-assistant-import.c:
+	* src/nact/nact-confirm-logout.c:
+	* src/nact/nact-export-ask.c:
+	* src/nact/nact-icon-chooser.c:
+	* src/nact/nact-main-window.c:
+	* src/nact/nact-preferences-editor.c: Updated accordingly.
+
 	* src/nact/base-application.c:
 	* src/nact/base-application.h:
 	Define new 'base-application-description' property.
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 7191e44..7c55ec1 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -51,16 +51,23 @@ struct _BaseWindowClassPrivate {
  */
 struct _BaseWindowPrivate {
 	gboolean         dispose_has_run;
+
+	/* properties
+	 */
 	BaseWindow      *parent;
 	BaseApplication *application;
+	gchar           *xmlui_filename;
+	gboolean         has_own_builder;
 	gchar           *toplevel_name;
+
+	/* internals
+	 */
 	GtkWindow       *toplevel_window;
+
 	gboolean         initialized;
 	GSList          *signals;
 	gboolean         save_window_position;
-	gboolean         has_own_builder;
 	BaseBuilder     *builder;
-	gchar           *ui_filename;
 };
 
 /* connected signal, to be disconnected at NactWindow dispose
@@ -74,14 +81,19 @@ typedef struct {
 /* instance properties
  */
 enum {
-	BASE_WINDOW_PROP_PARENT_ID = 1,
-	BASE_WINDOW_PROP_APPLICATION_ID,
-	BASE_WINDOW_PROP_TOPLEVEL_NAME_ID,
+	BASE_PROP_0,
+
+	BASE_PROP_PARENT_ID,
+	BASE_PROP_APPLICATION_ID,
+	BASE_PROP_XMLUI_FILENAME_ID,
+	BASE_PROP_HAS_OWN_BUILDER_ID,
+	BASE_PROP_TOPLEVEL_NAME_ID,
+
 	BASE_WINDOW_PROP_TOPLEVEL_WIDGET_ID,
 	BASE_WINDOW_PROP_INITIALIZED_ID,
 	BASE_WINDOW_PROP_SAVE_WINDOW_POSITION_ID,
-	BASE_WINDOW_PROP_HAS_OWN_BUILDER_ID,
-	BASE_WINDOW_PROP_XML_UI_FILENAME_ID
+
+	BASE_PROP_N_PROPERTIES
 };
 
 /* signals defined in BaseWindow, to be used in all derived classes
@@ -199,26 +211,50 @@ class_init( BaseWindowClass *klass )
 	object_class->get_property = instance_get_property;
 	object_class->set_property = instance_set_property;
 
-	spec = g_param_spec_pointer(
-			BASE_WINDOW_PROP_PARENT,
-			"BaseWindow parent pointer",
-			"A pointer (not a reference) to the BaseWindow parent of this BaseWindow",
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_PARENT_ID, spec );
-
-	spec = g_param_spec_pointer(
-			BASE_WINDOW_PROP_APPLICATION,
-			"BaseApplication pointer",
-			"A pointer (not a reference) to the BaseApplication object",
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_APPLICATION_ID, spec );
+	g_object_class_install_property( object_class, BASE_PROP_PARENT_ID,
+			g_param_spec_pointer(
+					BASE_PROP_PARENT,
+					_( "Parent BaseWindow" ),
+					_( "A pointer (not a reference) to the BaseWindow parent of this BaseWindow" ),
+					G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
+
+	g_object_class_install_property( object_class, BASE_PROP_APPLICATION_ID,
+			g_param_spec_pointer(
+				BASE_PROP_APPLICATION,
+				_( "BaseApplication" ),
+				_( "A pointer (not a reference) to the BaseApplication instance" ),
+				G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
+
+	g_object_class_install_property( object_class, BASE_PROP_XMLUI_FILENAME_ID,
+			g_param_spec_string(
+					BASE_PROP_XMLUI_FILENAME,
+					_( "XML UI filename" ),
+					_( "The filename which contains the XML UI definition" ),
+					"",
+					G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
+
+	g_object_class_install_property( object_class, BASE_PROP_HAS_OWN_BUILDER_ID,
+			g_param_spec_boolean(
+					BASE_PROP_HAS_OWN_BUILDER,
+					_( "Has its own GtkBuilder" ),
+					_( "Whether this BaseWindow reallocates a new GtkBuilder each time it is opened" ),
+					FALSE,
+					G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
+
+	g_object_class_install_property( object_class, BASE_PROP_TOPLEVEL_NAME_ID,
+			g_param_spec_string(
+					BASE_PROP_TOPLEVEL_NAME,
+					_( "Toplevel name" ),
+					_( "The internal GtkBuildable name of the toplevel window" ),
+					"",
+					G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 
-	spec = g_param_spec_string(
-			BASE_WINDOW_PROP_TOPLEVEL_NAME,
-			"Internal toplevel name",
-			"The internal name in GtkBuilder of the toplevel window", "",
+	spec = g_param_spec_boolean(
+			BASE_WINDOW_PROP_SAVE_WINDOW_POSITION,
+			"Save window size and position on dispose",
+			"Whether the size and position of the window must be saved as a GConf preference", FALSE,
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_TOPLEVEL_NAME_ID, spec );
+	g_object_class_install_property( object_class, BASE_WINDOW_PROP_SAVE_WINDOW_POSITION_ID, spec );
 
 	spec = g_param_spec_pointer(
 			BASE_WINDOW_PROP_TOPLEVEL_WIDGET,
@@ -234,27 +270,6 @@ class_init( BaseWindowClass *klass )
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
 	g_object_class_install_property( object_class, BASE_WINDOW_PROP_INITIALIZED_ID, spec );
 
-	spec = g_param_spec_boolean(
-			BASE_WINDOW_PROP_SAVE_WINDOW_POSITION,
-			"Save window size and position on dispose",
-			"Whether the size and position of the window must be saved as a GConf preference", FALSE,
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_SAVE_WINDOW_POSITION_ID, spec );
-
-	spec = g_param_spec_boolean(
-			BASE_WINDOW_PROP_HAS_OWN_BUILDER,
-			"Does this have its own GtkBuilder",
-			"Whether this BaseWindow reallocates a new GtkBuilder each time it is opened", FALSE,
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_HAS_OWN_BUILDER_ID, spec );
-
-	spec = g_param_spec_string(
-			BASE_WINDOW_PROP_XML_UI_FILENAME,
-			"Specific XML UI filename",
-			"The filename which contains the XML UI definition", "",
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
-	g_object_class_install_property( object_class, BASE_WINDOW_PROP_XML_UI_FILENAME_ID, spec );
-
 	klass->private = g_new0( BaseWindowClassPrivate, 1 );
 
 	klass->initial_load_toplevel = window_do_initial_load_toplevel;
@@ -384,15 +399,23 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
 	if( !self->private->dispose_has_run ){
 
 		switch( property_id ){
-			case BASE_WINDOW_PROP_PARENT_ID:
+			case BASE_PROP_PARENT_ID:
 				g_value_set_pointer( value, self->private->parent );
 				break;
 
-			case BASE_WINDOW_PROP_APPLICATION_ID:
+			case BASE_PROP_APPLICATION_ID:
 				g_value_set_pointer( value, self->private->application );
 				break;
 
-			case BASE_WINDOW_PROP_TOPLEVEL_NAME_ID:
+			case BASE_PROP_XMLUI_FILENAME_ID:
+				g_value_set_string( value, self->private->xmlui_filename );
+				break;
+
+			case BASE_PROP_HAS_OWN_BUILDER_ID:
+				g_value_set_boolean( value, self->private->has_own_builder );
+				break;
+
+			case BASE_PROP_TOPLEVEL_NAME_ID:
 				g_value_set_string( value, self->private->toplevel_name );
 				break;
 
@@ -408,14 +431,6 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
 				g_value_set_boolean( value, self->private->save_window_position );
 				break;
 
-			case BASE_WINDOW_PROP_HAS_OWN_BUILDER_ID:
-				g_value_set_boolean( value, self->private->has_own_builder );
-				break;
-
-			case BASE_WINDOW_PROP_XML_UI_FILENAME_ID:
-				g_value_set_string( value, self->private->ui_filename );
-				break;
-
 			default:
 				G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
 				break;
@@ -434,15 +449,24 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
 	if( !self->private->dispose_has_run ){
 
 		switch( property_id ){
-			case BASE_WINDOW_PROP_PARENT_ID:
+			case BASE_PROP_PARENT_ID:
 				self->private->parent = g_value_get_pointer( value );
 				break;
 
-			case BASE_WINDOW_PROP_APPLICATION_ID:
+			case BASE_PROP_APPLICATION_ID:
 				self->private->application = g_value_get_pointer( value );
 				break;
 
-			case BASE_WINDOW_PROP_TOPLEVEL_NAME_ID:
+			case BASE_PROP_XMLUI_FILENAME_ID:
+				g_free( self->private->xmlui_filename );
+				self->private->xmlui_filename = g_value_dup_string( value );
+				break;
+
+			case BASE_PROP_HAS_OWN_BUILDER_ID:
+				self->private->has_own_builder = g_value_get_boolean( value );
+				break;
+
+			case BASE_PROP_TOPLEVEL_NAME_ID:
 				g_free( self->private->toplevel_name );
 				self->private->toplevel_name = g_value_dup_string( value );
 				break;
@@ -459,15 +483,6 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
 				self->private->save_window_position = g_value_get_boolean( value );
 				break;
 
-			case BASE_WINDOW_PROP_HAS_OWN_BUILDER_ID:
-				self->private->has_own_builder = g_value_get_boolean( value );
-				break;
-
-			case BASE_WINDOW_PROP_XML_UI_FILENAME_ID:
-				g_free( self->private->ui_filename );
-				self->private->ui_filename = g_value_dup_string( value );
-				break;
-
 			default:
 				G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
 				break;
@@ -559,7 +574,7 @@ instance_finalize( GObject *window )
 	self = BASE_WINDOW( window );
 
 	g_free( self->private->toplevel_name );
-	g_free( self->private->ui_filename );
+	g_free( self->private->xmlui_filename );
 
 	g_free( self->private );
 
@@ -1011,13 +1026,13 @@ v_get_toplevel_name( const BaseWindow *window )
 
 	g_return_val_if_fail( BASE_IS_WINDOW( window ), NULL );
 
-	g_object_get( G_OBJECT( window ), BASE_WINDOW_PROP_TOPLEVEL_NAME, &name, NULL );
+	g_object_get( G_OBJECT( window ), BASE_PROP_TOPLEVEL_NAME, &name, NULL );
 
 	if( !name || !strlen( name )){
 		if( BASE_WINDOW_GET_CLASS( window )->get_toplevel_name ){
 			name = BASE_WINDOW_GET_CLASS( window )->get_toplevel_name( window );
 			if( name && strlen( name )){
-				g_object_set( G_OBJECT( window ), BASE_WINDOW_PROP_TOPLEVEL_NAME, name, NULL );
+				g_object_set( G_OBJECT( window ), BASE_PROP_TOPLEVEL_NAME, name, NULL );
 			}
 		}
 	}
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index f78b0a8..d30ac1a 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -45,15 +45,19 @@
 
 G_BEGIN_DECLS
 
-/* instance properties
+/**
+ * Properties defined by the BaseWindow class.
+ * They should be provided at object instanciation time.
  */
-#define BASE_WINDOW_PROP_PARENT						"base-window-parent"
-#define BASE_WINDOW_PROP_APPLICATION				"base-window-application"
-#define BASE_WINDOW_PROP_TOPLEVEL_NAME				"base-window-toplevel-name"
+#define BASE_PROP_PARENT						"base-window-parent"
+#define BASE_PROP_APPLICATION					"base-window-application"
+#define BASE_PROP_XMLUI_FILENAME				"base-window-xmlui-filename"
+#define BASE_PROP_HAS_OWN_BUILDER				"base-window-has-own-builder"
+#define BASE_PROP_TOPLEVEL_NAME					"base-window-toplevel-name"
+
 #define BASE_WINDOW_PROP_TOPLEVEL_WIDGET			"base-window-toplevel-widget"
 #define BASE_WINDOW_PROP_INITIALIZED				"base-window-is-initialized"
 #define BASE_WINDOW_PROP_SAVE_WINDOW_POSITION		"base-window-save-window-position"
-#define BASE_WINDOW_PROP_HAS_OWN_BUILDER			"base-window-has-own-builder"
 #define BASE_WINDOW_PROP_XML_UI_FILENAME			"base-window-xml-ui-filename"
 
 /* signals defined in this class
diff --git a/src/nact/nact-add-capability-dialog.c b/src/nact/nact-add-capability-dialog.c
index e72f546..a2cb3c8 100644
--- a/src/nact/nact-add-capability-dialog.c
+++ b/src/nact/nact-add-capability-dialog.c
@@ -264,7 +264,7 @@ instance_finalize( GObject *dialog )
 static NactAddCapabilityDialog *
 add_capability_dialog_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ADD_CAPABILITY_DIALOG_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_ADD_CAPABILITY_DIALOG_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-add-scheme-dialog.c b/src/nact/nact-add-scheme-dialog.c
index 1ea45ce..a393834 100644
--- a/src/nact/nact-add-scheme-dialog.c
+++ b/src/nact/nact-add-scheme-dialog.c
@@ -235,7 +235,7 @@ instance_finalize( GObject *dialog )
 static NactAddSchemeDialog *
 add_scheme_dialog_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ADD_SCHEME_DIALOG_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_ADD_SCHEME_DIALOG_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index 8fa6671..9bd4e8b 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -305,7 +305,7 @@ instance_finalize( GObject *window )
 static NactAssistantExport *
 assist_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ASSISTANT_EXPORT_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_ASSISTANT_EXPORT_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
@@ -319,7 +319,7 @@ nact_assistant_export_run( BaseWindow *main_window )
 	NactAssistantExport *assist;
 
 	assist = assist_new( main_window );
-	g_object_set( G_OBJECT( assist ), BASE_WINDOW_PROP_HAS_OWN_BUILDER, TRUE, NULL );
+	g_object_set( G_OBJECT( assist ), BASE_PROP_HAS_OWN_BUILDER, TRUE, NULL );
 
 	base_window_run( BASE_WINDOW( assist ));
 }
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index aa2c773..2c337b2 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -252,7 +252,7 @@ instance_finalize( GObject *window )
 static NactAssistantImport *
 assist_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ASSISTANT_IMPORT_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_ASSISTANT_IMPORT_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
@@ -267,7 +267,7 @@ nact_assistant_import_run( BaseWindow *main_window )
 	NactAssistantImport *assist;
 
 	assist = assist_new( main_window );
-	g_object_set( G_OBJECT( assist ), BASE_WINDOW_PROP_HAS_OWN_BUILDER, TRUE, NULL );
+	g_object_set( G_OBJECT( assist ), BASE_PROP_HAS_OWN_BUILDER, TRUE, NULL );
 
 	base_window_run( BASE_WINDOW( assist ));
 }
@@ -685,7 +685,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
 	imported_items = NULL;
 	memset( &import_parms, '\0', sizeof( NAImporterParms ));
 
-	g_object_get( G_OBJECT( wnd ), BASE_WINDOW_PROP_PARENT, &main_window, NULL );
+	g_object_get( G_OBJECT( wnd ), BASE_PROP_PARENT, &main_window, NULL );
 	import_parms.parent = base_window_get_toplevel( main_window );
 
 	chooser = base_window_get_widget( BASE_WINDOW( window ), "ImportFileChooser" );
diff --git a/src/nact/nact-confirm-logout.c b/src/nact/nact-confirm-logout.c
index 5338fc2..9ecde82 100644
--- a/src/nact/nact-confirm-logout.c
+++ b/src/nact/nact-confirm-logout.c
@@ -216,7 +216,7 @@ instance_finalize( GObject *dialog )
 static NactConfirmLogout *
 confirm_logout_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_CONFIRM_LOGOUT_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_CONFIRM_LOGOUT_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index ce88ab8..fd9d50a 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -231,7 +231,7 @@ instance_finalize( GObject *dialog )
 static NactExportAsk *
 export_ask_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_EXPORT_ASK_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_EXPORT_ASK_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index 9baf3c9..7de1369 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -286,7 +286,7 @@ instance_finalize( GObject *dialog )
 static NactIconChooser *
 icon_chooser_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ICON_CHOOSER_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	return( g_object_new( NACT_ICON_CHOOSER_TYPE, BASE_PROP_PARENT, parent, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 9eb5fc8..8faff91 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -827,7 +827,7 @@ nact_main_window_new( const NactApplication *application )
 	g_return_val_if_fail( NACT_IS_APPLICATION( application ), NULL );
 
 	return( g_object_new( NACT_MAIN_WINDOW_TYPE,
-			BASE_WINDOW_PROP_APPLICATION, application, NULL ));
+			BASE_PROP_APPLICATION, application, NULL ));
 }
 
 /**
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 14680bb..513e27e 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -292,7 +292,7 @@ preferences_editor_new( BaseWindow *parent )
 	NASettings *settings;
 	gboolean are_locked, mandatory;
 
-	editor = NACT_PREFERENCES_EDITOR( g_object_new( NACT_PREFERENCES_EDITOR_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
+	editor = NACT_PREFERENCES_EDITOR( g_object_new( NACT_PREFERENCES_EDITOR_TYPE, BASE_PROP_PARENT, parent, NULL ));
 
 	application = NACT_APPLICATION( base_window_get_application( parent ));
 	updater = nact_application_get_updater( application );



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