[nautilus-actions] na_about_get_icon_name() now returns a const string
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] na_about_get_icon_name() now returns a const string
- Date: Tue, 3 Jan 2012 22:33:44 +0000 (UTC)
commit b8e5bf7ca776c9aef60f32781547fb3f2f091643
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Jan 2 05:38:01 2012 +0100
na_about_get_icon_name() now returns a const string
ChangeLog | 5 ++++
src/core/na-about.c | 17 +++++++------
src/core/na-about.h | 8 +++---
src/plugin-menu/nautilus-actions.c | 45 ++++++++++++++++--------------------
4 files changed, 38 insertions(+), 37 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f00483c..93cfb8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-01-02 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-about.c:
+ * src/core/na-about.h (na_about_get_icon_name): Returns a const string.
+
+ * src/plugin-menu/nautilus-actions.c: Updated accordingly.
+
* Allmost all files: Bump copyright year.
* ChangeLog-2011: New file.
diff --git a/src/core/na-about.c b/src/core/na-about.c
index 4d55bea..25b5e04 100644
--- a/src/core/na-about.c
+++ b/src/core/na-about.c
@@ -46,7 +46,7 @@
void
na_about_display( GtkWindow *toplevel )
{
- gchar *application_name, *icon_name, *copyright;
+ gchar *application_name, *copyright;
int i;
GString *license_i18n;
@@ -84,7 +84,6 @@ na_about_display( GtkWindow *toplevel )
};
application_name = na_about_get_application_name();
- icon_name = na_about_get_icon_name();
copyright = na_about_get_copyright( FALSE );
i = 0;
@@ -103,7 +102,7 @@ na_about_display( GtkWindow *toplevel )
"copyright", copyright,
"documenters", documenters,
"license", license_i18n->str,
- "logo-icon-name", icon_name,
+ "logo-icon-name", na_about_get_icon_name(),
"program-name", application_name,
"translator-credits", _( "The GNOME Translation Project <gnome-i18n gnome org>" ),
"version", PACKAGE_VERSION,
@@ -114,7 +113,6 @@ na_about_display( GtkWindow *toplevel )
g_free( application_name );
g_string_free( license_i18n, TRUE );
g_free( copyright );
- g_free( icon_name );
}
/*
@@ -133,13 +131,16 @@ na_about_get_application_name( void )
/*
* 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.
+ * Returns: the name of the default icon for the application.
+ *
+ * This name is owned by the package, and should not be released by the caller.
+ *
+ * cf. Makefile: PACKAGE = nautilus-actions
*/
-gchar *
+const gchar *
na_about_get_icon_name( void )
{
- return( g_strdup( PACKAGE ));
+ return( PACKAGE );
}
/*
diff --git a/src/core/na-about.h b/src/core/na-about.h
index 99d6c77..075c1f8 100644
--- a/src/core/na-about.h
+++ b/src/core/na-about.h
@@ -43,11 +43,11 @@
G_BEGIN_DECLS
-void na_about_display( GtkWindow *parent );
+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 );
+gchar *na_about_get_application_name( void );
+const gchar *na_about_get_icon_name( void );
+gchar *na_about_get_copyright( gboolean console );
G_END_DECLS
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 3191928..021e4ca 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -871,7 +871,6 @@ create_root_menu( NautilusActions *plugin, GList *menu )
static const gchar *thisfn = "nautilus_actions_create_root_menu";
GList *nautilus_menu;
NautilusMenuItem *root_item;
- gchar *icon;
g_debug( "%s: plugin=%p, menu=%p (%d items)",
thisfn, ( void * ) plugin, ( void * ) menu, g_list_length( menu ));
@@ -880,16 +879,15 @@ create_root_menu( NautilusActions *plugin, GList *menu )
return( NULL );
}
- icon = na_about_get_icon_name();
- root_item = nautilus_menu_item_new( "NautilusActionsExtensions",
- /* i18n: label of an automagic root submenu */
- _( "Nautilus-Actions actions" ),
- /* i18n: tooltip of an automagic root submenu */
- _( "A submenu which embeds the currently available Nautilus-Actions actions and menus" ),
- icon );
+ root_item = nautilus_menu_item_new(
+ "NautilusActionsExtensions",
+ /* i18n: label of an automagic root submenu */
+ _( "Nautilus-Actions actions" ),
+ /* i18n: tooltip of an automagic root submenu */
+ _( "A submenu which embeds the currently available Nautilus-Actions actions and menus" ),
+ na_about_get_icon_name());
attach_submenu_to_item( root_item, menu );
nautilus_menu = g_list_append( NULL, root_item );
- g_free( icon );
return( nautilus_menu );
}
@@ -907,7 +905,6 @@ add_about_item( NautilusActions *plugin, GList *menu )
NautilusMenuItem *root_item;
NautilusMenuItem *about_item;
NautilusMenu *first;
- gchar *icon;
g_debug( "%s: plugin=%p, menu=%p (%d items)",
thisfn, ( void * ) plugin, ( void * ) menu, g_list_length( menu ));
@@ -929,23 +926,21 @@ add_about_item( NautilusActions *plugin, GList *menu )
}
if( have_root_menu ){
- icon = na_about_get_icon_name();
-
- about_item = nautilus_menu_item_new( "AboutNautilusActions",
- _( "About Nautilus-Actions" ),
- _( "Display some informations about Nautilus-Actions" ),
- icon );
-
- g_signal_connect_data( about_item,
- "activate",
- G_CALLBACK( execute_about ),
- plugin,
- NULL,
- 0 );
+ about_item = nautilus_menu_item_new(
+ "AboutNautilusActions",
+ _( "About Nautilus-Actions" ),
+ _( "Display some informations about Nautilus-Actions" ),
+ na_about_get_icon_name());
+
+ g_signal_connect_data(
+ about_item,
+ "activate",
+ G_CALLBACK( execute_about ),
+ plugin,
+ NULL,
+ 0 );
nautilus_menu_append_item( first, about_item );
-
- g_free( icon );
}
return( nautilus_menu );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]