[nautilus-actions] Remove BaseApplication::initialize_application_name() virtual method



commit f22663f0d17f9bc31a9c46a40d64d58e17dac068
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jan 21 02:00:00 2011 +0100

    Remove BaseApplication::initialize_application_name() virtual method

 ChangeLog                   |    8 ++++
 src/nact/base-application.c |   93 +++++++++++++++++++-----------------------
 src/nact/base-application.h |   34 +++-------------
 src/nact/nact-application.c |   13 ------
 4 files changed, 56 insertions(+), 92 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2f55c7a..9223cf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-01-20 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/base-application.c:
+	* src/nact/base-application.h
+	(initialize_i18n, initialize_application_name, get_application_name):
+	Remove virtual methods.
+
+	* src/nact/nact-application.c (appli_get_application_name):
+	Removed function.
+
 	* src/nact/nact-application.c (nact_application_new_with_args):
 	Make NactApplication initializes with these new properties.
 
diff --git a/src/nact/base-application.c b/src/nact/base-application.c
index 88958bf..34c5479 100644
--- a/src/nact/base-application.c
+++ b/src/nact/base-application.c
@@ -104,26 +104,27 @@ static void           instance_dispose( GObject *application );
 static void           instance_finalize( GObject *application );
 
 static gboolean       appli_initialize_i18n( BaseApplication *application, int *code );
+static gboolean       appli_initialize_application_name( BaseApplication *application, int *code );
 
 static gboolean       v_initialize( BaseApplication *application );
 static gboolean       v_initialize_gtk( BaseApplication *application );
 static gboolean       v_manage_options( const BaseApplication *application, int *code );
-static gboolean       v_initialize_application_name( BaseApplication *application );
 static gboolean       v_initialize_session_manager( BaseApplication *application );
 static gboolean       v_initialize_unique_app( BaseApplication *application );
 static gboolean       v_initialize_ui( BaseApplication *application );
 static gboolean       v_initialize_default_icon( BaseApplication *application );
 #if 0
+static gboolean       v_initialize_application_name( BaseApplication *application );
 static gboolean       v_initialize_application( BaseApplication *application );
 static void           set_initialize_application_error( BaseApplication *application );
 static gboolean       application_do_initialize_application( BaseApplication *application );
 static void           set_initialize_i18n_error( BaseApplication *application );
+static gboolean       application_do_initialize_application_name( BaseApplication *application );
 #endif
 static int            application_do_run( BaseApplication *application );
 static gboolean       application_do_initialize( BaseApplication *application );
 static gboolean       application_do_initialize_gtk( BaseApplication *application );
 static gboolean       application_do_manage_options( const BaseApplication *application, int *code );
-static gboolean       application_do_initialize_application_name( BaseApplication *application );
 static gboolean       application_do_initialize_session_manager( BaseApplication *application );
 static gboolean       application_do_initialize_unique_app( BaseApplication *application );
 static gboolean       application_do_initialize_ui( BaseApplication *application );
@@ -303,13 +304,11 @@ class_init( BaseApplicationClass *klass )
 	klass->run = application_do_run;
 	klass->initialize = application_do_initialize;
 	klass->initialize_gtk = application_do_initialize_gtk;
-	klass->initialize_application_name = application_do_initialize_application_name;
 	klass->initialize_session_manager = application_do_initialize_session_manager;
 	klass->initialize_unique_app = application_do_initialize_unique_app;
 	klass->initialize_ui = application_do_initialize_ui;
 	klass->initialize_default_icon = application_do_initialize_default_icon;
 	klass->initialize_application = NULL;
-	klass->get_application_name = NULL;
 	klass->get_icon_name = NULL;
 	klass->get_unique_app_name = NULL;
 	klass->get_ui_filename = NULL;
@@ -576,8 +575,8 @@ base_application_run( BaseApplication *application )
 		code = BASE_EXIT_CODE_OK;
 
 		if( appli_initialize_i18n( application, &code ) &&
-				v_initialize( application ) /*
 			appli_initialize_application_name( application, &code ) &&
+				v_initialize( application ) /*
 			appli_initialize_gtk( application, &code ) &&
 			appli_initialize_manage_options( application, &code ) &&
 			appli_initialize_session_manager( application, &code ) &&
@@ -585,6 +584,8 @@ base_application_run( BaseApplication *application )
 			appli_initialize_default_icon( application, &code ) &&
 			appli_initialize_builder( application, &code ) &&
 			appli_initialize_first_window( application, &code )*/){
+
+				code = application_do_run( application );
 		}
 	}
 
@@ -596,7 +597,7 @@ appli_initialize_i18n( BaseApplication *application, int *code )
 {
 	static const gchar *thisfn = "base_application_appli_initialize_i18n";
 
-	g_debug( "%s: application=%p, code=%p", thisfn, ( void * ) application, ( void * ) code );
+	g_debug( "%s: application=%p, code=%p (%d)", thisfn, ( void * ) application, ( void * ) code, *code );
 
 #ifdef ENABLE_NLS
 	bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR );
@@ -611,33 +612,40 @@ appli_initialize_i18n( BaseApplication *application, int *code )
 	return( TRUE );
 }
 
+static gboolean
+appli_initialize_application_name( BaseApplication *application, int *code )
+{
+	static const gchar *thisfn = "base_application_appli_initialize_application_name";
+	gchar *name;
+
+	g_debug( "%s: application=%p, code=%p (%d)", thisfn, ( void * ) application, ( void * ) code, *code );
+
+	name = base_application_get_application_name( application );
+	if( name && g_utf8_strlen( name, -1 )){
+		g_set_application_name( name );
+	}
+	g_free( name );
+
+	return( TRUE );
+}
+
 /**
  * base_application_get_application_name:
  * @application: this #BaseApplication instance.
  *
- * Asks the #BaseApplication-derived class for its localized
- * application name.
- *
- * Defaults to empty.
- *
- * Returns: a newly allocated string to be g_free() by the caller.
+ * Returns: the application name as a newly allocated string which should
+ * be be g_free() by the caller.
  */
 gchar *
-base_application_get_application_name( BaseApplication *application )
+base_application_get_application_name( const BaseApplication *application )
 {
-	/*static const gchar *thisfn = "base_application_get_application_name";
-	g_debug( "%s: application=%p", thisfn, application );*/
 	gchar *name = NULL;
 
 	g_return_val_if_fail( BASE_IS_APPLICATION( application ), NULL );
 
 	if( !application->private->dispose_has_run ){
-		if( BASE_APPLICATION_GET_CLASS( application )->get_application_name ){
-			name = BASE_APPLICATION_GET_CLASS( application )->get_application_name( application );
 
-		} else {
-			name = g_strdup( "" );
-		}
+		name = g_strdup( application->private->application_name );
 	}
 
 	return( name );
@@ -878,19 +886,6 @@ v_manage_options( const BaseApplication *application, int *code )
 }
 
 static gboolean
-v_initialize_application_name( BaseApplication *application )
-{
-	static const gchar *thisfn = "base_application_v_initialize_application_name";
-	gboolean ok;
-
-	g_debug( "%s: application=%p", thisfn, ( void * ) application );
-
-	ok = BASE_APPLICATION_GET_CLASS( application )->initialize_application_name( application );
-
-	return( ok );
-}
-
-static gboolean
 v_initialize_session_manager( BaseApplication *application )
 {
 	static const gchar *thisfn = "base_application_v_initialize_session_manager";
@@ -948,6 +943,20 @@ v_initialize_default_icon( BaseApplication *application )
 }
 
 #if 0
+
+static gboolean
+v_initialize_application_name( BaseApplication *application )
+{
+	static const gchar *thisfn = "base_application_v_initialize_application_name";
+	gboolean ok;
+
+	g_debug( "%s: application=%p", thisfn, ( void * ) application );
+
+	ok = BASE_APPLICATION_GET_CLASS( application )->initialize_application_name( application );
+
+	return( ok );
+}
+
 static gboolean
 v_initialize_application( BaseApplication *application )
 {
@@ -1033,7 +1042,6 @@ application_do_initialize( BaseApplication *application )
 	g_debug( "%s: application=%p", thisfn, ( void * ) application );
 
 	return(
-			v_initialize_application_name( application ) &&
 			v_initialize_gtk( application ) &&
 			v_manage_options( application, &code ) &&
 			v_initialize_session_manager( application ) &&
@@ -1085,23 +1093,6 @@ application_do_manage_options( const BaseApplication *application, int *code )
 }
 
 static gboolean
-application_do_initialize_application_name( BaseApplication *application )
-{
-	static const gchar *thisfn = "base_application_do_initialize_application_name";
-	gchar *name;
-
-	g_debug( "%s: application=%p", thisfn, ( void * ) application );
-
-	name = base_application_get_application_name( application );
-	if( name && g_utf8_strlen( name, -1 )){
-		g_set_application_name( name );
-	}
-	g_free( name );
-
-	return( TRUE );
-}
-
-static gboolean
 application_do_initialize_session_manager( BaseApplication *application )
 {
 	static const gchar *thisfn = "base_application_do_initialize_session_manager";
diff --git a/src/nact/base-application.h b/src/nact/base-application.h
index ae4f2c0..f229eab 100644
--- a/src/nact/base-application.h
+++ b/src/nact/base-application.h
@@ -213,14 +213,6 @@ typedef struct {
 	gboolean  ( *initialize_gtk )             ( BaseApplication *appli );
 
 	/**
-	 * initialize_application_name:
-	 * @appli: this #BaseApplication instance.
-	 *
-	 * Initializes the name of the application.
-	 */
-	gboolean  ( *initialize_application_name )( BaseApplication *appli );
-
-	/**
 	 * initialize_unique_app:
 	 * @appli: this #BaseApplication instance.
 	 *
@@ -315,21 +307,6 @@ typedef struct {
 	gboolean  ( *initialize_application )     ( BaseApplication *appli );
 
 	/**
-	 * get_application_name:
-	 * @appli: this #BaseApplication instance.
-	 *
-	 * Asks the derived class for the application name.
-	 *
-	 * It is typically used as the primary title of the main window.
-	 *
-	 * If not provided by the derived class, application name defaults
-	 * to empty.
-	 *
-	 * Returns: the application name, to be g_free() by the caller.
-	 */
-	gchar *   ( *get_application_name )       ( BaseApplication *appli );
-
-	/**
 	 * get_icon_name:
 	 * @appli: this #BaseApplication instance.
 	 *
@@ -425,6 +402,12 @@ typedef enum {
 }
 	BaseExitCode;
 
+GType        base_application_get_type( void );
+
+int          base_application_run( BaseApplication *application );
+
+gchar       *base_application_get_application_name( const BaseApplication *application );
+
 /**
  * @BASE_APPLICATION_PROP_IS_GTK_INITIALIZED: set to %TRUE after
  * successfully returning from the application_initialize_gtk() virtual
@@ -470,11 +453,6 @@ typedef enum {
  */
 #define BASE_APPLICATION_PROP_MAIN_WINDOW			"base-application-main-window"
 
-GType        base_application_get_type( void );
-
-int          base_application_run( BaseApplication *application );
-
-gchar       *base_application_get_application_name( BaseApplication *application );
 gchar       *base_application_get_icon_name( BaseApplication *application );
 gchar       *base_application_get_unique_app_name( BaseApplication *application );
 gchar       *base_application_get_ui_filename( BaseApplication *application );
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index 4c140c1..e342665 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -93,7 +93,6 @@ static GObject *appli_main_window_new( const BaseApplication *application, int *
 
 static gboolean appli_initialize_unique_app( BaseApplication *application );
 static gboolean appli_initialize_application( BaseApplication *application );
-static gchar   *appli_get_application_name( BaseApplication *application );
 static gchar   *appli_get_icon_name( BaseApplication *application );
 static gchar   *appli_get_unique_app_name( BaseApplication *application );
 static gchar   *appli_get_gtkbuilder_filename( BaseApplication *application );
@@ -169,7 +168,6 @@ class_init( NactApplicationClass *klass )
 
 	appli_class->initialize_unique_app = appli_initialize_unique_app;
 	appli_class->initialize_application = appli_initialize_application;
-	appli_class->get_application_name = appli_get_application_name;
 	appli_class->get_icon_name = appli_get_icon_name;
 	appli_class->get_unique_app_name = appli_get_unique_app_name;
 	appli_class->get_ui_filename = appli_get_gtkbuilder_filename;
@@ -454,17 +452,6 @@ appli_initialize_application( BaseApplication *application )
 }
 
 static gchar *
-appli_get_application_name( BaseApplication *application )
-{
-	/*static const gchar *thisfn = "nact_application_appli_get_application_name";*/
-
-	/*g_debug( "%s: application=%p", thisfn, ( void * ) application );*/
-
-	/* i18n: this is the application name, used in window title */
-	return( g_strdup( _( "Nautilus-Actions Configuration Tool" )));
-}
-
-static gchar *
 appli_get_icon_name( BaseApplication *application )
 {
 	static const gchar *thisfn = "nact_application_appli_get_icon_name";



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