X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=tilda-controller.c;h=613bedbbd59acb1f6775153bd1197c13cbddc031;hb=2b17e21d2ac627242479945521f7a8e65c51d5b5;hp=aa6182320c5b7e29551b7c601cde27cc35c64ef0;hpb=b29938cc9dcd9059a83448cecf15aebab7f55323;p=tilda-gobject.git diff --git a/tilda-controller.c b/tilda-controller.c index aa61823..613bedb 100644 --- a/tilda-controller.c +++ b/tilda-controller.c @@ -73,7 +73,7 @@ tilda_controller_add_window (TildaController *self) } gboolean -tilda_controller_delete_window (TildaController *self, gint window_number) +tilda_controller_remove_window (TildaController *self, gint window_number) { debug_enter (); debug_assert (TILDA_IS_CONTROLLER(self)); @@ -101,12 +101,42 @@ tilda_controller_delete_window (TildaController *self, gint window_number) gtk_main_quit (); } - /* We were able to delete the window */ + /* We were able to remove the window */ return TRUE; } } - /* There must have been no window to delete */ + /* There must have been no window to remove */ + return FALSE; +} + +/** + * Check if a key is used in one of our windows. + * + * This is needed because the tomboy_keybinder_bind() function allows + * more than one callback to be registered for the same key. + */ +gboolean +tilda_controller_global_key_in_use (const TildaController *self, const gchar *keystr) +{ + gint i; + TildaWindow *tw; + + guint key1, key2; + GdkModifierType mod1, mod2; + + gtk_accelerator_parse (keystr, &key1, &mod1); + + for (i=0; iwindows->len; ++i) + { + tw = g_ptr_array_index (self->windows, i); + gtk_accelerator_parse (tw->key, &key2, &mod2); + + if (key1 == key2 && mod1 == mod2) + return TRUE; + } + + /* No identical keys found, we're ok */ return FALSE; }