[gnome-control-center] Printers: Move check for availability of CUPS to better place



commit 3fe26cfe504487dfec9ce229dccc79e014be86c6
Author: Marek Kasik <mkasik redhat com>
Date:   Fri Jun 3 12:51:57 2011 +0200

    Printers: Move check for availability of CUPS to better place
    
    Fixes problem of not showing information about stopped CUPS and
    missing printers.

 panels/printers/cc-printers-panel.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 5d55312..e4fad13 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -870,20 +870,6 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
     }
   else
     {
-      http_t *http = NULL;
-
-      widget = (GtkWidget*)
-        gtk_builder_get_object (priv->builder, "notebook");
-
-      http = httpConnectEncrypt (cupsServer (), ippPort (), cupsEncryption ());
-      if (http)
-        {
-          httpClose (http);
-          gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), NOTEBOOK_NO_PRINTERS_PAGE);
-        }
-      else
-        gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), NOTEBOOK_NO_CUPS_PAGE);
-
       widget = (GtkWidget*)
         gtk_builder_get_object (priv->builder, "printer-name-label");
       cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
@@ -921,8 +907,10 @@ actualize_printers_list (CcPrintersPanel *self)
   GtkTreeView            *treeview;
   GtkTreeIter             iter;
   cups_job_t             *jobs = NULL;
+  GtkWidget              *widget;
   gboolean                paused = FALSE;
   gboolean                valid = FALSE;
+  http_t                 *http;
   gchar                  *current_printer_instance = NULL;
   gchar                  *current_printer_name = NULL;
   gchar                  *printer_icon_name = NULL;
@@ -959,6 +947,18 @@ actualize_printers_list (CcPrintersPanel *self)
 
   if (priv->num_dests == 0)
     {
+      widget = (GtkWidget*)
+        gtk_builder_get_object (priv->builder, "notebook");
+
+      http = httpConnectEncrypt (cupsServer (), ippPort (), cupsEncryption ());
+      if (http)
+        {
+          httpClose (http);
+          gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), NOTEBOOK_NO_PRINTERS_PAGE);
+        }
+      else
+        gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), NOTEBOOK_NO_CUPS_PAGE);
+
       gtk_list_store_append (store, &iter);
       gtk_list_store_set (store, &iter,
                           PRINTER_ID_COLUMN, 0,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]