aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c13
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c10
-rw-r--r--libdbusmenu-gtk/parser.c9
3 files changed, 27 insertions, 5 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 38b6a75..533764a 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -505,7 +505,6 @@ menu_item_stop_activating(DbusmenuMenuitem * mi)
guint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent),
data_idle_close_id));
if (id > 0) {
- g_source_remove(id);
g_object_set_data(G_OBJECT(parent), data_idle_close_id,
GINT_TO_POINTER(0));
should_close = TRUE;
@@ -575,6 +574,14 @@ close_in_idle (DbusmenuMenuitem * mi)
}
static void
+cancel_idle_close_id (gpointer data)
+{
+ guint id = GPOINTER_TO_INT(data);
+ if (id > 0)
+ g_source_remove(id);
+}
+
+static void
submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi)
{
if (gtk_widget_get_visible (menu)) {
@@ -591,8 +598,8 @@ submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuite
data_idle_close_id));
if (id == 0) {
id = g_idle_add((GSourceFunc)close_in_idle, mi);
- g_object_set_data(G_OBJECT(mi), data_idle_close_id,
- GINT_TO_POINTER(id));
+ g_object_set_data_full(G_OBJECT(mi), data_idle_close_id,
+ GINT_TO_POINTER(id), cancel_idle_close_id);
}
}
}
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index ef77a2e..098de67 100644
--- a/libdbusmenu-gtk/genericmenuitem.c
+++ b/libdbusmenu-gtk/genericmenuitem.c
@@ -241,7 +241,12 @@ set_label (GtkMenuItem * menu_item, const gchar * in_label)
/* We need to put the child into a new box and
make the box the child of the menu item. Basically
we're inserting a box in the middle. */
+ #ifdef HAVE_GTK3
+ GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,
+ get_toggle_space(GTK_WIDGET(menu_item)));
+ #else
GtkWidget * hbox = gtk_hbox_new(FALSE, get_toggle_space(GTK_WIDGET(menu_item)));
+ #endif
g_object_ref(child);
gtk_container_remove(GTK_CONTAINER(menu_item), child);
gtk_box_pack_start(GTK_BOX(hbox), child, FALSE, FALSE, 0);
@@ -457,7 +462,12 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
/* We need to put the child into a new box and
make the box the child of the menu item. Basically
we're inserting a box in the middle. */
+ #ifdef HAVE_GTK3
+ GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,
+ get_toggle_space(GTK_WIDGET(menu_item)));
+ #else
GtkWidget * hbox = gtk_hbox_new(FALSE, get_toggle_space(GTK_WIDGET(menu_item)));
+ #endif
g_object_ref(child);
gtk_container_remove(GTK_CONTAINER(menu_item), child);
gtk_box_pack_end(GTK_BOX(hbox), child, TRUE, TRUE, 0);
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index e988c62..92932c5 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -1059,8 +1059,13 @@ widget_notify_cb (GtkWidget *widget,
DBUSMENU_MENUITEM_PROP_VISIBLE,
g_value_get_boolean (&prop_value));
}
- else if (pspec->name == g_intern_static_string ("image") ||
- pspec->name == g_intern_static_string ("always-show-image"))
+ else if (pspec->name == g_intern_static_string ("always-show-image"))
+ {
+ GtkWidget *image = NULL;
+ g_object_get(widget, "image", &image, NULL);
+ update_icon (child, GTK_IMAGE(image));
+ }
+ else if (pspec->name == g_intern_static_string ("image"))
{
GtkWidget *image;
image = GTK_WIDGET (g_value_get_object (&prop_value));