gboolean tilda_keygrabber_bind (const gchar *keystr, tilda_window *tw) { /* Empty strings are no good */ if (keystr == NULL || strcmp ("", keystr) == 0) return FALSE; return tomboy_keybinder_bind (keystr, (TomboyBindkeyHandler)onKeybindingPull, tw); }
static gboolean gtk_hotkey_x11_listener_real_bind_hotkey (GtkHotkeyListener *base, GtkHotkeyInfo *hotkey, GError **error) { GtkHotkeyX11Listener *self; g_return_val_if_fail (GTK_HOTKEY_IS_X11_LISTENER(base), FALSE); g_return_val_if_fail (GTK_HOTKEY_IS_INFO (hotkey), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); self = GTK_HOTKEY_X11_LISTENER (base); if (find_hotkey_from_key_id(self, gtk_hotkey_info_get_key_id (hotkey))) { g_warning ("Hotkey '%s' already registered. Ignoring register request.", gtk_hotkey_info_get_key_id (hotkey)); return FALSE; } if (tomboy_keybinder_bind (gtk_hotkey_info_get_signature(hotkey), hotkey_activated_cb, self)) { self->priv->hotkeys = g_list_prepend (self->priv->hotkeys, hotkey); g_object_ref (hotkey); return TRUE; } /* Bugger, we failed to bind */ g_set_error (error, GTK_HOTKEY_LISTENER_ERROR, GTK_HOTKEY_LISTENER_ERROR_BIND, "Failed to register hotkey '%s' with signature '%s'", gtk_hotkey_info_get_key_id (hotkey), gtk_hotkey_info_get_signature (hotkey)); return FALSE; }
void XKeybinder::bind(const std::string & keystring, const sigc::slot<void> & handler) { m_bindings[keystring] = handler; tomboy_keybinder_bind(keystring.c_str(), &XKeybinder::keybinding_pressed, this); }