[gnome-control-center/gnome-3-8] printers: Don't move to beginning of list of new devices
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-8] printers: Don't move to beginning of list of new devices
- Date: Tue, 21 May 2013 14:34:30 +0000 (UTC)
commit d3fc1b3d24ce069b92fbad63ee57523f574687f2
Author: Marek Kasik <mkasik redhat com>
Date: Wed May 15 15:08:32 2013 +0200
printers: Don't move to beginning of list of new devices
Don't reset position of tree view containing new devices when
an actualization of the tree view is required.
https://bugzilla.gnome.org/show_bug.cgi?id=693185
panels/printers/new-printer-dialog.ui | 11 +++++++++++
panels/printers/pp-new-printer-dialog.c | 10 +++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index 6a1ef29..5fb98ee 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkListStore" id="devices-liststore">
+ <columns>
+ <!-- column-name device_icon -->
+ <column type="gchararray"/>
+ <!-- column-name device_name -->
+ <column type="gchararray"/>
+ <!-- column-name device_display_name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="dialog">
<property name="width_request">500</property>
<property name="height_request">350</property>
@@ -76,6 +86,7 @@
<object class="GtkTreeView" id="devices-treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="model">devices-liststore</property>
<property name="headers_visible">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 9781489..20bc3d5 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -286,7 +286,7 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
GtkStyleContext *context;
GtkWidget *widget;
GError *error = NULL;
- gchar *objects[] = { "dialog", NULL };
+ gchar *objects[] = { "dialog", "devices-liststore", NULL };
guint builder_result;
priv = PP_NEW_PRINTER_DIALOG_GET_PRIVATE (dialog);
@@ -1406,7 +1406,10 @@ actualize_devices_list (PpNewPrinterDialog *dialog)
treeview = (GtkTreeView *)
gtk_builder_get_object (priv->builder, "devices-treeview");
- store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ store = (GtkListStore *)
+ gtk_builder_get_object (priv->builder, "devices-liststore");
+
+ gtk_list_store_clear (store);
for (item = priv->devices; item; item = item->next)
{
@@ -1484,14 +1487,11 @@ actualize_devices_list (PpNewPrinterDialog *dialog)
gtk_widget_set_sensitive (GTK_WIDGET (treeview), TRUE);
}
- gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
-
if (!no_device &&
gtk_tree_model_get_iter_first ((GtkTreeModel *) store, &iter) &&
(selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview))) != NULL)
gtk_tree_selection_select_iter (selection, &iter);
- g_object_unref (store);
update_spinner_state (dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]