]> git.0d.be Git - empathy.git/commitdiff
Center the 'smiley images' inside the menu items
authorKevin Haller <kevin.haller@outofbits.com>
Thu, 11 Sep 2014 20:56:37 +0000 (22:56 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 12 Sep 2014 07:39:26 +0000 (09:39 +0200)
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
libempathy-gtk/empathy-smiley-manager.c

index 72a48caee08ddd42808bcab2df9a9951ba5c05bf..ee0c32170d71d64f47b9778551a5128969f8daca 100644 (file)
@@ -14,3 +14,8 @@
   -GtkButtonBox-child-internal-pad-x: 0;
   -GtkButtonBox-child-internal-pad-y: 0;
 }
+
+.empathy-smiley-menu-item
+{
+  padding: 8px 12px;
+}
index bc4b44d7364765504c3ee416f2934ca966fa6fa4..d63763d8933da270ef0fe846a95c1baaacd609ea 100644 (file)
@@ -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);