aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-05-27 11:36:00 -0500
committerTed Gould <ted@gould.cx>2010-05-27 11:36:00 -0500
commit77dfdb6c174eed409e8060fd08f6e0bd50d8e9ec (patch)
treeb86c7d1a4376b377429437912c4d1fc90c91d46b /libdbusmenu-gtk
parent187a33539569163ee953903010169356b8d57beb (diff)
parent7f65b44564cda33de94688b35f0b191fedea1bf8 (diff)
downloadlibdbusmenu-77dfdb6c174eed409e8060fd08f6e0bd50d8e9ec.tar.gz
libdbusmenu-77dfdb6c174eed409e8060fd08f6e0bd50d8e9ec.tar.bz2
libdbusmenu-77dfdb6c174eed409e8060fd08f6e0bd50d8e9ec.zip
Import upstream version 0.3.0
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/Makefile.am9
-rw-r--r--libdbusmenu-gtk/Makefile.in10
-rw-r--r--libdbusmenu-gtk/client.c29
-rw-r--r--libdbusmenu-gtk/client.h1
-rw-r--r--libdbusmenu-gtk/menu.c6
5 files changed, 43 insertions, 12 deletions
diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am
index 9cc557c..2be63b7 100644
--- a/libdbusmenu-gtk/Makefile.am
+++ b/libdbusmenu-gtk/Makefile.am
@@ -45,7 +45,10 @@ pkgconfigdir = $(libdir)/pkgconfig
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --add-include-path=$(top_builddir)/libdbusmenu-glib
+INTROSPECTION_SCANNER_ARGS = \
+ --add-include-path=$(srcdir) \
+ --add-include-path=$(top_builddir)/libdbusmenu-glib \
+ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources))
INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib
if HAVE_INTROSPECTION
@@ -56,7 +59,7 @@ DbusmenuGtk-0.2.gir: libdbusmenu-gtk.la
DbusmenuGtk_0_2_gir_INCLUDES = \
GObject-2.0 \
Gtk-2.0 \
- DbusmenuGlib-0.2
+ Dbusmenu-Glib-0.2
DbusmenuGtk_0_2_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir)
DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk.la
DbusmenuGtk_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources))
@@ -87,7 +90,7 @@ DbusmenuGtk-0.2.vapi: DbusmenuGtk-0.2.tmp.gir Makefile.am
--pkg gdk-pixbuf-2.0 \
--pkg gtk+-2.0 \
--pkg atk \
- --pkg DbusmenuGlib-0.2 \
+ --pkg Dbusmenu-Glib-0.2 \
--vapidir=$(top_builddir)/libdbusmenu-glib \
$<
diff --git a/libdbusmenu-gtk/Makefile.in b/libdbusmenu-gtk/Makefile.in
index 771ba0a..f64ef95 100644
--- a/libdbusmenu-gtk/Makefile.in
+++ b/libdbusmenu-gtk/Makefile.in
@@ -316,13 +316,17 @@ libdbusmenu_gtk_la_LIBADD = \
pkgconfig_DATA = dbusmenu-gtk.pc
pkgconfigdir = $(libdir)/pkgconfig
INTROSPECTION_GIRS = $(am__append_1)
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --add-include-path=$(top_builddir)/libdbusmenu-glib
+INTROSPECTION_SCANNER_ARGS = \
+ --add-include-path=$(srcdir) \
+ --add-include-path=$(top_builddir)/libdbusmenu-glib \
+ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources))
+
INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib
@HAVE_INTROSPECTION_TRUE@introspection_sources = $(libdbusmenu_gtkinclude_HEADERS)
@HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_2_gir_INCLUDES = \
@HAVE_INTROSPECTION_TRUE@ GObject-2.0 \
@HAVE_INTROSPECTION_TRUE@ Gtk-2.0 \
-@HAVE_INTROSPECTION_TRUE@ DbusmenuGlib-0.2
+@HAVE_INTROSPECTION_TRUE@ Dbusmenu-Glib-0.2
@HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_2_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir)
@HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk.la
@@ -805,7 +809,7 @@ uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \
@HAVE_INTROSPECTION_TRUE@ --pkg gdk-pixbuf-2.0 \
@HAVE_INTROSPECTION_TRUE@ --pkg gtk+-2.0 \
@HAVE_INTROSPECTION_TRUE@ --pkg atk \
-@HAVE_INTROSPECTION_TRUE@ --pkg DbusmenuGlib-0.2 \
+@HAVE_INTROSPECTION_TRUE@ --pkg Dbusmenu-Glib-0.2 \
@HAVE_INTROSPECTION_TRUE@ --vapidir=$(top_builddir)/libdbusmenu-glib \
@HAVE_INTROSPECTION_TRUE@ $<
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 3de42fe..3bd0af6 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -308,7 +308,7 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem *
/* Oh, we're a child, let's deal with that */
if (parent != NULL) {
- new_child(parent, item, dbusmenu_menuitem_get_position(item, parent), DBUSMENU_GTKCLIENT(client));
+ new_child(parent, item, dbusmenu_menuitem_get_position_realized(item, parent), DBUSMENU_GTKCLIENT(client));
}
return;
@@ -335,7 +335,7 @@ new_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position, Dbus
}
GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
- gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);
+ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), dbusmenu_menuitem_get_position_realized(child, mi));
gtk_widget_show(GTK_WIDGET(menu));
return;
@@ -373,7 +373,7 @@ move_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint new, guint ol
}
GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
- gtk_menu_reorder_child(GTK_MENU(ann_menu), GTK_WIDGET(childmi), new);
+ gtk_menu_reorder_child(GTK_MENU(ann_menu), GTK_WIDGET(childmi), dbusmenu_menuitem_get_position_realized(child, mi));
return;
}
@@ -423,6 +423,29 @@ dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem *
return GTK_MENU_ITEM(data);
}
+/**
+ dbusmenu_gtkclient_menuitem_get_submenu:
+ @client: A #DbusmenuGtkClient with the item in it.
+ @item: #DbusmenuMenuitem to get associated #GtkMenu on.
+
+ This grabs the submenu associated with the menuitem.
+
+ Return value: The #GtkMenu if there is one.
+*/
+GtkMenu *
+dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item)
+{
+ g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), NULL);
+ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(item), NULL);
+
+ gpointer data = g_object_get_data(G_OBJECT(item), data_menu);
+ if (data == NULL) {
+ return NULL;
+ }
+
+ return GTK_MENU(data);
+}
+
/* The base type handler that builds a plain ol'
GtkMenuItem to represent, well, the GtkMenuItem */
static gboolean
diff --git a/libdbusmenu-gtk/client.h b/libdbusmenu-gtk/client.h
index 4cfbdcf..7672bf7 100644
--- a/libdbusmenu-gtk/client.h
+++ b/libdbusmenu-gtk/client.h
@@ -77,6 +77,7 @@ struct _DbusmenuGtkClient {
GType dbusmenu_gtkclient_get_type (void);
DbusmenuGtkClient * dbusmenu_gtkclient_new (gchar * dbus_name, gchar * dbus_object);
GtkMenuItem * dbusmenu_gtkclient_menuitem_get (DbusmenuGtkClient * client, DbusmenuMenuitem * item);
+GtkMenu * dbusmenu_gtkclient_menuitem_get_submenu (DbusmenuGtkClient * client, DbusmenuMenuitem * item);
void dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * item, GtkMenuItem * gmi, DbusmenuMenuitem * parent);
diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c
index 103ecfe..4fa546b 100644
--- a/libdbusmenu-gtk/menu.c
+++ b/libdbusmenu-gtk/menu.c
@@ -237,7 +237,7 @@ root_child_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint posit
GtkMenuItem * mi = dbusmenu_gtkclient_menuitem_get(priv->client, child);
if (mi != NULL) {
GtkWidget * item = GTK_WIDGET(mi);
- gtk_menu_insert(GTK_MENU(menu), item, position);
+ gtk_menu_insert(GTK_MENU(menu), item, dbusmenu_menuitem_get_position_realized(child, root));
#ifdef MASSIVEDEBUGGING
menu_pos_t menu_pos;
menu_pos.mi = mi;
@@ -260,7 +260,7 @@ root_child_moved (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint newpo
g_debug("Root child moved");
#endif
DbusmenuGtkMenuPrivate * priv = DBUSMENU_GTKMENU_GET_PRIVATE(menu);
- gtk_menu_reorder_child(GTK_MENU(menu), GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(priv->client, child)), newposition);
+ gtk_menu_reorder_child(GTK_MENU(menu), GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(priv->client, child)), dbusmenu_menuitem_get_position_realized(child, root));
return;
}
@@ -300,7 +300,7 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata)
if (child_widget != NULL) {
gtk_menu_append(menu, child_widget);
- gtk_menu_reorder_child(GTK_MENU(menu), child_widget, dbusmenu_menuitem_get_position(child, dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client))));
+ gtk_menu_reorder_child(GTK_MENU(menu), child_widget, dbusmenu_menuitem_get_position_realized(child, dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client))));
} else {
g_warning("Child is realized, but doesn't have a GTK Widget!");
}