Back to index

indicator-appmenu  12.10.0
Classes | Defines | Typedefs | Functions
window-menu-dbusmenu.h File Reference
#include "window-menu.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _WindowMenuDbusmenuClass
struct  _WindowMenuDbusmenu

Defines

#define WINDOW_MENU_DBUSMENU_TYPE   (window_menu_dbusmenu_get_type ())
#define WINDOW_MENU_DBUSMENU(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenu))
#define WINDOW_MENU_DBUSMENU_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass))
#define IS_WINDOW_MENU_DBUSMENU(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINDOW_MENU_DBUSMENU_TYPE))
#define IS_WINDOW_MENU_DBUSMENU_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), WINDOW_MENU_DBUSMENU_TYPE))
#define WINDOW_MENU_DBUSMENU_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass))

Typedefs

typedef struct _WindowMenuDbusmenu
typedef struct _WindowMenuDbusmenuClass

Functions

GType window_menu_dbusmenu_get_type (void)
WindowMenuDbusmenu * window_menu_dbusmenu_new (const guint windowid, const gchar *dbus_addr, const gchar *dbus_object)
gchar * window_menu_dbusmenu_get_path (WindowMenuDbusmenu *wm)
gchar * window_menu_dbusmenu_get_address (WindowMenuDbusmenu *wm)

Class Documentation

struct _WindowMenuDbusmenuClass

Definition at line 39 of file window-menu-dbusmenu.h.

Class Members
WindowMenuClass parent_class
struct _WindowMenuDbusmenu

Definition at line 43 of file window-menu-dbusmenu.h.

Class Members
WindowMenu parent

Define Documentation

#define IS_WINDOW_MENU_DBUSMENU (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINDOW_MENU_DBUSMENU_TYPE))

Definition at line 32 of file window-menu-dbusmenu.h.

#define IS_WINDOW_MENU_DBUSMENU_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), WINDOW_MENU_DBUSMENU_TYPE))

Definition at line 33 of file window-menu-dbusmenu.h.

#define WINDOW_MENU_DBUSMENU (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenu))

Definition at line 30 of file window-menu-dbusmenu.h.

#define WINDOW_MENU_DBUSMENU_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass))

Definition at line 31 of file window-menu-dbusmenu.h.

#define WINDOW_MENU_DBUSMENU_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass))

Definition at line 34 of file window-menu-dbusmenu.h.

Definition at line 29 of file window-menu-dbusmenu.h.


Typedef Documentation

typedef struct _WindowMenuDbusmenu

Definition at line 36 of file window-menu-dbusmenu.h.

typedef struct _WindowMenuDbusmenuClass

Definition at line 37 of file window-menu-dbusmenu.h.


Function Documentation

gchar* window_menu_dbusmenu_get_address ( WindowMenuDbusmenu *  wm)

Definition at line 813 of file window-menu-dbusmenu.c.

{
       g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), NULL);
       WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm);
       GValue obj = {0};
       g_value_init(&obj, G_TYPE_STRING);
       g_object_get_property(G_OBJECT(priv->client), DBUSMENU_CLIENT_PROP_DBUS_NAME, &obj);
       gchar * retval = g_value_dup_string(&obj);
       g_value_unset(&obj);
       return retval;
}
gchar* window_menu_dbusmenu_get_path ( WindowMenuDbusmenu *  wm)

Definition at line 799 of file window-menu-dbusmenu.c.

{
       g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), NULL);
       WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm);
       GValue obj = {0};
       g_value_init(&obj, G_TYPE_STRING);
       g_object_get_property(G_OBJECT(priv->client), DBUSMENU_CLIENT_PROP_DBUS_OBJECT, &obj);
       gchar * retval = g_value_dup_string(&obj);
       g_value_unset(&obj);
       return retval;
}
WindowMenuDbusmenu* window_menu_dbusmenu_new ( const guint  windowid,
const gchar *  dbus_addr,
const gchar *  dbus_object 
)

Definition at line 368 of file window-menu-dbusmenu.c.

{
       g_debug("Creating new windows menu: %X, %s, %s", windowid, dbus_addr, dbus_object);

       g_return_val_if_fail(windowid != 0, NULL);
       g_return_val_if_fail(dbus_addr != NULL, NULL);
       g_return_val_if_fail(dbus_object != NULL, NULL);

       WindowMenuDbusmenu * newmenu = WINDOW_MENU_DBUSMENU(g_object_new(WINDOW_MENU_DBUSMENU_TYPE, NULL));
       WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(newmenu);

       priv->windowid = windowid;

       /* Build the service proxy */
       priv->props_cancel = g_cancellable_new();
       g_object_ref(newmenu); /* Take a ref for the async callback */
       g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION,
                                G_DBUS_PROXY_FLAGS_NONE,
                                NULL,
                                dbus_addr,
                                dbus_object,
                                "org.freedesktop.DBus.Properties",
                                priv->props_cancel,
                                props_cb,
                                newmenu);

       priv->client = dbusmenu_gtkclient_new((gchar *)dbus_addr, (gchar *)dbus_object);
       GtkAccelGroup * agroup = gtk_accel_group_new();
       dbusmenu_gtkclient_set_accel_group(priv->client, agroup);
       g_object_unref(agroup);

       g_signal_connect(G_OBJECT(priv->client), DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed),   newmenu);
       g_signal_connect(G_OBJECT(priv->client), DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT, G_CALLBACK(event_status), newmenu);
       g_signal_connect(G_OBJECT(priv->client), DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, G_CALLBACK(item_activate), newmenu);
       g_signal_connect(G_OBJECT(priv->client), "notify::" DBUSMENU_CLIENT_PROP_STATUS, G_CALLBACK(status_changed), newmenu);

       DbusmenuMenuitem * root = dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client));
       if (root != NULL) {
              root_changed(DBUSMENU_CLIENT(priv->client), root, newmenu);
       }

       return newmenu;
}

Here is the call graph for this function: