diff options
author | DarkTrick <notebook22312@gmail.com> | 2020-10-27 20:18:06 +0100 |
---|---|---|
committer | Olivier Fourdan <fourdan@xfce.org> | 2020-10-27 20:18:06 +0100 |
commit | 9e1b0cc6de363ac75d9a656a10b0562e0ebeb61d (patch) | |
tree | 79036f28c55e060f3fa903fbac372bf9db86959e /settings-dialogs | |
parent | 0779790de68ccd8b45c85f01e8db7283f3a91cc0 (diff) | |
download | xfwm4-9e1b0cc6de363ac75d9a656a10b0562e0ebeb61d.tar.gz |
xfwm4-settings: Keyboard: Enable column sorting
Initial issue: Columns were not sortable by the user.
Diffstat (limited to 'settings-dialogs')
-rw-r--r-- | settings-dialogs/xfwm4-settings.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c index e8fe5c974..0a0b0c0c3 100644 --- a/settings-dialogs/xfwm4-settings.c +++ b/settings-dialogs/xfwm4-settings.c @@ -489,6 +489,7 @@ xfwm_settings_constructed (GObject *object) /* Keyboard tab: Shortcuts tree view */ { + GtkTreeViewColumn * column = NULL; gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (shortcuts_treeview)), GTK_SELECTION_MULTIPLE); @@ -497,14 +498,21 @@ xfwm_settings_constructed (GObject *object) g_object_unref (G_OBJECT (list_store)); renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (shortcuts_treeview), - 0, _("Action"), renderer, - "text", SHORTCUTS_NAME_COLUMN, NULL); + column = gtk_tree_view_column_new_with_attributes (_("Action"), renderer, + "text", SHORTCUTS_NAME_COLUMN, + NULL); + gtk_tree_view_insert_column (GTK_TREE_VIEW (shortcuts_treeview), column, 0); + gtk_tree_view_column_set_sort_column_id (column, SHORTCUTS_NAME_COLUMN); renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (shortcuts_treeview), - 1, _("Shortcut"), renderer, - "text", SHORTCUTS_SHORTCUT_LABEL_COLUMN, NULL); + column = gtk_tree_view_column_new_with_attributes (_("Shortcut"), renderer, + "text", SHORTCUTS_SHORTCUT_LABEL_COLUMN, + NULL); + gtk_tree_view_insert_column (GTK_TREE_VIEW (shortcuts_treeview), column, 1); + gtk_tree_view_column_set_sort_column_id (column, SHORTCUTS_SHORTCUT_LABEL_COLUMN); + + // set initial sorting + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), SHORTCUTS_NAME_COLUMN, GTK_SORT_ASCENDING); g_signal_connect (shortcuts_treeview, "row-activated", G_CALLBACK (xfwm_settings_shortcut_row_activated), settings); |