Hello Remote World!

Some days ago, ross posted in his blog a very interesting example of how to do a RPC with DBus/GObject by using the DBus glib bindings. I’ve taken this example as base for playing with widgets embedded. Basically I’ve created a label to be embedded in a container. The container also will be able to change the text of the label by doing a method invocation.

The xml file that describes the object is as simple as:

 <?xml version="1.0" encoding="UTF-8" ?> <node name="/org/freedesktop/DBus/Tests/Label">   <interface name="org.freedesktop.DBus.Tests.Label">   <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="label"/>     <method name="GetXid">     <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="label_get_xid"/>     <arg type="u" name="xid" direction="out"/>    </method>     <method name="SetText">     <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="label_set_text"/>     <arg type="s" name="text" direction="in"/>    </method>   </interface> </node> 

The method SetText only changes the current text of the label and the implementation is:

 gboolean label_set_text (Label *label, char *text, GError **error) {         gtk_label_set_text (GTK_LABEL (label->label), text); 	gtk_widget_show (label->label);  	return TRUE; } 

The method GetXid is used by the container to obtain the window ID of the label, which is needed to be able to embed it. The code is also very simple:

 gboolean label_get_xid (Label *label, guint32 *xid, GError **error) {         *xid = label->xid;  	return TRUE; } 

The container is a window with an entry and a frame. The frame is the real container of the label, and the entry is used to input the text for changing the label. First of all the container invokes the GetXid method in order to obtain the window ID of the label:

 if (!org_freedesktop_DBus_Tests_Label_get_xid (proxy, &xid, &error)) { 	die ("Call to get_xid failed", error); } 

When the activate signal of the entry is emitted the callback invokes the SetText method of the label:

 static void on_entry_activate (GtkWidget *entry, gpointer gdata) {         DBusGProxy *proxy;         gchar      *text;         GError     *error = NULL;          proxy = (DBusGProxy *) gdata;          text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));          if (!org_freedesktop_DBus_Tests_Label_set_text (proxy, text, &error)) {                 g_free (text);                 die ("Call to set_text failed", error);         }  	g_free (text); } 
Hello Remote World
Hello Remote World

I think it’s a first approach for using DBus instead of bonobo

Governor Selecting

I’ve just committed the changes which add support to change the governor with the frequency selector. I didn’t know how to exactly add it, so finally I’ve chosen what I think it’s the less bad option.

CPUFreq Applet Preferences dialog
CPUFreq Applet Preferences dialog

Frequencies menu Governors menu Frequencies and governors menu
Frequencies menu Governors menu Frequencies and governors menu

Maybe the names of the governors are technical and difficult to understand for the users