[gnome-control-center/gnome-3-2] Printers: Don't hide address entry
- From: Marek KaÅÃk <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-2] Printers: Don't hide address entry
- Date: Tue, 11 Oct 2011 14:33:44 +0000 (UTC)
commit c023c06ef6621e08358abcd233bfd40bf3679b71
Author: Marek Kasik <mkasik redhat com>
Date: Tue Oct 11 16:33:23 2011 +0200
Printers: Don't hide address entry
Don't hide address entry when there is not firewalld available.
It is still possible that firewall is set up correctly and user
should be able to enter address of his network printer and
install it (rhbz #743694).
panels/printers/new-printer-dialog.ui | 108 +++++++++++++++++++++++++++---
panels/printers/pp-new-printer-dialog.c | 72 ++++++++++++++++-----
2 files changed, 152 insertions(+), 28 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index cbb947f..fafd424 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -54,17 +54,60 @@
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <object class="GtkNotebook" id="local-devices-notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkTreeView" id="local-devices-treeview">
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="local-devices-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="no">page 1</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTextView" id="local-warning">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="pixels_above_lines">6</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="left_margin">10</property>
+ <property name="right_margin">10</property>
</object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="no">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
</child>
</object>
</child>
@@ -83,18 +126,61 @@
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <object class="GtkNotebook" id="network-devices-notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkTreeView" id="network-devices-treeview">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="network-devices-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="no">page 1</property>
</object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTextView" id="network-warning">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="pixels_above_lines">6</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="left_margin">10</property>
+ <property name="right_margin">10</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="no">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
</child>
</object>
<packing>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 43663aa..6497b6a 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -88,8 +88,13 @@ enum
enum
{
DEVICE_TYPE_LOCAL = 0,
- DEVICE_TYPE_NETWORK,
- DEVICE_TYPE_N
+ DEVICE_TYPE_NETWORK
+};
+
+enum
+{
+ STANDARD_TAB = 0,
+ WARNING_TAB
};
typedef struct{
@@ -155,6 +160,7 @@ device_type_selection_changed_cb (GtkTreeSelection *selection,
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *treeview = NULL;
+ GtkWidget *notebook = NULL;
GtkWidget *widget;
gchar *device_type_name = NULL;
gint device_type_id = -1;
@@ -174,17 +180,30 @@ device_type_selection_changed_cb (GtkTreeSelection *selection,
widget = (GtkWidget*)
gtk_builder_get_object (pp->builder, "device-type-notebook");
- if (pp->show_warning && device_type == DEVICE_TYPE_NETWORK)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
- else
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), device_type);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), device_type);
if (device_type == DEVICE_TYPE_LOCAL)
- treeview = (GtkWidget*)
- gtk_builder_get_object (pp->builder, "local-devices-treeview");
+ {
+ treeview = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "local-devices-treeview");
+ notebook = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "local-devices-notebook");
+ }
else if (device_type == DEVICE_TYPE_NETWORK)
- treeview = (GtkWidget*)
- gtk_builder_get_object (pp->builder, "network-devices-treeview");
+ {
+ treeview = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "network-devices-treeview");
+ notebook = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "network-devices-notebook");
+ }
+
+ if (notebook)
+ {
+ if (pp->show_warning && device_type == DEVICE_TYPE_NETWORK)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), WARNING_TAB);
+ else
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), STANDARD_TAB);
+ }
widget = (GtkWidget*)
gtk_builder_get_object (pp->builder, "new-printer-add-button");
@@ -609,8 +628,12 @@ devices_get (PpNewPrinterDialog *pp)
if (pp->show_warning)
{
widget = (GtkWidget*)
- gtk_builder_get_object (pp->builder, "device-type-notebook");
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
+ gtk_builder_get_object (pp->builder, "local-devices-notebook");
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), WARNING_TAB);
+
+ widget = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "network-devices-notebook");
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), WARNING_TAB);
}
in_include = g_variant_builder_new (G_VARIANT_TYPE ("as"));
@@ -1139,6 +1162,8 @@ actualize_devices_list (PpNewPrinterDialog *pp)
GtkTreeIter iter;
GtkWidget *treeview;
GtkWidget *widget;
+ GtkWidget *local_notebook;
+ GtkWidget *network_notebook;
gint i;
gint device_type = -1;
@@ -1206,10 +1231,15 @@ actualize_devices_list (PpNewPrinterDialog *pp)
widget = (GtkWidget*)
gtk_builder_get_object (pp->builder, "device-type-notebook");
- if (pp->show_warning && device_type == DEVICE_TYPE_NETWORK)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
- else
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), device_type);
+ local_notebook = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "local-devices-notebook");
+
+ network_notebook = (GtkWidget*)
+ gtk_builder_get_object (pp->builder, "network-devices-notebook");
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (network_notebook), pp->show_warning ? WARNING_TAB : STANDARD_TAB);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (local_notebook), STANDARD_TAB);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), device_type);
g_object_unref (network_store);
g_object_unref (local_store);
@@ -1264,7 +1294,15 @@ Network printer detection needs services mdns, ipp, ipp-client \
and samba-client enabled on firewall."));
warning_textview = (GtkTextView*)
- gtk_builder_get_object (pp->builder, "warning-textview");
+ gtk_builder_get_object (pp->builder, "local-warning");
+ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (warning_textview));
+
+ gtk_text_buffer_set_text (text_buffer, "", 0);
+ gtk_text_buffer_get_iter_at_offset (text_buffer, &text_iter, 0);
+ gtk_text_buffer_insert (text_buffer, &text_iter, pp->warning, -1);
+
+ warning_textview = (GtkTextView*)
+ gtk_builder_get_object (pp->builder, "network-warning");
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (warning_textview));
gtk_text_buffer_set_text (text_buffer, "", 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]