[nautilus-actions] Trying to fix display of stock icons in menus



commit c1e02b1767f3241a887d89882fa95a4e68e71638
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jul 31 17:05:48 2009 +0200

    Trying to fix display of stock icons in menus

 src/common/Makefile.am                   |    5 ++-
 src/common/na-gconf.c                    |    4 +-
 src/nact/nact-icommand-tab.c             |   11 ++++--
 src/nact/nact-imenubar.c                 |   58 +++++++++++++++++++----------
 src/nact/nautilus-actions-config-tool.ui |   27 --------------
 5 files changed, 52 insertions(+), 53 deletions(-)
---
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 0ae64ff..9110d1d 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -63,4 +63,7 @@ libnact_la_SOURCES = \
 	na-xml-writer.h								\
 	$(NULL)
 
-libnact_la_LIBADD = -lxml2 -luuid
+libnact_la_LIBADD = \
+	-lxml2										\
+	-luuid										\
+	$(NULL)
diff --git a/src/common/na-gconf.c b/src/common/na-gconf.c
index 5a1a3fc..403e02d 100644
--- a/src/common/na-gconf.c
+++ b/src/common/na-gconf.c
@@ -777,7 +777,7 @@ entry_to_notify( const GConfEntry *entry )
 
 			case GCONF_VALUE_BOOL:
 				npn->type = NA_PIVOT_BOOL;
-				npn->data = ( gpointer ) gconf_value_get_bool( value );
+				npn->data = GINT_TO_POINTER( gconf_value_get_bool( value ));
 				break;
 
 			case GCONF_VALUE_LIST:
@@ -856,7 +856,7 @@ search_for_bool( GSList *properties, const gchar *profile, const gchar *key, gbo
 		if( npn->type == NA_PIVOT_BOOL &&
 		  ( !profile || !g_ascii_strcasecmp( profile, npn->profile )) &&
 			!g_ascii_strcasecmp( key, npn->parm )){
-				*value = ( gboolean ) npn->data;
+				*value = GPOINTER_TO_INT( npn->data );
 				return( TRUE );
 		}
 	}
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 8b4c97a..bfc589e 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -175,6 +175,11 @@ nact_icommand_tab_initial_load( NactWindow *dialog )
 		guint context = gtk_statusbar_get_context_id( GTK_STATUSBAR( status_bar ), "nact-iaction-tab" );
 		set_status_context( dialog, context );
 	}
+
+	/* doesn't work under f10 */
+	GtkWidget *tab = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTabLabel" );
+	GtkWidget *widget = get_path_entry( dialog );
+	gtk_label_set_mnemonic_widget( GTK_LABEL( tab ), widget );
 }
 
 void
@@ -704,14 +709,14 @@ show_legend_dialog( NactWindow *window )
 	nact_iprefs_position_named_window( window, legend_dialog, IPREFS_LEGEND_DIALOG );
 	gtk_widget_show( GTK_WIDGET( legend_dialog ));
 
-	g_object_set_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE, ( gpointer ) TRUE );
+	g_object_set_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE, GINT_TO_POINTER( TRUE ));
 }
 
 static void
 hide_legend_dialog( NactWindow *window )
 {
 	GtkWindow *legend_dialog = get_legend_dialog( window );
-	gboolean is_visible = ( gboolean ) g_object_get_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE );
+	gboolean is_visible = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE ));
 
 	if( is_visible ){
 		g_assert( GTK_IS_WINDOW( legend_dialog ));
@@ -724,7 +729,7 @@ hide_legend_dialog( NactWindow *window )
 		GtkButton *legend_button = get_legend_button( window );
 		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( legend_button ), FALSE );
 
-		g_object_set_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE, ( gpointer ) FALSE );
+		g_object_set_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE, GINT_TO_POINTER( FALSE ));
 	}
 }
 
diff --git a/src/nact/nact-imenubar.c b/src/nact/nact-imenubar.c
index 73705a9..24079c5 100644
--- a/src/nact/nact-imenubar.c
+++ b/src/nact/nact-imenubar.c
@@ -208,6 +208,31 @@ nact_imenubar_init( NactMainWindow *window )
 	g_assert( NACT_IS_MAIN_WINDOW( window ));
 	g_assert( NACT_IS_IMENUBAR( window ));
 
+	/*static const gchar *menubar[] =
+			"<ui>"
+			"    <menubar>"
+			"        <menu action=\"FileMenu\">"
+			"            <menuitem action=\"NewActionItem\" />"
+			"            <menuitem action=\"NewProfileItem\" />"
+			"            <menuitem action=\"SaveItem\" />"
+			"            <menuitem action=\"QuitItem\" />"
+			"        </menu>"
+			"        <menu action=\"EditMenu\">"
+			"            <menuitem action=\"DuplicateItem\" />"
+			"            <menuitem action=\"DeleteItem\" />"
+			"            <menuitem action=\"ReloadActionsItem\" />"
+			"        </menu>"
+			"        <menu action=\"ToolsMenu\">"
+			"            <menuitem action=\"ImportItem\" />"
+			"            <menuitem action=\"ExportItem\" />"
+			"        </menu>"
+			"        <menu action=\"HelpMenu\">"
+			"            <menuitem action=\"HelpItem\" />"
+			"            <menuitem action=\"AboutItem\" />"
+			"        </menu>"
+			"    </menubar>"
+			"</ui>";*/
+
 	GtkWidget *vbox = base_window_get_widget( BASE_WINDOW( window ), "MenuBarVBox" );
 	GtkWidget *menubar= gtk_menu_bar_new();
 	gtk_container_add( GTK_CONTAINER( vbox ), menubar );
@@ -268,23 +293,21 @@ static void
 create_file_menu( NactMainWindow *window, GtkMenuBar *menubar )
 {
 	/* i18n: File menu */
-	GtkWidget *file = gtk_menu_item_new_with_label( _( "_File" ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( file ), TRUE );
+	GtkWidget *file = gtk_menu_item_new_with_mnemonic( _( "_File" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), file );
 	GtkWidget *menu = gtk_menu_new();
 	gtk_menu_item_set_submenu( GTK_MENU_ITEM( file ), menu );
 	nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( file ), "select", G_CALLBACK( on_file_selected ));
 
-	GtkWidget *item = gtk_image_menu_item_new_from_stock( GTK_STOCK_NEW, NULL );
 	/* i18n: 'New action' item in 'File' menu */
-	gtk_menu_item_set_label( GTK_MENU_ITEM( item ), _( "_New action" ));
+	GtkWidget *item = gtk_image_menu_item_new_with_mnemonic( _( "_New action" ));
+	gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( item ), gtk_image_new_from_stock( GTK_STOCK_NEW, GTK_ICON_SIZE_MENU ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 	signal_connect( window, item, G_CALLBACK( on_new_action_activated ), G_CALLBACK( on_new_action_selected ));
 
 	/* i18n: 'New profile' item in 'File' menu */
-	item = gtk_image_menu_item_new_with_label( _( "New _profile" ));
+	item = gtk_image_menu_item_new_with_mnemonic( _( "New _profile" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
 	set_new_profile_item( NACT_WINDOW( window ), item );
 	signal_connect( window, item, G_CALLBACK( on_new_profile_activated ), G_CALLBACK( on_new_profile_selected ));
 
@@ -305,16 +328,15 @@ static void
 create_edit_menu( NactMainWindow *window, GtkMenuBar *menubar )
 {
 	/* i18n: Edit menu */
-	GtkWidget *edit = gtk_menu_item_new_with_label( _( "_Edit" ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( edit ), TRUE );
+	GtkWidget *edit = gtk_menu_item_new_with_mnemonic( _( "_Edit" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), edit );
 	GtkWidget *menu = gtk_menu_new();
 	gtk_menu_item_set_submenu( GTK_MENU_ITEM( edit ), menu );
 	nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( edit ), "select", G_CALLBACK( on_edit_selected ));
 
-	GtkWidget *item = gtk_image_menu_item_new_from_stock( GTK_STOCK_COPY, NULL );
 	/* i18n: Duplicate item in Edit menu */
-	gtk_menu_item_set_label( GTK_MENU_ITEM( item ), _( "D_uplicate" ));
+	GtkWidget *item = gtk_image_menu_item_new_with_mnemonic( _( "D_uplicate" ));
+	gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( item ), gtk_image_new_from_stock( GTK_STOCK_COPY, GTK_ICON_SIZE_MENU ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 	set_duplicate_item( NACT_WINDOW( window ), item );
 	signal_connect( window, item, G_CALLBACK( on_duplicate_activated ), G_CALLBACK( on_duplicate_selected ));
@@ -328,8 +350,7 @@ create_edit_menu( NactMainWindow *window, GtkMenuBar *menubar )
 	item = gtk_separator_menu_item_new();
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 
-	item = gtk_image_menu_item_new_with_label( _( "_Reload the list of actions" ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
+	item = gtk_image_menu_item_new_with_mnemonic( _( "_Reload the list of actions" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 	signal_connect( window, item, G_CALLBACK( on_reload_activated ), G_CALLBACK( on_reload_selected ));
 }
@@ -338,22 +359,20 @@ static void
 create_tools_menu( NactMainWindow *window, GtkMenuBar *menubar )
 {
 	/* i18n: Tools menu */
-	GtkWidget *tools = gtk_menu_item_new_with_label( _( "_Tools" ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( tools ), TRUE );
+	GtkWidget *tools = gtk_menu_item_new_with_mnemonic( _( "_Tools" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), tools );
 	GtkWidget *menu = gtk_menu_new();
 	gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools ), menu );
 	nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( tools ), "select", G_CALLBACK( on_tools_selected ));
 
 	/* i18n: Import item in Tools menu */
-	GtkWidget *item = gtk_image_menu_item_new_with_label( _( "_Import assistant..." ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
+	GtkWidget *item = gtk_image_menu_item_new_with_mnemonic( _( "_Import assistant..." ));
+	gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( item ), gtk_image_new_from_stock( GTK_STOCK_CONVERT, GTK_ICON_SIZE_MENU ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 	signal_connect( window, item, G_CALLBACK( on_import_activated ), G_CALLBACK( on_import_selected ));
 
 	/* i18n: Export item in Tools menu */
-	item = gtk_image_menu_item_new_with_label( _( "E_xport assistant..." ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
+	item = gtk_image_menu_item_new_with_mnemonic( _( "E_xport assistant..." ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
 	set_export_item( NACT_WINDOW( window ), item );
 	signal_connect( window, item, G_CALLBACK( on_export_activated ), G_CALLBACK( on_export_selected ));
@@ -363,8 +382,7 @@ static void
 create_help_menu( NactMainWindow *window, GtkMenuBar *menubar )
 {
 	/* i18n: Help menu */
-	GtkWidget *help = gtk_menu_item_new_with_label( _( "_Help" ));
-	gtk_menu_item_set_use_underline( GTK_MENU_ITEM( help ), TRUE );
+	GtkWidget *help = gtk_menu_item_new_with_mnemonic( _( "_Help" ));
 	gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), help );
 	GtkWidget *menu = gtk_menu_new();
 	gtk_menu_item_set_submenu( GTK_MENU_ITEM( help ), menu );
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index f8c7a29..8d6dcd2 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -6,11 +6,9 @@
     <child>
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <child>
           <object class="GtkVBox" id="MenuBarVBox">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <placeholder/>
             </child>
@@ -33,7 +31,6 @@
         <child>
           <object class="GtkVBox" id="vbox16">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkHPaned" id="MainPaned">
                 <property name="visible">True</property>
@@ -41,7 +38,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox2">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkLabel" id="ActionsListLabel">
                         <property name="visible">True</property>
@@ -90,11 +86,9 @@
                       <object class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkVBox" id="vbox4">
                             <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
                             <property name="spacing">10</property>
                             <child>
                               <object class="GtkLabel" id="label2">
@@ -267,16 +261,13 @@
                       <object class="GtkVBox" id="vbox5">
                         <property name="visible">True</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkVBox" id="vbox6">
                             <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
                             <property name="spacing">10</property>
                             <child>
                               <object class="GtkVBox" id="vbox7">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">10</property>
                                 <child>
                                   <object class="GtkLabel" id="label10">
@@ -327,7 +318,6 @@
                             <child>
                               <object class="GtkVBox" id="vbox8">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">10</property>
                                 <child>
                                   <object class="GtkLabel" id="label12">
@@ -498,16 +488,13 @@ Defining several profiles lets you have several commands, each applying with a d
                       <object class="GtkVBox" id="vbox9">
                         <property name="visible">True</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkVBox" id="vbox10">
                             <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
                             <property name="spacing">10</property>
                             <child>
                               <object class="GtkVBox" id="vbox11">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">10</property>
                                 <child>
                                   <object class="GtkLabel" id="label16">
@@ -609,7 +596,6 @@ Defining several profiles lets you have several commands, each applying with a d
                             <child>
                               <object class="GtkVBox" id="vbox12">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">10</property>
                                 <child>
                                   <object class="GtkLabel" id="label19">
@@ -683,7 +669,6 @@ Defining several profiles lets you have several commands, each applying with a d
                             <child>
                               <object class="GtkVBox" id="vbox13">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <child>
                                   <object class="GtkCheckButton" id="ConditionsMultipleButton">
                                     <property name="label" translatable="yes">Appears if selection has multiple files or folders</property>
@@ -730,12 +715,10 @@ Defining several profiles lets you have several commands, each applying with a d
                       <object class="GtkVBox" id="vbox14">
                         <property name="visible">True</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkVBox" id="vbox340">
                             <property name="visible">True</property>
                             <property name="border_width">12</property>
-                            <property name="orientation">vertical</property>
                             <property name="spacing">10</property>
                             <child>
                               <object class="GtkLabel" id="label46">
@@ -778,7 +761,6 @@ Defining several profiles lets you have several commands, each applying with a d
                                 <child>
                                   <object class="GtkVBox" id="vbox345">
                                     <property name="visible">True</property>
-                                    <property name="orientation">vertical</property>
                                     <property name="spacing">6</property>
                                     <child>
                                       <object class="GtkButton" id="AddSchemeButton">
@@ -915,7 +897,6 @@ Defining several profiles lets you have several commands, each applying with a d
     <child>
       <object class="GtkFileChooserWidget" id="filechooserwidget1">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="select_multiple">True</property>
         <property name="use_preview_label">False</property>
         <property name="preview_widget_active">False</property>
@@ -959,7 +940,6 @@ Defining several profiles lets you have several commands, each applying with a d
         <child>
           <object class="GtkVBox" id="vbox5">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkLabel" id="ActionsListLabel">
                 <property name="visible">True</property>
@@ -1023,7 +1003,6 @@ to extend a selection.</property>
         <child>
           <object class="GtkFileChooserWidget" id="ExportFolderChooser">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <property name="use_preview_label">False</property>
             <property name="action">select-folder</property>
             <property name="preview_widget_active">False</property>
@@ -1042,12 +1021,10 @@ to extend a selection.</property>
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
         <property name="border_width">10</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">10</property>
         <child>
           <object class="GtkVBox" id="vbox2">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkRadioButton" id="ExportSchemaV1Button">
                 <property name="label" translatable="yes">Export as a GConf schema file with full key descriptions.</property>
@@ -1106,7 +1083,6 @@ The exported file may later be imported via :
         <child>
           <object class="GtkVBox" id="vbox3">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkRadioButton" id="ExportSchemaV2Button">
                 <property name="label" translatable="yes">Export as a light GConf schema file.</property>
@@ -1166,7 +1142,6 @@ The exported file may later be imported via :
         <child>
           <object class="GtkVBox" id="vbox4">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <child>
               <object class="GtkRadioButton" id="ExportGConfDumpButton">
                 <property name="label" translatable="yes">Export as a GConf dump file.</property>
@@ -1257,7 +1232,6 @@ The exported file may later be imported via :
       <object class="GtkVBox" id="vbox11">
         <property name="visible">True</property>
         <property name="border_width">12</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
           <object class="GtkHBox" id="hbox11">
@@ -1306,7 +1280,6 @@ The exported file may later be imported via :
         <child>
           <object class="GtkVBox" id="vbox397">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkLabel" id="label17">



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