gint number;
TildaTerminal *tt;
+ GtkWidget *label;
+ gint notebook_index;
number = tilda_window_find_next_free_terminal_number (self);
tt = g_object_new (TILDA_TYPE_TERMINAL,
NULL);
g_ptr_array_add (self->terms, tt);
- GtkWidget *label = gtk_label_new ("Tilda");
- gint index = gtk_notebook_prepend_page (GTK_NOTEBOOK(self->notebook), tt->hbox, label);
+ label = gtk_label_new ("Tilda");
+ notebook_index = gtk_notebook_prepend_page (GTK_NOTEBOOK(self->notebook), tt->hbox, label);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook), tt->hbox, TRUE, TRUE, GTK_PACK_END);
- gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), index);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), notebook_index);
if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) > 1)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
gchar *object_path;
- // Register this object with DBus
+ /* 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 configuration subsystem code is below
+ * All accelerator-related stuff below
******************************************************************************/
+typedef gboolean (*TildaWindowAccelCallback) (TildaWindow *self, gpointer data);
+
/**
- * Lookup a setting in the config file for this TildaWindow.
+ * 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).
*
- * The returned string MUST be g_strdup()'d if you want to actually use
- * it as a value. It is owned by the config system. You MUST NOT g_free() it.
+ * Returns: TRUE on success, FALSE on failure
*/
-static gchar *
-tilda_window_lookup_from_config (TildaWindow *self, const gchar key[])
+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 (key != NULL);
+ debug_assert (accel_to_update != NULL);
+ debug_assert (func != NULL);
- GError *error = NULL;
- gchar *group_name;
- gpointer value;
+ gboolean ret;
+ guint key;
+ GdkModifierType mod;
+ GClosure *closure;
- /* Do the bottom-most lookup */
- group_name = g_strdup_printf ("Window%d", self->number);
- value = g_key_file_get_string (config_userprefs, group_name, key, &error);
- g_free (group_name);
+ /* 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 (!error)
- return value;
- else
- g_clear_error (&error);
+ /* 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;
+ }
- /* Do the global lookup */
- value = g_key_file_get_string (config_userprefs, "Global", key, &error);
+ /* Create the closure for this function */
+ closure = g_cclosure_new_swap (G_CALLBACK(func), self, NULL);
- if (!error)
- return value;
- else
- g_clear_error (&error);
+ /* Try to parse the new accelerator */
+ gtk_accelerator_parse (accel, &key, &mod);
- /* Look in the defaults */
- if (!g_hash_table_lookup_extended (config_defaults, key, NULL, &value))
+ if (!gtk_accelerator_valid (key, mod))
{
- /* If this happened, the developers forgot to set the default for
- * a key they added. Please email them. */
- g_critical ("Error: unable to find the default for key=%s\n", key);
- exit (1);
+ 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;
}
- /* Return the default key */
- return value;
+ /* 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;
}
-/**
- * Set one of TildaWindow's integer properties from the config file or defaults.
- */
-static void
-tilda_window_config_int_property (TildaWindow *self, const gchar *property)
+static gboolean
+tilda_window_accel_quit_cb (TildaWindow *self, gpointer data)
{
debug_enter ();
debug_assert (TILDA_IS_WINDOW(self));
- debug_assert (property != NULL);
- gint config_value;
- gchar *config_value_raw;
+ tilda_window_close (self);
- config_value_raw = tilda_window_lookup_from_config (self, property);
- config_value = atoi (config_value_raw);
- g_object_set (G_OBJECT(self), property, config_value, NULL);
+ /* Do not keep propagating */
+ return TRUE;
}
-static void
-tilda_window_config_enum_property (TildaWindow *self, const gchar *property)
+static gboolean
+tilda_window_accel_next_tab_cb (TildaWindow *self, gpointer data)
{
debug_enter ();
debug_assert (TILDA_IS_WINDOW(self));
- debug_assert (property != NULL);
- gint config_value;
- gchar *config_value_raw;
+ gint num_pages;
+ gint current_page;
- /* Copy, then strip spaces off of the string from the config */
- config_value_raw = g_strstrip (g_strdup (tilda_window_lookup_from_config (self, property)));
+ num_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook));
+ current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(self->notebook));
-begin_parsing:
+ /* 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);
- /* Just try all of the possible enums */
- if (g_ascii_strcasecmp (config_value_raw, "LEFT") == 0)
- config_value = GTK_POS_LEFT;
- else if (g_ascii_strcasecmp (config_value_raw, "RIGHT") == 0)
- config_value = GTK_POS_RIGHT;
- else if (g_ascii_strcasecmp (config_value_raw, "TOP") == 0)
- config_value = GTK_POS_TOP;
- else if (g_ascii_strcasecmp (config_value_raw, "BOTTOM") == 0)
- config_value = GTK_POS_BOTTOM;
+ /* 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
- {
- g_critical ("Unable to parse: '%s' as an enum\n", config_value_raw);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), 0);
- /* Use the default -- which I sure hope is valid (famous last words) */
- config_value_raw = g_hash_table_lookup (config_defaults, property);
- goto begin_parsing;
- }
+ /* 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));
- /* Free the value from the config system */
- g_free (config_value_raw);
+ tilda_window_add_terminal (self);
- g_object_set (G_OBJECT(self), property, config_value, NULL);
+ /* Do not keep propagating */
+ return TRUE;
}
-static void
-tilda_window_config_string_property (TildaWindow *self, const gchar *property)
+static gboolean
+tilda_window_accel_remove_term_cb (TildaWindow *self, gpointer data)
{
debug_enter ();
debug_assert (TILDA_IS_WINDOW(self));
- debug_assert (property != NULL);
- gchar *config_value_raw;
+ TildaTerminal *tt = tilda_window_find_current_terminal (self);
- config_value_raw = tilda_window_lookup_from_config (self, property);
+ tilda_window_remove_terminal (self, tt->number);
- /* The property system g_strdup()s strings for us! */
- g_object_set (G_OBJECT(self), property, config_value_raw, NULL);
+ /* Do not keep propagating */
+ return TRUE;
}
-static void
-tilda_window_config_boolean_property (TildaWindow *self, const gchar *property)
+static gboolean
+tilda_window_accel_copy_cb (TildaWindow *self, gpointer data)
{
debug_enter ();
debug_assert (TILDA_IS_WINDOW(self));
- debug_assert (property != NULL);
- gboolean config_value;
- gchar *config_value_raw;
+ TildaTerminal *tt = tilda_window_find_current_terminal (self);
+
+ vte_terminal_copy_clipboard (VTE_TERMINAL(tt->vte_term));
+
+ /* Do not keep propagating */
+ return TRUE;
+}
- config_value_raw = tilda_window_lookup_from_config (self, property);
+static gboolean
+tilda_window_accel_paste_cb (TildaWindow *self, gpointer data)
+{
+ debug_enter ();
+ debug_assert (TILDA_IS_WINDOW(self));
-begin_parsing:
+ TildaTerminal *tt = tilda_window_find_current_terminal (self);
- if (g_ascii_strcasecmp (config_value_raw, "true") == 0)
- config_value = TRUE;
- else if (g_ascii_strcasecmp (config_value_raw, "false") == 0)
- config_value = FALSE;
- else
- {
- g_critical ("Unable to parse: '%s' as a boolean\n", config_value_raw);
+ vte_terminal_paste_clipboard (VTE_TERMINAL(tt->vte_term));
+
+ /* Do not keep propagating */
+ return TRUE;
+}
- /* Use the default -- which I sure hope is valid (famous last words) */
- config_value_raw = g_hash_table_lookup (config_defaults, property);
- goto begin_parsing;
+static gboolean
+tilda_window_accel_goto_generic (TildaWindow *self, guint number)
+{
+ debug_enter ();
+ debug_assert (TILDA_IS_WINDOW(self));
+
+ if (self->terms->len > (number - 1))
+ {
+ gint temp = self->terms->len - number;
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), temp);
}
- g_object_set (G_OBJECT(self), property, config_value, NULL);
+ /* 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
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_HEIGHT,
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;
debug_printf ("window controller: 0x%x\n", self->controller);
break;
+ 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_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_TAB_POSITION:
- self->tab_position = g_value_get_int (value);
+ 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);
+ self->animation_orientation = g_value_get_enum (value);
debug_printf ("window animation orientation: %d\n", self->animation_orientation);
break;
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_ACCEL_GOTO_4:
+ g_value_set_string (value, self->accel_goto_4);
+ break;
+
+ case TILDA_WINDOW_ACCEL_GOTO_5:
+ g_value_set_string (value, self->accel_goto_5);
+ break;
+
+ case TILDA_WINDOW_ACCEL_GOTO_6:
+ g_value_set_string (value, self->accel_goto_6);
+ break;
+
+ 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;
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:
gtk_window_set_decorated (GTK_WINDOW(self->window), FALSE);
/* Set all of the properties out of the config file */
- tilda_window_config_string_property (self, "key");
+ tilda_window_set_property_from_config (self, "key");
// FIXME: hack -- start the wizard in this case :)
if (!self->key)
g_critical ("HACK: start the wizard here\n");
}
- tilda_window_config_int_property (self, "height");
- tilda_window_config_int_property (self, "width");
- tilda_window_config_int_property (self, "x-position");
- tilda_window_config_int_property (self, "y-position");
- tilda_window_config_int_property (self, "initial-terminals");
- tilda_window_config_int_property (self, "animation-delay");
-
- tilda_window_config_enum_property (self, "tab-position");
- tilda_window_config_enum_property (self, "animation-orientation");
-
- tilda_window_config_boolean_property (self, "keep-above");
- tilda_window_config_boolean_property (self, "skip-taskbar-hint");
- tilda_window_config_boolean_property (self, "stick");
- tilda_window_config_boolean_property (self, "hidden-at-start");
- tilda_window_config_boolean_property (self, "centered-horizontally");
- tilda_window_config_boolean_property (self, "centered-vertically");
+ 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");
/* Add the initial terminal(s) */
for (i=0; i<self->initial_terminals; ++i)
* NOTE: See the following for how to deal with GtkObject-derived things:
* http://library.gnome.org/devel/gtk/unstable/GtkObject.html
*/
+ g_object_unref (G_OBJECT(self->accel_group));
g_ptr_array_foreach (self->terms, g_object_unref, NULL);
gtk_widget_destroy (self->window);
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_ACCEL_QUIT,
+ pspec);
+
+ 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_ACCEL_NEXT_TAB,
+ pspec);
+
+ 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,
TILDA_WINDOW_INITIAL_TERMINALS,
pspec);
- pspec = g_param_spec_int ("tab-position",
- _("Position of window's tab bar"),
- NULL,
- 0,
- INT_MAX,
- 0,
- G_PARAM_READWRITE);
+ 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,