[nautilus-actions] Deprecate NAIbout interface



commit 7a68b2f924acc339299b34fe81a962bdf90aafd7
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Feb 25 00:16:34 2011 +0100

    Deprecate NAIbout interface
    
    Replacing it with just a set of functions to display program informations.

 ChangeLog                          |   17 ++++-
 src/core/Makefile.am               |    4 +-
 src/core/na-about.c                |  168 ++++++++++++++++++++++++++++++++++++
 src/core/na-about.h                |   54 ++++++++++++
 src/core/na-core-utils.c           |    4 +-
 src/nact/nact-application.c        |    4 +-
 src/nact/nact-main-window.c        |   46 ----------
 src/nact/nact-menubar-help.c       |    4 +-
 src/plugin-menu/nautilus-actions.c |   37 +-------
 9 files changed, 250 insertions(+), 88 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 43fb013..f427701 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
-2011-02-23 Pierre Wieser <pwieser trychlos org>
+2011-02-25 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-iabout.c: Renamed as src/core/na-about.c.
+	* src/core/na-iabout.h: Renamed as src/core/na-about.h.
+	NAIAbout is no more an interface, but just a set of functions.
+
+	* src/core/Makefile.am:
+	* src/core/na-core-utils.c (na_core_utils_print_version):
+	* src/nact/nact-application.c (nact_application_new_with_args):
+	* src/nact/nact-main-window.c:
+	* src/nact/nact-menubar-help.c (nact_menubar_help_on_about):
+	* src/plugin-menu/nautilus-actions.c (execute_about): Updated accordingly.
+
+2011-02-24 Pierre Wieser <pwieser trychlos org>
 
 	Improve ExecutionMode implementation by defining a new user preference
 
@@ -16,6 +29,8 @@
 	* src/utils/nautilus-actions-run.c:
 	* po/POTFILES.in: Updated accordingly.
 
+2011-02-23 Pierre Wieser <pwieser trychlos org>
+
 	* src/core/na-settings.c:
 	* src/core/na-settings.h: Define a new NA_IPREFS_PLUGIN_LOG user preference.
 
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index dd1515f..c8122b5 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -46,6 +46,8 @@ BUILT_SOURCES = \
 	$(NULL)
 
 libna_core_la_SOURCES = \
+	na-about.c											\
+	na-about.h											\
 	na-boxed.c											\
 	na-core-utils.c										\
 	na-data-boxed.c										\
@@ -67,8 +69,6 @@ libna_core_la_SOURCES = \
 	na-gnome-vfs-uri.h									\
 	na-gtk-utils.c										\
 	na-gtk-utils.h										\
-	na-iabout.c											\
-	na-iabout.h											\
 	na-icontext.c										\
 	na-icontext-factory.c								\
 	na-iduplicable.c									\
diff --git a/src/core/na-about.c b/src/core/na-about.c
new file mode 100644
index 0000000..5fd977d
--- /dev/null
+++ b/src/core/na-about.c
@@ -0,0 +1,168 @@
+/*
+ * Nautilus-Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <libintl.h>
+
+#include "na-about.h"
+
+/*
+ * na_about_display:
+ * @toplevel: the parent window.
+ *
+ * Displays the About dialog.
+ */
+void
+na_about_display( GtkWindow *toplevel )
+{
+	gchar *application_name, *icon_name, *copyright;
+	int i;
+	GString *license_i18n;
+
+	static const gchar *artists[] = {
+		"Ulisse Perusin <uli peru gmail com>",
+		"DragonArtz - http://www.dragonartz.net/";,
+		NULL
+	};
+
+	static const gchar *authors[] = {
+		"Frederic Ruaudel <grumz grumz net>",
+		"Rodrigo Moya <rodrigo gnome-db org>",
+		"Pierre Wieser <pwieser trychlos org>",
+		NULL
+	};
+
+	static const gchar *documenters[] = {
+		NULL
+	};
+
+	static gchar *license[] = {
+		N_( "Nautilus-Actions Configuration Tool is free software; you can "
+			"redistribute it and/or modify it under the terms of the GNU General "
+			"Public License as published by the Free Software Foundation; either "
+			"version 2 of the License, or (at your option) any later version." ),
+		N_( "Nautilus-Actions Configuration Tool is distributed in the hope that it "
+			"will be useful, but WITHOUT ANY WARRANTY; without even the implied "
+			"warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See "
+			"the GNU General Public License for more details." ),
+		N_( "You should have received a copy of the GNU General Public License along "
+			"with Nautilus-Actions Configuration Tool ; if not, write to the Free "
+			"Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, "
+			"MA 02110-1301, USA." ),
+		NULL
+	};
+
+	application_name = na_about_get_application_name();
+	icon_name = na_about_get_icon_name();
+	copyright = na_about_get_copyright( FALSE );
+
+	i = 0;
+	license_i18n = g_string_new( "" );
+	while( license[i] ){
+		g_string_append_printf( license_i18n, "%s\n\n", gettext( license[i] ));
+		i += 1;
+	}
+
+	gtk_show_about_dialog( toplevel,
+			"artists", artists,
+			"authors", authors,
+			/* i10n: "Nautilus actions" here is not a typo; this does not refer to the
+			 * Nautilus-Actions product, but to the actions which are to be added to Nautilus */
+			"comments", _( "A graphical interface to create and edit your Nautilus actions." ),
+			"copyright", copyright,
+			"documenters", documenters,
+			"license", license_i18n->str,
+			"logo-icon-name", icon_name,
+			"program-name", application_name,
+			"translator-credits", _( "The GNOME Translation Project <gnome-i18n gnome org>" ),
+			"version", PACKAGE_VERSION,
+			"website", "http://www.nautilus-actions.org";,
+			"wrap-license", TRUE,
+			NULL );
+
+	g_free( application_name );
+	g_string_free( license_i18n, TRUE );
+	g_free( copyright );
+	g_free( icon_name );
+}
+
+/*
+ * na_about_get_application_name:
+ *
+ * Returns: the name of the application, as a newly allocated string
+ * which should be g_free() by the caller.
+ */
+gchar *
+na_about_get_application_name( void )
+{
+	/* i18n: title of the About dialog box, when seen from Nautilus file manager */
+	return( g_strdup( _( "Nautilus-Actions" )));
+}
+
+/*
+ * na_about_get_icon_name:
+ *
+ * Returns: the name of the default icon for the application, as a newly
+ * allocated string which should be g_free() by the caller.
+ */
+gchar *
+na_about_get_icon_name( void )
+{
+	return( g_strdup( PACKAGE ));
+}
+
+/*
+ * na_about_get_copyright:
+ * @console: whether the string is to be printed on a console.
+ *
+ * Returns: the copyright string, as a newly allocated string which
+ * should be g_free() by the caller.
+ */
+gchar *
+na_about_get_copyright( gboolean console )
+{
+	gchar *copyright;
+	gchar *symbol;
+
+	symbol = g_strdup( console ? "(C)" : "\xc2\xa9");
+
+	copyright = g_strdup_printf(
+			_( "Copyright %s 2005 The GNOME Foundation\n"
+				"Copyright %s 2006, 2007, 2008 Frederic Ruaudel <grumz grumz net>\n"
+				"Copyright %s 2009, 2010, 2011 Pierre Wieser <pwieser trychlos org>" ), symbol, symbol, symbol );
+
+	g_free( symbol );
+
+	return( copyright );
+}
diff --git a/src/core/na-about.h b/src/core/na-about.h
new file mode 100644
index 0000000..5148ecc
--- /dev/null
+++ b/src/core/na-about.h
@@ -0,0 +1,54 @@
+/*
+ * Nautilus-Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifndef __CORE_NA_ABOUT_H__
+#define __CORE_NA_ABOUT_H__
+
+/* @title NAAbout
+ * @short_description: The #NAAbout API
+ * @include: runtime/na-about.h
+ *
+ * These functions displays the 'About Nautilus-Actions' dialog box,
+ * and provides contant informations about the application.
+ */
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void   na_about_display( GtkWindow *parent );
+
+gchar *na_about_get_application_name( void );
+gchar *na_about_get_icon_name( void );
+gchar *na_about_get_copyright( gboolean console );
+
+G_END_DECLS
+
+#endif /* __CORE_NA_IABOUT_H__ */
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 4817544..d08ef7b 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -41,7 +41,7 @@
 
 #include <api/na-core-utils.h>
 
-#include "na-iabout.h"
+#include "na-about.h"
 
 static GSList  *text_to_string_list( const gchar *text, const gchar *separator, const gchar *default_value );
 static gboolean info_dir_is_writable( GFile *file, const gchar *path );
@@ -1024,7 +1024,7 @@ na_core_utils_print_version( void )
 
 	g_print( "\n" );
 	g_print( "%s (%s) v %s\n", g_get_prgname(), PACKAGE_NAME, PACKAGE_VERSION );
-	copyright = na_iabout_get_copyright( TRUE );
+	copyright = na_about_get_copyright( TRUE );
 	g_print( "%s\n", copyright );
 	g_free( copyright );
 
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index eff380c..c53996d 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -37,7 +37,7 @@
 
 #include <api/na-core-utils.h>
 
-#include <core/na-iabout.h>
+#include <core/na-about.h>
 
 #include "nact-application.h"
 #include "nact-main-window.h"
@@ -282,7 +282,7 @@ nact_application_new_with_args( int argc, char **argv )
 	NactApplication *application;
 	gchar *icon_name;
 
-	icon_name = na_iabout_get_icon_name();
+	icon_name = na_about_get_icon_name();
 
 	application = g_object_new( NACT_APPLICATION_TYPE,
 			BASE_PROP_ARGC,             argc,
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index ddd8491..1a1c700 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -38,7 +38,6 @@
 #include <api/na-object-api.h>
 #include <api/na-timeout.h>
 
-#include <core/na-iabout.h>
 #include <core/na-iprefs.h>
 #include <core/na-pivot.h>
 
@@ -172,7 +171,6 @@ static void       icapabilities_tab_iface_init( NactICapabilitiesTabInterface *i
 static void       ienvironment_tab_iface_init( NactIEnvironmentTabInterface *iface );
 static void       iexecution_tab_iface_init( NactIExecutionTabInterface *iface );
 static void       iproperties_tab_iface_init( NactIPropertiesTabInterface *iface );
-static void       iabout_iface_init( NAIAboutInterface *iface );
 static void       instance_init( GTypeInstance *instance, gpointer klass );
 static void       instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
 static void       instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
@@ -205,10 +203,6 @@ static gboolean   on_base_is_willing_to_quit( const BaseWindow *window, gconstpo
 static gboolean   on_delete_event( GtkWidget *toplevel, GdkEvent *event, NactMainWindow *window );
 static gboolean   warn_modified( NactMainWindow *window );
 
-/* NAIAbout interface */
-static gchar     *iabout_get_application_name( NAIAbout *instance );
-static GtkWindow *iabout_get_toplevel( NAIAbout *instance );
-
 
 GType
 nact_main_window_get_type( void )
@@ -300,12 +294,6 @@ register_type( void )
 		NULL
 	};
 
-	static const GInterfaceInfo iabout_iface_info = {
-		( GInterfaceInitFunc ) iabout_iface_init,
-		NULL,
-		NULL
-	};
-
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( BASE_WINDOW_TYPE, "NactMainWindow", &info, 0 );
@@ -330,8 +318,6 @@ register_type( void )
 
 	g_type_add_interface_static( type, NACT_IPROPERTIES_TAB_TYPE, &iproperties_tab_iface_info );
 
-	g_type_add_interface_static( type, NA_IABOUT_TYPE, &iabout_iface_info );
-
 	return( type );
 }
 
@@ -549,17 +535,6 @@ iproperties_tab_iface_init( NactIPropertiesTabInterface *iface )
 }
 
 static void
-iabout_iface_init( NAIAboutInterface *iface )
-{
-	static const gchar *thisfn = "nact_main_window_iabout_iface_init";
-
-	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-
-	iface->get_application_name = iabout_get_application_name;
-	iface->get_toplevel = iabout_get_toplevel;
-}
-
-static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nact_main_window_instance_init";
@@ -1396,24 +1371,3 @@ warn_modified( NactMainWindow *window )
 
 	return( confirm );
 }
-
-static gchar *
-iabout_get_application_name( NAIAbout *instance )
-{
-	BaseApplication *application;
-
-	g_return_val_if_fail( NA_IS_IABOUT( instance ), NULL );
-	g_return_val_if_fail( BASE_IS_WINDOW( instance ), NULL );
-
-	application = base_window_get_application( BASE_WINDOW( instance ));
-	return( base_application_get_application_name( application ));
-}
-
-static GtkWindow *
-iabout_get_toplevel( NAIAbout *instance )
-{
-	g_return_val_if_fail( NA_IS_IABOUT( instance ), NULL );
-	g_return_val_if_fail( BASE_IS_WINDOW( instance ), NULL );
-
-	return( base_window_get_gtk_toplevel( BASE_WINDOW( instance )));
-}
diff --git a/src/nact/nact-menubar-help.c b/src/nact/nact-menubar-help.c
index b7da768..daf8413 100644
--- a/src/nact/nact-menubar-help.c
+++ b/src/nact/nact-menubar-help.c
@@ -32,7 +32,7 @@
 #include <config.h>
 #endif
 
-#include <core/na-iabout.h>
+#include <core/na-about.h>
 
 #include "nact-menubar-priv.h"
 
@@ -80,5 +80,5 @@ nact_menubar_help_on_help( GtkAction *action, BaseWindow *window )
 void
 nact_menubar_help_on_about( GtkAction *action, BaseWindow *window )
 {
-	na_iabout_display( NA_IABOUT( window ));
+	na_about_display( base_window_get_gtk_toplevel( window ));
 }
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index c21cf83..039b163 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -45,7 +45,7 @@
 #include <api/na-timeout.h>
 
 #include <core/na-pivot.h>
-#include <core/na-iabout.h>
+#include <core/na-about.h>
 #include <core/na-selected-info.h>
 #include <core/na-tokens.h>
 
@@ -80,9 +80,6 @@ static void              instance_constructed( GObject *object );
 static void              instance_dispose( GObject *object );
 static void              instance_finalize( GObject *object );
 
-static void              iabout_iface_init( NAIAboutInterface *iface );
-static gchar            *iabout_get_application_name( NAIAbout *instance );
-
 static void              menu_provider_iface_init( NautilusMenuProviderIface *iface );
 static GList            *menu_provider_get_background_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder );
 static GList            *menu_provider_get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files );
@@ -143,12 +140,6 @@ nautilus_actions_register_type( GTypeModule *module )
 		NULL
 	};
 
-	static const GInterfaceInfo iabout_iface_info = {
-		( GInterfaceInitFunc ) iabout_iface_init,
-		NULL,
-		NULL
-	};
-
 	g_assert( st_actions_type == 0 );
 
 	g_debug( "%s: module=%p", thisfn, ( void * ) module );
@@ -156,8 +147,6 @@ nautilus_actions_register_type( GTypeModule *module )
 	st_actions_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NautilusActions", &info, 0 );
 
 	g_type_module_add_interface( module, st_actions_type, NAUTILUS_TYPE_MENU_PROVIDER, &menu_provider_iface_info );
-
-	g_type_module_add_interface( module, st_actions_type, NA_IABOUT_TYPE, &iabout_iface_info );
 }
 
 static void
@@ -309,23 +298,6 @@ instance_finalize( GObject *object )
 	}
 }
 
-static void
-iabout_iface_init( NAIAboutInterface *iface )
-{
-	static const gchar *thisfn = "nautilus_actions_iabout_iface_init";
-
-	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-
-	iface->get_application_name = iabout_get_application_name;
-}
-
-static gchar *
-iabout_get_application_name( NAIAbout *instance )
-{
-	/* i18n: title of the About dialog box, when seen from Nautilus file manager */
-	return( g_strdup( _( "Nautilus-Actions" )));
-}
-
 gboolean
 nautilus_action_is_log_enabled( void )
 {
@@ -937,7 +909,7 @@ create_root_menu( NautilusActions *plugin, GList *menu )
 		return( NULL );
 	}
 
-	icon = na_iabout_get_icon_name();
+	icon = na_about_get_icon_name();
 	root_item = nautilus_menu_item_new( "NautilusActionsExtensions",
 				/* i18n: label of an automagic root submenu */
 				_( "Nautilus-Actions actions" ),
@@ -986,7 +958,7 @@ add_about_item( NautilusActions *plugin, GList *menu )
 	}
 
 	if( have_root_menu ){
-		icon = na_iabout_get_icon_name();
+		icon = na_about_get_icon_name();
 
 		about_item = nautilus_menu_item_new( "AboutNautilusActions",
 					_( "About Nautilus-Actions" ),
@@ -1012,9 +984,8 @@ static void
 execute_about( NautilusMenuItem *item, NautilusActions *plugin )
 {
 	g_return_if_fail( NAUTILUS_IS_ACTIONS( plugin ));
-	g_return_if_fail( NA_IS_IABOUT( plugin ));
 
-	na_iabout_display( NA_IABOUT( plugin ));
+	na_about_display( NULL );
 }
 
 /*



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