[gnome-panel] [panel] Always show icons for categories in the applications menu
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Always show icons for categories in the applications menu
- Date: Tue, 8 Sep 2009 00:09:52 +0000 (UTC)
commit 19e8d22d3202964a8f74f102a5c0228590b8aec5
Author: Vincent Untz <vuntz gnome org>
Date: Tue Sep 8 02:05:07 2009 +0200
[panel] Always show icons for categories in the applications menu
After feedback from distributors, users and people from the usability
team, it appears that it's better to keep the icons there. The rationale
is that the categories are dynamic since they can appear/disappear
depending on the applications you install.
Note that Preferences/Administration in the System menu don't have icons
because they are static.
gnome-panel/menu.c | 29 ++++++++++++++++++++++++++---
gnome-panel/menu.h | 3 ++-
gnome-panel/panel-menu-bar.c | 2 +-
gnome-panel/panel-menu-button.c | 3 ++-
gnome-panel/panel-menu-items.c | 2 +-
5 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/gnome-panel/menu.c b/gnome-panel/menu.c
index 393b454..e2ce55a 100644
--- a/gnome-panel/menu.c
+++ b/gnome-panel/menu.c
@@ -1388,8 +1388,16 @@ create_submenu_entry (GtkWidget *menu,
GMenuTreeDirectory *directory)
{
GtkWidget *menuitem;
+ gboolean force_categories_icon;
+
+ force_categories_icon = g_object_get_data (G_OBJECT (menu),
+ "panel-menu-force-icon-for-categories") != NULL;
+
+ if (force_categories_icon)
+ menuitem = panel_image_menu_item_new ();
+ else
+ menuitem = gtk_image_menu_item_new ();
- menuitem = gtk_image_menu_item_new ();
panel_load_menu_image_deferred (menuitem,
panel_menu_icon_get_size (),
NULL, NULL,
@@ -1415,6 +1423,7 @@ create_submenu (GtkWidget *menu,
{
GtkWidget *menuitem;
GtkWidget *submenu;
+ gboolean force_categories_icon;
if (alias_directory)
menuitem = create_submenu_entry (menu, alias_directory);
@@ -1424,6 +1433,13 @@ create_submenu (GtkWidget *menu,
submenu = create_fake_menu (directory);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+
+ /* Keep the infor that we force (or not) the icons to be visible */
+ force_categories_icon = g_object_get_data (G_OBJECT (menu),
+ "panel-menu-force-icon-for-categories") != NULL;
+ g_object_set_data (G_OBJECT (submenu),
+ "panel-menu-force-icon-for-categories",
+ GINT_TO_POINTER (force_categories_icon));
}
static void
@@ -1598,7 +1614,8 @@ remove_gmenu_tree_monitor (GtkWidget *menu,
GtkWidget *
create_applications_menu (const char *menu_file,
- const char *menu_path)
+ const char *menu_path,
+ gboolean always_show_image)
{
GMenuTree *tree;
GtkWidget *menu;
@@ -1606,6 +1623,11 @@ create_applications_menu (const char *menu_file,
menu = create_empty_menu ();
+ if (always_show_image)
+ g_object_set_data (G_OBJECT (menu),
+ "panel-menu-force-icon-for-categories",
+ GINT_TO_POINTER (TRUE));
+
tree = gmenu_tree_lookup (menu_file, GMENU_TREE_FLAGS_NONE);
gmenu_tree_set_sort_key (tree, GMENU_TREE_SORT_DISPLAY_NAME);
@@ -1760,7 +1782,8 @@ create_main_menu (PanelWidget *panel)
{
GtkWidget *main_menu;
- main_menu = create_applications_menu ("applications.menu", NULL);
+ main_menu = create_applications_menu ("applications.menu", NULL, TRUE);
+
g_object_set_data (G_OBJECT (main_menu), "menu_panel", panel);
/* FIXME need to update the panel on parent_set */
diff --git a/gnome-panel/menu.h b/gnome-panel/menu.h
index 5c9b48d..667f463 100644
--- a/gnome-panel/menu.h
+++ b/gnome-panel/menu.h
@@ -43,7 +43,8 @@ void setup_menu_item_with_icon (GtkWidget *item,
GtkWidget *create_empty_menu (void);
GtkWidget *create_applications_menu (const char *menu_file,
- const char *menu_path);
+ const char *menu_path,
+ gboolean always_show_image);
GtkWidget *create_main_menu (PanelWidget *panel);
void setup_internal_applet_drag (GtkWidget *menuitem,
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index 190ceaa..e1a7ad9 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -140,7 +140,7 @@ panel_menu_bar_init (PanelMenuBar *menubar)
menubar->priv->info = NULL;
- menubar->priv->applications_menu = create_applications_menu ("applications.menu", NULL);
+ menubar->priv->applications_menu = create_applications_menu ("applications.menu", NULL, TRUE);
menubar->priv->applications_item = panel_image_menu_item_new ();
gtk_menu_item_set_label (GTK_MENU_ITEM (menubar->priv->applications_item),
diff --git a/gnome-panel/panel-menu-button.c b/gnome-panel/panel-menu-button.c
index 5153209..e9676b3 100644
--- a/gnome-panel/panel-menu-button.c
+++ b/gnome-panel/panel-menu-button.c
@@ -386,7 +386,8 @@ panel_menu_button_create_menu (PanelMenuButton *button)
filename = panel_menu_path_root_to_filename (button->priv->path_root);
button->priv->menu = create_applications_menu (filename,
- button->priv->menu_path);
+ button->priv->menu_path,
+ TRUE);
} else
button->priv->menu = create_main_menu (panel_widget);
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 901bbeb..14eed46 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -1169,7 +1169,7 @@ panel_desktop_menu_item_create_menu (PanelDesktopMenuItem *desktop_item)
{
GtkWidget *desktop_menu;
- desktop_menu = create_applications_menu ("settings.menu", NULL);
+ desktop_menu = create_applications_menu ("settings.menu", NULL, FALSE);
g_object_set_data (G_OBJECT (desktop_menu),
"panel-menu-append-callback",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]