aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-01-26 13:50:22 -0600
committerTed Gould <ted@gould.cx>2012-01-26 13:50:22 -0600
commit8e1916d4a397b766f81f4ac426888971746d0484 (patch)
tree9f0f5340ad8b223c5dbea1e0ddf498053ecfbf68 /libdbusmenu-gtk
parent144708e6667818d48e3bbd9403e447079e8a5c56 (diff)
parent310990fdddef125e167e6ea28ab84d25110005b2 (diff)
downloadlibdbusmenu-8e1916d4a397b766f81f4ac426888971746d0484.tar.gz
libdbusmenu-8e1916d4a397b766f81f4ac426888971746d0484.tar.bz2
libdbusmenu-8e1916d4a397b766f81f4ac426888971746d0484.zip
Update to trunk
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/Makefile.am7
-rw-r--r--libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in2
-rw-r--r--libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in2
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c10
-rw-r--r--libdbusmenu-gtk/menuitem.c14
-rw-r--r--libdbusmenu-gtk/parser.c35
6 files changed, 44 insertions, 26 deletions
diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am
index b4564d1..b1ee91a 100644
--- a/libdbusmenu-gtk/Makefile.am
+++ b/libdbusmenu-gtk/Makefile.am
@@ -33,7 +33,7 @@ glib_enum_headers = $(srcdir)/genericmenuitem.h
# Include Directory
#####################
-libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-gtk$(VER)/
+libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-gtk$(VER)-0.4/libdbusmenu-gtk/
libdbusmenu_gtkinclude_HEADERS = \
dbusmenu-gtk.h \
@@ -62,7 +62,10 @@ libdbusmenu_gtk_la_LDFLAGS = \
-export-symbols-regex "^[^_].*"
libdbusmenu_gtk_la_CFLAGS = \
- $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) -Wall -Werror -DG_DISABLE_DEPRECATED -DG_LOG_DOMAIN="\"LIBDBUSMENU-GTK\""
+ $(DBUSMENUGTK_CFLAGS) \
+ -I$(top_srcdir) \
+ -Wall -Werror -Wno-error=deprecated-declarations \
+ -DG_LOG_DOMAIN="\"LIBDBUSMENU-GTK\""
libdbusmenu_gtk_la_LIBADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
diff --git a/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in
index 9a1b460..cae4c10 100644
--- a/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in
+++ b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in
@@ -4,7 +4,7 @@ libdir=@libdir@
bindir=@bindir@
includedir=@includedir@
-Cflags: -I${includedir}/libdbusmenu-0.4
+Cflags: -I${includedir}/libdbusmenu-gtk-0.4
Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-2.0
Libs: -L${libdir} -ldbusmenu-gtk
diff --git a/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in
index c297db3..ba4c1aa 100644
--- a/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in
+++ b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in
@@ -4,7 +4,7 @@ libdir=@libdir@
bindir=@bindir@
includedir=@includedir@
-Cflags: -I${includedir}/libdbusmenu-0.4
+Cflags: -I${includedir}/libdbusmenu-gtk3-0.4
Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-3.0
Libs: -L${libdir} -ldbusmenu-gtk3
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/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 0f511bc..19ea1a0 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -66,11 +66,9 @@ dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar *
return FALSE;
}
- gchar * prop_str = g_base64_encode((guchar *)png_data, png_data_len);
gboolean propreturn = FALSE;
- propreturn = dbusmenu_menuitem_property_set(menuitem, property, prop_str);
+ propreturn = dbusmenu_menuitem_property_set_byte_array(menuitem, property, (guchar *)png_data, png_data_len);
- g_free(prop_str);
g_free(png_data);
return propreturn;
@@ -94,20 +92,17 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar *
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(menuitem), NULL);
g_return_val_if_fail(property != NULL && property[0] != '\0', NULL);
- const gchar * value = dbusmenu_menuitem_property_get(menuitem, property);
+ gsize length = 0;
+ const guchar * icondata = dbusmenu_menuitem_property_get_byte_array(menuitem, property, &length);
/* There is no icon */
- if (value == NULL || value[0] == '\0') {
+ if (length == 0) {
return NULL;
}
-
- gsize length = 0;
- guchar * icondata = g_base64_decode(value, &length);
GInputStream * input = g_memory_input_stream_new_from_data(icondata, length, NULL);
if (input == NULL) {
g_warning("Cound not create input stream from icon property data");
- g_free(icondata);
return NULL;
}
@@ -120,7 +115,6 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar *
}
g_object_unref(input);
- g_free(icondata);
return icon;
}
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 92932c5..d222f10 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -66,10 +66,13 @@ static void image_notify_cb (GtkWidget * widget,
static void action_notify_cb (GtkAction * action,
GParamSpec * pspec,
gpointer data);
-static void child_added_cb (GtkContainer * menu,
+static void item_inserted_cb (GtkContainer * menu,
GtkWidget * widget,
+#ifdef HAVE_GTK3
+ gint position,
+#endif
gpointer data);
-static void child_removed_cb (GtkContainer * menu,
+static void item_removed_cb (GtkContainer * menu,
GtkWidget * widget,
gpointer data);
static void theme_changed_cb (GtkIconTheme * theme,
@@ -184,9 +187,9 @@ parse_data_free (gpointer data)
if (pdata != NULL && pdata->shell != NULL) {
g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, G_CALLBACK(child_added_cb), NULL);
+ 0, 0, NULL, G_CALLBACK(item_inserted_cb), NULL);
g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, G_CALLBACK(child_removed_cb), NULL);
+ 0, 0, NULL, G_CALLBACK(item_removed_cb), NULL);
g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell);
}
@@ -290,12 +293,16 @@ watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)
pdata->shell = menu;
g_signal_connect (G_OBJECT (menu),
- "child-added",
- G_CALLBACK (child_added_cb),
+#ifdef HAVE_GTK3
+ "insert",
+#else
+ "child-added"
+#endif
+ G_CALLBACK (item_inserted_cb),
mi);
g_signal_connect (G_OBJECT (menu),
- "child-removed",
- G_CALLBACK (child_removed_cb),
+ "remove",
+ G_CALLBACK (item_removed_cb),
mi);
g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell);
@@ -1137,7 +1144,12 @@ widget_add_cb (GtkWidget *widget,
/* A child item was added to a menu we're watching. Let's try to integrate it. */
static void
-child_added_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
+item_inserted_cb (GtkContainer *menu,
+ GtkWidget *widget,
+#ifdef HAVE_GTK3
+ gint position,
+#endif
+ gpointer data)
{
DbusmenuMenuitem *menuitem = (DbusmenuMenuitem *)data;
@@ -1152,9 +1164,9 @@ child_added_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
parse_menu_structure_helper(widget, &recurse);
}
-/* A child item was added to a menu we're watching. Let's try to integrate it. */
+/* A child item was removed from a menu we're watching. */
static void
-child_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
+item_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
{
gpointer pmi = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM);
if (pmi == NULL) {
@@ -1216,4 +1228,3 @@ should_show_image (GtkImage *image)
return FALSE;
}
-