static void key_accel_changed(GtkAccelMap *object, gchar *accel_path, guint accel_key, GdkModifierType accel_mods, gpointer user_data) { char path[256]; // Updating all the stored accelerator keys/mods for key_pressed shortcuts dt_accel_path_view(path, 256, "filmstrip", "scroll forward"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.filmstrip_forward); dt_accel_path_view(path, 256, "filmstrip", "scroll back"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.filmstrip_back); // Lighttable dt_accel_path_view(path, 256, "lighttable", "scroll up"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_up); dt_accel_path_view(path, 256, "lighttable", "scroll down"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_down); dt_accel_path_view(path, 256, "lighttable", "scroll left"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_left); dt_accel_path_view(path, 256, "lighttable", "scroll right"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_right); dt_accel_path_view(path, 256, "lighttable", "scroll center"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_center); dt_accel_path_view(path, 256, "lighttable", "preview"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.lighttable_preview); // Global dt_accel_path_global(path, 256, "toggle side borders"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.global_sideborders); dt_accel_path_global(path, 256, "toggle header"); gtk_accel_map_lookup_entry(path, &darktable.control->accels.global_header); }
static gboolean shortcuts_hotkey_for_action (GtkAction* action, GtkAccelKey* key) { const gchar* accel_path = gtk_action_get_accel_path (action); if (accel_path) if (gtk_accel_map_lookup_entry (accel_path, key)) return TRUE; return FALSE; }
int clip_GTK_ACCELMAPLOOKUPENTRY(ClipMachine * ClipMachineMemory) { gchar *accel_path = _clip_parc(ClipMachineMemory, 1); ClipVar *cv = _clip_spar(ClipMachineMemory, 2); GtkAccelKey key; CHECKARG(1, CHARACTER_type_of_ClipVarType); CHECKARG(2, MAP_type_of_ClipVarType); _map_to_gtk_accel_key(ClipMachineMemory, cv, &key); gtk_accel_map_lookup_entry(accel_path, &key); return 0; err: return 1; }
static void add_key_entry_to_changeset (gpointer key, KeyEntry *key_entry, GSettings *changeset) { GtkAccelKey gtk_key; if (!key_entry->needs_gsettings_sync) return; key_entry->needs_gsettings_sync = FALSE; if (gtk_accel_map_lookup_entry (key_entry->accel_path, >k_key) && (gtk_key.accel_key != key_entry->gsettings_keyval || gtk_key.accel_mods != key_entry->gsettings_mask)) { char *accel_name; accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods); g_settings_set_string (changeset, key_entry->gsettings_key, accel_name); g_free (accel_name); } }
static void accel_edited_callback (GtkCellRendererAccel *cell, gchar *path_string, guint keyval, GdkModifierType mask, guint hardware_keycode, GtkTreeView *view) { GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; KeyEntry *ke; GtkAccelGroupEntry *entries; guint n_entries; char *str; model = gtk_tree_view_get_model (view); path = gtk_tree_path_new_from_string (path_string); if (!path) return; if (!gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_path_free (path); return; } gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1); /* sanity check */ if (ke == NULL) return; /* Check if we already have an entry using this accel */ entries = gtk_accel_group_query (notification_group, keyval, mask, &n_entries); if (n_entries > 0) { if (entries[0].accel_path_quark != g_quark_from_string (ke->accel_path)) { GtkWidget *dialog; char *name; KeyEntry *other_key; name = gtk_accelerator_get_label (keyval, mask); other_key = entries[0].closure->data; g_assert (other_key); dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The shortcut key ā%sā is already bound to the ā%sā action"), name, other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gsettings_key); g_free (name); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_present (GTK_WINDOW (dialog)); } return; } str = binding_name (keyval, mask); _terminal_debug_print (TERMINAL_DEBUG_ACCELS, "Edited path %s keyval %s, setting GSettings to %s\n", ke->accel_path, gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null", str); #ifdef MATE_ENABLE_DEBUG _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS) { GtkAccelKey old_key; if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key)) { _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " Old entry of path %s is keyval %s mask %x\n", ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods); } else { _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " Failed to look up the old entry of path %s\n", ke->accel_path); } } #endif g_settings_set_string (settings_keybindings, ke->gsettings_key, str); g_free (str); }