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
This commit is contained in:
parent
3d1a04e5dc
commit
bba624e9d3
2 changed files with 16 additions and 5 deletions
|
@ -1,6 +1,16 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<!-- interface-requires gtk+ 3.0 -->
|
<!-- 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">
|
<object class="GtkDialog" id="dialog">
|
||||||
<property name="width_request">500</property>
|
<property name="width_request">500</property>
|
||||||
<property name="height_request">350</property>
|
<property name="height_request">350</property>
|
||||||
|
@ -76,6 +86,7 @@
|
||||||
<object class="GtkTreeView" id="devices-treeview">
|
<object class="GtkTreeView" id="devices-treeview">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="model">devices-liststore</property>
|
||||||
<property name="headers_visible">False</property>
|
<property name="headers_visible">False</property>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection" id="treeview-selection"/>
|
<object class="GtkTreeSelection" id="treeview-selection"/>
|
||||||
|
|
|
@ -286,7 +286,7 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *objects[] = { "dialog", NULL };
|
gchar *objects[] = { "dialog", "devices-liststore", NULL };
|
||||||
guint builder_result;
|
guint builder_result;
|
||||||
|
|
||||||
priv = PP_NEW_PRINTER_DIALOG_GET_PRIVATE (dialog);
|
priv = PP_NEW_PRINTER_DIALOG_GET_PRIVATE (dialog);
|
||||||
|
@ -1406,7 +1406,10 @@ actualize_devices_list (PpNewPrinterDialog *dialog)
|
||||||
treeview = (GtkTreeView *)
|
treeview = (GtkTreeView *)
|
||||||
gtk_builder_get_object (priv->builder, "devices-treeview");
|
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)
|
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_widget_set_sensitive (GTK_WIDGET (treeview), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
|
|
||||||
|
|
||||||
if (!no_device &&
|
if (!no_device &&
|
||||||
gtk_tree_model_get_iter_first ((GtkTreeModel *) store, &iter) &&
|
gtk_tree_model_get_iter_first ((GtkTreeModel *) store, &iter) &&
|
||||||
(selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview))) != NULL)
|
(selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview))) != NULL)
|
||||||
gtk_tree_selection_select_iter (selection, &iter);
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
|
|
||||||
g_object_unref (store);
|
|
||||||
update_spinner_state (dialog);
|
update_spinner_state (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue