[Xfce4-commits] [xfce/xfce4-panel] 14/73: Preserve the current item selection when rebuilding the item store.
noreply at xfce.org
noreply at xfce.org
Sun Feb 26 16:33:55 CET 2017
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.
commit 96ba862e3561d6ccc8dcce8424a708a674a29ca0
Author: Andrzej <ndrwrdck at gmail.com>
Date: Tue Jan 7 02:17:49 2014 +0000
Preserve the current item selection when rebuilding the item store.
---
panel/panel-preferences-dialog.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 49e905c..e71fdae 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -934,15 +934,22 @@ static void
panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
PanelPreferencesDialog *dialog)
{
- GList *items, *li;
- guint i;
- PanelModule *module;
- gchar *tooltip, *display_name;
+ GList *items, *li;
+ guint i;
+ PanelModule *module;
+ gchar *tooltip, *display_name;
+ XfcePanelPluginProvider *selected_provider;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GObject *treeview;
panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
panel_return_if_fail (GTK_IS_LIST_STORE (dialog->store));
panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
+ /* memorize selected item */
+ selected_provider = panel_preferences_dialog_item_get_selected (dialog, NULL);
+
gtk_list_store_clear (dialog->store);
g_signal_handlers_block_by_func (G_OBJECT (dialog->store),
@@ -981,7 +988,7 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
xfce_panel_plugin_provider_get_unique_id (li->data));
}
- gtk_list_store_insert_with_values (dialog->store, NULL, i,
+ gtk_list_store_insert_with_values (dialog->store, &iter, i,
ITEM_COLUMN_ICON_NAME,
panel_module_get_icon_name (module),
ITEM_COLUMN_DISPLAY_NAME,
@@ -990,6 +997,16 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
tooltip,
ITEM_COLUMN_PROVIDER, li->data, -1);
+ /* reconstruct selection */
+ if (selected_provider == li->data)
+ {
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->store), &iter);
+ treeview = gtk_builder_get_object (GTK_BUILDER (dialog), "item-treeview");
+ if (GTK_IS_WIDGET (treeview))
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+
g_free (tooltip);
g_free (display_name);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list