aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-11 23:49:27 -0600
committerTed Gould <ted@gould.cx>2010-01-11 23:49:27 -0600
commit942727aba499a4d3f4a17fcf6bbe70b9ce7fd7eb (patch)
treea3d4d4404e86bcba1f5a4ad69ff4e36fc5bfb943
parent011c5282901f61042a7b2b783470c048116f3a74 (diff)
parent40006f0ef5e265c62a3ddd685bc56e7608aef86c (diff)
downloadlibdbusmenu-942727aba499a4d3f4a17fcf6bbe70b9ce7fd7eb.tar.gz
libdbusmenu-942727aba499a4d3f4a17fcf6bbe70b9ce7fd7eb.tar.bz2
libdbusmenu-942727aba499a4d3f4a17fcf6bbe70b9ce7fd7eb.zip
Fix to put a small amount of padding between the icon and the label.
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index f927556..3264e1d 100644
--- a/libdbusmenu-gtk/genericmenuitem.c
+++ b/libdbusmenu-gtk/genericmenuitem.c
@@ -143,6 +143,17 @@ set_label_helper (GtkWidget * widget, gpointer data)
return;
}
+/* A quick little function to grab the padding from the
+ style. It should be considered for caching when
+ optimizing. */
+static gint
+get_hpadding (GtkWidget * widget)
+{
+ gint padding = 0;
+ gtk_widget_style_get(widget, "horizontal-padding", &padding, NULL);
+ return padding;
+}
+
/* Set the label on the item */
static void
set_label (GtkMenuItem * menu_item, const gchar * label)
@@ -166,7 +177,7 @@ set_label (GtkMenuItem * menu_item, const gchar * label)
GtkWidget * hbox = gtk_hbox_new(FALSE, 0);
g_object_ref(child);
gtk_container_remove(GTK_CONTAINER(menu_item), child);
- gtk_box_pack_start(GTK_BOX(hbox), child, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), child, FALSE, FALSE, get_hpadding(GTK_WIDGET(menu_item)));
gtk_container_add(GTK_CONTAINER(menu_item), hbox);
gtk_widget_show(hbox);
g_object_unref(child);
@@ -190,7 +201,7 @@ set_label (GtkMenuItem * menu_item, const gchar * label)
if (child == NULL) {
gtk_container_add(GTK_CONTAINER(menu_item), GTK_WIDGET(labelw));
} else {
- gtk_box_pack_end(GTK_BOX(child), GTK_WIDGET(labelw), TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(child), GTK_WIDGET(labelw), TRUE, TRUE, get_hpadding(GTK_WIDGET(menu_item)));
}
} else {
/* Oh, just an update. No biggie. */
@@ -383,7 +394,7 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
GtkWidget * hbox = gtk_hbox_new(FALSE, 0);
g_object_ref(child);
gtk_container_remove(GTK_CONTAINER(menu_item), child);
- gtk_box_pack_end(GTK_BOX(hbox), child, TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(hbox), child, TRUE, TRUE, get_hpadding(GTK_WIDGET(menu_item)));
gtk_container_add(GTK_CONTAINER(menu_item), hbox);
gtk_widget_show(hbox);
g_object_unref(child);
@@ -405,7 +416,7 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
if (child == NULL) {
gtk_container_add(GTK_CONTAINER(menu_item), GTK_WIDGET(image));
} else {
- gtk_box_pack_start(GTK_BOX(child), GTK_WIDGET(image), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(child), GTK_WIDGET(image), FALSE, FALSE, get_hpadding(GTK_WIDGET(menu_item)));
}
gtk_widget_show(image);