CSC 195.01 2013S Technologies for Mediascripting
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Disabilities]
[Instructions]
[Teaching and Learning]
Groups:
[Handouts]
[Outlines]
(Current Outline)
[EBoards]
(Current EBoard)
[Examples]
Misc:
[SamR]
[EBook]
[GNU Coding Standards]
Back to Class 07: Cancelled. On to Class 09: GIMP Internals (1): GIMP Plug-Ins.
This outline is also available in PDF.
Held: Thursday, 14 March 2013
Summary: We consider the basic steps in writing a D-Bus client.
Related Pages:
Notes:
GDBusProxy
is documented at https://developer.gnome.org/gio/2.28/GDBusProxy.html.Overview:
GDBusProxy
library the easiest way to deal with
connecting to servers.
g_dbus_proxy_new_for_bus_sync
GDBusProxy *g_dbus_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, GDBusInterfaceInfo *info, const gchar *name, const gchar *object_path, const gchar *interface_name, GCancellable *cancellable, GError **error);
g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, service, object, interface, NULL, errorp);
g_dbus_proxy_call
. This
procedure is asynchronous.
g_dbus_proxy_call_sync
.
GVariant *g_dbus_proxy_call_sync (GDBusProxy *proxy, const gchar *method_name, GVariant *parameters, GDBusCallFlags flags, gint timeout_msec, GCancellable *cancellable, GError **error);
g_object_unref
when we're done with a proxy and
g_variant_unref
when we're done with a variant. That's
about it.
talk tothe server.
/** * Get information on a proxied object. */ static GDBusNodeInfo * g_dbus_proxy_get_node_info (GDBusProxy *proxy) { GError *error; // Error returned by various functions. GVariant *response; // The response from the proxy call. GDBusNodeInfo *info; // Information on the node. const gchar *xml; // XML code for the proxy interface. // Get the introspection data error = NULL; response = g_dbus_proxy_call_sync (proxy, "org.freedesktop.DBus.Introspectable.Introspect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (response == NULL) { return NULL; } // if (response == NULL) // Get the XML from the introspection data g_variant_get (response, "(&s)", &xml); // Build an object that lets us explore the introspection data. error = NULL; info = g_dbus_node_info_new_for_xml (xml, &error); g_variant_unref (response); if (info == NULL) { return NULL; } // if (info == NULL) // And return that object return info; } // g_dbus_proxy_get_node_info
Back to Class 07: Cancelled. On to Class 09: GIMP Internals (1): GIMP Plug-Ins.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Disabilities]
[Instructions]
[Teaching and Learning]
Groups:
[Handouts]
[Outlines]
(Current Outline)
[EBoards]
(Current EBoard)
[Examples]
Misc:
[SamR]
[EBook]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed May 1 10:51:44 2013.
The source to the document was last modified on Mon Jan 21 13:59:23 2013.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC195/2013S/outline.08.html
.
You may wish to validate this document's HTML ; ;
Samuel A. Rebelsky, rebelsky@grinnell.eduhttp://creativecommons.org/licenses/by-nc/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.