4 #include "tilda-window.h"
5 #include "tilda-terminal.h"
7 DBusGConnection *dbus_connection;
11 tilda_initialize_dbus ()
13 const gchar service_name[] = "net.sourceforge.Tilda";
15 DBusGProxy *driver_proxy;
18 // Initialize the DBus connection
19 dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
20 if (dbus_connection == NULL)
22 g_warning ("Unable to connect to dbus: %s", error->message);
27 // Register the service name
28 driver_proxy = dbus_g_proxy_new_for_name (dbus_connection,
33 if (!org_freedesktop_DBus_request_name (driver_proxy, service_name, 0, &request_ret, &error))
35 // FIXME: for whatever reason, this is wrong. The error message doesn't appear
36 // FIXME: when we were unable to register the service. Perhaps there's a more
37 // FIXME: GLib-y way of doing this?
38 g_warning ("Unable to register service: %s", error->message);
42 g_object_unref (driver_proxy);
46 tilda_find_next_free_window_number ()
51 for (i=0; i<INT_MAX; ++i)
55 for (j=0; j<windows->len; ++j)
57 TildaWindow *tw = g_ptr_array_index (windows, j);
79 number = tilda_find_next_free_window_number ();
80 ret = g_object_new (TILDA_TYPE_WINDOW, "number", number, NULL);
82 g_ptr_array_add (windows, ret);
84 g_print ("Adding window: 0x%x (number %d of %d)\n", ret, ret->number, windows->len);
89 tilda_del_window (gint number)
94 for (i=0; i<windows->len; ++i)
96 win = g_ptr_array_index (windows, i);
98 if (win->number == number)
100 g_print ("Deleting window 0x%x (number %d)\n", win, win->number);
101 g_ptr_array_remove_index (windows, i);
102 g_object_unref (G_OBJECT(win));
108 int main (int argc, char *argv[])
112 /* Initialize GTK+ (and the GObject system) */
113 gtk_init (&argc, &argv);
115 /* Initialize the keybinder */
116 tomboy_keybinder_init ();
118 /* Start our connection to DBus */
119 tilda_initialize_dbus ();
121 /* Initialize the array of windows */
122 windows = g_ptr_array_new ();
124 /* Create a TildaWindow, run it, and exit when it does, basically.
126 * This is nothing like what the real main() will be, but it's
127 * a good start for testing and integration of more of TildaWindow
128 * and TildaTerminal. */
129 tw = tilda_add_window ();
136 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */