[empathy] Center the 'smiley images' inside the menu items



commit 05687495cc78fe906ebe760e0f1fccaffc768bb0
Author: Kevin Haller <kevin haller outofbits com>
Date:   Thu Sep 11 22:56:37 2014 +0200

    Center the 'smiley images' inside the menu items
    
    Adds the #GtkImage widget to the menu item (act like #GtkBin) and sets the stylename 
'empathy-smiley-menu-item'.
    
    The style of the menu item can be changed with CSS (empathy.css > .empathy-smiley-menu-item).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736369

 data/empathy.css                        |    5 +++++
 libempathy-gtk/empathy-smiley-manager.c |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/data/empathy.css b/data/empathy.css
index 72a48ca..ee0c321 100644
--- a/data/empathy.css
+++ b/data/empathy.css
@@ -14,3 +14,8 @@
   -GtkButtonBox-child-internal-pad-x: 0;
   -GtkButtonBox-child-internal-pad-y: 0;
 }
+
+.empathy-smiley-menu-item
+{
+  padding: 8px 12px;
+}
diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c
index bc4b44d..d63763d 100644
--- a/libempathy-gtk/empathy-smiley-manager.c
+++ b/libempathy-gtk/empathy-smiley-manager.c
@@ -490,9 +490,10 @@ empathy_smiley_menu_new (EmpathySmileyManager *manager,
                smiley = l->data;
                image = gtk_image_new_from_pixbuf (smiley->pixbuf);
 
-               item = gtk_image_menu_item_new_with_label ("");
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-               gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
+               item = gtk_image_menu_item_new ();
+               gtk_style_context_add_class (gtk_widget_get_style_context (item),
+                       "empathy-smiley-menu-item");
+               gtk_container_add (GTK_CONTAINER (item), image);
 
                gtk_menu_attach (GTK_MENU (menu), item,
                                 x, x + 1, y, y + 1);


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