Adding Dbus support to Gedit

At this moment, when you start a second Gedit process , it opens a new tab in your current Gedit window instead of creating a new one. This behaviour has been added from scratch in Gedit using the so called bacon-message, developed by them.

Today I’ve started working on the replacement of bacon-message stuff of Gedit with Dbus.  I started by creating a GObject that contains all the Dbus related behaviour.

My first problem was that I needed to know if the current Gedit process is a server (first Gedit  process in the user session) or a client (not  the first). To solve this issue I had to check the result of the org_freedesktop_DBus_request_name function (which tries to register the Dbus service name). The tricky part was to find the set of result #defines and examine their behaviour depending on the flags you use when requesting the name.
Once I’ve solved this issue, it was not too dificult to finish this Dbus object, and at this moment I have tested Dbus setup inside Gedit and it seems to be working fine :).

Next time I’ll start replacing bacon-message stuff in gedit.c main with my brand new Dbus stuff. Let’s see how it works 🙂

Comments are closed.