[gnome-control-center] Network: Always select a device
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] Network: Always select a device
- Date: Fri, 18 Mar 2011 02:57:56 +0000 (UTC)
commit e9e553579777c732f8c64d3e8c1ec103e7216d3e
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 17 22:56:48 2011 -0400
Network: Always select a device
In particular, when removing the selected row, we need to manually
select another one.
https://bugzilla.gnome.org/show_bug.cgi?id=645095
panels/network/cc-network-panel.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 1924168..5411c7f 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -413,6 +413,12 @@ object_removed_cb (NetObject *object, CcNetworkPanel *panel)
NetObject *object_tmp;
GtkTreeIter iter;
GtkTreeModel *model;
+ GtkWidget *widget;
+ GtkTreeSelection *selection;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "treeview_devices"));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
/* remove device from model */
model = GTK_TREE_MODEL (gtk_builder_get_object (panel->priv->builder,
@@ -428,8 +434,11 @@ object_removed_cb (NetObject *object, CcNetworkPanel *panel)
-1);
if (g_strcmp0 (net_object_get_id (object),
net_object_get_id (object_tmp)) == 0) {
- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
g_object_unref (object_tmp);
+ if (!gtk_list_store_remove (GTK_LIST_STORE (model), &iter))
+ gtk_tree_model_get_iter_first (model, &iter);
+ gtk_tree_selection_select_iter (selection, &iter);
+
break;
}
g_object_unref (object_tmp);
@@ -2074,6 +2083,7 @@ cc_network_panel_init (CcNetworkPanel *panel)
"treeview_devices"));
panel_add_devices_columns (panel, GTK_TREE_VIEW (widget));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
g_signal_connect (selection, "changed",
G_CALLBACK (nm_devices_treeview_clicked_cb), panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]