Updating branch refs/heads/master to 5b473cf697eab460c157619d5c1c0c12cd2313b0 (commit) from 1498e23fdbecad0d35c9cf53d7b29f55ec098213 (commit)
commit 5b473cf697eab460c157619d5c1c0c12cd2313b0 Author: Jérôme Guelfucci <jero...@xfce.org> Date: Sun Dec 30 15:01:58 2012 +0100 Update treeview when choosing to use new value in a conflict. We need to erase the old shortcut manually in the treeview as we won't get a signal for features which are not used anymore. settings-dialogs/xfwm4-settings.c | 45 ++++++++++++++++++++++++++++++++++++- 1 files changed, 44 insertions(+), 1 deletions(-) diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c index 15a83e7..4f284d3 100644 --- a/settings-dialogs/xfwm4-settings.c +++ b/settings-dialogs/xfwm4-settings.c @@ -175,6 +175,10 @@ static void xfwm_settings_shortcut_added (XfceShortc static void xfwm_settings_shortcut_removed (XfceShortcutsProvider *provider, const gchar *shortcut, XfwmSettings *settings); +static gboolean xfwm_settings_update_treeview_on_conflict_replace (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer shortcut_to_erase); static void xfwm_settings_shortcut_edit_clicked (GtkButton *button, XfwmSettings *settings); static void xfwm_settings_shortcut_clear_clicked (GtkButton *button, @@ -1909,6 +1913,35 @@ xfwm_settings_shortcut_reset_clicked (GtkButton *button, static gboolean +xfwm_settings_update_treeview_on_conflict_replace (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer shortcut_to_erase) +{ + gchar *shortcut; + + gtk_tree_model_get (model, iter, SHORTCUTS_SHORTCUT_COLUMN, &shortcut, -1); + + if (g_strcmp0 (shortcut_to_erase, shortcut) == 0) + { + /* We found the iter for which we want to erase the shortcut value */ + /* Let's do it! */ + gtk_list_store_set (GTK_LIST_STORE (model), iter, + SHORTCUTS_SHORTCUT_COLUMN, NULL, + SHORTCUTS_SHORTCUT_LABEL_COLUMN, NULL, -1); + + g_free (shortcut); + + return TRUE; + } + + g_free (shortcut); + + return FALSE; +} + + +static gboolean xfwm_settings_validate_shortcut (XfceShortcutDialog *dialog, const gchar *shortcut, XfwmSettings *settings) @@ -1964,7 +1997,17 @@ xfwm_settings_validate_shortcut (XfceShortcutDialog *dialog, FALSE); if (G_UNLIKELY (response == GTK_RESPONSE_ACCEPT)) - xfce_shortcuts_provider_reset_shortcut (other_provider, shortcut); + { + GObject *view; + + xfce_shortcuts_provider_reset_shortcut (other_provider, shortcut); + + /* We need to update the treeview to erase the shortcut value */ + view = gtk_builder_get_object (settings->priv->builder, "shortcuts_treeview"); + gtk_tree_model_foreach (gtk_tree_view_get_model (GTK_TREE_VIEW (view)), + xfwm_settings_update_treeview_on_conflict_replace, + (gpointer) shortcut); + } else accepted = FALSE; } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits