aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/libdbusmenu-glib/reference/Makefile.am1
-rw-r--r--docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml1
-rw-r--r--docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt29
-rw-r--r--libdbusmenu-glib/client.h15
-rw-r--r--libdbusmenu-glib/defaults.c8
-rw-r--r--libdbusmenu-glib/defaults.h4
-rw-r--r--libdbusmenu-glib/enum-types.h.in6
-rw-r--r--libdbusmenu-glib/menuitem-marshal.list1
-rw-r--r--libdbusmenu-glib/menuitem.c24
-rw-r--r--libdbusmenu-glib/menuitem.h6
-rw-r--r--libdbusmenu-glib/server.c2
-rw-r--r--libdbusmenu-glib/server.h10
-rw-r--r--libdbusmenu-glib/types.h11
-rw-r--r--libdbusmenu-gtk/parser.c18
14 files changed, 109 insertions, 27 deletions
diff --git a/docs/libdbusmenu-glib/reference/Makefile.am b/docs/libdbusmenu-glib/reference/Makefile.am
index 1c8dfa8..2af5ec3 100644
--- a/docs/libdbusmenu-glib/reference/Makefile.am
+++ b/docs/libdbusmenu-glib/reference/Makefile.am
@@ -51,6 +51,7 @@ IGNORE_HFILES= \
dbus-menu-clean.xml.h \
client-menuitem.h \
client-private.h \
+ defaults.h \
menuitem-marshal.h \
server-marshal.h \
menuitem-private.h
diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml
index 16ed624..53a0ceb 100644
--- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml
+++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-docs.sgml
@@ -18,6 +18,7 @@
<xi:include href="xml/client-menuitem.xml"/>
<xi:include href="xml/dbusmenu-client.xml"/>
<xi:include href="xml/dbusmenu-server.xml"/>
+ <xi:include href="xml/types.xml"/>
</chapter>
<chapter id="object-tree">
diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
index b3a78b7..11316d6 100644
--- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
+++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
@@ -6,8 +6,11 @@ DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED
DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM
DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT
DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE
+DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED
DBUSMENU_CLIENT_PROP_DBUS_NAME
DBUSMENU_CLIENT_PROP_DBUS_OBJECT
+DBUSMENU_CLIENT_PROP_STATUS
+DBUSMENU_CLIENT_PROP_TEXT_DIRECTION
DBUSMENU_CLIENT_TYPES_DEFAULT
DBUSMENU_CLIENT_TYPES_SEPARATOR
DBUSMENU_CLIENT_TYPES_IMAGE
@@ -17,6 +20,8 @@ DbusmenuClientTypeHandler
DbusmenuClientTypeDestroyHandler
dbusmenu_client_new
dbusmenu_client_get_root
+dbusmenu_client_get_status
+dbusmenu_client_get_text_direction
dbusmenu_client_add_type_handler
dbusmenu_client_add_type_handler_full
<SUBSECTION Standard>
@@ -125,11 +130,17 @@ DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE
DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION
DBUSMENU_SERVER_PROP_DBUS_OBJECT
DBUSMENU_SERVER_PROP_ROOT_NODE
+DBUSMENU_SERVER_PROP_STATUS
+DBUSMENU_SERVER_PROP_TEXT_DIRECTION
DBUSMENU_SERVER_PROP_VERSION
DbusmenuServer
DbusmenuServerClass
dbusmenu_server_new
+dbusmenu_server_get_status
+dbusmenu_server_get_text_direction
dbusmenu_server_set_root
+dbusmenu_server_set_status
+dbusmenu_server_set_text_direction
<SUBSECTION Standard>
DBUSMENU_SERVER
DBUSMENU_IS_SERVER
@@ -161,3 +172,21 @@ DbusmenuMenuitemProxyPrivate
dbusmenu_menuitem_proxy_get_type
</SECTION>
+<SECTION>
+<FILE>types</FILE>
+<TITLE>Types</TITLE>
+DBUSMENU_TYPE_STATUS
+DBUSMENU_TYPE_TEXT_DIRECTION
+DbusmenuStatus
+DbusmenuTextDirection
+dbusmenu_status_get_nick
+dbusmenu_status_get_type
+dbusmenu_status_get_value_from_nick
+dbusmenu_text_direction_get_nick
+dbusmenu_text_direction_get_type
+dbusmenu_text_direction_get_value_from_nick
+<SUBSECTION Private>
+DbusmenuServerPrivate
+dbusmenu_server_get_type
+</SECTION>
+
diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h
index 0b94eb2..28d4dd3 100644
--- a/libdbusmenu-glib/client.h
+++ b/libdbusmenu-glib/client.h
@@ -74,6 +74,11 @@ G_BEGIN_DECLS
* String to attach to signal #DbusmenuClient::event-result
*/
#define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result"
+/**
+ * DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED:
+ *
+ * String to attach to signal #DbusmenuClient::text-direction-changed
+ */
#define DBUSMENU_CLIENT_SIGNAL_TEXT_DIRECTION_CHANGED "text-direction-changed"
/**
@@ -88,7 +93,17 @@ G_BEGIN_DECLS
* String to access property #DbusmenuClient:dbus-object
*/
#define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object"
+/**
+ * DBUSMENU_CLIENT_PROP_STATUS:
+ *
+ * String to access property #DbusmenuClient:status
+ */
#define DBUSMENU_CLIENT_PROP_STATUS "status"
+/**
+ * DBUSMENU_CLIENT_PROP_TEXT_DIRECTION:
+ *
+ * String to access property #DbusmenuClient:text-direction
+ */
#define DBUSMENU_CLIENT_PROP_TEXT_DIRECTION "text-direction"
/**
diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c
index 3ad5d76..c05ef38 100644
--- a/libdbusmenu-glib/defaults.c
+++ b/libdbusmenu-glib/defaults.c
@@ -156,7 +156,7 @@ entry_destroy (gpointer entry)
static DbusmenuDefaults * default_defaults = NULL;
-/**
+/*
* dbusmenu_defaults_ref_default:
*
* Get a reference to the default instance. If it doesn't exist this
@@ -177,7 +177,7 @@ dbusmenu_defaults_ref_default (void)
return default_defaults;
}
-/**
+/*
* dbusmenu_defaults_default_set:
* @defaults: The #DbusmenuDefaults object to add to
* @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT
@@ -216,7 +216,7 @@ dbusmenu_defaults_default_set (DbusmenuDefaults * defaults, const gchar * type,
return;
}
-/**
+/*
* dbusmenu_defaults_default_get:
* @defaults: The default database to use
* @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT
@@ -253,7 +253,7 @@ dbusmenu_defaults_default_get (DbusmenuDefaults * defaults, const gchar * type,
return entry->value;
}
-/**
+/*
* dbusmenu_defaults_default_get_type:
* @defaults: The default database to use
* @type: (allow-none): The #DbusmenuMenuitem type for this default if #NULL will default to #DBUSMENU_CLIENT_TYPE_DEFAULT
diff --git a/libdbusmenu-glib/defaults.h b/libdbusmenu-glib/defaults.h
index ab377f7..a1a8158 100644
--- a/libdbusmenu-glib/defaults.h
+++ b/libdbusmenu-glib/defaults.h
@@ -45,7 +45,7 @@ typedef struct _DbusmenuDefaults DbusmenuDefaults;
typedef struct _DbusmenuDefaultsClass DbusmenuDefaultsClass;
typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate;
-/**
+/*
* DbusmenuDefaultsClass:
*
* All of the signals and functions for #DbusmenuDefaults
@@ -54,7 +54,7 @@ struct _DbusmenuDefaultsClass {
GObjectClass parent_class;
};
-/**
+/*
* DbusmenuDefaults:
*
* A singleton to hold all of the defaults for the menuitems
diff --git a/libdbusmenu-glib/enum-types.h.in b/libdbusmenu-glib/enum-types.h.in
index 8c5f463..488b615 100644
--- a/libdbusmenu-glib/enum-types.h.in
+++ b/libdbusmenu-glib/enum-types.h.in
@@ -51,6 +51,12 @@ G_END_DECLS
GType @enum_name@_get_type (void) G_GNUC_CONST;
const gchar * @enum_name@_get_nick (@EnumName@ value) G_GNUC_CONST;
@EnumName@ @enum_name@_get_value_from_nick (const gchar * nick) G_GNUC_CONST;
+/**
+ DBUSMENU_TYPE_@ENUMSHORT@:
+
+ Gets the #GType value for the type associated with the
+ #@EnumName@ enumerated type.
+*/
#define DBUSMENU_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/
diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list
index e3cb272..4382ed7 100644
--- a/libdbusmenu-glib/menuitem-marshal.list
+++ b/libdbusmenu-glib/menuitem-marshal.list
@@ -4,3 +4,4 @@ VOID: OBJECT, UINT
VOID: OBJECT
VOID: VOID
VOID: UINT
+BOOLEAN: STRING, VARIANT, UINT
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index de8a1ad..3dd98df 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -75,6 +75,7 @@ enum {
REALIZED,
SHOW_TO_USER,
ABOUT_TO_SHOW,
+ EVENT,
LAST_SIGNAL
};
@@ -248,6 +249,23 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass)
NULL, NULL,
_dbusmenu_menuitem_marshal_VOID__VOID,
G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
+ /**
+ DbusmenuMenuitem::event:
+ @arg0: The #DbusmenuMenuitem object.
+ @arg1: Name of the event
+ @arg2: Information passed along with the event
+ @arg3: X11 timestamp of when the event happened
+
+ Emitted when an event is passed through. The event is signalled
+ after handle_event is called.
+ */
+ signals[EVENT] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_EVENT,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuMenuitemClass, event),
+ g_signal_accumulator_true_handled, NULL,
+ _dbusmenu_menuitem_marshal_BOOLEAN__STRING_VARIANT_UINT,
+ G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT);
g_object_class_install_property (object_class, PROP_ID,
g_param_spec_int(PROP_ID_S, "ID for the menu item",
@@ -1652,9 +1670,13 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari
#endif
DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi);
- if (class->handle_event != NULL) {
+ gboolean handled = FALSE;
+ g_signal_emit(G_OBJECT(mi), EVENT, g_quark_from_string(name), name, variant, timestamp, &handled);
+
+ if (!handled && class->handle_event != NULL) {
return class->handle_event(mi, name, variant, timestamp);
}
+
return;
}
diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h
index 5f56803..6d41e25 100644
--- a/libdbusmenu-glib/menuitem.h
+++ b/libdbusmenu-glib/menuitem.h
@@ -96,6 +96,7 @@ G_BEGIN_DECLS
* String to attach to signal #DbusmenuServer::about-to-show
*/
#define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show"
+#define DBUSMENU_MENUITEM_SIGNAL_EVENT "event"
/**
* DBUSMENU_MENUITEM_PROP_TYPE:
@@ -320,12 +321,12 @@ typedef GVariant * (*dbusmenu_menuitem_buildvariant_slot_t) (DbusmenuMenuitem *
* @handle_event: This function is to override how events are handled by subclasses. Look at #dbusmenu_menuitem_handle_event for lots of good information.
* @send_about_to_show: Virtual function that notifies server that the client is about to show a menu.
* @show_to_user: Slot for #DbusmenuMenuitem::show-to-user.
+ * @event: Slot for #DbsumenuMenuitem::event.
* @reserved1: Reserved for future use.
* @reserved2: Reserved for future use.
* @reserved3: Reserved for future use.
* @reserved4: Reserved for future use.
* @reserved5: Reserved for future use.
- * @reserved6: Reserved for future use.
*
* Functions and signals that every menuitem should know something
* about.
@@ -351,13 +352,14 @@ struct _DbusmenuMenuitemClass
void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data);
gboolean (*about_to_show) (void);
+ void (*event) (const gchar * name, GVariant * value, guint timestamp);
+
/*< Private >*/
void (*reserved1) (void);
void (*reserved2) (void);
void (*reserved3) (void);
void (*reserved4) (void);
void (*reserved5) (void);
- void (*reserved6) (void);
};
GType dbusmenu_menuitem_get_type (void);
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index c3faa6b..e3fd2cd 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -1635,6 +1635,7 @@ dbusmenu_server_get_text_direction (DbusmenuServer * server)
/**
dbusmenu_server_set_text_direction:
@server: The #DbusmenuServer object to set the text direction on
+ @dir: Direction of the text
Sets the text direction that should be exported over DBus for
this server. If the value is set to #DBUSMENU_TEXT_DIRECTION_NONE
@@ -1682,6 +1683,7 @@ dbusmenu_server_get_status (DbusmenuServer * server)
/**
dbusmenu_server_set_status:
@server: The #DbusmenuServer to set the status on
+ @status: Status value to set on the server
Changes the status of the server.
*/
diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h
index 3e07395..80b7abb 100644
--- a/libdbusmenu-glib/server.h
+++ b/libdbusmenu-glib/server.h
@@ -93,7 +93,17 @@ G_BEGIN_DECLS
* String to access property #DbusmenuServer:version
*/
#define DBUSMENU_SERVER_PROP_VERSION "version"
+/**
+ * DBUSMENU_SERVER_PROP_TEXT_DIRECTION:
+ *
+ * String to access property #DbusmenuServer:text-direction
+ */
#define DBUSMENU_SERVER_PROP_TEXT_DIRECTION "text-direction"
+/**
+ * DBUSMENU_SERVER_PROP_STATUS:
+ *
+ * String to access property #DbusmenuServer:status
+ */
#define DBUSMENU_SERVER_PROP_STATUS "status"
typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate;
diff --git a/libdbusmenu-glib/types.h b/libdbusmenu-glib/types.h
index e573476..03ae801 100644
--- a/libdbusmenu-glib/types.h
+++ b/libdbusmenu-glib/types.h
@@ -59,6 +59,17 @@ typedef enum { /*< prefix=DBUSMENU_STATUS >*/
DBUSMENU_STATUS_NOTICE /*< nick=notice >*/
} DbusmenuStatus;
+/**
+ SECTION:types
+ @short_description: Types that are used by both client and
+ server.
+ @stability: Unstable
+ @include: libdbusmenu-glib/types.h
+
+ Enums that are used to describe states of the server across the
+ bus. They are sent over dbus using their nicks but then turned
+ back into enums by the client.
+*/
G_END_DECLS
#endif /* __DBUSMENU_TYPES_H__ */
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 44ea301..8f1286c 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -169,23 +169,6 @@ widget_freed (gpointer data, GObject * obj)
return;
}
-#if 0
-/* Called if we replace the cache on the object with a new
- dbusmenu menuitem */
-static void
-object_cache_freed (gpointer data)
-{
- // TODO: make this have access to both data and obj so we can call these
- //if (!G_IS_OBJECT(obj)) return;
- //g_object_weak_unref(G_OBJECT(obj), dbusmenu_cache_freed, data);
- //dbusmenu_cache_freed(data, obj);
-
- g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), data);
-
- return;
-}
-#endif
-
/* Gets the positon of the child with its' parent if it has one.
Returns -1 if the position is unable to be calculated. */
static gint
@@ -223,7 +206,6 @@ new_menuitem (GtkWidget * widget)
ParserData *pdata = g_new0 (ParserData, 1);
g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free);
- /* g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); */
g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL);
g_object_weak_ref(G_OBJECT(widget), widget_freed, NULL);