[gnome-control-center] Printers: Allow editing of printer name and location
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] Printers: Allow editing of printer name and location
- Date: Fri, 27 May 2011 11:38:58 +0000 (UTC)
commit 8f4895559aeeca11f67e6374ae1da22b6da686ce
Author: Marek Kasik <mkasik redhat com>
Date: Mon May 16 12:11:30 2011 +0200
Printers: Allow editing of printer name and location
Use CcEditableEntry for editing name and location of local printers
(#649511).
panels/printers/Makefile.am | 1 +
panels/printers/cc-printers-panel.c | 322 +++++---------
panels/printers/pp-new-printer-dialog.c | 36 +--
panels/printers/pp-utils.c | 752 ++++++++++++++++++++++++++++++-
panels/printers/pp-utils.h | 37 ++-
panels/printers/printers.ui | 33 +-
6 files changed, 923 insertions(+), 258 deletions(-)
---
diff --git a/panels/printers/Makefile.am b/panels/printers/Makefile.am
index 4f319eb..31dd720 100644
--- a/panels/printers/Makefile.am
+++ b/panels/printers/Makefile.am
@@ -8,6 +8,7 @@ dist_ui_DATA = \
INCLUDES = \
$(PANEL_CFLAGS) \
$(PRINTERS_PANEL_CFLAGS) \
+ -I$(top_srcdir)/libgnome-control-center/ \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DDATADIR="\"$(uidir)\"" \
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 83ddb12..5d55312 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -32,6 +32,7 @@
#include <math.h>
+#include "cc-editable-entry.h"
#include "pp-new-printer-dialog.h"
#include "pp-utils.h"
@@ -727,11 +728,11 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (printer_name)
{
- gtk_label_set_text (GTK_LABEL (widget), printer_name);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), printer_name);
g_free (printer_name);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
widget = (GtkWidget*)
@@ -739,11 +740,11 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (status)
{
- gtk_label_set_text (GTK_LABEL (widget), status);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), status);
g_free (status);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
widget = (GtkWidget*)
@@ -751,11 +752,11 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (location)
{
- gtk_label_set_text (GTK_LABEL (widget), location);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), location);
g_free (location);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
widget = (GtkWidget*)
@@ -763,11 +764,11 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (printer_model)
{
- gtk_label_set_text (GTK_LABEL (widget), printer_model);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), printer_model);
g_free (printer_model);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
widget = (GtkWidget*)
@@ -781,7 +782,7 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (is_local)
{
- gtk_label_set_text (GTK_LABEL (widget), "localhost");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "localhost");
}
else
{
@@ -798,12 +799,12 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
sizeof(resource));
if (server[0] != '\0')
- gtk_label_set_text (GTK_LABEL (widget), server);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), server);
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
}
@@ -861,11 +862,11 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
if (active_jobs)
{
- gtk_label_set_text (GTK_LABEL (widget), active_jobs);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), active_jobs);
g_free (active_jobs);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
}
else
{
@@ -885,27 +886,27 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-name-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-status-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-location-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-model-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-ip-address-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
widget = (GtkWidget*)
gtk_builder_get_object (priv->builder, "printer-jobs-label");
- gtk_label_set_text (GTK_LABEL (widget), "");
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), "");
}
actualize_sensitivity (self);
@@ -1245,11 +1246,11 @@ actualize_jobs_list (CcPrintersPanel *self)
if (active_jobs)
{
- gtk_label_set_text (GTK_LABEL (widget), active_jobs);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), active_jobs);
g_free (active_jobs);
}
else
- gtk_label_set_text (GTK_LABEL (widget), EMPTY_TEXT);
+ cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
}
store = gtk_list_store_new (JOB_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -1610,10 +1611,7 @@ printer_disable_cb (GObject *gobject,
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- DBusGProxy *proxy;
gboolean paused = FALSE;
- GError *error = NULL;
- char *ret_error = NULL;
char *name = NULL;
int i;
@@ -1632,38 +1630,8 @@ printer_disable_cb (GObject *gobject,
}
}
- if (name)
- {
- proxy = get_dbus_proxy (MECHANISM_BUS,
- "/",
- MECHANISM_BUS,
- TRUE);
-
- if (!proxy)
- return;
-
- dbus_g_proxy_call (proxy, "PrinterSetEnabled", &error,
- G_TYPE_STRING, name,
- G_TYPE_BOOLEAN, paused,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- g_object_unref (proxy);
-
- if (error || (ret_error && ret_error[0] != '\0'))
- {
- if (error)
- g_warning ("%s", error->message);
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
- }
- else
- actualize_printers_list (self);
-
- g_clear_error (&error);
- }
+ if (name && printer_set_enabled (name, paused))
+ actualize_printers_list (self);
}
typedef struct {
@@ -1863,9 +1831,6 @@ allowed_user_remove_cb (GtkToolButton *button,
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- DBusGProxy *proxy;
- GError *error = NULL;
- char *ret_error = NULL;
char *printer_name = NULL;
char **names = NULL;
char *name = NULL;
@@ -1885,14 +1850,6 @@ allowed_user_remove_cb (GtkToolButton *button,
if (name && printer_name)
{
- proxy = get_dbus_proxy (MECHANISM_BUS,
- "/",
- MECHANISM_BUS,
- TRUE);
-
- if (!proxy)
- return;
-
names = g_new0 (gchar*, priv->num_allowed_users);
j = 0;
for (i = 0; i < (priv->num_allowed_users); i++)
@@ -1904,27 +1861,9 @@ allowed_user_remove_cb (GtkToolButton *button,
}
}
- dbus_g_proxy_call (proxy, "PrinterSetUsersAllowed", &error,
- G_TYPE_STRING, printer_name,
- G_TYPE_STRV, names,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- g_object_unref (proxy);
-
- if (error || (ret_error && ret_error[0] != '\0'))
- {
- if (error)
- g_warning ("%s", error->message);
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
- }
- else
- actualize_allowed_users_list (self);
+ printer_set_users (printer_name, names, TRUE);
+ actualize_allowed_users_list (self);
- g_clear_error (&error);
g_free (names);
}
}
@@ -1937,9 +1876,6 @@ allowed_user_add_cb (GtkCellRendererText *renderer,
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- DBusGProxy *proxy;
- GError *error = NULL;
- char *ret_error = NULL;
char *printer_name = NULL;
char **names = NULL;
int i;
@@ -1958,38 +1894,13 @@ allowed_user_add_cb (GtkCellRendererText *renderer,
if (new_text && new_text[0] != '\0' && printer_name)
{
- proxy = get_dbus_proxy (MECHANISM_BUS,
- "/",
- MECHANISM_BUS,
- TRUE);
-
- if (!proxy)
- return;
-
names = g_new0 (char *, priv->num_allowed_users + 2);
for (i = 0; i < (priv->num_allowed_users); i++)
names[i] = priv->allowed_users[i];
names[priv->num_allowed_users] = new_text;
- dbus_g_proxy_call (proxy, "PrinterSetUsersAllowed", &error,
- G_TYPE_STRING, printer_name,
- G_TYPE_STRV, names,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- g_object_unref (proxy);
+ printer_set_users (printer_name, names, TRUE);
- if (error || (ret_error && ret_error[0] != '\0'))
- {
- if (error)
- g_warning ("%s", error->message);
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
- }
-
- g_clear_error (&error);
g_free (names);
}
@@ -2048,11 +1959,7 @@ printer_set_default_cb (GtkToggleButton *button,
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- DBusGProxy *proxy;
- GError *error = NULL;
- char *ret_error = NULL;
char *name = NULL;
- const char *cups_server;
priv = PRINTERS_PANEL_PRIVATE (self);
@@ -2063,54 +1970,8 @@ printer_set_default_cb (GtkToggleButton *button,
if (name)
{
- cups_server = cupsServer ();
- if (g_ascii_strncasecmp (cups_server, "localhost", 9) == 0 ||
- g_ascii_strncasecmp (cups_server, "127.0.0.1", 9) == 0 ||
- g_ascii_strncasecmp (cups_server, "::1", 3) == 0 ||
- cups_server[0] == '/')
- {
- /* Clean .cups/lpoptions before setting
- * default printer on local CUPS server.
- */
- set_local_default_printer (NULL);
-
- proxy = get_dbus_proxy (MECHANISM_BUS,
- "/",
- MECHANISM_BUS,
- TRUE);
-
- if (!proxy)
- return;
-
- dbus_g_proxy_call (proxy, "PrinterSetDefault", &error,
- G_TYPE_STRING, name,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- g_object_unref (proxy);
-
- if (error || (ret_error && ret_error[0] != '\0'))
- {
- if (error)
- g_warning ("%s", error->message);
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
- }
- else
- actualize_printers_list (self);
-
- g_clear_error (&error);
- }
- else
- /* Store default printer to .cups/lpoptions
- * if we are connected to a remote CUPS server.
- */
- {
- set_local_default_printer (name);
- actualize_printers_list (self);
- }
+ printer_set_default (name);
+ actualize_printers_list (self);
g_signal_handlers_block_by_func (G_OBJECT (button), printer_set_default_cb, self);
gtk_toggle_button_set_active (button, priv->dests[priv->current_dest].is_default);
@@ -2176,45 +2037,77 @@ printer_remove_cb (GtkToolButton *toolbutton,
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- DBusGProxy *proxy;
- GError *error = NULL;
- char *ret_error = NULL;
- char *name = NULL;
+ char *printer_name = NULL;
priv = PRINTERS_PANEL_PRIVATE (self);
if (priv->current_dest >= 0 &&
priv->current_dest < priv->num_dests &&
priv->dests != NULL)
- name = priv->dests[priv->current_dest].name;
+ printer_name = priv->dests[priv->current_dest].name;
- if (name)
+ if (printer_name && printer_delete (printer_name))
+ actualize_printers_list (self);
+}
+
+static void
+printer_name_edit_cb (GtkWidget *entry,
+ gpointer user_data)
+{
+ CcPrintersPanelPrivate *priv;
+ CcPrintersPanel *self = (CcPrintersPanel*) user_data;
+ const gchar *new_name;
+ gchar *old_name = NULL;
+ gint i;
+
+ priv = PRINTERS_PANEL_PRIVATE (self);
+
+ new_name = cc_editable_entry_get_text (CC_EDITABLE_ENTRY (entry));
+
+ if (priv->current_dest >= 0 &&
+ priv->current_dest < priv->num_dests &&
+ priv->dests != NULL)
+ old_name = priv->dests[priv->current_dest].name;
+
+ if (printer_rename (old_name, new_name))
{
- proxy = get_dbus_proxy (MECHANISM_BUS,
- "/",
- MECHANISM_BUS,
- TRUE);
+ free_dests (self);
+ priv->num_dests = cupsGetDests (&priv->dests);
+ priv->dest_model_names = g_new0 (gchar *, priv->num_dests);
+ priv->ppd_file_names = g_new0 (gchar *, priv->num_dests);
- if (!proxy)
- return;
+ for (i = 0; i < priv->num_dests; i++)
+ if (g_strcmp0 (priv->dests[i].name, new_name) == 0)
+ {
+ priv->current_dest = i;
+ break;
+ }
+ }
- dbus_g_proxy_call (proxy, "PrinterDelete", &error,
- G_TYPE_STRING, name,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
+ actualize_printers_list (self);
+}
- if (error || (ret_error && ret_error[0] != '\0'))
- {
- if (error)
- g_warning ("%s", error->message);
+static void
+printer_location_edit_cb (GtkWidget *entry,
+ gpointer user_data)
+{
+ CcPrintersPanelPrivate *priv;
+ CcPrintersPanel *self = (CcPrintersPanel*) user_data;
+ const gchar *location;
+ gchar *printer_name = NULL;
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
- }
- else
- actualize_printers_list (self);
- }
+ priv = PRINTERS_PANEL_PRIVATE (self);
+
+ location = cc_editable_entry_get_text (CC_EDITABLE_ENTRY (entry));
+
+ if (priv->current_dest >= 0 &&
+ priv->current_dest < priv->num_dests &&
+ priv->dests != NULL)
+ printer_name = priv->dests[priv->current_dest].name;
+
+ if (printer_name && location &&
+ printer_set_location (printer_name, location))
+ actualize_printers_list (self);
}
static void
@@ -2346,10 +2239,12 @@ actualize_sensitivity (gpointer user_data)
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
cups_ptype_t type = 0;
+ const char *cups_server = NULL;
GtkWidget *widget;
gboolean is_authorized;
gboolean is_discovered = FALSE;
gboolean printer_selected;
+ gboolean local_server = TRUE;
gint i;
priv = PRINTERS_PANEL_PRIVATE (self);
@@ -2375,26 +2270,34 @@ actualize_sensitivity (gpointer user_data)
}
}
+ cups_server = cupsServer ();
+ if (cups_server &&
+ g_ascii_strncasecmp (cups_server, "localhost", 9) != 0 &&
+ g_ascii_strncasecmp (cups_server, "127.0.0.1", 9) != 0 &&
+ g_ascii_strncasecmp (cups_server, "::1", 3) != 0 &&
+ cups_server[0] != '/')
+ local_server = FALSE;
+
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-add-button");
- gtk_widget_set_sensitive (widget, is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-add-button2");
- gtk_widget_set_sensitive (widget, is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-remove-button");
- gtk_widget_set_sensitive (widget, !is_discovered && is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && !is_discovered && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-disable-switch");
- gtk_widget_set_sensitive (widget, is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && !is_discovered && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-default-check-button");
gtk_widget_set_sensitive (widget, is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "allowed-user-add-button");
- gtk_widget_set_sensitive (widget, is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && !is_discovered && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "allowed-user-remove-button");
- gtk_widget_set_sensitive (widget, is_authorized);
+ gtk_widget_set_sensitive (widget, local_server && !is_discovered && is_authorized);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "print-test-page-button");
gtk_widget_set_sensitive (widget, printer_selected);
@@ -2407,6 +2310,12 @@ actualize_sensitivity (gpointer user_data)
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-icon");
gtk_widget_set_sensitive (widget, printer_selected);
+
+ widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-name-label");
+ cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), local_server && !is_discovered && is_authorized);
+
+ widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "printer-location-label");
+ cc_editable_entry_set_editable (CC_EDITABLE_ENTRY (widget), local_server && !is_discovered && is_authorized);
}
static void
@@ -2603,6 +2512,14 @@ cc_printers_panel_init (CcPrintersPanel *self)
gtk_builder_get_object (priv->builder, "printer-options-button");
g_signal_connect (widget, "clicked", G_CALLBACK (switch_to_options_cb), self);
+ widget = (GtkWidget*)
+ gtk_builder_get_object (priv->builder, "printer-name-label");
+ g_signal_connect (widget, "editing-done", G_CALLBACK (printer_name_edit_cb), self);
+
+ widget = (GtkWidget*)
+ gtk_builder_get_object (priv->builder, "printer-location-label");
+ g_signal_connect (widget, "editing-done", G_CALLBACK (printer_location_edit_cb), self);
+
priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
if (priv->lockdown_settings)
g_signal_connect (priv->lockdown_settings,
@@ -2657,7 +2574,6 @@ cc_printers_panel_init (CcPrintersPanel *self)
\"org.opensuse.cupspkhelper.mechanism.all-edit\" installed. \
Please check your installation");
-
gtk_style_context_get_background_color (gtk_widget_get_style_context (top_widget),
GTK_STATE_FLAG_NORMAL,
&priv->background_color);
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 0b9ece9..2986bd3 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -1094,40 +1094,8 @@ new_printer_add_button_cb (GtkButton *button,
if (proxy)
{
- dbus_g_proxy_call (proxy, "PrinterSetAcceptJobs", &error,
- G_TYPE_STRING, pp->devices[device_id].display_name,
- G_TYPE_BOOLEAN, TRUE,
- G_TYPE_STRING, NULL,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- if (error)
- {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
-
-
- dbus_g_proxy_call (proxy, "PrinterSetEnabled", &error,
- G_TYPE_STRING, pp->devices[device_id].display_name,
- G_TYPE_BOOLEAN, TRUE,
- G_TYPE_INVALID,
- G_TYPE_STRING, &ret_error,
- G_TYPE_INVALID);
-
- if (error)
- {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-
- if (ret_error && ret_error[0] != '\0')
- g_warning ("%s", ret_error);
-
+ printer_set_accepting_jobs (pp->devices[device_id].display_name, TRUE, NULL);
+ printer_set_enabled (pp->devices[device_id].display_name, TRUE);
if (g_strcmp0 (pp->devices[device_id].device_class, "direct") == 0)
{
diff --git a/panels/printers/pp-utils.c b/panels/printers/pp-utils.c
index 8dbe04f..07ccfc3 100644
--- a/panels/printers/pp-utils.c
+++ b/panels/printers/pp-utils.c
@@ -29,6 +29,8 @@
#include "pp-utils.h"
+#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism"
+
DBusGProxy *
get_dbus_proxy (const gchar *name,
const gchar *path,
@@ -1435,7 +1437,7 @@ renew_cups_subscription (gint id,
* Unset default destination if "dest" is NULL.
*/
void
-set_local_default_printer (gchar *printer_name)
+set_local_default_printer (const gchar *printer_name)
{
cups_dest_t *dests = NULL;
int num_dests = 0;
@@ -1453,3 +1455,751 @@ set_local_default_printer (gchar *printer_name)
cupsSetDests (num_dests, dests);
}
+
+/*
+ * This function does something which should be provided by CUPS...
+ * It returns FALSE if the renaming fails.
+ */
+gboolean
+printer_rename (const gchar *old_name,
+ const gchar *new_name)
+{
+ ipp_attribute_t *attr = NULL;
+ cups_ptype_t printer_type = 0;
+ cups_dest_t *dests = NULL;
+ cups_dest_t *dest = NULL;
+ cups_job_t *jobs = NULL;
+ DBusGProxy *proxy;
+ const char *printer_location = NULL;
+ const char *ppd_filename = NULL;
+ const char *printer_info = NULL;
+ const char *printer_uri = NULL;
+ const char *device_uri = NULL;
+ const char *job_sheets = NULL;
+ gboolean result = FALSE;
+ gboolean accepting = TRUE;
+ gboolean printer_paused = FALSE;
+ gboolean default_printer = FALSE;
+ gboolean printer_shared = FALSE;
+ GError *error = NULL;
+ http_t *http;
+ gchar **sheets = NULL;
+ gchar **users_allowed = NULL;
+ gchar **users_denied = NULL;
+ gchar **member_names = NULL;
+ gchar *start_sheet = NULL;
+ gchar *end_sheet = NULL;
+ gchar *error_policy = NULL;
+ gchar *op_policy = NULL;
+ ipp_t *request;
+ ipp_t *response;
+ char *ret_error = NULL;
+ gint i;
+ int num_dests = 0;
+ int num_jobs = 0;
+ static const char * const requested_attrs[] = {
+ "printer-error-policy",
+ "printer-op-policy",
+ "requesting-user-name-allowed",
+ "requesting-user-name-denied",
+ "member-names"};
+
+ if (old_name == NULL ||
+ old_name[0] == '\0' ||
+ new_name == NULL ||
+ new_name[0] == '\0' ||
+ g_strcmp0 (old_name, new_name) == 0)
+ return FALSE;
+
+ num_dests = cupsGetDests (&dests);
+
+ dest = cupsGetDest (new_name, NULL, num_dests, dests);
+ if (dest)
+ {
+ cupsFreeDests (num_dests, dests);
+ return FALSE;
+ }
+
+ num_jobs = cupsGetJobs (&jobs, old_name, 0, CUPS_WHICHJOBS_ACTIVE);
+ cupsFreeJobs (num_jobs, jobs);
+ if (num_jobs > 1)
+ {
+ g_warning ("There are queued jobs on printer %s!", old_name);
+ cupsFreeDests (num_dests, dests);
+ return FALSE;
+ }
+
+ /*
+ * Gather some informations about the original printer
+ */
+ dest = cupsGetDest (old_name, NULL, num_dests, dests);
+ if (dest)
+ {
+ for (i = 0; i < dest->num_options; i++)
+ {
+ if (g_strcmp0 (dest->options[i].name, "printer-is-accepting-jobs") == 0)
+ accepting = g_strcmp0 (dest->options[i].value, "true") == 0;
+ else if (g_strcmp0 (dest->options[i].name, "printer-is-shared") == 0)
+ printer_shared = g_strcmp0 (dest->options[i].value, "true") == 0;
+ else if (g_strcmp0 (dest->options[i].name, "device-uri") == 0)
+ device_uri = dest->options[i].value;
+ else if (g_strcmp0 (dest->options[i].name, "printer-uri-supported") == 0)
+ printer_uri = dest->options[i].value;
+ else if (g_strcmp0 (dest->options[i].name, "printer-info") == 0)
+ printer_info = dest->options[i].value;
+ else if (g_strcmp0 (dest->options[i].name, "printer-location") == 0)
+ printer_location = dest->options[i].value;
+ else if (g_strcmp0 (dest->options[i].name, "printer-state") == 0)
+ printer_paused = g_strcmp0 (dest->options[i].value, "5") == 0;
+ else if (g_strcmp0 (dest->options[i].name, "job-sheets") == 0)
+ job_sheets = dest->options[i].value;
+ else if (g_strcmp0 (dest->options[i].name, "printer-type") == 0)
+ printer_type = atoi (dest->options[i].value);
+ }
+ default_printer = dest->is_default;
+ }
+ cupsFreeDests (num_dests, dests);
+
+ if (accepting)
+ {
+ printer_set_accepting_jobs (old_name, FALSE, NULL);
+
+ num_jobs = cupsGetJobs (&jobs, old_name, 0, CUPS_WHICHJOBS_ACTIVE);
+ cupsFreeJobs (num_jobs, jobs);
+ if (num_jobs > 1)
+ {
+ printer_set_accepting_jobs (old_name, accepting, NULL);
+ g_warning ("There are queued jobs on printer %s!", old_name);
+ return FALSE;
+ }
+ }
+
+
+ /*
+ * Gather additional informations about the original printer
+ */
+ if ((http = httpConnectEncrypt (cupsServer (), ippPort (),
+ cupsEncryption ())) != NULL)
+ {
+ request = ippNewRequest (IPP_GET_PRINTER_ATTRIBUTES);
+ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI,
+ "printer-uri", NULL, printer_uri);
+ ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", G_N_ELEMENTS (requested_attrs), NULL, requested_attrs);
+ response = cupsDoRequest (http, request, "/");
+
+ if (response)
+ {
+ if (response->request.status.status_code <= IPP_OK_CONFLICT)
+ {
+ attr = ippFindAttribute (response, "printer-error-policy", IPP_TAG_NAME);
+ if (attr)
+ error_policy = g_strdup (attr->values[0].string.text);
+
+ attr = ippFindAttribute (response, "printer-op-policy", IPP_TAG_NAME);
+ if (attr)
+ op_policy = g_strdup (attr->values[0].string.text);
+
+ attr = ippFindAttribute (response, "requesting-user-name-allowed", IPP_TAG_NAME);
+ if (attr && attr->num_values > 0)
+ {
+ users_allowed = g_new0 (gchar *, attr->num_values + 1);
+ for (i = 0; i < attr->num_values; i++)
+ users_allowed[i] = g_strdup (attr->values[i].string.text);
+ }
+
+ attr = ippFindAttribute (response, "requesting-user-name-denied", IPP_TAG_NAME);
+ if (attr && attr->num_values > 0)
+ {
+ users_denied = g_new0 (gchar *, attr->num_values + 1);
+ for (i = 0; i < attr->num_values; i++)
+ users_denied[i] = g_strdup (attr->values[i].string.text);
+ }
+
+ attr = ippFindAttribute (response, "member-names", IPP_TAG_NAME);
+ if (attr && attr->num_values > 0)
+ {
+ member_names = g_new0 (gchar *, attr->num_values + 1);
+ for (i = 0; i < attr->num_values; i++)
+ member_names[i] = g_strdup (attr->values[i].string.text);
+ }
+ }
+ ippDelete (response);
+ }
+ httpClose (http);
+ }
+
+ if (job_sheets)
+ {
+ sheets = g_strsplit (job_sheets, ",", 0);
+ if (g_strv_length (sheets) > 1)
+ {
+ start_sheet = sheets[0];
+ end_sheet = sheets[1];
+ }
+ }
+
+ ppd_filename = cupsGetPPD (old_name);
+
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+
+ if (printer_type & CUPS_PRINTER_CLASS)
+ {
+ if (member_names)
+ for (i = 0; i < g_strv_length (member_names); i++)
+ class_add_printer (new_name, member_names[i]);
+ }
+ else
+ dbus_g_proxy_call (proxy, "PrinterAddWithPpdFile", &error,
+ G_TYPE_STRING, new_name,
+ G_TYPE_STRING, device_uri,
+ G_TYPE_STRING, ppd_filename,
+ G_TYPE_STRING, printer_info,
+ G_TYPE_STRING, printer_location,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ g_warning ("%s", ret_error);
+
+ g_object_unref (proxy);
+ }
+
+ if (ppd_filename)
+ g_unlink (ppd_filename);
+
+ num_dests = cupsGetDests (&dests);
+ dest = cupsGetDest (new_name, NULL, num_dests, dests);
+ if (dest)
+ {
+ printer_set_accepting_jobs (new_name, accepting, NULL);
+ printer_set_enabled (new_name, !printer_paused);
+ printer_set_shared (new_name, printer_shared);
+ printer_set_job_sheets (new_name, start_sheet, end_sheet);
+ printer_set_policy (new_name, op_policy, FALSE);
+ printer_set_policy (new_name, error_policy, TRUE);
+ printer_set_users (new_name, users_allowed, TRUE);
+ printer_set_users (new_name, users_denied, FALSE);
+ if (default_printer)
+ printer_set_default (new_name);
+
+ printer_delete (old_name);
+
+ result = TRUE;
+ }
+ else
+ printer_set_accepting_jobs (old_name, accepting, NULL);
+
+ cupsFreeDests (num_dests, dests);
+ g_free (op_policy);
+ g_free (error_policy);
+ if (sheets)
+ g_strfreev (sheets);
+ if (users_allowed)
+ g_strfreev (users_allowed);
+ if (users_denied)
+ g_strfreev (users_denied);
+
+ return result;
+}
+
+gboolean
+printer_set_location (const gchar *printer_name,
+ const gchar *location)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name && location)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetLocation", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRING, location,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_accepting_jobs (const gchar *printer_name,
+ gboolean accepting_jobs,
+ const gchar *reason)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetAcceptJobs", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_BOOLEAN, accepting_jobs,
+ G_TYPE_STRING, reason,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_enabled (const gchar *printer_name,
+ gboolean enabled)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetEnabled", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_BOOLEAN, enabled,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_delete (const gchar *printer_name)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterDelete", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_default (const gchar *printer_name)
+{
+ DBusGProxy *proxy;
+ const char *cups_server;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name)
+ {
+ cups_server = cupsServer ();
+ if (g_ascii_strncasecmp (cups_server, "localhost", 9) == 0 ||
+ g_ascii_strncasecmp (cups_server, "127.0.0.1", 9) == 0 ||
+ g_ascii_strncasecmp (cups_server, "::1", 3) == 0 ||
+ cups_server[0] == '/')
+ {
+ /* Clean .cups/lpoptions before setting
+ * default printer on local CUPS server.
+ */
+ set_local_default_printer (NULL);
+
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetDefault", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+ else
+ /* Store default printer to .cups/lpoptions
+ * if we are connected to a remote CUPS server.
+ */
+ {
+ set_local_default_printer (printer_name);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_shared (const gchar *printer_name,
+ gboolean shared)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetShared", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_BOOLEAN, shared,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_job_sheets (const gchar *printer_name,
+ const gchar *start_sheet,
+ const gchar *end_sheet)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name && start_sheet && end_sheet)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "PrinterSetJobSheets", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRING, start_sheet,
+ G_TYPE_STRING, end_sheet,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_policy (const gchar *printer_name,
+ const gchar *policy,
+ gboolean error_policy)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name && policy)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ if (error_policy)
+ dbus_g_proxy_call (proxy, "PrinterSetErrorPolicy", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRING, policy,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+ else
+ dbus_g_proxy_call (proxy, "PrinterSetOpPolicy", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRING, policy,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+printer_set_users (const gchar *printer_name,
+ gchar **users,
+ gboolean allowed)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (printer_name && users)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ if (allowed)
+ dbus_g_proxy_call (proxy, "PrinterSetUsersAllowed", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRV, users,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+ else
+ dbus_g_proxy_call (proxy, "PrinterSetUsersDenied", &error,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_STRV, users,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
+
+gboolean
+class_add_printer (const gchar *class_name,
+ const gchar *printer_name)
+{
+ DBusGProxy *proxy;
+ gboolean result = TRUE;
+ GError *error = NULL;
+ char *ret_error = NULL;
+
+ if (class_name && printer_name)
+ {
+ proxy = get_dbus_proxy (MECHANISM_BUS,
+ "/",
+ MECHANISM_BUS,
+ TRUE);
+
+ if (proxy)
+ {
+ dbus_g_proxy_call (proxy, "ClassAddPrinter", &error,
+ G_TYPE_STRING, class_name,
+ G_TYPE_STRING, printer_name,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &ret_error,
+ G_TYPE_INVALID);
+
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+
+ if (ret_error && ret_error[0] != '\0')
+ {
+ g_warning ("%s", ret_error);
+ result = FALSE;
+ }
+
+ g_object_unref (proxy);
+ }
+ }
+
+ return result;
+}
diff --git a/panels/printers/pp-utils.h b/panels/printers/pp-utils.h
index 9e3c77f..512065a 100644
--- a/panels/printers/pp-utils.h
+++ b/panels/printers/pp-utils.h
@@ -79,7 +79,42 @@ gint renew_cups_subscription (gint id,
gint num_events,
gint lease_duration);
-void set_local_default_printer (gchar *printer_name);
+void set_local_default_printer (const gchar *printer_name);
+
+gboolean printer_set_location (const gchar *printer_name,
+ const gchar *location);
+
+gboolean printer_set_accepting_jobs (const gchar *printer_name,
+ gboolean accepting_jobs,
+ const gchar *reason);
+
+gboolean printer_set_enabled (const gchar *printer_name,
+ gboolean enabled);
+
+gboolean printer_rename (const gchar *old_name,
+ const gchar *new_name);
+
+gboolean printer_delete (const gchar *printer_name);
+
+gboolean printer_set_default (const gchar *printer_name);
+
+gboolean printer_set_shared (const gchar *printer_name,
+ gboolean shared);
+
+gboolean printer_set_job_sheets (const gchar *printer_name,
+ const gchar *start_sheet,
+ const gchar *end_sheet);
+
+gboolean printer_set_policy (const gchar *printer_name,
+ const gchar *policy,
+ gboolean error_policy);
+
+gboolean printer_set_users (const gchar *printer_name,
+ gchar **users,
+ gboolean allowed);
+
+gboolean class_add_printer (const gchar *class_name,
+ const gchar *printer_name);
G_END_DECLS
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index 155e667..01445a7 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -141,11 +141,10 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-location-label">
+ <object class="CcEditableEntry" id="printer-location-label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">---</property>
- <property name="ellipsize">end</property>
+ <property name="text">---</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -156,12 +155,11 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-status-label">
+ <object class="CcEditableEntry" id="printer-status-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="label" translatable="yes">Printing...</property>
- <property name="ellipsize">end</property>
+ <property name="text">Printing...</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -224,10 +222,10 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-jobs-label">
+ <object class="CcEditableEntry" id="printer-jobs-label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="no">0 active</property>
+ <property name="text" translatable="no">0 active</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -256,15 +254,13 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-name-label">
+ <object class="CcEditableEntry" id="printer-name-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">1</property>
- <property name="label" translatable="yes">Printer</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.200000"/>
- </attributes>
+ <property name="text">Printer</property>
+ <property name="weight">700</property>
+ <property name="scale">1.2</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -318,11 +314,10 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-model-label">
+ <object class="CcEditableEntry" id="printer-model-label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">---</property>
- <property name="ellipsize">end</property>
+ <property name="text">---</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -333,10 +328,10 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="printer-ip-address-label">
+ <object class="CcEditableEntry" id="printer-ip-address-label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">---</property>
+ <property name="text">---</property>
</object>
<packing>
<property name="left_attach">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]