summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/theme/mate-panel.css3
-rw-r--r--mate-panel/libpanel-util/panel-gtk.c43
2 files changed, 44 insertions, 2 deletions
diff --git a/data/theme/mate-panel.css b/data/theme/mate-panel.css
index bfa890d1..e53950d2 100644
--- a/data/theme/mate-panel.css
+++ b/data/theme/mate-panel.css
@@ -8,3 +8,6 @@ MatePanelAppletFrameDBus > MatePanelAppletFrameDBus {
background-size: 12px 22px;
}
+.mate-panel-menu-icon-box{
+ min-width: 16px;
+}
diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c
index 4ac3e9bc..47cf17db 100644
--- a/mate-panel/libpanel-util/panel-gtk.c
+++ b/mate-panel/libpanel-util/panel-gtk.c
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include "panel-gtk.h"
+#include "panel-cleanup.h"
/*
* Originally based on code from panel-properties-dialog.c. This part of the
@@ -33,6 +34,11 @@
* Copyright (C) 2005 Vincent Untz <[email protected]>
*/
+/*There should be only one icon_settings object for the whole panel
+ *So we need a global variable here
+ */
+static GSettings *icon_settings = NULL;
+
static void
panel_gtk_file_chooser_preview_update (GtkFileChooser *chooser,
gpointer data)
@@ -160,12 +166,27 @@ panel_file_chooser_dialog_new (const gchar *title,
return result;
}
+
+static void
+ensure_icon_settings (void)
+{
+ if (icon_settings != NULL)
+ return;
+
+ icon_settings = g_settings_new ("org.mate.interface");
+
+ panel_cleanup_register (panel_cleanup_unref_and_nullify,
+ &icon_settings);
+}
+
GtkWidget *
panel_image_menu_item_new_from_icon (const gchar *icon_name,
const gchar *label_name)
{
GtkWidget *icon;
+ GtkStyleContext *context;
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ GtkWidget *icon_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
if (icon_name)
icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
@@ -175,12 +196,20 @@ panel_image_menu_item_new_from_icon (const gchar *icon_name,
GtkWidget *label_menu = gtk_label_new_with_mnemonic (g_strconcat (label_name, " ", NULL));
GtkWidget *menuitem = gtk_menu_item_new ();
- gtk_container_add (GTK_CONTAINER (box), icon);
+ context = gtk_widget_get_style_context (GTK_WIDGET(icon_box));
+ gtk_style_context_add_class(context,"mate-panel-menu-icon-box");
+
+ gtk_container_add (GTK_CONTAINER (icon_box), icon);
+ gtk_container_add (GTK_CONTAINER (box), icon_box);
gtk_container_add (GTK_CONTAINER (box), label_menu);
gtk_container_add (GTK_CONTAINER (menuitem), box);
gtk_widget_show_all (menuitem);
+ ensure_icon_settings();
+ g_settings_bind (icon_settings, "menus-have-icons", icon, "visible",
+ G_SETTINGS_BIND_GET);
+
return menuitem;
}
@@ -189,7 +218,9 @@ panel_image_menu_item_new_from_gicon (GIcon *gicon,
const gchar *label_name)
{
GtkWidget *icon;
+ GtkStyleContext *context;
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ GtkWidget *icon_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
if (gicon)
icon = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_MENU);
@@ -198,13 +229,21 @@ panel_image_menu_item_new_from_gicon (GIcon *gicon,
GtkWidget *label_menu = gtk_label_new_with_mnemonic (g_strconcat (label_name, " ", NULL));
GtkWidget *menuitem = gtk_menu_item_new ();
+
+ context = gtk_widget_get_style_context (GTK_WIDGET(icon_box));
+ gtk_style_context_add_class(context,"mate-panel-menu-icon-box");
- gtk_container_add (GTK_CONTAINER (box), icon);
+ gtk_container_add (GTK_CONTAINER (icon_box), icon);
+ gtk_container_add (GTK_CONTAINER (box), icon_box);
gtk_container_add (GTK_CONTAINER (box), label_menu);
gtk_container_add (GTK_CONTAINER (menuitem), box);
gtk_widget_show_all (menuitem);
+ ensure_icon_settings();
+ g_settings_bind (icon_settings, "menus-have-icons", icon, "visible",
+ G_SETTINGS_BIND_GET);
+
return menuitem;
}