[Window] Fix automatic pulldown code
[tilda-gobject.git] / tilda-window.c
index 3455112..44a04e8 100644 (file)
@@ -1,10 +1,47 @@
+#include <gdk/gdkx.h> /* for gdk_x11_window_set_user_time() */
+#include <stdlib.h>
+
 #include "tilda.h"
+#include "tilda-config.h"
+#include "tilda-controller.h"
 #include "tilda-window.h"
 #include "tilda-window-dbus-glue.h"
+#include "tomboykeybinder.h"
+
+/**
+ * Find the TildaTerminal corresponding to the currently selected
+ * tab in self->notebook. This could go away if TildaTerminal were
+ * a proper subclass of GtkWidget.
+ */
+static TildaTerminal *
+tilda_window_find_current_terminal (TildaWindow *self)
+{
+       debug_enter();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       gint i;
+       TildaTerminal *ret;
+       gint current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(self->notebook));
+       GtkWidget *box = gtk_notebook_get_nth_page (GTK_NOTEBOOK(self->notebook), current_page);
+
+       for (i=0; i<self->terms->len; ++i)
+       {
+               ret = g_ptr_array_index (self->terms, i);
+
+               if (ret->hbox == box)
+                       return ret;
+       }
+
+       debug_printf ("ERROR: unable to find current terminal!\n");
+       return NULL;
+}
 
 static gint
-tilda_window_find_next_free_terminal_number (TildaWindow *tw)
+tilda_window_find_next_free_terminal_number (TildaWindow *self)
 {
+       debug_enter ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
        gint i, j;
        gboolean found;
 
@@ -12,9 +49,9 @@ tilda_window_find_next_free_terminal_number (TildaWindow *tw)
        {
                found = FALSE;
 
-               for (j=0; j<tw->terms->len; ++j)
+               for (j=0; j<self->terms->len; ++j)
                {
-                       TildaTerminal *tt = g_ptr_array_index (tw->terms, j);
+                       TildaTerminal *tt = g_ptr_array_index (self->terms, j);
 
                        if (tt->number == i)
                        {
@@ -30,27 +67,71 @@ tilda_window_find_next_free_terminal_number (TildaWindow *tw)
        return 0;
 }
 
-static gboolean
-tilda_window_add_term (TildaWindow *tw)
+static void
+tilda_window_show_hide_tabs_if_appropriate (TildaWindow *self)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       /* If we only have one tab, we have a choice to make, otherwise, always show tabs */
+       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) <= 1)
+       {
+               if (self->always_show_tabs)
+                       gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
+               else
+                       gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), FALSE);
+       }
+       else
+       {
+               gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
+       }
+}
+
+/**
+ * Clean up and remove self completely from the program
+ *
+ * Should only be used by DBus...
+ */
+gboolean
+tilda_window_close (TildaWindow *self)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       tilda_controller_remove_window (TILDA_CONTROLLER(self->controller), self->number);
+
+       return TRUE;
+}
+
+gboolean
+tilda_window_add_terminal (TildaWindow *self)
 {
+       debug_enter ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
        gint number;
        TildaTerminal *tt;
+       GtkWidget *label;
+       gint notebook_index;
 
-       number = tilda_window_find_next_free_terminal_number (tw);
+       number = tilda_window_find_next_free_terminal_number (self);
        tt = g_object_new (TILDA_TYPE_TERMINAL,
                                           "number", number,
-                                          "window-number", tw->number,
-                                          "parent-window", tw,
+                                          "parent-window", self,
                                           NULL);
-       g_ptr_array_add (tw->terms, tt);
+       g_ptr_array_add (self->terms, tt);
 
-       GtkWidget *label = gtk_label_new ("Tilda");
-       gint index = gtk_notebook_prepend_page (GTK_NOTEBOOK(tw->notebook), tt->hbox, label);
-       gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(tw->notebook), tt->hbox, TRUE, TRUE, GTK_PACK_END);
-       //gtk_notebook_set_current_page (GTK_NOTEBOOK(tw->notebook), index);
+       label = gtk_label_new ("Tilda");
+       notebook_index = gtk_notebook_append_page (GTK_NOTEBOOK(self->notebook), tt->hbox, label);
+       gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook), tt->hbox,
+                                                                               self->full_width_tabs, TRUE, GTK_PACK_START);
+       gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), notebook_index);
 
-       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(tw->notebook)) > 1)
-               gtk_notebook_set_show_tabs (GTK_NOTEBOOK(tw->notebook), TRUE);
+       /* Always show tabs if we have > 1 tab open */
+       tilda_window_show_hide_tabs_if_appropriate (self);
+
+       /* Focus the VTE Terminal */
+       gtk_widget_grab_focus (tt->vte_term);
 
        return TRUE;
 }
@@ -62,43 +143,46 @@ tilda_window_add_term (TildaWindow *tw)
  * Return: TRUE on success, FALSE otherwise.
  */
 gboolean
-tilda_window_remove_term (TildaWindow *tw, gint terminal_number)
+tilda_window_remove_terminal (TildaWindow *self, gint terminal_number)
 {
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+       debug_assert (terminal_number >= 0);
+
        gint i;
 
-       for (i=0; i<tw->terms->len; ++i)
+       for (i=0; i<self->terms->len; ++i)
        {
-               TildaTerminal *tt = g_ptr_array_index (tw->terms, i);
+               TildaTerminal *tt = g_ptr_array_index (self->terms, i);
 
                if (tt->number == terminal_number)
                {
-                       gint notebook_index = gtk_notebook_page_num (GTK_NOTEBOOK(tw->notebook), tt->hbox);
+                       gint notebook_index = gtk_notebook_page_num (GTK_NOTEBOOK(self->notebook), tt->hbox);
 
                        /* Make sure the index was valid */
                        if (notebook_index == -1)
                        {
-                               g_printerr ("DEBUG ERROR: Bad Notebook Tab\n");
+                               debug_printf ("ERROR: Bad Notebook Tab\n");
                                return FALSE;
                        }
 
                        /* Actually remove the terminal */
-                       gtk_notebook_remove_page (GTK_NOTEBOOK (tw->notebook), notebook_index);
+                       gtk_notebook_remove_page (GTK_NOTEBOOK (self->notebook), notebook_index);
 
                        /* We should hide the tabs if there is only one tab left */
-                       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (tw->notebook)) == 1)
-                               gtk_notebook_set_show_tabs (GTK_NOTEBOOK (tw->notebook), FALSE);
-
-#if 0
-                       // FIXME FIXME FIXME: need to actually do the stuff below
-                       /* With no pages left, it's time to leave the program */
-                       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (tw->notebook)) < 1)
-                               gtk_main_quit ();
-#endif
+                       tilda_window_show_hide_tabs_if_appropriate (self);
 
                        /* Remove the term from our lists, then free it */
-                       g_ptr_array_remove_fast (tw->terms, tt);
+                       g_ptr_array_remove_fast (self->terms, tt);
                        g_object_unref (G_OBJECT(tt));
 
+                       /* With no pages left, it's time to remove this window */
+                       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->notebook)) < 1)
+                       {
+                               debug_printf ("no terminals left, closing window %d\n", self->number);
+                               tilda_controller_remove_window (TILDA_CONTROLLER(self->controller), self->number);
+                       }
+
                        /* Leave the loop, we're done */
                        break;
                }
@@ -113,6 +197,9 @@ tilda_window_remove_term (TildaWindow *tw, gint terminal_number)
 static void
 tilda_window_setup_real_transparency (TildaWindow *self)
 {
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
        GdkScreen *screen;
        GdkColormap *colormap;
 
@@ -131,30 +218,147 @@ tilda_window_setup_real_transparency (TildaWindow *self)
        self->have_real_transparency = FALSE;
 }
 
+/* Center the given TildaWindow in the horizontal axis */
+static void
+tilda_window_center_horizontally (TildaWindow *self)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       const gint screen_center = gdk_screen_width() / 2;
+       const gint tilda_center  = self->width / 2;
+       const gint center_coord  = screen_center - tilda_center;
+
+       g_object_set (G_OBJECT(self), "x-position", center_coord, NULL);
+}
+
+/* Center the given TildaWindow in the vertical axis */
+static void
+tilda_window_center_vertically (TildaWindow *self)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       const gint screen_center = gdk_screen_height() / 2;
+       const gint tilda_center  = self->height / 2;
+       const gint center_coord  = screen_center - tilda_center;
+
+       g_object_set (G_OBJECT(self), "y-position", center_coord, NULL);
+}
+
+/* Shamelessly adapted (read: ripped off) from gdk_window_focus() and
+ * http://code.google.com/p/ttm/ trunk/src/window.c set_active()
+ *
+ * Also, more thanks to halfline and marnanel from irc.gnome.org #gnome
+ * for their help in figuring this out.
+ *
+ * Thank you.
+ */
+
+/* This function will make sure that tilda window becomes active (gains
+ * the focus) when it is called.
+ *
+ * This has to be the worst possible way of making this work, but it was the
+ * only way to get metacity to play nicely. All the other WM's are so nice,
+ * why oh why does metacity hate us so?
+ */
+static void
+tilda_window_set_active (TildaWindow *self)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       Display *x11_display = GDK_WINDOW_XDISPLAY( self->window->window );
+       Window *x11_window = GDK_WINDOW_XWINDOW( self->window->window );
+       Window *x11_root_window = GDK_WINDOW_XWINDOW( gtk_widget_get_root_window (self->window) );
+       GdkScreen *screen = gtk_widget_get_screen (self->window);
+
+       XEvent event;
+       long mask = SubstructureRedirectMask | SubstructureNotifyMask;
+
+       if (gdk_x11_screen_supports_net_wm_hint (screen,
+                                                                                        gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
+       {
+               event.xclient.type = ClientMessage;
+               event.xclient.serial = 0;
+               event.xclient.send_event = True;
+               event.xclient.display = x11_display;
+               event.xclient.window = x11_window;
+               event.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
+
+               event.xclient.format = 32;
+               event.xclient.data.l[0] = 2; /* pager */
+               event.xclient.data.l[1] = tomboy_keybinder_get_current_event_time(); /* timestamp */
+               event.xclient.data.l[2] = 0;
+               event.xclient.data.l[3] = 0;
+               event.xclient.data.l[4] = 0;
+
+               XSendEvent (x11_display, x11_root_window, False, mask, &event);
+       }
+       else
+       {
+               /* The WM doesn't support the EWMH standards. We'll print a warning and
+                * try this, though it probably won't work... */
+               g_printerr (_("WARNING: Window manager (%s) does not support EWMH hints\n"),
+                                       gdk_x11_screen_get_window_manager_name (screen));
+               XRaiseWindow (x11_display, x11_window);
+       }
+}
+
 static void
 tilda_window_keybinding_cb (const gchar *keystr, gpointer data)
 {
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(data));
+
        TildaWindow *self = TILDA_WINDOW(data);
-       g_print ("tilda_window_keybinding_cb() called! -- window %d\n", self->number);
+       TildaTerminal *tt;
 
-       // FIXME: this doesn't handle animation!
+       /* This call sets the X11 window property _NET_WM_USER_TIME, which GTK+ normally
+        * sets for us. However, because this callback is activated via a global keybinding,
+        * we see the event before GDK / GTK+ does. Therefore, to get the focus, we must
+        * set the property ourselves. */
+       gdk_x11_window_set_user_time (GTK_WIDGET(self->window)->window,
+                                                                 tomboy_keybinder_get_current_event_time());
 
        switch (self->state)
        {
-               case WINDOW_UP:
-                       /* Pull Down */
-                       tomboy_window_present_hardcore (GTK_WINDOW(self->window));
+               case WINDOW_UP: /* Pull the window up */
+
+                       /* Bugfix: having this here keeps the tilda window from being
+                        * hidden if you turn off "stick", pull it down on workspace 1,
+                        * switch to workspace 2, then pull it up and back down. Without
+                        * this, something in metacity (at least) hides the window. Stupid. */
+                       gtk_window_deiconify (GTK_WINDOW(self->window));
+
+                       /* Re-set the window properties that do not linger after hiding the
+                        * window. I know this looks stupid, but it keeps all of the state-
+                        * changing code in the place it belongs: the property-setting code. */
+                       g_object_set (G_OBJECT(self),
+                                       "keep-above", self->keep_above,
+                                       "stick", self->stick,
+                                       NULL);
+                       gtk_widget_show (GTK_WIDGET(self->window));
+
+                       /* Bugfix: this code fixes metacity-2.22 */
+                       tilda_window_set_active (self);
+
+                       /* Focusing the term here works perfectly, near as I can tell */
+                       tt = tilda_window_find_current_terminal (self);
+                       gtk_widget_grab_focus (GTK_WIDGET(tt->vte_term));
+
                        self->state = WINDOW_DOWN;
                        break;
 
-               case WINDOW_DOWN:
-                       /* Pull Up */
+               case WINDOW_DOWN: /* Pull the window up */
+
                        gtk_widget_hide (GTK_WIDGET(self->window));
+
                        self->state = WINDOW_UP;
                        break;
 
                default:
-                       g_printerr ("FIXME: the window is in a bad state!\n");
+                       debug_printf ("ERROR: Window is in a bad state!\n");
 
                        /* Pretend we're down, for good measure.... */
                        self->state = WINDOW_DOWN;
@@ -170,15 +374,24 @@ tilda_window_keybinding_cb (const gchar *keystr, gpointer data)
 static gboolean
 tilda_window_try_to_bind_key (TildaWindow *self, const gchar *new_key)
 {
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
        gboolean ret = FALSE;
 
        /* Make sure the new key is not null in any way */
-       if (new_key == NULL || strcmp("", new_key) == 0)
+       if (new_key == NULL || g_ascii_strcasecmp("", new_key) == 0)
+               return FALSE;
+
+       /* Check that no other windows are using the key */
+       // FIXME: there should be a hidden option to disable this. Maybe some people want
+       // to have logs in two Tildas, and just show them with one key. Crazy...
+       if (tilda_controller_global_key_in_use(TILDA_CONTROLLER(self->controller), new_key))
                return FALSE;
 
        /* Unbind if we were set */
        if (self->key)
-               tomboy_keybinder_unbind (self->key, tilda_window_keybinding_cb, self);
+               tomboy_keybinder_unbind (self->key, tilda_window_keybinding_cb);
 
        ret = tomboy_keybinder_bind (new_key, tilda_window_keybinding_cb, self);
 
@@ -190,34 +403,326 @@ tilda_window_try_to_bind_key (TildaWindow *self, const gchar *new_key)
                return TRUE;
        }
 
-       g_printerr ("Keybinding unsuccessful. Reverting to original key\n");
+       g_printerr (_("Bind key '%s' failed. Reverting to original keybinding\n"), self->key);
 
        /* Not successful, so rebind the old key, and return FALSE */
-       if (self->key != NULL && strcmp("",self->key) != 0)
+       if (self->key != NULL && g_ascii_strcasecmp("",self->key) != 0)
        {
                ret = tomboy_keybinder_bind (self->key, tilda_window_keybinding_cb, self);
 
                /* Check that it went ok */
                if (!ret)
-                       g_printerr ("Unable to bind original key as well! Oh shit...\n");
+                       g_printerr (_("Unable to re-bind original key '%s'. Oh shit...\n"), self->key);
        }
        else
-               g_printerr ("No original key to revert to!\n");
+               g_printerr (_("No original key to revert to!\n"));
 
        return FALSE;
 }
 
 static void
-tilda_window_dbus_register_object (TildaWindow *tw)
+tilda_window_dbus_register_object (TildaWindow *self)
 {
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
        gchar *object_path;
 
-       // Register this object with DBus
-       object_path = g_strdup_printf ("/net/sourceforge/Tilda/Window%d", tw->number);
-       dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(tw));
+       /* If DBus is not running, leave */
+       if (!dbus_connection)
+               return;
+
+       /* Register this object with DBus */
+       object_path = g_strdup_printf ("/net/sourceforge/Tilda/Window%d", self->number);
+       dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(self));
        g_free (object_path);
 }
 
+/*******************************************************************************
+ * All accelerator-related stuff below
+ ******************************************************************************/
+
+typedef gboolean (*TildaWindowAccelCallback) (TildaWindow *self, gpointer data);
+
+/**
+ * This function updates the accelerator used to call the given function for this
+ * TildaWindow. If accel is NULL, then func will be removed (no accelerator will
+ * cause func to be called).
+ *
+ * Returns: TRUE on success, FALSE on failure
+ */
+static gboolean
+tilda_window_update_accelerator (TildaWindow *self,                            /* object */
+                                                                gchar **accel_to_update,               /* self->??? */
+                                                                const gchar *accel,                    /* new accel */
+                                                                const TildaWindowAccelCallback func)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+       debug_assert (accel_to_update != NULL);
+       debug_assert (func != NULL);
+
+       gboolean ret;
+       guint key;
+       GdkModifierType mod;
+       GClosure *closure;
+
+       /* Remove the old accelerator if there was a previous one set */
+       if (*accel_to_update != NULL)
+       {
+               /* This should always parse, we've done it before! */
+               gtk_accelerator_parse (*accel_to_update, &key, &mod);
+               ret = gtk_accel_group_disconnect_key (self->accel_group, key, mod);
+       }
+
+       /* If we are just removing the old accelerator, we're already done */
+       if (accel == NULL)
+       {
+               g_free (*accel_to_update);
+               *accel_to_update = NULL;
+               return TRUE;
+       }
+
+       /* Create the closure for this function */
+       closure = g_cclosure_new_swap (G_CALLBACK(func), self, NULL);
+
+       /* Try to parse the new accelerator */
+       gtk_accelerator_parse (accel, &key, &mod);
+
+       if (!gtk_accelerator_valid (key, mod))
+       {
+               g_warning (_("Failed to parse accelerator: %s\n"), accel);
+
+               /* Re-install the old accelerator */
+               if (*accel_to_update != NULL)
+               {
+                       gtk_accelerator_parse (*accel_to_update, &key, &mod);
+                       gtk_accel_group_connect (self->accel_group, key, mod, GTK_ACCEL_VISIBLE, closure);
+               }
+               return FALSE;
+       }
+
+       /* All good, g_free() the old accelerator, g_strdup() the new one */
+       g_free (*accel_to_update);
+       *accel_to_update = g_strdup(accel);
+
+       /* Add the new accelerator */
+       gtk_accel_group_connect (self->accel_group, key, mod, GTK_ACCEL_VISIBLE, closure);
+
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_quit_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       tilda_window_close (self);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_next_tab_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       gint num_pages;
+       gint current_page;
+
+       num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook));
+       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(self->notebook));
+
+       /* Go to next page (with wrapping) */
+       if (num_pages != (current_page + num_pages))
+               gtk_notebook_next_page (GTK_NOTEBOOK(self->notebook));
+       else
+               gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), num_pages-1);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_prev_tab_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       gint num_pages;
+       gint current_page;
+
+       num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook));
+       current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(self->notebook));
+
+       if ((num_pages-1) != current_page)
+               gtk_notebook_prev_page (GTK_NOTEBOOK(self->notebook));
+       else
+               gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), 0);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_add_term_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       tilda_window_add_terminal (self);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_remove_term_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       TildaTerminal *tt = tilda_window_find_current_terminal (self);
+
+       tilda_window_remove_terminal (self, tt->number);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_copy_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       TildaTerminal *tt = tilda_window_find_current_terminal (self);
+
+       vte_terminal_copy_clipboard (VTE_TERMINAL(tt->vte_term));
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_paste_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       TildaTerminal *tt = tilda_window_find_current_terminal (self);
+
+       vte_terminal_paste_clipboard (VTE_TERMINAL(tt->vte_term));
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_goto_generic (TildaWindow *self, guint number)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), number-1);
+
+       /* Do not keep propagating */
+       return TRUE;
+}
+
+static gboolean
+tilda_window_accel_goto_1_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 1);
+}
+
+static gboolean
+tilda_window_accel_goto_2_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 2);
+}
+
+static gboolean
+tilda_window_accel_goto_3_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 3);
+}
+
+static gboolean
+tilda_window_accel_goto_4_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 4);
+}
+
+static gboolean
+tilda_window_accel_goto_5_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 5);
+}
+
+static gboolean
+tilda_window_accel_goto_6_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 6);
+}
+
+static gboolean
+tilda_window_accel_goto_7_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 7);
+}
+
+static gboolean
+tilda_window_accel_goto_8_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 8);
+}
+
+static gboolean
+tilda_window_accel_goto_9_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 9);
+}
+
+static gboolean
+tilda_window_accel_goto_10_cb (TildaWindow *self, gpointer data)
+{
+       debug_enter  ();
+       debug_assert (TILDA_IS_WINDOW(self));
+
+       return tilda_window_accel_goto_generic (self, 10);
+}
+
 /*******************************************************************************
  * ALL GOBJECT STUFF BELOW PLEASE
  ******************************************************************************/
@@ -226,26 +731,47 @@ static GObjectClass *parent_class = NULL;
 
 enum tilda_window_properties {
        TILDA_WINDOW_NUMBER = 1,
+       TILDA_WINDOW_CONTROLLER,
+
+       TILDA_WINDOW_ACCEL_QUIT,
+       TILDA_WINDOW_ACCEL_NEXT_TAB,
+       TILDA_WINDOW_ACCEL_PREV_TAB,
+       TILDA_WINDOW_ACCEL_ADD_TERM,
+       TILDA_WINDOW_ACCEL_REMOVE_TERM,
+       TILDA_WINDOW_ACCEL_COPY,
+       TILDA_WINDOW_ACCEL_PASTE,
+       TILDA_WINDOW_ACCEL_GOTO_1,
+       TILDA_WINDOW_ACCEL_GOTO_2,
+       TILDA_WINDOW_ACCEL_GOTO_3,
+       TILDA_WINDOW_ACCEL_GOTO_4,
+       TILDA_WINDOW_ACCEL_GOTO_5,
+       TILDA_WINDOW_ACCEL_GOTO_6,
+       TILDA_WINDOW_ACCEL_GOTO_7,
+       TILDA_WINDOW_ACCEL_GOTO_8,
+       TILDA_WINDOW_ACCEL_GOTO_9,
+       TILDA_WINDOW_ACCEL_GOTO_10,
 
        TILDA_WINDOW_KEY,
 
-       TILDA_WINDOW_MIN_HEIGHT,
-       TILDA_WINDOW_MIN_WIDTH,
-       TILDA_WINDOW_MAX_HEIGHT,
-       TILDA_WINDOW_MAX_WIDTH,
+       TILDA_WINDOW_HEIGHT,
+       TILDA_WINDOW_WIDTH,
        TILDA_WINDOW_X_POSITION,
        TILDA_WINDOW_Y_POSITION,
+       TILDA_WINDOW_INITIAL_TERMINALS,
 
        TILDA_WINDOW_TAB_POSITION,
        TILDA_WINDOW_ANIMATION_ORIENTATION,
        TILDA_WINDOW_ANIMATION_DELAY,
 
        TILDA_WINDOW_KEEP_ABOVE,
-       TILDA_WINDOW_SHOW_IN_TASKBAR,
-       TILDA_WINDOW_PINNED,
+       TILDA_WINDOW_SKIP_TASKBAR_HINT,
+       TILDA_WINDOW_STICK,
        TILDA_WINDOW_HIDDEN_AT_START,
        TILDA_WINDOW_CENTERED_HORIZONTALLY,
        TILDA_WINDOW_CENTERED_VERTICALLY,
+       TILDA_WINDOW_FULL_WIDTH_TABS,
+       TILDA_WINDOW_ALWAYS_SHOW_TABS,
+       TILDA_WINDOW_ALWAYS_SHOW_BORDER,
 
        TILDA_WINDOW_HAVE_REAL_TRANSPARENCY,
 };
@@ -254,6 +780,8 @@ static void
 tilda_window_instance_init (GTypeInstance *instance,
                                                        gpointer       g_class)
 {
+       debug_enter ();
+
        TildaWindow *self = (TildaWindow *) instance;
        self->dispose_has_run = FALSE;
 
@@ -262,8 +790,13 @@ tilda_window_instance_init (GTypeInstance *instance,
        self->notebook = gtk_notebook_new ();
        self->terms = g_ptr_array_new ();
 
+       /* Accelerators */
+       self->accel_group = gtk_accel_group_new ();
+       gtk_window_add_accel_group (GTK_WINDOW(self->window), self->accel_group);
+
        /* Somewhat of a "poison" value, incase we don't set this */
        self->number = 0xdeadbeef;
+       self->controller = NULL;
 
        self->state = WINDOW_UP;
 }
@@ -275,97 +808,274 @@ tilda_window_set_property (GObject      *object,
                                                   GParamSpec   *pspec)
 {
        TildaWindow *self = (TildaWindow *) object;
+       gint i;
 
        switch (property_id) {
 
                case TILDA_WINDOW_NUMBER:
                        self->number = g_value_get_int (value);
-                       g_print ("window number: %d\n", self->number);
+                       debug_printf ("window number: %d\n", self->number);
                        break;
 
-               case TILDA_WINDOW_KEY:
-                       tilda_window_try_to_bind_key (self, g_value_get_string (value));
-                       g_print ("window key: %s\n", self->key);
+               case TILDA_WINDOW_CONTROLLER:
+                       self->controller = g_value_get_pointer (value);
+                       debug_printf ("window controller: 0x%p\n", self->controller);
                        break;
 
-               case TILDA_WINDOW_MIN_HEIGHT:
-                       self->min_height = g_value_get_int (value);
-                       g_print ("window min height: %d\n", self->min_height);
+               case TILDA_WINDOW_ACCEL_QUIT:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_quit,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_quit_cb);
+                       debug_printf ("window accel quit: %s\n", self->accel_quit);
                        break;
 
-               case TILDA_WINDOW_MIN_WIDTH:
-                       self->min_width = g_value_get_int (value);
-                       g_print ("window min width: %d\n", self->min_width);
+               case TILDA_WINDOW_ACCEL_NEXT_TAB:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_next_tab,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_next_tab_cb);
+                       debug_printf ("window accel next tab: %s\n", self->accel_next_tab);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_PREV_TAB:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_prev_tab,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_prev_tab_cb);
+                       debug_printf ("window accel prev tab: %s\n", self->accel_prev_tab);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_ADD_TERM:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_add_term,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_add_term_cb);
+                       debug_printf ("window accel add term: %s\n", self->accel_add_term);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_REMOVE_TERM:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_remove_term,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_remove_term_cb);
+                       debug_printf ("window accel remove term: %s\n", self->accel_remove_term);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_COPY:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_copy,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_copy_cb);
+                       debug_printf ("window accel copy: %s\n", self->accel_copy);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_PASTE:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_paste,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_paste_cb);
+                       debug_printf ("window accel paste: %s\n", self->accel_paste);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_1:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_1,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_1_cb);
+                       debug_printf ("window accel goto 1: %s\n", self->accel_goto_1);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_2:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_2,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_2_cb);
+                       debug_printf ("window accel goto 2: %s\n", self->accel_goto_2);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_3:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_3,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_3_cb);
+                       debug_printf ("window accel goto 3: %s\n", self->accel_goto_3);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_4:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_4,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_4_cb);
+                       debug_printf ("window accel goto 4: %s\n", self->accel_goto_4);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_5:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_5,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_5_cb);
+                       debug_printf ("window accel goto 5: %s\n", self->accel_goto_5);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_6:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_6,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_6_cb);
+                       debug_printf ("window accel goto 6: %s\n", self->accel_goto_6);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_7:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_7,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_7_cb);
+                       debug_printf ("window accel goto 7: %s\n", self->accel_goto_7);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_8:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_8,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_8_cb);
+                       debug_printf ("window accel goto 8: %s\n", self->accel_goto_8);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_9:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_9,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_9_cb);
+                       debug_printf ("window accel goto 9: %s\n", self->accel_goto_9);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_10:
+                       tilda_window_update_accelerator (self,
+                                                                                        &self->accel_goto_10,
+                                                                                        g_value_get_string (value),
+                                                                                        tilda_window_accel_goto_10_cb);
+                       debug_printf ("window accel goto 10: %s\n", self->accel_goto_10);
+                       break;
+
+               case TILDA_WINDOW_KEY:
+                       tilda_window_try_to_bind_key (self, g_value_get_string (value));
+                       debug_printf ("window key %s\n", self->key);
                        break;
 
-               case TILDA_WINDOW_MAX_HEIGHT:
-                       self->max_height = g_value_get_int (value);
-                       g_print ("window max height: %d\n", self->max_height);
+               case TILDA_WINDOW_HEIGHT:
+                       self->height = g_value_get_int (value);
+                       gtk_widget_set_size_request (self->window, self->width, self->height);
+                       gtk_window_resize (GTK_WINDOW(self->window), self->width, self->height);
+                       debug_printf ("window height: %d\n", self->height);
                        break;
 
-               case TILDA_WINDOW_MAX_WIDTH:
-                       self->max_width = g_value_get_int (value);
-                       g_print ("window max width: %d\n", self->max_width);
+               case TILDA_WINDOW_WIDTH:
+                       self->width = g_value_get_int (value);
+                       gtk_widget_set_size_request (self->window, self->width, self->height);
+                       gtk_window_resize (GTK_WINDOW(self->window), self->width, self->height);
+                       debug_printf ("window width: %d\n", self->width);
                        break;
 
                case TILDA_WINDOW_X_POSITION:
                        self->x_position = g_value_get_int (value);
-                       g_print ("window x position: %d\n", self->x_position);
+                       gtk_window_move (GTK_WINDOW(self->window), self->x_position, self->y_position);
+                       debug_printf ("window x position: %d\n", self->x_position);
                        break;
 
                case TILDA_WINDOW_Y_POSITION:
                        self->y_position = g_value_get_int (value);
-                       g_print ("window y position: %d\n", self->y_position);
+                       gtk_window_move (GTK_WINDOW(self->window), self->x_position, self->y_position);
+                       debug_printf ("window y position: %d\n", self->y_position);
+                       break;
+
+               case TILDA_WINDOW_INITIAL_TERMINALS:
+                       self->initial_terminals = g_value_get_int (value);
+                       debug_printf ("window initial terminals: %d\n", self->initial_terminals);
                        break;
 
                case TILDA_WINDOW_TAB_POSITION:
-                       self->tab_position = g_value_get_int (value);
-                       g_print ("window tab position: %d\n", self->tab_position);
+                       self->tab_position = g_value_get_enum (value);
+                       gtk_notebook_set_tab_pos (GTK_NOTEBOOK(self->notebook), self->tab_position);
+                       debug_printf ("window tab position: %d\n", self->tab_position);
                        break;
 
                case TILDA_WINDOW_ANIMATION_ORIENTATION:
-                       self->animation_orientation = g_value_get_int (value);
-                       g_print ("window animation orientation: %d\n", self->animation_orientation);
+                       self->animation_orientation = g_value_get_enum (value);
+                       debug_printf ("window animation orientation: %d\n", self->animation_orientation);
                        break;
 
                case TILDA_WINDOW_ANIMATION_DELAY:
                        self->animation_delay = g_value_get_int (value);
-                       g_print ("window animation delay: %d\n", self->animation_delay);
+                       debug_printf ("window animation delay: %d\n", self->animation_delay);
                        break;
 
                case TILDA_WINDOW_KEEP_ABOVE:
                        self->keep_above = g_value_get_boolean (value);
-                       g_print ("window keep above: %d\n", self->keep_above);
+                       gtk_window_set_keep_above (GTK_WINDOW(self->window), self->keep_above);
+                       debug_printf ("window keep above: %d\n", self->keep_above);
                        break;
 
-               case TILDA_WINDOW_SHOW_IN_TASKBAR:
-                       self->show_in_taskbar = g_value_get_boolean (value);
-                       g_print ("window show in taskbar: %d\n", self->show_in_taskbar);
+               case TILDA_WINDOW_SKIP_TASKBAR_HINT:
+                       self->skip_taskbar_hint = g_value_get_boolean (value);
+                       gtk_window_set_skip_taskbar_hint (GTK_WINDOW(self->window), self->skip_taskbar_hint);
+                       debug_printf ("window skip taskbar hint: %d\n", self->skip_taskbar_hint);
                        break;
 
-               case TILDA_WINDOW_PINNED:
-                       self->pinned = g_value_get_boolean (value);
-                       g_print ("window pinned: %d\n", self->pinned);
+               case TILDA_WINDOW_STICK:
+                       self->stick = g_value_get_boolean (value);
+
+                       /* This is moderately ugly, but GTK+ does it this way... */
+                       self->stick ? gtk_window_stick (GTK_WINDOW(self->window))
+                                               : gtk_window_unstick (GTK_WINDOW(self->window));
+                       debug_printf ("window stick: %d\n", self->stick);
                        break;
 
                case TILDA_WINDOW_HIDDEN_AT_START:
                        self->hidden_at_start = g_value_get_boolean (value);
-                       g_print ("window hidden at start: %d\n", self->hidden_at_start);
+                       debug_printf ("window hidden at start: %d\n", self->hidden_at_start);
                        break;
 
                case TILDA_WINDOW_CENTERED_HORIZONTALLY:
                        self->centered_horizontally = g_value_get_boolean (value);
-                       g_print ("window centered horizontally: %d\n", self->centered_horizontally);
+                       if (self->centered_horizontally)
+                               tilda_window_center_horizontally (self);
+                       debug_printf ("window centered horizontally: %d\n", self->centered_horizontally);
                        break;
 
                case TILDA_WINDOW_CENTERED_VERTICALLY:
                        self->centered_vertically = g_value_get_boolean (value);
-                       g_print ("window centered vertically: %d\n", self->centered_vertically);
+                       if (self->centered_vertically)
+                               tilda_window_center_vertically (self);
+                       debug_printf ("window centered vertically: %d\n", self->centered_vertically);
+                       break;
+
+               case TILDA_WINDOW_FULL_WIDTH_TABS:
+                       self->full_width_tabs = g_value_get_boolean (value);
+                       for (i=0; i<self->terms->len; ++i)
+                               gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook),
+                                                                                                       TILDA_TERMINAL(g_ptr_array_index(self->terms, i))->hbox,
+                                                                                                       self->full_width_tabs,
+                                                                                                       TRUE,
+                                                                                                       GTK_PACK_START);
+                       debug_printf ("window full width tabs: %d\n", self->full_width_tabs);
+                       break;
+
+               case TILDA_WINDOW_ALWAYS_SHOW_TABS:
+                       self->always_show_tabs = g_value_get_boolean (value);
+                       tilda_window_show_hide_tabs_if_appropriate (self);
+                       debug_printf ("window always show tabs: %d\n", self->always_show_tabs);
+                       break;
+
+               case TILDA_WINDOW_ALWAYS_SHOW_BORDER:
+                       self->always_show_border = g_value_get_boolean (value);
+                       gtk_notebook_set_show_border (GTK_NOTEBOOK(self->notebook), self->always_show_border);
+                       debug_printf ("window always show border: %d\n", self->always_show_border);
                        break;
 
                case TILDA_WINDOW_HAVE_REAL_TRANSPARENCY:
                        self->have_real_transparency = g_value_get_boolean (value);
-                       g_print ("window have real transp: %d\n", self->have_real_transparency);
+                       debug_printf ("window have real transp: %d\n", self->have_real_transparency);
                        break;
 
                default:
@@ -389,24 +1099,88 @@ tilda_window_get_property (GObject    *object,
                        g_value_set_int (value, self->number);
                        break;
 
-               case TILDA_WINDOW_KEY:
-                       g_value_set_string (value, self->key);
+               case TILDA_WINDOW_CONTROLLER:
+                       g_value_set_pointer (value, self->controller);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_QUIT:
+                       g_value_set_string (value, self->accel_quit);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_NEXT_TAB:
+                       g_value_set_string (value, self->accel_next_tab);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_PREV_TAB:
+                       g_value_set_string (value, self->accel_prev_tab);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_ADD_TERM:
+                       g_value_set_string (value, self->accel_prev_tab);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_REMOVE_TERM:
+                       g_value_set_string (value, self->accel_remove_term);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_COPY:
+                       g_value_set_string (value, self->accel_copy);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_PASTE:
+                       g_value_set_string (value, self->accel_paste);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_1:
+                       g_value_set_string (value, self->accel_goto_1);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_2:
+                       g_value_set_string (value, self->accel_goto_2);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_3:
+                       g_value_set_string (value, self->accel_goto_3);
                        break;
 
-               case TILDA_WINDOW_MIN_HEIGHT:
-                       g_value_set_int (value, self->min_height);
+               case TILDA_WINDOW_ACCEL_GOTO_4:
+                       g_value_set_string (value, self->accel_goto_4);
                        break;
 
-               case TILDA_WINDOW_MIN_WIDTH:
-                       g_value_set_int (value, self->min_width);
+               case TILDA_WINDOW_ACCEL_GOTO_5:
+                       g_value_set_string (value, self->accel_goto_5);
                        break;
 
-               case TILDA_WINDOW_MAX_HEIGHT:
-                       g_value_set_int (value, self->max_height);
+               case TILDA_WINDOW_ACCEL_GOTO_6:
+                       g_value_set_string (value, self->accel_goto_6);
                        break;
 
-               case TILDA_WINDOW_MAX_WIDTH:
-                       g_value_set_int (value, self->max_width);
+               case TILDA_WINDOW_ACCEL_GOTO_7:
+                       g_value_set_string (value, self->accel_goto_7);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_8:
+                       g_value_set_string (value, self->accel_goto_8);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_9:
+                       g_value_set_string (value, self->accel_goto_9);
+                       break;
+
+               case TILDA_WINDOW_ACCEL_GOTO_10:
+                       g_value_set_string (value, self->accel_goto_10);
+                       break;
+
+               case TILDA_WINDOW_KEY:
+                       g_value_set_string (value, self->key);
+                       break;
+
+               case TILDA_WINDOW_HEIGHT:
+                       g_value_set_int (value, self->height);
+                       break;
+
+               case TILDA_WINDOW_WIDTH:
+                       g_value_set_int (value, self->width);
                        break;
 
                case TILDA_WINDOW_X_POSITION:
@@ -417,12 +1191,16 @@ tilda_window_get_property (GObject    *object,
                        g_value_set_int (value, self->y_position);
                        break;
 
+               case TILDA_WINDOW_INITIAL_TERMINALS:
+                       g_value_set_int (value, self->initial_terminals);
+                       break;
+
                case TILDA_WINDOW_TAB_POSITION:
-                       g_value_set_int (value, self->tab_position);
+                       g_value_set_enum (value, self->tab_position);
                        break;
 
                case TILDA_WINDOW_ANIMATION_ORIENTATION:
-                       g_value_set_int (value, self->animation_orientation);
+                       g_value_set_enum (value, self->animation_orientation);
                        break;
 
                case TILDA_WINDOW_ANIMATION_DELAY:
@@ -433,12 +1211,12 @@ tilda_window_get_property (GObject    *object,
                        g_value_set_boolean (value, self->keep_above);
                        break;
 
-               case TILDA_WINDOW_SHOW_IN_TASKBAR:
-                       g_value_set_boolean (value, self->show_in_taskbar);
+               case TILDA_WINDOW_SKIP_TASKBAR_HINT:
+                       g_value_set_boolean (value, self->skip_taskbar_hint);
                        break;
 
-               case TILDA_WINDOW_PINNED:
-                       g_value_set_boolean (value, self->pinned);
+               case TILDA_WINDOW_STICK:
+                       g_value_set_boolean (value, self->stick);
                        break;
 
                case TILDA_WINDOW_HIDDEN_AT_START:
@@ -453,6 +1231,18 @@ tilda_window_get_property (GObject    *object,
                        g_value_set_boolean (value, self->centered_vertically);
                        break;
 
+               case TILDA_WINDOW_FULL_WIDTH_TABS:
+                       g_value_set_boolean (value, self->full_width_tabs);
+                       break;
+
+               case TILDA_WINDOW_ALWAYS_SHOW_TABS:
+                       g_value_set_boolean (value, self->always_show_tabs);
+                       break;
+
+               case TILDA_WINDOW_ALWAYS_SHOW_BORDER:
+                       g_value_set_boolean (value, self->always_show_border);
+                       break;
+
                case TILDA_WINDOW_HAVE_REAL_TRANSPARENCY:
                        g_value_set_boolean (value, self->have_real_transparency);
                        break;
@@ -469,8 +1259,11 @@ tilda_window_constructor (GType                  type,
                                                  guint                  n_construct_properties,
                                                  GObjectConstructParam *construct_properties)
 {
+       debug_enter ();
+
        GObject *obj;
        TildaWindow *self;
+       gint i;
 
        /* Invoke parent constructor */
        TildaWindowClass *klass;
@@ -481,36 +1274,93 @@ tilda_window_constructor (GType                  type,
 
        /* Do other stuff here. The object is ready to go now, and all
         * ctor properties have been set.
-        *
-        * TODO: This is the place to do DBus-init */
+        */
        self = TILDA_WINDOW(obj);
 
-       /* Register this object with DBus */
-       tilda_window_dbus_register_object (self);
-
        /* Try to set up real transparency */
        tilda_window_setup_real_transparency (self);
 
        gtk_container_add (GTK_CONTAINER(self->window), self->notebook);
+       g_object_set (G_OBJECT(self->notebook), "can-focus", FALSE, NULL);
        gtk_widget_show (self->notebook);
 
-       tilda_window_add_term (self);
-       tilda_window_add_term (self);
-       gtk_widget_show_all (self->window);
-       self->state = WINDOW_DOWN;
+       /* Tilda is never decorated */
+       gtk_window_set_decorated (GTK_WINDOW(self->window), FALSE);
 
-       return obj;
-}
+       /* Set all of the properties out of the config file */
+       tilda_window_set_property_from_config (self, "key");
 
-static void
-my_unref (gpointer data, gpointer user_data)
-{
-       g_object_unref (G_OBJECT(data));
+       // FIXME: hack -- start the wizard in this case :)
+       if (!self->key)
+       {
+               gchar *key = g_strdup_printf ("F%d", self->number+3);
+               g_object_set (G_OBJECT(self), "key", key, NULL);
+               g_free (key);
+
+               g_critical ("HACK: start the wizard here\n");
+       }
+
+       tilda_window_set_property_from_config (self, "accelerator-quit");
+       tilda_window_set_property_from_config (self, "accelerator-next-tab");
+       tilda_window_set_property_from_config (self, "accelerator-previous-tab");
+       tilda_window_set_property_from_config (self, "accelerator-add-terminal");
+       tilda_window_set_property_from_config (self, "accelerator-remove-terminal");
+       tilda_window_set_property_from_config (self, "accelerator-copy");
+       tilda_window_set_property_from_config (self, "accelerator-paste");
+       tilda_window_set_property_from_config (self, "accelerator-goto-1");
+       tilda_window_set_property_from_config (self, "accelerator-goto-2");
+       tilda_window_set_property_from_config (self, "accelerator-goto-3");
+       tilda_window_set_property_from_config (self, "accelerator-goto-4");
+       tilda_window_set_property_from_config (self, "accelerator-goto-5");
+       tilda_window_set_property_from_config (self, "accelerator-goto-6");
+       tilda_window_set_property_from_config (self, "accelerator-goto-7");
+       tilda_window_set_property_from_config (self, "accelerator-goto-8");
+       tilda_window_set_property_from_config (self, "accelerator-goto-9");
+       tilda_window_set_property_from_config (self, "accelerator-goto-10");
+
+       tilda_window_set_property_from_config (self, "height");
+       tilda_window_set_property_from_config (self, "width");
+       tilda_window_set_property_from_config (self, "x-position");
+       tilda_window_set_property_from_config (self, "y-position");
+       tilda_window_set_property_from_config (self, "initial-terminals");
+       tilda_window_set_property_from_config (self, "animation-delay");
+
+       tilda_window_set_property_from_config (self, "tab-position");
+       tilda_window_set_property_from_config (self, "animation-orientation");
+
+       tilda_window_set_property_from_config (self, "keep-above");
+       tilda_window_set_property_from_config (self, "skip-taskbar-hint");
+       tilda_window_set_property_from_config (self, "stick");
+       tilda_window_set_property_from_config (self, "hidden-at-start");
+       tilda_window_set_property_from_config (self, "centered-horizontally");
+       tilda_window_set_property_from_config (self, "centered-vertically");
+       tilda_window_set_property_from_config (self, "full-width-tabs");
+       tilda_window_set_property_from_config (self, "always-show-tabs");
+       tilda_window_set_property_from_config (self, "always-show-border");
+
+       /* Add the initial terminal(s) */
+       for (i=0; i<self->initial_terminals; ++i)
+               tilda_window_add_terminal (self);
+
+       /* Realize the window (only sets up X resources), and set its current state */
+       gtk_widget_realize (self->window);
+       self->state = WINDOW_UP;
+
+       /* If we should be shown now, do a mock call of the global callback */
+       if (!self->hidden_at_start)
+               tilda_window_keybinding_cb (NULL, self);
+
+       /* Register this object with DBus */
+       tilda_window_dbus_register_object (self);
+
+       return obj;
 }
 
 static void
 tilda_window_dispose (GObject *obj)
 {
+       debug_enter ();
+
        TildaWindow *self = (TildaWindow *) obj;
 
        /* We don't want to run dispose twice, so just return immediately */
@@ -526,9 +1376,14 @@ tilda_window_dispose (GObject *obj)
         * NOTE: See the following for how to deal with GtkObject-derived things:
         * http://library.gnome.org/devel/gtk/unstable/GtkObject.html
         */
-       g_ptr_array_foreach (self->terms, my_unref, NULL);
+       g_object_unref (G_OBJECT(self->accel_group));
+       g_ptr_array_foreach (self->terms, g_object_unref, NULL);
        gtk_widget_destroy (self->window);
 
+       /* Unbind if we were set */
+       if (self->key)
+               tomboy_keybinder_unbind (self->key, tilda_window_keybinding_cb);
+
        /* Chain up to the parent class */
        G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
@@ -536,6 +1391,8 @@ tilda_window_dispose (GObject *obj)
 static void
 tilda_window_finalize (GObject *obj)
 {
+       debug_enter ();
+
        TildaWindow *self = (TildaWindow *) obj;
 
        /*
@@ -554,6 +1411,8 @@ static void
 tilda_window_class_init (gpointer g_class,
                                                 gpointer g_class_data)
 {
+       debug_enter ();
+
        GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
        TildaWindowClass *klass = TILDA_WINDOW_CLASS (g_class);
        GParamSpec *pspec;
@@ -569,8 +1428,8 @@ tilda_window_class_init (gpointer g_class,
 
        /* Install all of the properties */
        pspec = g_param_spec_int ("number",
-                                                         "Window number",
-                                                         "Set window's number",
+                                                         _("Window number"),
+                                                         NULL,
                                                          0,            // min value
                                                          INT_MAX,      // max value
                                                          0,            // def value
@@ -580,42 +1439,197 @@ tilda_window_class_init (gpointer g_class,
                                                                         TILDA_WINDOW_NUMBER,
                                                                         pspec);
 
-       pspec = g_param_spec_string ("key",
-                                                                "Window's drop-down keybinding",
+       pspec = g_param_spec_pointer ("controller",
+                                                                 _("Pointer to window's controlling TildaController"),
+                                                                 NULL,
+                                                                 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_CONTROLLER,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-quit",
+                                                                _("Accelerator to quit this window"),
                                                                 NULL,
                                                                 NULL,
                                                                 G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_KEY,
+                                                                        TILDA_WINDOW_ACCEL_QUIT,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("min-height",
-                                                         "Window's minimum height",
-                                                         NULL,
-                                                         0,
-                                                         INT_MAX,
-                                                         0,
-                                                         G_PARAM_READWRITE);
+       pspec = g_param_spec_string ("accelerator-next-tab",
+                                                                _("Accelerator to go to the next tab"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_MIN_HEIGHT,
+                                                                        TILDA_WINDOW_ACCEL_NEXT_TAB,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("min-width",
-                                                         "Window's minimum width",
-                                                         NULL,
-                                                         0,
-                                                         INT_MAX,
-                                                         0,
-                                                         G_PARAM_READWRITE);
+       pspec = g_param_spec_string ("accelerator-previous-tab",
+                                                                _("Accelerator to go to the previous tab"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_PREV_TAB,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-add-terminal",
+                                                                _("Accelerator to add a terminal"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_ADD_TERM,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-remove-terminal",
+                                                                _("Accelerator to remove a terminal"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_REMOVE_TERM,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-copy",
+                                                                _("Accelerator to copy to the clipboard"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_COPY,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-paste",
+                                                                _("Accelerator to paste from the clipboard"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_PASTE,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-1",
+                                                                _("Accelerator to go to tab 1"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_1,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-2",
+                                                                _("Accelerator to go to tab 2"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_2,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-3",
+                                                                _("Accelerator to go to tab 3"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_3,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-4",
+                                                                _("Accelerator to go to tab 4"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_4,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-5",
+                                                                _("Accelerator to go to tab 5"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_5,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-6",
+                                                                _("Accelerator to go to tab 6"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_6,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-7",
+                                                                _("Accelerator to go to tab 7"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_7,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-8",
+                                                                _("Accelerator to go to tab 8"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_8,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-9",
+                                                                _("Accelerator to go to tab 9"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_9,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("accelerator-goto-10",
+                                                                _("Accelerator to go to tab 10"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ACCEL_GOTO_10,
+                                                                        pspec);
+
+       pspec = g_param_spec_string ("key",
+                                                                _("Window's drop-down keybinding"),
+                                                                NULL,
+                                                                NULL,
+                                                                G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_MIN_WIDTH,
+                                                                        TILDA_WINDOW_KEY,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("max-height",
-                                                         "Window's maximum height",
+       pspec = g_param_spec_int ("height",
+                                                         _("Window's height"),
                                                          NULL,
                                                          0,
                                                          INT_MAX,
@@ -623,11 +1637,11 @@ tilda_window_class_init (gpointer g_class,
                                                          G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_MAX_HEIGHT,
+                                                                        TILDA_WINDOW_HEIGHT,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("max-width",
-                                                         "Window's maximum width",
+       pspec = g_param_spec_int ("width",
+                                                         _("Window's width"),
                                                          NULL,
                                                          0,
                                                          INT_MAX,
@@ -635,11 +1649,11 @@ tilda_window_class_init (gpointer g_class,
                                                          G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_MAX_WIDTH,
+                                                                        TILDA_WINDOW_WIDTH,
                                                                         pspec);
 
        pspec = g_param_spec_int ("x-position",
-                                                         "Window's x position",
+                                                         _("Window's x position"),
                                                          NULL,
                                                          0,
                                                          INT_MAX,
@@ -651,7 +1665,7 @@ tilda_window_class_init (gpointer g_class,
                                                                         pspec);
 
        pspec = g_param_spec_int ("y-position",
-                                                         "Window's y position",
+                                                         _("Window's y position"),
                                                          NULL,
                                                          0,
                                                          INT_MAX,
@@ -662,32 +1676,42 @@ tilda_window_class_init (gpointer g_class,
                                                                         TILDA_WINDOW_Y_POSITION,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("tab-position",
-                                                         "Window's tab position",
+       pspec = g_param_spec_int ("initial-terminals",
+                                                         _("Window's inital number of terminals"),
                                                          NULL,
-                                                         0,
+                                                         1,
                                                          INT_MAX,
-                                                         0,
+                                                         1,
                                                          G_PARAM_READWRITE);
 
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_INITIAL_TERMINALS,
+                                                                        pspec);
+
+       pspec = g_param_spec_enum ("tab-position",
+                                                          _("Position of window's tab bar"),
+                                                          NULL,
+                                                          gtk_position_type_get_type(),
+                                                          GTK_POS_TOP,
+                                                          G_PARAM_READWRITE);
+
        g_object_class_install_property (gobject_class,
                                                                         TILDA_WINDOW_TAB_POSITION,
                                                                         pspec);
 
-       pspec = g_param_spec_int ("animation-orientation",
-                                                         "Window's animation orientation",
-                                                         NULL,
-                                                         0,
-                                                         INT_MAX,
-                                                         0,
-                                                         G_PARAM_READWRITE);
+       pspec = g_param_spec_enum ("animation-orientation",
+                                                          _("Window's animation orientation"),
+                                                          NULL,
+                                                          gtk_position_type_get_type(),
+                                                          GTK_POS_TOP,
+                                                          G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
                                                                         TILDA_WINDOW_ANIMATION_ORIENTATION,
                                                                         pspec);
 
        pspec = g_param_spec_int ("animation-delay",
-                                                         "Amount of time in milliseconds between animation intervals",
+                                                         _("Amount of time in milliseconds between animation intervals"),
                                                          NULL,
                                                          0,
                                                          INT_MAX,
@@ -699,7 +1723,7 @@ tilda_window_class_init (gpointer g_class,
                                                                         pspec);
 
        pspec = g_param_spec_boolean ("keep-above",
-                                                                 "Keep this window above all others",
+                                                                 _("Keep this window above all others"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
@@ -708,28 +1732,28 @@ tilda_window_class_init (gpointer g_class,
                                                                         TILDA_WINDOW_KEEP_ABOVE,
                                                                         pspec);
 
-       pspec = g_param_spec_boolean ("show-in-taskbar",
-                                                                 "Show this window in the taskbar",
+       pspec = g_param_spec_boolean ("skip-taskbar-hint",
+                                                                 _("Hide this window in the taskbar if TRUE"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_SHOW_IN_TASKBAR,
+                                                                        TILDA_WINDOW_SKIP_TASKBAR_HINT,
                                                                         pspec);
 
-       pspec = g_param_spec_boolean ("pinned",
-                                                                 "Display this window on all workspaces",
+       pspec = g_param_spec_boolean ("stick",
+                                                                 _("Display this window on all workspaces"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
 
        g_object_class_install_property (gobject_class,
-                                                                        TILDA_WINDOW_PINNED,
+                                                                        TILDA_WINDOW_STICK,
                                                                         pspec);
 
        pspec = g_param_spec_boolean ("hidden-at-start",
-                                                                 "Hide the window when it is first created",
+                                                                 _("Hide the window when it is first created"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
@@ -739,7 +1763,7 @@ tilda_window_class_init (gpointer g_class,
                                                                         pspec);
 
        pspec = g_param_spec_boolean ("centered-horizontally",
-                                                                 "Center the window horizontally",
+                                                                 _("Center the window horizontally"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
@@ -749,7 +1773,7 @@ tilda_window_class_init (gpointer g_class,
                                                                         pspec);
 
        pspec = g_param_spec_boolean ("centered-vertically",
-                                                                 "Center the window vertically",
+                                                                 _("Center the window vertically"),
                                                                  NULL,
                                                                  FALSE,
                                                                  G_PARAM_READWRITE);
@@ -758,6 +1782,36 @@ tilda_window_class_init (gpointer g_class,
                                                                         TILDA_WINDOW_CENTERED_VERTICALLY,
                                                                         pspec);
 
+       pspec = g_param_spec_boolean ("full-width-tabs",
+                                                                 _("Tabs should have full width of window"),
+                                                                 NULL,
+                                                                 TRUE,
+                                                                 G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_FULL_WIDTH_TABS,
+                                                                        pspec);
+
+       pspec = g_param_spec_boolean ("always-show-tabs",
+                                                                 _("Always show the tab bar, regardless of the number of open tabs"),
+                                                                 NULL,
+                                                                 TRUE,
+                                                                 G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ALWAYS_SHOW_TABS,
+                                                                        pspec);
+
+       pspec = g_param_spec_boolean ("always-show-border",
+                                                                 _("Always show the window borders, regardless of the number of open tabs"),
+                                                                 NULL,
+                                                                 TRUE,
+                                                                 G_PARAM_READWRITE);
+
+       g_object_class_install_property (gobject_class,
+                                                                        TILDA_WINDOW_ALWAYS_SHOW_BORDER,
+                                                                        pspec);
+
        pspec = g_param_spec_boolean ("have-real-transparency",
                                                                  NULL, NULL, FALSE, G_PARAM_READABLE);
 
@@ -765,8 +1819,6 @@ tilda_window_class_init (gpointer g_class,
                                                                         TILDA_WINDOW_HAVE_REAL_TRANSPARENCY,
                                                                         pspec);
 
-       /* TODO: more properties */
-
        /* Hook the TildaWindow type into DBus */
        dbus_g_object_type_install_info (tilda_window_get_type(), &dbus_glib_tilda_window_object_info);
 }
@@ -799,34 +1851,4 @@ tilda_window_get_type (void)
        return type;
 }
 
-#if 0
-
-int main (int argc, char *argv[])
-{
-       GObject *tw;
-       gint test_number = INT_MIN;
-
-       /* Initialize the GObject type system */
-       g_type_init ();
-       gtk_init (&argc, &argv);
-
-       tw = g_object_new (TILDA_TYPE_WINDOW, "number", 10, NULL);
-       g_object_get (G_OBJECT (tw), "number", &test_number, NULL);
-       g_assert (test_number == 10);
-
-       g_object_unref (G_OBJECT (tw));
-
-       tw = g_object_new (TILDA_TYPE_WINDOW, "number", 22, NULL);
-       g_object_get (G_OBJECT (tw), "number", &test_number, NULL);
-       g_assert (test_number == 22);
-
-       gtk_main ();
-
-       g_object_unref (G_OBJECT (tw));
-
-       return 0;
-}
-
-#endif
-
 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */