Skip to content
Snippets Groups Projects
Commit 8a1ae9bb authored by Julien Bonjean's avatar Julien Bonjean
Browse files

[#2916] Added support to disable a shortcut

parent d1057e02
No related branches found
No related tags found
No related merge requests found
......@@ -85,12 +85,15 @@ setup_tree_view(GtkWidget *treeview)
gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column);
g_signal_connect (G_OBJECT (renderer), "accel_edited", G_CALLBACK (accel_edited), (gpointer) treeview);
g_signal_connect (G_OBJECT (renderer), "accel_cleared", G_CALLBACK (accel_cleared), (gpointer) treeview);
}
static void
accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview)
{
DEBUG("Accel edited");
GtkTreeModel *model;
GtkTreeIter iter;
......@@ -105,3 +108,20 @@ accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
// Update GDK bindings
shortcuts_update_bindings(atoi(path), code);
}
static void
accel_cleared(GtkCellRendererAccel *renderer, gchar *path, GtkTreeView *treeview)
{
DEBUG("Accel cleared");
GtkTreeModel *model;
GtkTreeIter iter;
// Update treeview
model = gtk_tree_view_get_model(treeview);
if (gtk_tree_model_get_iter_from_string(model, &iter, path))
gtk_list_store_set(GTK_LIST_STORE (model), &iter, MASK, 0, VALUE, 0, -1);
// Update GDK bindings
shortcuts_update_bindings(atoi(path), 0);
}
......@@ -34,15 +34,19 @@ enum
};
GtkWidget*
create_shortcuts_settings();
create_shortcuts_settings ();
static void
setup_tree_view(GtkWidget *treeview);
setup_tree_view (GtkWidget *treeview);
static void
accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
accel_edited (GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview);
static void
accel_cleared (GtkCellRendererAccel *renderer, gchar *path,
GtkTreeView *treeview);
G_END_DECLS
#endif // _SHORTCUTS_CONFIG
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment