Archive

Archive for April, 2005

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

Categories: GNOME Tags:

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

Categories: GNOME Tags: ,

San Pancracio 41 – Cherokee 40

Nerves and Responsibility

We are now at the end of the league, and we had to play against Cherokee. It was a very important game because they are in the second place and we are in the fourth. They were also motivated because in the fisrt round we won in a too easy game

The last sunday, during the training, I hurt two fingers of my left hand. I was very angry, I wanted to play against Cherokee and there was a lot of pain in my fingers. So, I decided to be very careful and bandage my fingers. I also didn’t train in the gym this week. Finally on Saturday I didn’t know if I was going to play. I decided to test myself during the training previous to the game. And yeah!, I felt I could play, with a bit of bandage in my fingers I felt no pain :-)

Since the first minutes of the game I noticed it was to be a great game. We did an individual defense in the whole game, specially against Jimmy, the best player of Cherokee. And this strategy seemed to work, at least to achive going equal in the scoreboard.

We were losing for 1 point and there was almost no time, then I forced a foul so I had two free throws. I didn’t know neither the scoreboard nor the time, so everybody were more nervous than I was. If I scored the two shots we won the game. I don’t want to think what might have happened if I don’t score any of the shots. Finally I scored only one of them. Ok we didn’t win, but we had now a prorogation.

Five minutes more, without stopping the time and with the same fouls of the fourth quater. So, both teams were in bonus, every foul is punished by 2 free throws. I can’t believe it, at the end of the prorogation we were in the same situation!!. San Pancracio 39 – Cherokee 40, there is no time, and I am in the free throw line. And again, I didn’t know those data. This time I scored the two shots and we won!! It was very exciting, it seemed that we had won the champions league final :-)

Categories: General Tags: