summaryrefslogtreecommitdiff
path: root/panels/printers
diff options
context:
space:
mode:
Diffstat (limited to 'panels/printers')
-rw-r--r--panels/printers/pp-cups.c34
-rw-r--r--panels/printers/pp-host.c52
-rw-r--r--panels/printers/pp-ipp-option-widget.c262
-rw-r--r--panels/printers/pp-job.c28
-rw-r--r--panels/printers/pp-jobs-dialog.c291
-rw-r--r--panels/printers/pp-maintenance-command.c36
-rw-r--r--panels/printers/pp-new-printer-dialog.c730
-rw-r--r--panels/printers/pp-new-printer.c164
-rw-r--r--panels/printers/pp-options-dialog.c276
-rw-r--r--panels/printers/pp-ppd-option-widget.c256
-rw-r--r--panels/printers/pp-ppd-selection-dialog.c144
-rw-r--r--panels/printers/pp-print-device.c88
-rw-r--r--panels/printers/pp-printer-entry.c14
-rw-r--r--panels/printers/pp-printer.c58
14 files changed, 1191 insertions, 1242 deletions
diff --git a/panels/printers/pp-cups.c b/panels/printers/pp-cups.c
index 162bf81c3..32525f860 100644
--- a/panels/printers/pp-cups.c
+++ b/panels/printers/pp-cups.c
@@ -51,7 +51,7 @@ pp_cups_class_init (PpCupsClass *klass)
}
static void
-pp_cups_init (PpCups *cups)
+pp_cups_init (PpCups *self)
{
}
@@ -89,25 +89,25 @@ _pp_cups_get_dests_thread (GTask *task,
}
void
-pp_cups_get_dests_async (PpCups *cups,
+pp_cups_get_dests_async (PpCups *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (cups, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_return_on_cancel (task, TRUE);
g_task_run_in_thread (task, (GTaskThreadFunc) _pp_cups_get_dests_thread);
g_object_unref (task);
}
PpCupsDests *
-pp_cups_get_dests_finish (PpCups *cups,
+pp_cups_get_dests_finish (PpCups *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, cups), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
@@ -130,14 +130,14 @@ connection_test_thread (GTask *task,
}
void
-pp_cups_connection_test_async (PpCups *cups,
+pp_cups_connection_test_async (PpCups *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (cups, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_return_on_cancel (task, TRUE);
g_task_run_in_thread (task, connection_test_thread);
@@ -145,11 +145,11 @@ pp_cups_connection_test_async (PpCups *cups,
}
gboolean
-pp_cups_connection_test_finish (PpCups *cups,
+pp_cups_connection_test_finish (PpCups *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, cups), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
@@ -183,14 +183,14 @@ cancel_subscription_thread (GTask *task,
}
void
-pp_cups_cancel_subscription_async (PpCups *cups,
+pp_cups_cancel_subscription_async (PpCups *self,
gint subscription_id,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (cups, NULL, callback, user_data);
+ task = g_task_new (self, NULL, callback, user_data);
g_task_set_task_data (task, GINT_TO_POINTER (subscription_id), NULL);
g_task_run_in_thread (task, cancel_subscription_thread);
@@ -198,10 +198,10 @@ pp_cups_cancel_subscription_async (PpCups *cups,
}
gboolean
-pp_cups_cancel_subscription_finish (PpCups *cups,
+pp_cups_cancel_subscription_finish (PpCups *self,
GAsyncResult *result)
{
- g_return_val_if_fail (g_task_is_valid (result, cups), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_boolean (G_TASK (result), NULL);
}
@@ -288,7 +288,7 @@ renew_subscription_thread (GTask *task,
}
void
-pp_cups_renew_subscription_async (PpCups *cups,
+pp_cups_renew_subscription_async (PpCups *self,
gint subscription_id,
gchar **events,
gint lease_duration,
@@ -304,7 +304,7 @@ pp_cups_renew_subscription_async (PpCups *cups,
subscription_data->events = g_strdupv (events);
subscription_data->lease_duration = lease_duration;
- task = g_task_new (cups, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, subscription_data, (GDestroyNotify) crs_data_free);
g_task_run_in_thread (task, renew_subscription_thread);
@@ -313,10 +313,10 @@ pp_cups_renew_subscription_async (PpCups *cups,
/* Returns id of renewed subscription or new id */
gint
-pp_cups_renew_subscription_finish (PpCups *cups,
+pp_cups_renew_subscription_finish (PpCups *self,
GAsyncResult *result)
{
- g_return_val_if_fail (g_task_is_valid (result, cups), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_int (G_TASK (result), NULL);
}
diff --git a/panels/printers/pp-host.c b/panels/printers/pp-host.c
index 476a691f0..15e65a574 100644
--- a/panels/printers/pp-host.c
+++ b/panels/printers/pp-host.c
@@ -140,9 +140,9 @@ pp_host_class_init (PpHostClass *klass)
}
static void
-pp_host_init (PpHost *host)
+pp_host_init (PpHost *self)
{
- PpHostPrivate *priv = pp_host_get_instance_private (host);
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
priv->port = PP_HOST_UNSET_PORT;
}
@@ -244,8 +244,8 @@ _pp_host_get_snmp_devices_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- PpHost *host = (PpHost *) source_object;
- PpHostPrivate *priv = pp_host_get_instance_private (host);
+ PpHost *self = source_object;
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
PpDevicesList *devices;
PpPrintDevice *device;
gboolean is_network_device;
@@ -310,23 +310,23 @@ _pp_host_get_snmp_devices_thread (GTask *task,
}
void
-pp_host_get_snmp_devices_async (PpHost *host,
+pp_host_get_snmp_devices_async (PpHost *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
- task = g_task_new (host, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_run_in_thread (task, _pp_host_get_snmp_devices_thread);
}
PpDevicesList *
-pp_host_get_snmp_devices_finish (PpHost *host,
+pp_host_get_snmp_devices_finish (PpHost *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, host), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
@@ -338,8 +338,8 @@ _pp_host_get_remote_cups_devices_thread (GTask *task,
GCancellable *cancellable)
{
cups_dest_t *dests = NULL;
- PpHost *host = (PpHost *) source_object;
- PpHostPrivate *priv = pp_host_get_instance_private (host);
+ PpHost *self = (PpHost *) source_object;
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
PpDevicesList *devices;
PpPrintDevice *device;
const char *device_location;
@@ -396,23 +396,23 @@ _pp_host_get_remote_cups_devices_thread (GTask *task,
}
void
-pp_host_get_remote_cups_devices_async (PpHost *host,
+pp_host_get_remote_cups_devices_async (PpHost *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
- task = g_task_new (host, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_run_in_thread (task, _pp_host_get_remote_cups_devices_thread);
}
PpDevicesList *
-pp_host_get_remote_cups_devices_finish (PpHost *host,
+pp_host_get_remote_cups_devices_finish (PpHost *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, host), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
@@ -485,25 +485,25 @@ jetdirect_connection_test_cb (GObject *source_object,
See http://en.wikipedia.org/wiki/JetDirect
http://www.cups.org/documentation.php/network.html */
void
-pp_host_get_jetdirect_devices_async (PpHost *host,
+pp_host_get_jetdirect_devices_async (PpHost *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- PpHostPrivate *priv = pp_host_get_instance_private (host);
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
JetDirectData *data;
g_autoptr(GTask) task = NULL;
g_autofree gchar *address = NULL;
data = g_new0 (JetDirectData, 1);
- data->host = g_object_ref (host);
+ data->host = g_object_ref (self);
if (priv->port == PP_HOST_UNSET_PORT)
data->port = PP_HOST_DEFAULT_JETDIRECT_PORT;
else
data->port = priv->port;
- task = g_task_new (G_OBJECT (host), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_task_data (task, data, (GDestroyNotify) jetdirect_data_free);
address = g_strdup_printf ("%s:%d", priv->hostname, data->port);
@@ -527,11 +527,11 @@ pp_host_get_jetdirect_devices_async (PpHost *host,
}
PpDevicesList *
-pp_host_get_jetdirect_devices_finish (PpHost *host,
+pp_host_get_jetdirect_devices_finish (PpHost *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, host), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
@@ -616,8 +616,8 @@ _pp_host_get_lpd_devices_thread (GTask *task,
{
g_autoptr(GSocketConnection) connection = NULL;
PpPrintDevice *device;
- PpHost *host = (PpHost *) source_object;
- PpHostPrivate *priv = pp_host_get_instance_private (host);
+ PpHost *self = source_object;
+ PpHostPrivate *priv = pp_host_get_instance_private (self);
PpDevicesList *devices;
g_autoptr(GSocketClient) client = NULL;
g_autoptr(GError) error = NULL;
@@ -720,23 +720,23 @@ _pp_host_get_lpd_devices_thread (GTask *task,
}
void
-pp_host_get_lpd_devices_async (PpHost *host,
+pp_host_get_lpd_devices_async (PpHost *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
- task = g_task_new (G_OBJECT (host), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_run_in_thread (task, _pp_host_get_lpd_devices_thread);
}
PpDevicesList *
-pp_host_get_lpd_devices_finish (PpHost *host,
+pp_host_get_lpd_devices_finish (PpHost *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, host), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
diff --git a/panels/printers/pp-ipp-option-widget.c b/panels/printers/pp-ipp-option-widget.c
index 5ae738463..4435cdd00 100644
--- a/panels/printers/pp-ipp-option-widget.c
+++ b/panels/printers/pp-ipp-option-widget.c
@@ -30,9 +30,9 @@
static void pp_ipp_option_widget_finalize (GObject *object);
-static gboolean construct_widget (PpIPPOptionWidget *widget);
-static void update_widget (PpIPPOptionWidget *widget);
-static void update_widget_real (PpIPPOptionWidget *widget);
+static gboolean construct_widget (PpIPPOptionWidget *self);
+static void update_widget (PpIPPOptionWidget *self);
+static void update_widget_real (PpIPPOptionWidget *self);
struct _PpIPPOptionWidget
{
@@ -104,38 +104,38 @@ pp_ipp_option_widget_class_init (PpIPPOptionWidgetClass *class)
}
static void
-pp_ipp_option_widget_init (PpIPPOptionWidget *widget)
+pp_ipp_option_widget_init (PpIPPOptionWidget *self)
{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (widget),
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (self),
GTK_ORIENTATION_HORIZONTAL);
- widget->switch_button = NULL;
- widget->spin_button = NULL;
- widget->combo = NULL;
- widget->box = NULL;
+ self->switch_button = NULL;
+ self->spin_button = NULL;
+ self->combo = NULL;
+ self->box = NULL;
- widget->printer_name = NULL;
- widget->option_name = NULL;
+ self->printer_name = NULL;
+ self->option_name = NULL;
- widget->option_supported = NULL;
- widget->option_default = NULL;
+ self->option_supported = NULL;
+ self->option_default = NULL;
- widget->ipp_attribute = NULL;
+ self->ipp_attribute = NULL;
}
static void
pp_ipp_option_widget_finalize (GObject *object)
{
- PpIPPOptionWidget *widget = PP_IPP_OPTION_WIDGET (object);
+ PpIPPOptionWidget *self = PP_IPP_OPTION_WIDGET (object);
- g_cancellable_cancel (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
- g_clear_pointer (&widget->option_name, g_free);
- g_clear_pointer (&widget->printer_name, g_free);
- g_clear_pointer (&widget->option_supported, ipp_attribute_free);
- g_clear_pointer (&widget->option_default, ipp_attribute_free);
- g_clear_pointer (&widget->ipp_attribute, g_hash_table_unref);
- g_clear_object (&widget->cancellable);
+ g_clear_pointer (&self->option_name, g_free);
+ g_clear_pointer (&self->printer_name, g_free);
+ g_clear_pointer (&self->option_supported, ipp_attribute_free);
+ g_clear_pointer (&self->option_default, ipp_attribute_free);
+ g_clear_pointer (&self->ipp_attribute, g_hash_table_unref);
+ g_clear_object (&self->cancellable);
G_OBJECT_CLASS (pp_ipp_option_widget_parent_class)->finalize (object);
}
@@ -146,30 +146,30 @@ pp_ipp_option_widget_new (IPPAttribute *attr_supported,
const gchar *option_name,
const gchar *printer)
{
- PpIPPOptionWidget *widget = NULL;
+ PpIPPOptionWidget *self = NULL;
if (attr_supported && option_name && printer)
{
- widget = g_object_new (PP_TYPE_IPP_OPTION_WIDGET, NULL);
+ self = g_object_new (PP_TYPE_IPP_OPTION_WIDGET, NULL);
- widget->printer_name = g_strdup (printer);
- widget->option_name = g_strdup (option_name);
- widget->option_supported = ipp_attribute_copy (attr_supported);
- widget->option_default = ipp_attribute_copy (attr_default);
+ self->printer_name = g_strdup (printer);
+ self->option_name = g_strdup (option_name);
+ self->option_supported = ipp_attribute_copy (attr_supported);
+ self->option_default = ipp_attribute_copy (attr_default);
- if (construct_widget (widget))
+ if (construct_widget (self))
{
- update_widget_real (widget);
+ update_widget_real (self);
}
else
{
- g_object_ref_sink (widget);
- g_object_unref (widget);
- widget = NULL;
+ g_object_ref_sink (self);
+ g_object_unref (self);
+ self = NULL;
}
}
- return (GtkWidget *) widget;
+ return (GtkWidget *) self;
}
enum {
@@ -277,16 +277,16 @@ static void
printer_add_option_async_cb (gboolean success,
gpointer user_data)
{
- PpIPPOptionWidget *widget = (PpIPPOptionWidget *) user_data;
+ PpIPPOptionWidget *self = user_data;
update_widget (user_data);
- g_clear_object (&widget->cancellable);
+ g_clear_object (&self->cancellable);
}
static void
switch_changed_cb (GtkWidget *switch_button,
GParamSpec *pspec,
- PpIPPOptionWidget *widget)
+ PpIPPOptionWidget *self)
{
gchar **values;
@@ -297,156 +297,156 @@ switch_changed_cb (GtkWidget *switch_button,
else
values[0] = g_strdup ("False");
- if (widget->cancellable)
+ if (self->cancellable)
{
- g_cancellable_cancel (widget->cancellable);
- g_object_unref (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
}
- widget->cancellable = g_cancellable_new ();
- printer_add_option_async (widget->printer_name,
- widget->option_name,
+ self->cancellable = g_cancellable_new ();
+ printer_add_option_async (self->printer_name,
+ self->option_name,
values,
TRUE,
- widget->cancellable,
+ self->cancellable,
printer_add_option_async_cb,
- widget);
+ self);
g_strfreev (values);
}
static void
combo_changed_cb (GtkWidget *combo,
- PpIPPOptionWidget *widget)
+ PpIPPOptionWidget *self)
{
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = combo_box_get (combo);
- if (widget->cancellable)
+ if (self->cancellable)
{
- g_cancellable_cancel (widget->cancellable);
- g_object_unref (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
}
- widget->cancellable = g_cancellable_new ();
- printer_add_option_async (widget->printer_name,
- widget->option_name,
+ self->cancellable = g_cancellable_new ();
+ printer_add_option_async (self->printer_name,
+ self->option_name,
values,
TRUE,
- widget->cancellable,
+ self->cancellable,
printer_add_option_async_cb,
- widget);
+ self);
g_strfreev (values);
}
static void
spin_button_changed_cb (GtkWidget *spin_button,
- PpIPPOptionWidget *widget)
+ PpIPPOptionWidget *self)
{
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button)));
- if (widget->cancellable)
+ if (self->cancellable)
{
- g_cancellable_cancel (widget->cancellable);
- g_object_unref (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
}
- widget->cancellable = g_cancellable_new ();
- printer_add_option_async (widget->printer_name,
- widget->option_name,
+ self->cancellable = g_cancellable_new ();
+ printer_add_option_async (self->printer_name,
+ self->option_name,
values,
TRUE,
- widget->cancellable,
+ self->cancellable,
printer_add_option_async_cb,
- widget);
+ self);
g_strfreev (values);
}
static gboolean
-construct_widget (PpIPPOptionWidget *widget)
+construct_widget (PpIPPOptionWidget *self)
{
gboolean trivial_option = FALSE;
gboolean result = FALSE;
gchar *value;
gint i;
- if (widget->option_supported)
+ if (self->option_supported)
{
- switch (widget->option_supported->attribute_type)
+ switch (self->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_INTEGER:
- if (widget->option_supported->num_of_values <= 1)
+ if (self->option_supported->num_of_values <= 1)
trivial_option = TRUE;
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- if (widget->option_supported->num_of_values <= 1)
+ if (self->option_supported->num_of_values <= 1)
trivial_option = TRUE;
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- if (widget->option_supported->attribute_values[0].lower_range ==
- widget->option_supported->attribute_values[0].upper_range)
+ if (self->option_supported->attribute_values[0].lower_range ==
+ self->option_supported->attribute_values[0].upper_range)
trivial_option = TRUE;
break;
}
if (!trivial_option)
{
- switch (widget->option_supported->attribute_type)
+ switch (self->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_BOOLEAN:
- widget->switch_button = gtk_switch_new ();
+ self->switch_button = gtk_switch_new ();
- gtk_box_pack_start (GTK_BOX (widget), widget->switch_button, FALSE, FALSE, 0);
- g_signal_connect (widget->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->switch_button, FALSE, FALSE, 0);
+ g_signal_connect (self->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), self);
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- widget->combo = combo_box_new ();
+ self->combo = combo_box_new ();
- for (i = 0; i < widget->option_supported->num_of_values; i++)
+ for (i = 0; i < self->option_supported->num_of_values; i++)
{
- value = g_strdup_printf ("%d", widget->option_supported->attribute_values[i].integer_value);
- combo_box_append (widget->combo,
- ipp_choice_translate (widget->option_name,
+ value = g_strdup_printf ("%d", self->option_supported->attribute_values[i].integer_value);
+ combo_box_append (self->combo,
+ ipp_choice_translate (self->option_name,
value),
value);
g_free (value);
}
- gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
- g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ g_signal_connect (self->combo, "changed", G_CALLBACK (combo_changed_cb), self);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- widget->combo = combo_box_new ();
+ self->combo = combo_box_new ();
- for (i = 0; i < widget->option_supported->num_of_values; i++)
- combo_box_append (widget->combo,
- ipp_choice_translate (widget->option_name,
- widget->option_supported->attribute_values[i].string_value),
- widget->option_supported->attribute_values[i].string_value);
+ for (i = 0; i < self->option_supported->num_of_values; i++)
+ combo_box_append (self->combo,
+ ipp_choice_translate (self->option_name,
+ self->option_supported->attribute_values[i].string_value),
+ self->option_supported->attribute_values[i].string_value);
- gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
- g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ g_signal_connect (self->combo, "changed", G_CALLBACK (combo_changed_cb), self);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- widget->spin_button = gtk_spin_button_new_with_range (
- widget->option_supported->attribute_values[0].lower_range,
- widget->option_supported->attribute_values[0].upper_range,
+ self->spin_button = gtk_spin_button_new_with_range (
+ self->option_supported->attribute_values[0].lower_range,
+ self->option_supported->attribute_values[0].upper_range,
1);
- gtk_box_pack_start (GTK_BOX (widget), widget->spin_button, FALSE, FALSE, 0);
- g_signal_connect (widget->spin_button, "value-changed", G_CALLBACK (spin_button_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->spin_button, FALSE, FALSE, 0);
+ g_signal_connect (self->spin_button, "value-changed", G_CALLBACK (spin_button_changed_cb), self);
break;
default:
@@ -461,96 +461,96 @@ construct_widget (PpIPPOptionWidget *widget)
}
static void
-update_widget_real (PpIPPOptionWidget *widget)
+update_widget_real (PpIPPOptionWidget *self)
{
IPPAttribute *attr = NULL;
gchar *value;
gchar *attr_name;
- if (widget->option_default)
+ if (self->option_default)
{
- attr = ipp_attribute_copy (widget->option_default);
+ attr = ipp_attribute_copy (self->option_default);
- ipp_attribute_free (widget->option_default);
- widget->option_default = NULL;
+ ipp_attribute_free (self->option_default);
+ self->option_default = NULL;
}
- else if (widget->ipp_attribute)
+ else if (self->ipp_attribute)
{
- attr_name = g_strdup_printf ("%s-default", widget->option_name);
- attr = ipp_attribute_copy (g_hash_table_lookup (widget->ipp_attribute, attr_name));
+ attr_name = g_strdup_printf ("%s-default", self->option_name);
+ attr = ipp_attribute_copy (g_hash_table_lookup (self->ipp_attribute, attr_name));
g_free (attr_name);
- g_hash_table_unref (widget->ipp_attribute);
- widget->ipp_attribute = NULL;
+ g_hash_table_unref (self->ipp_attribute);
+ self->ipp_attribute = NULL;
}
- switch (widget->option_supported->attribute_type)
+ switch (self->option_supported->attribute_type)
{
case IPP_ATTRIBUTE_TYPE_BOOLEAN:
- g_signal_handlers_block_by_func (widget->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->switch_button, switch_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_BOOLEAN)
{
- gtk_switch_set_active (GTK_SWITCH (widget->switch_button),
+ gtk_switch_set_active (GTK_SWITCH (self->switch_button),
attr->attribute_values[0].boolean_value);
}
- g_signal_handlers_unblock_by_func (widget->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (self->switch_button, switch_changed_cb, self);
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
{
value = g_strdup_printf ("%d", attr->attribute_values[0].integer_value);
- combo_box_set (widget->combo, value);
+ combo_box_set (self->combo, value);
g_free (value);
}
else
{
- value = g_strdup_printf ("%d", widget->option_supported->attribute_values[0].integer_value);
- combo_box_set (widget->combo, value);
+ value = g_strdup_printf ("%d", self->option_supported->attribute_values[0].integer_value);
+ combo_box_set (self->combo, value);
g_free (value);
}
- g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_STRING)
{
- combo_box_set (widget->combo, attr->attribute_values[0].string_value);
+ combo_box_set (self->combo, attr->attribute_values[0].string_value);
}
else
{
- combo_box_set (widget->combo, widget->option_supported->attribute_values[0].string_value);
+ combo_box_set (self->combo, self->option_supported->attribute_values[0].string_value);
}
- g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
- g_signal_handlers_block_by_func (widget->spin_button, spin_button_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->spin_button, spin_button_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
{
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget->spin_button),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->spin_button),
attr->attribute_values[0].integer_value);
}
else
{
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget->spin_button),
- widget->option_supported->attribute_values[0].lower_range);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->spin_button),
+ self->option_supported->attribute_values[0].lower_range);
}
- g_signal_handlers_unblock_by_func (widget->spin_button, spin_button_changed_cb, widget);
+ g_signal_handlers_unblock_by_func (self->spin_button, spin_button_changed_cb, self);
break;
default:
@@ -564,28 +564,28 @@ static void
get_ipp_attributes_cb (GHashTable *table,
gpointer user_data)
{
- PpIPPOptionWidget *widget = (PpIPPOptionWidget *) user_data;
+ PpIPPOptionWidget *self = user_data;
- if (widget->ipp_attribute)
- g_hash_table_unref (widget->ipp_attribute);
+ if (self->ipp_attribute)
+ g_hash_table_unref (self->ipp_attribute);
- widget->ipp_attribute = table;
+ self->ipp_attribute = table;
- update_widget_real (widget);
+ update_widget_real (self);
}
static void
-update_widget (PpIPPOptionWidget *widget)
+update_widget (PpIPPOptionWidget *self)
{
gchar **attributes_names;
attributes_names = g_new0 (gchar *, 2);
- attributes_names[0] = g_strdup_printf ("%s-default", widget->option_name);
+ attributes_names[0] = g_strdup_printf ("%s-default", self->option_name);
- get_ipp_attributes_async (widget->printer_name,
+ get_ipp_attributes_async (self->printer_name,
attributes_names,
get_ipp_attributes_cb,
- widget);
+ self);
g_strfreev (attributes_names);
}
diff --git a/panels/printers/pp-job.c b/panels/printers/pp-job.c
index 90f7e3b4b..77ea6a249 100644
--- a/panels/printers/pp-job.c
+++ b/panels/printers/pp-job.c
@@ -86,14 +86,14 @@ pp_job_cancel_purge_async_dbus_cb (GObject *source_object,
}
void
-pp_job_cancel_purge_async (PpJob *job,
+pp_job_cancel_purge_async (PpJob *self,
gboolean job_purge)
{
GDBusConnection *bus;
g_autoptr(GError) error = NULL;
gint *job_id;
- g_object_get (job, "id", &job_id, NULL);
+ g_object_get (self, "id", &job_id, NULL);
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (!bus)
@@ -137,14 +137,14 @@ pp_job_set_hold_until_async_dbus_cb (GObject *source_object,
}
void
-pp_job_set_hold_until_async (PpJob *job,
+pp_job_set_hold_until_async (PpJob *self,
const gchar *job_hold_until)
{
GDBusConnection *bus;
g_autoptr(GError) error = NULL;
gint *job_id;
- g_object_get (job, "id", &job_id, NULL);
+ g_object_get (self, "id", &job_id, NULL);
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (!bus)
@@ -392,7 +392,7 @@ _pp_job_get_attributes_thread (GTask *task,
}
void
-pp_job_get_attributes_async (PpJob *job,
+pp_job_get_attributes_async (PpJob *self,
gchar **attributes_names,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -400,7 +400,7 @@ pp_job_get_attributes_async (PpJob *job,
{
GTask *task;
- task = g_task_new (job, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, g_strdupv (attributes_names), (GDestroyNotify) g_strfreev);
g_task_run_in_thread (task, _pp_job_get_attributes_thread);
@@ -408,11 +408,11 @@ pp_job_get_attributes_async (PpJob *job,
}
GVariant *
-pp_job_get_attributes_finish (PpJob *job,
+pp_job_get_attributes_finish (PpJob *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, job), NULL);
+ g_return_val_if_fail (g_task_is_valid (result, self), NULL);
return g_task_propagate_pointer (G_TASK (result), error);
}
@@ -423,7 +423,7 @@ _pp_job_authenticate_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- PpJob *job = PP_JOB (source_object);
+ PpJob *self = source_object;
gboolean result = FALSE;
gchar **auth_info = task_data;
ipp_t *request;
@@ -433,7 +433,7 @@ _pp_job_authenticate_thread (GTask *task,
if (auth_info != NULL)
{
- job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", job->id);
+ job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", self->id);
length = g_strv_length (auth_info);
@@ -458,7 +458,7 @@ _pp_job_authenticate_thread (GTask *task,
}
void
-pp_job_authenticate_async (PpJob *job,
+pp_job_authenticate_async (PpJob *self,
gchar **auth_info,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -466,7 +466,7 @@ pp_job_authenticate_async (PpJob *job,
{
GTask *task;
- task = g_task_new (job, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, g_strdupv (auth_info), (GDestroyNotify) g_strfreev);
g_task_run_in_thread (task, _pp_job_authenticate_thread);
@@ -474,11 +474,11 @@ pp_job_authenticate_async (PpJob *job,
}
gboolean
-pp_job_authenticate_finish (PpJob *job,
+pp_job_authenticate_finish (PpJob *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, job), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
diff --git a/panels/printers/pp-jobs-dialog.c b/panels/printers/pp-jobs-dialog.c
index e3956e5c8..875862ede 100644
--- a/panels/printers/pp-jobs-dialog.c
+++ b/panels/printers/pp-jobs-dialog.c
@@ -43,7 +43,7 @@
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
#define CLOCK_FORMAT_KEY "clock-format"
-static void pp_jobs_dialog_hide (PpJobsDialog *dialog);
+static void pp_jobs_dialog_hide (PpJobsDialog *self);
struct _PpJobsDialog {
GtkBuilder *builder;
@@ -66,17 +66,17 @@ struct _PpJobsDialog {
};
static gboolean
-is_info_required (PpJobsDialog *dialog,
+is_info_required (PpJobsDialog *self,
const gchar *info)
{
gboolean required = FALSE;
gint i;
- if (dialog != NULL && dialog->actual_auth_info_required != NULL)
+ if (self != NULL && self->actual_auth_info_required != NULL)
{
- for (i = 0; dialog->actual_auth_info_required[i] != NULL; i++)
+ for (i = 0; self->actual_auth_info_required[i] != NULL; i++)
{
- if (g_strcmp0 (dialog->actual_auth_info_required[i], info) == 0)
+ if (g_strcmp0 (self->actual_auth_info_required[i], info) == 0)
{
required = TRUE;
break;
@@ -88,25 +88,25 @@ is_info_required (PpJobsDialog *dialog,
}
static gboolean
-is_domain_required (PpJobsDialog *dialog)
+is_domain_required (PpJobsDialog *self)
{
- return is_info_required (dialog, "domain");
+ return is_info_required (self, "domain");
}
static gboolean
-is_username_required (PpJobsDialog *dialog)
+is_username_required (PpJobsDialog *self)
{
- return is_info_required (dialog, "username");
+ return is_info_required (self, "username");
}
static gboolean
-is_password_required (PpJobsDialog *dialog)
+is_password_required (PpJobsDialog *self)
{
- return is_info_required (dialog, "password");
+ return is_info_required (self, "password");
}
static gboolean
-auth_popup_filled (PpJobsDialog *dialog)
+auth_popup_filled (PpJobsDialog *self)
{
gboolean domain_required;
gboolean username_required;
@@ -115,13 +115,13 @@ auth_popup_filled (PpJobsDialog *dialog)
guint16 username_length;
guint16 password_length;
- domain_required = is_domain_required (dialog);
- username_required = is_username_required (dialog);
- password_required = is_password_required (dialog);
+ domain_required = is_domain_required (self);
+ username_required = is_username_required (self);
+ password_required = is_password_required (self);
- domain_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (dialog->builder, "domain-entry")));
- username_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (dialog->builder, "username-entry")));
- password_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (dialog->builder, "password-entry")));
+ domain_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (self->builder, "domain-entry")));
+ username_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (self->builder, "username-entry")));
+ password_length = gtk_entry_get_text_length (GTK_ENTRY (gtk_builder_get_object (self->builder, "password-entry")));
return (!domain_required || domain_length > 0) &&
(!username_required || username_length > 0) &&
@@ -130,59 +130,59 @@ auth_popup_filled (PpJobsDialog *dialog)
static void
auth_entries_changed (GtkEntry *entry,
- PpJobsDialog *dialog)
+ PpJobsDialog *self)
{
GtkWidget *widget;
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "authenticate-button"));
- gtk_widget_set_sensitive (widget, auth_popup_filled (dialog));
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "authenticate-button"));
+ gtk_widget_set_sensitive (widget, auth_popup_filled (self));
}
static void
auth_entries_activated (GtkEntry *entry,
- PpJobsDialog *dialog)
+ PpJobsDialog *self)
{
GtkWidget *widget;
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "authenticate-button"));
- if (auth_popup_filled (dialog))
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "authenticate-button"));
+ if (auth_popup_filled (self))
gtk_button_clicked (GTK_BUTTON (widget));
}
static void
-authenticate_popover_update (PpJobsDialog *dialog)
+authenticate_popover_update (PpJobsDialog *self)
{
GtkWidget *widget;
gboolean domain_required;
gboolean username_required;
gboolean password_required;
- domain_required = is_domain_required (dialog);
- username_required = is_username_required (dialog);
- password_required = is_password_required (dialog);
+ domain_required = is_domain_required (self);
+ username_required = is_username_required (self);
+ password_required = is_password_required (self);
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "domain-label"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "domain-label"));
gtk_widget_set_visible (widget, domain_required);
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "domain-entry"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "domain-entry"));
gtk_widget_set_visible (widget, domain_required);
if (domain_required)
gtk_entry_set_text (GTK_ENTRY (widget), "");
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "username-label"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "username-label"));
gtk_widget_set_visible (widget, username_required);
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "username-entry"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "username-entry"));
gtk_widget_set_visible (widget, username_required);
if (username_required)
gtk_entry_set_text (GTK_ENTRY (widget), cupsUser ());
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "password-label"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "password-label"));
gtk_widget_set_visible (widget, password_required);
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "password-entry"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "password-entry"));
gtk_widget_set_visible (widget, password_required);
if (password_required)
gtk_entry_set_text (GTK_ENTRY (widget), "");
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "authenticate-button"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "authenticate-button"));
gtk_widget_set_sensitive (widget, FALSE);
}
@@ -301,13 +301,13 @@ create_listbox_row (gpointer item,
}
static void
-pop_up_authentication_popup (PpJobsDialog *dialog)
+pop_up_authentication_popup (PpJobsDialog *self)
{
GtkWidget *widget;
- if (dialog->actual_auth_info_required != NULL)
+ if (self->actual_auth_info_required != NULL)
{
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "authenticate-jobs-button"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "authenticate-jobs-button"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
}
}
@@ -317,7 +317,7 @@ update_jobs_list_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- PpJobsDialog *dialog = user_data;
+ PpJobsDialog *self = user_data;
PpPrinter *printer = PP_PRINTER (source_object);
GtkWidget *clear_all_button;
GtkWidget *infobar;
@@ -330,10 +330,10 @@ update_jobs_list_cb (GObject *source_object,
gchar *text;
gint num_of_jobs, num_of_auth_jobs = 0;
- g_list_store_remove_all (dialog->store);
+ g_list_store_remove_all (self->store);
- stack = GTK_STACK (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "stack"));
- clear_all_button = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "jobs-clear-all-button"));
+ stack = GTK_STACK (gtk_builder_get_object (GTK_BUILDER (self->builder), "stack"));
+ clear_all_button = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "jobs-clear-all-button"));
jobs = pp_printer_get_jobs_finish (printer, result, &error);
if (error != NULL)
@@ -362,7 +362,7 @@ update_jobs_list_cb (GObject *source_object,
{
job = PP_JOB (l->data);
- g_list_store_append (dialog->store, job);
+ g_list_store_append (self->store, job);
g_object_get (G_OBJECT (job),
"auth-info-required", &auth_info_required,
@@ -371,8 +371,8 @@ update_jobs_list_cb (GObject *source_object,
{
num_of_auth_jobs++;
- if (dialog->actual_auth_info_required == NULL)
- dialog->actual_auth_info_required = auth_info_required;
+ if (self->actual_auth_info_required == NULL)
+ self->actual_auth_info_required = auth_info_required;
else
g_strfreev (auth_info_required);
@@ -380,10 +380,10 @@ update_jobs_list_cb (GObject *source_object,
}
}
- infobar = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "authentication-infobar"));
+ infobar = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "authentication-infobar"));
if (num_of_auth_jobs > 0)
{
- label = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "authenticate-jobs-label"));
+ label = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "authenticate-jobs-label"));
/* Translators: This label shows how many jobs of this printer needs to be authenticated to be printed. */
text = g_strdup_printf (ngettext ("%u Job Requires Authentication", "%u Jobs Require Authentication", num_of_auth_jobs), num_of_auth_jobs);
@@ -397,42 +397,42 @@ update_jobs_list_cb (GObject *source_object,
gtk_widget_hide (infobar);
}
- authenticate_popover_update (dialog);
+ authenticate_popover_update (self);
g_list_free (jobs);
- g_clear_object (&dialog->get_jobs_cancellable);
+ g_clear_object (&self->get_jobs_cancellable);
- if (!dialog->jobs_filled)
+ if (!self->jobs_filled)
{
- if (dialog->pop_up_authentication_popup)
+ if (self->pop_up_authentication_popup)
{
- pop_up_authentication_popup (dialog);
- dialog->pop_up_authentication_popup = FALSE;
+ pop_up_authentication_popup (self);
+ self->pop_up_authentication_popup = FALSE;
}
- dialog->jobs_filled = TRUE;
+ self->jobs_filled = TRUE;
}
}
static void
-update_jobs_list (PpJobsDialog *dialog)
+update_jobs_list (PpJobsDialog *self)
{
PpPrinter *printer;
- if (dialog->printer_name != NULL)
+ if (self->printer_name != NULL)
{
- g_cancellable_cancel (dialog->get_jobs_cancellable);
- g_clear_object (&dialog->get_jobs_cancellable);
+ g_cancellable_cancel (self->get_jobs_cancellable);
+ g_clear_object (&self->get_jobs_cancellable);
- dialog->get_jobs_cancellable = g_cancellable_new ();
+ self->get_jobs_cancellable = g_cancellable_new ();
- printer = pp_printer_new (dialog->printer_name);
+ printer = pp_printer_new (self->printer_name);
pp_printer_get_jobs_async (printer,
TRUE,
CUPS_WHICHJOBS_ACTIVE,
- dialog->get_jobs_cancellable,
+ self->get_jobs_cancellable,
update_jobs_list_cb,
- dialog);
+ self);
}
}
@@ -441,28 +441,28 @@ jobs_dialog_response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
- PpJobsDialog *jobs_dialog = (PpJobsDialog*) user_data;
+ PpJobsDialog *self = (PpJobsDialog*) user_data;
- pp_jobs_dialog_hide (jobs_dialog);
+ pp_jobs_dialog_hide (self);
- jobs_dialog->user_callback (GTK_DIALOG (jobs_dialog->dialog),
- response_id,
- jobs_dialog->user_data);
+ self->user_callback (GTK_DIALOG (self->dialog),
+ response_id,
+ self->user_data);
}
static void
on_clear_all_button_clicked (GtkButton *button,
gpointer user_data)
{
- PpJobsDialog *dialog = user_data;
+ PpJobsDialog *self = user_data;
guint num_items;
guint i;
- num_items = g_list_model_get_n_items (G_LIST_MODEL (dialog->store));
+ num_items = g_list_model_get_n_items (G_LIST_MODEL (self->store));
for (i = 0; i < num_items; i++)
{
- PpJob *job = PP_JOB (g_list_model_get_item (G_LIST_MODEL (dialog->store), i));
+ PpJob *job = PP_JOB (g_list_model_get_item (G_LIST_MODEL (self->store), i));
pp_job_cancel_purge_async (job, FALSE);
}
@@ -473,7 +473,7 @@ pp_job_authenticate_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpJobsDialog *dialog = user_data;
+ PpJobsDialog *self = user_data;
gboolean result;
g_autoptr(GError) error = NULL;
PpJob *job = PP_JOB (source_object);
@@ -481,7 +481,7 @@ pp_job_authenticate_cb (GObject *source_object,
result = pp_job_authenticate_finish (job, res, &error);
if (result)
{
- pp_jobs_dialog_update (dialog);
+ pp_jobs_dialog_update (self);
}
else if (error != NULL)
{
@@ -496,7 +496,7 @@ static void
authenticate_button_clicked (GtkWidget *button,
gpointer user_data)
{
- PpJobsDialog *dialog = user_data;
+ PpJobsDialog *self = user_data;
GtkWidget *widget;
PpJob *job;
gchar **auth_info_required = NULL;
@@ -504,15 +504,15 @@ authenticate_button_clicked (GtkWidget *button,
guint num_items;
gint i;
- auth_info = g_new0 (gchar *, g_strv_length (dialog->actual_auth_info_required) + 1);
- for (i = 0; dialog->actual_auth_info_required[i] != NULL; i++)
+ auth_info = g_new0 (gchar *, g_strv_length (self->actual_auth_info_required) + 1);
+ for (i = 0; self->actual_auth_info_required[i] != NULL; i++)
{
- if (g_strcmp0 (dialog->actual_auth_info_required[i], "domain") == 0)
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "domain-entry"));
- else if (g_strcmp0 (dialog->actual_auth_info_required[i], "username") == 0)
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "username-entry"));
- else if (g_strcmp0 (dialog->actual_auth_info_required[i], "password") == 0)
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "password-entry"));
+ if (g_strcmp0 (self->actual_auth_info_required[i], "domain") == 0)
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "domain-entry"));
+ else if (g_strcmp0 (self->actual_auth_info_required[i], "username") == 0)
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "username-entry"));
+ else if (g_strcmp0 (self->actual_auth_info_required[i], "password") == 0)
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "password-entry"));
else
widget = NULL;
@@ -520,15 +520,15 @@ authenticate_button_clicked (GtkWidget *button,
auth_info[i] = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
}
- num_items = g_list_model_get_n_items (G_LIST_MODEL (dialog->store));
+ num_items = g_list_model_get_n_items (G_LIST_MODEL (self->store));
for (i = 0; i < num_items; i++)
{
- job = PP_JOB (g_list_model_get_item (G_LIST_MODEL (dialog->store), i));
+ job = PP_JOB (g_list_model_get_item (G_LIST_MODEL (self->store), i));
g_object_get (job, "auth-info-required", &auth_info_required, NULL);
if (auth_info_required != NULL)
{
- pp_job_authenticate_async (job, auth_info, NULL, pp_job_authenticate_cb, dialog);
+ pp_job_authenticate_async (job, auth_info, NULL, pp_job_authenticate_cb, self);
g_strfreev (auth_info_required);
auth_info_required = NULL;
@@ -555,7 +555,7 @@ pp_jobs_dialog_new (GtkWindow *parent,
gpointer user_data,
gchar *printer_name)
{
- PpJobsDialog *dialog;
+ PpJobsDialog *self;
GtkWidget *widget;
g_autoptr(GError) error = NULL;
gchar *objects[] = { "jobs-dialog", "authentication_popover", NULL };
@@ -563,12 +563,12 @@ pp_jobs_dialog_new (GtkWindow *parent,
guint builder_result;
gchar *title;
- dialog = g_new0 (PpJobsDialog, 1);
+ self = g_new0 (PpJobsDialog, 1);
- dialog->builder = gtk_builder_new ();
- dialog->parent = GTK_WIDGET (parent);
+ self->builder = gtk_builder_new ();
+ self->parent = GTK_WIDGET (parent);
- builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
+ builder_result = gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/printers/jobs-dialog.ui",
objects, &error);
@@ -578,109 +578,108 @@ pp_jobs_dialog_new (GtkWindow *parent,
return NULL;
}
- dialog->dialog = (GtkWidget *) gtk_builder_get_object (dialog->builder, "jobs-dialog");
- dialog->user_callback = user_callback;
- dialog->user_data = user_data;
- dialog->printer_name = g_strdup (printer_name);
- dialog->actual_auth_info_required = NULL;
- dialog->jobs_filled = FALSE;
- dialog->pop_up_authentication_popup = FALSE;
+ self->dialog = (GtkWidget *) gtk_builder_get_object (self->builder, "jobs-dialog");
+ self->user_callback = user_callback;
+ self->user_data = user_data;
+ self->printer_name = g_strdup (printer_name);
+ self->actual_auth_info_required = NULL;
+ self->jobs_filled = FALSE;
+ self->pop_up_authentication_popup = FALSE;
/* connect signals */
- g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- g_signal_connect (dialog->dialog, "response", G_CALLBACK (jobs_dialog_response_cb), dialog);
- g_signal_connect (dialog->dialog, "key-press-event", G_CALLBACK (key_press_event_cb), NULL);
+ g_signal_connect (self->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+ g_signal_connect (self->dialog, "response", G_CALLBACK (jobs_dialog_response_cb), self);
+ g_signal_connect (self->dialog, "key-press-event", G_CALLBACK (key_press_event_cb), NULL);
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "jobs-clear-all-button"));
- g_signal_connect (widget, "clicked", G_CALLBACK (on_clear_all_button_clicked), dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "jobs-clear-all-button"));
+ g_signal_connect (widget, "clicked", G_CALLBACK (on_clear_all_button_clicked), self);
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "authenticate-button"));
- g_signal_connect (widget, "clicked", G_CALLBACK (authenticate_button_clicked), dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "authenticate-button"));
+ g_signal_connect (widget, "clicked", G_CALLBACK (authenticate_button_clicked), self);
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "domain-entry"));
- g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), dialog);
- g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "domain-entry"));
+ g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), self);
+ g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), self);
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "username-entry"));
- g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), dialog);
- g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "username-entry"));
+ g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), self);
+ g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), self);
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "password-entry"));
- g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), dialog);
- g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "password-entry"));
+ g_signal_connect (widget, "changed", G_CALLBACK (auth_entries_changed), self);
+ g_signal_connect (widget, "activate", G_CALLBACK (auth_entries_activated), self);
/* Translators: This is the printer name for which we are showing the active jobs */
title = g_strdup_printf (C_("Printer jobs dialog title", "%s — Active Jobs"), printer_name);
- gtk_window_set_title (GTK_WINDOW (dialog->dialog), title);
+ gtk_window_set_title (GTK_WINDOW (self->dialog), title);
g_free (title);
/* Translators: The printer needs authentication info to print. */
text = g_strdup_printf (_("Enter credentials to print from %s."), printer_name);
- widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "authentication-label"));
+ widget = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (self->builder), "authentication-label"));
gtk_label_set_text (GTK_LABEL (widget), text);
g_free (text);
- dialog->listbox = GTK_LIST_BOX (gtk_builder_get_object (dialog->builder, "jobs-listbox"));
- gtk_list_box_set_header_func (dialog->listbox,
+ self->listbox = GTK_LIST_BOX (gtk_builder_get_object (self->builder, "jobs-listbox"));
+ gtk_list_box_set_header_func (self->listbox,
cc_list_box_update_header_func, NULL, NULL);
- dialog->store = g_list_store_new (pp_job_get_type ());
- gtk_list_box_bind_model (dialog->listbox, G_LIST_MODEL (dialog->store),
+ self->store = g_list_store_new (pp_job_get_type ());
+ gtk_list_box_bind_model (self->listbox, G_LIST_MODEL (self->store),
create_listbox_row, NULL, NULL);
- update_jobs_list (dialog);
+ update_jobs_list (self);
- gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (parent));
- gtk_window_present (GTK_WINDOW (dialog->dialog));
- gtk_widget_show_all (GTK_WIDGET (dialog->dialog));
+ gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
+ gtk_window_present (GTK_WINDOW (self->dialog));
+ gtk_widget_show_all (GTK_WIDGET (self->dialog));
- return dialog;
+ return self;
}
void
-pp_jobs_dialog_update (PpJobsDialog *dialog)
+pp_jobs_dialog_update (PpJobsDialog *self)
{
- update_jobs_list (dialog);
+ update_jobs_list (self);
}
void
-pp_jobs_dialog_set_callback (PpJobsDialog *dialog,
+pp_jobs_dialog_set_callback (PpJobsDialog *self,
UserResponseCallback user_callback,
gpointer user_data)
{
- if (dialog != NULL)
- {
- dialog->user_callback = user_callback;
- dialog->user_data = user_data;
- }
+ g_return_if_fail (self != NULL);
+
+ self->user_callback = user_callback;
+ self->user_data = user_data;
}
void
-pp_jobs_dialog_free (PpJobsDialog *dialog)
+pp_jobs_dialog_free (PpJobsDialog *self)
{
- g_cancellable_cancel (dialog->get_jobs_cancellable);
- g_clear_object (&dialog->get_jobs_cancellable);
+ g_cancellable_cancel (self->get_jobs_cancellable);
+ g_clear_object (&self->get_jobs_cancellable);
- gtk_widget_destroy (GTK_WIDGET (dialog->dialog));
- dialog->dialog = NULL;
+ gtk_widget_destroy (GTK_WIDGET (self->dialog));
+ self->dialog = NULL;
- g_strfreev (dialog->actual_auth_info_required);
+ g_strfreev (self->actual_auth_info_required);
- g_clear_object (&dialog->builder);
- g_free (dialog->printer_name);
- g_free (dialog);
+ g_clear_object (&self->builder);
+ g_free (self->printer_name);
+ g_free (self);
}
static void
-pp_jobs_dialog_hide (PpJobsDialog *dialog)
+pp_jobs_dialog_hide (PpJobsDialog *self)
{
- gtk_widget_hide (GTK_WIDGET (dialog->dialog));
+ gtk_widget_hide (GTK_WIDGET (self->dialog));
}
void
-pp_jobs_dialog_authenticate_jobs (PpJobsDialog *dialog)
+pp_jobs_dialog_authenticate_jobs (PpJobsDialog *self)
{
- if (dialog->jobs_filled)
- pop_up_authentication_popup (dialog);
+ if (self->jobs_filled)
+ pop_up_authentication_popup (self);
else
- dialog->pop_up_authentication_popup = TRUE;
+ self->pop_up_authentication_popup = TRUE;
}
diff --git a/panels/printers/pp-maintenance-command.c b/panels/printers/pp-maintenance-command.c
index 60dea4d80..ae59b7ce6 100644
--- a/panels/printers/pp-maintenance-command.c
+++ b/panels/printers/pp-maintenance-command.c
@@ -171,7 +171,7 @@ pp_maintenance_command_class_init (PpMaintenanceCommandClass *klass)
}
static void
-pp_maintenance_command_init (PpMaintenanceCommand *command)
+pp_maintenance_command_init (PpMaintenanceCommand *self)
{
}
@@ -198,11 +198,11 @@ _pp_maintenance_command_execute_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- PpMaintenanceCommand *command = PP_MAINTENANCE_COMMAND (source_object);
+ PpMaintenanceCommand *self = PP_MAINTENANCE_COMMAND (source_object);
gboolean success = FALSE;
GError *error = NULL;
- if (_pp_maintenance_command_is_supported (command->printer_name, command->command))
+ if (_pp_maintenance_command_is_supported (self->printer_name, self->command))
{
ipp_t *request;
ipp_t *response = NULL;
@@ -211,14 +211,14 @@ _pp_maintenance_command_execute_thread (GTask *task,
int fd = -1;
printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
- command->printer_name);
+ self->printer_name);
request = ippNewRequest (IPP_PRINT_JOB);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
- "job-name", NULL, command->title);
+ "job-name", NULL, self->title);
ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
"document-format", NULL, "application/vnd.cups-command");
@@ -230,9 +230,9 @@ _pp_maintenance_command_execute_thread (GTask *task,
file = fdopen (fd, "w");
fprintf (file, "#CUPS-COMMAND\n");
- fprintf (file, "%s", command->command);
- if (command->parameters)
- fprintf (file, " %s", command->parameters);
+ fprintf (file, "%s", self->command);
+ if (self->parameters)
+ fprintf (file, " %s", self->parameters);
fprintf (file, "\n");
fclose (file);
@@ -270,14 +270,14 @@ _pp_maintenance_command_execute_thread (GTask *task,
}
void
-pp_maintenance_command_execute_async (PpMaintenanceCommand *command,
+pp_maintenance_command_execute_async (PpMaintenanceCommand *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (command, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_check_cancellable (task, TRUE);
g_task_run_in_thread (task, _pp_maintenance_command_execute_thread);
@@ -285,11 +285,11 @@ pp_maintenance_command_execute_async (PpMaintenanceCommand *command,
}
gboolean
-pp_maintenance_command_execute_finish (PpMaintenanceCommand *command,
+pp_maintenance_command_execute_finish (PpMaintenanceCommand *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, command), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
@@ -368,22 +368,22 @@ _pp_maintenance_command_is_supported_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- PpMaintenanceCommand *command = PP_MAINTENANCE_COMMAND (source_object);
+ PpMaintenanceCommand *self = PP_MAINTENANCE_COMMAND (source_object);
gboolean success = FALSE;
- success = _pp_maintenance_command_is_supported (command->printer_name, command->command);
+ success = _pp_maintenance_command_is_supported (self->printer_name, self->command);
g_task_return_boolean (task, success);
}
void
-pp_maintenance_command_is_supported_async (PpMaintenanceCommand *command,
+pp_maintenance_command_is_supported_async (PpMaintenanceCommand *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (command, cancellable, callback, user_data);
+ task = g_task_new (self, cancellable, callback, user_data);
g_task_set_check_cancellable (task, TRUE);
g_task_run_in_thread (task, _pp_maintenance_command_is_supported_thread);
@@ -391,11 +391,11 @@ pp_maintenance_command_is_supported_async (PpMaintenanceCommand *command,
}
gboolean
-pp_maintenance_command_is_supported_finish (PpMaintenanceCommand *command,
+pp_maintenance_command_is_supported_finish (PpMaintenanceCommand *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, command), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index e7335b913..bf2769333 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -53,18 +53,18 @@
*/
#define HOST_SEARCH_DELAY (500 - 150)
-#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog->builder, s))
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->builder, s))
#define AUTHENTICATION_PAGE "authentication-page"
#define ADDPRINTER_PAGE "addprinter-page"
-static void set_device (PpNewPrinterDialog *dialog,
+static void set_device (PpNewPrinterDialog *self,
PpPrintDevice *device,
GtkTreeIter *iter);
-static void replace_device (PpNewPrinterDialog *dialog,
+static void replace_device (PpNewPrinterDialog *self,
PpPrintDevice *old_device,
PpPrintDevice *new_device);
-static void populate_devices_list (PpNewPrinterDialog *dialog);
+static void populate_devices_list (PpNewPrinterDialog *self);
static void search_entry_activated_cb (GtkEntry *entry,
gpointer user_data);
static void search_entry_changed_cb (GtkSearchEntry *entry,
@@ -72,10 +72,10 @@ static void search_entry_changed_cb (GtkSearchEntry *entry,
static void new_printer_dialog_response_cb (GtkDialog *_dialog,
gint response_id,
gpointer user_data);
-static void update_dialog_state (PpNewPrinterDialog *dialog);
-static void add_devices_to_list (PpNewPrinterDialog *dialog,
+static void update_dialog_state (PpNewPrinterDialog *self);
+static void add_devices_to_list (PpNewPrinterDialog *self,
GList *devices);
-static void remove_device_from_list (PpNewPrinterDialog *dialog,
+static void remove_device_from_list (PpNewPrinterDialog *self,
const gchar *device_name);
enum
@@ -192,38 +192,38 @@ PpNewPrinterDialog *
pp_new_printer_dialog_new (GtkWindow *parent,
PPDList *ppd_list)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self;
- dialog = g_object_new (PP_TYPE_NEW_PRINTER_DIALOG, NULL);
+ self = g_object_new (PP_TYPE_NEW_PRINTER_DIALOG, NULL);
- dialog->list = ppd_list_copy (ppd_list);
- dialog->parent = parent;
+ self->list = ppd_list_copy (ppd_list);
+ self->parent = parent;
- gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (parent));
+ gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
- gtk_widget_show_all (dialog->dialog);
+ gtk_widget_show_all (self->dialog);
- return PP_NEW_PRINTER_DIALOG (dialog);
+ return PP_NEW_PRINTER_DIALOG (self);
}
void
-pp_new_printer_dialog_set_ppd_list (PpNewPrinterDialog *dialog,
+pp_new_printer_dialog_set_ppd_list (PpNewPrinterDialog *self,
PPDList *list)
{
- dialog->list = ppd_list_copy (list);
+ self->list = ppd_list_copy (list);
- if (dialog->ppd_selection_dialog)
- pp_ppd_selection_dialog_set_ppd_list (dialog->ppd_selection_dialog, dialog->list);
+ if (self->ppd_selection_dialog)
+ pp_ppd_selection_dialog_set_ppd_list (self->ppd_selection_dialog, self->list);
}
static void
-emit_pre_response (PpNewPrinterDialog *dialog,
+emit_pre_response (PpNewPrinterDialog *self,
const gchar *device_name,
const gchar *device_location,
const gchar *device_make_and_model,
gboolean network_device)
{
- g_signal_emit (dialog,
+ g_signal_emit (self,
signals[PRE_RESPONSE],
0,
device_name,
@@ -233,10 +233,10 @@ emit_pre_response (PpNewPrinterDialog *dialog,
}
static void
-emit_response (PpNewPrinterDialog *dialog,
+emit_response (PpNewPrinterDialog *self,
gint response_id)
{
- g_signal_emit (dialog, signals[RESPONSE], 0, response_id);
+ g_signal_emit (self, signals[RESPONSE], 0, response_id);
}
typedef struct
@@ -250,10 +250,10 @@ get_authenticated_samba_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ AuthSMBData *data = user_data;
+ PpNewPrinterDialog *self = PP_NEW_PRINTER_DIALOG (data->dialog);
PpDevicesList *result;
PpPrintDevice *device;
- AuthSMBData *data;
GtkWidget *widget;
gboolean cancelled = FALSE;
PpSamba *samba = (PpSamba *) source_object;
@@ -265,13 +265,9 @@ get_authenticated_samba_devices_cb (GObject *source_object,
result = pp_samba_get_devices_finish (samba, res, &error);
g_object_unref (source_object);
- data = (AuthSMBData *) user_data;
-
if (result != NULL)
{
- dialog = PP_NEW_PRINTER_DIALOG (data->dialog);
-
- dialog->samba_authenticated_searching = FALSE;
+ self->samba_authenticated_searching = FALSE;
for (iter = result->devices; iter; iter = iter->next)
{
@@ -288,19 +284,19 @@ get_authenticated_samba_devices_cb (GObject *source_object,
if (result->devices != NULL)
{
- add_devices_to_list (dialog, result->devices);
+ add_devices_to_list (self, result->devices);
device = (PpPrintDevice *) result->devices->data;
if (device != NULL)
{
widget = WID ("search-entry");
gtk_entry_set_text (GTK_ENTRY (widget), pp_print_device_get_device_location (device));
- search_entry_activated_cb (GTK_ENTRY (widget), dialog);
+ search_entry_activated_cb (GTK_ENTRY (widget), self);
}
}
}
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -308,12 +304,10 @@ get_authenticated_samba_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (data->dialog);
-
g_warning ("%s", error->message);
- dialog->samba_authenticated_searching = FALSE;
- update_dialog_state (dialog);
+ self->samba_authenticated_searching = FALSE;
+ update_dialog_state (self);
}
}
@@ -322,7 +316,7 @@ get_authenticated_samba_devices_cb (GObject *source_object,
}
static void
-go_to_page (PpNewPrinterDialog *dialog,
+go_to_page (PpNewPrinterDialog *self,
const gchar *page)
{
GtkStack *stack;
@@ -339,7 +333,7 @@ go_to_page (PpNewPrinterDialog *dialog,
static gchar *
get_entry_text (const gchar *object_name,
- PpNewPrinterDialog *dialog)
+ PpNewPrinterDialog *self)
{
return g_strdup (gtk_entry_get_text (GTK_ENTRY (WID (object_name))));
}
@@ -348,13 +342,13 @@ static void
on_authenticate (GtkWidget *button,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ PpNewPrinterDialog *self = user_data;
gchar *hostname = NULL;
gchar *username = NULL;
gchar *password = NULL;
- username = get_entry_text ("username-entry", dialog);
- password = get_entry_text ("password-entry", dialog);
+ username = get_entry_text ("username-entry", self);
+ password = get_entry_text ("password-entry", self);
if ((username == NULL) || (username[0] == '\0') ||
(password == NULL) || (password[0] == '\0'))
@@ -364,20 +358,20 @@ on_authenticate (GtkWidget *button,
return;
}
- pp_samba_set_auth_info (PP_SAMBA (dialog->samba_host), username, password);
+ pp_samba_set_auth_info (PP_SAMBA (self->samba_host), username, password);
gtk_header_bar_set_title (GTK_HEADER_BAR (WID ("headerbar")), _("Add Printer"));
- go_to_page (dialog, ADDPRINTER_PAGE);
+ go_to_page (self, ADDPRINTER_PAGE);
- g_object_get (PP_HOST (dialog->samba_host), "hostname", &hostname, NULL);
- remove_device_from_list (dialog, hostname);
+ g_object_get (PP_HOST (self->samba_host), "hostname", &hostname, NULL);
+ remove_device_from_list (self, hostname);
}
static void
on_authentication_required (PpHost *host,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ PpNewPrinterDialog *self = user_data;
gchar *text, *hostname;
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (WID ("headerbar")), NULL);
@@ -395,22 +389,22 @@ on_authentication_required (PpHost *host,
g_free (hostname);
g_free (text);
- go_to_page (dialog, AUTHENTICATION_PAGE);
+ go_to_page (self, AUTHENTICATION_PAGE);
- g_signal_connect (WID ("authenticate-button"), "clicked", G_CALLBACK (on_authenticate), dialog);
+ g_signal_connect (WID ("authenticate-button"), "clicked", G_CALLBACK (on_authenticate), self);
}
static void
auth_entries_changed (GtkEditable *editable,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ PpNewPrinterDialog *self = user_data;
gboolean can_authenticate = FALSE;
gchar *username = NULL;
gchar *password = NULL;
- username = get_entry_text ("username-entry", dialog);
- password = get_entry_text ("password-entry", dialog);
+ username = get_entry_text ("username-entry", self);
+ password = get_entry_text ("password-entry", self);
can_authenticate = (username != NULL && username[0] != '\0' &&
password != NULL && password[0] != '\0');
@@ -425,23 +419,23 @@ static void
on_go_back_button_clicked (GtkButton *button,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ PpNewPrinterDialog *self = user_data;
- pp_samba_set_auth_info (dialog->samba_host, NULL, NULL);
- g_clear_object (&dialog->samba_host);
+ pp_samba_set_auth_info (self->samba_host, NULL, NULL);
+ g_clear_object (&self->samba_host);
- go_to_page (dialog, ADDPRINTER_PAGE);
+ go_to_page (self, ADDPRINTER_PAGE);
gtk_header_bar_set_title (GTK_HEADER_BAR (WID ("headerbar")), _("Add Printer"));
gtk_widget_set_sensitive (WID ("new-printer-add-button"), FALSE);
- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (dialog->treeview));
+ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (self->treeview));
}
static void
authenticate_samba_server (GtkButton *button,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
AuthSMBData *data;
@@ -451,7 +445,7 @@ authenticate_samba_server (GtkButton *button,
gtk_widget_set_sensitive (WID ("authenticate-button"), FALSE);
gtk_widget_grab_focus (WID ("username-entry"));
- if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview), &model, &iter))
+ if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->treeview), &model, &iter))
{
gtk_tree_model_get (model, &iter,
DEVICE_NAME_COLUMN, &server_name,
@@ -459,24 +453,24 @@ authenticate_samba_server (GtkButton *button,
if (server_name != NULL)
{
- g_clear_object (&dialog->samba_host);
+ g_clear_object (&self->samba_host);
- dialog->samba_host = pp_samba_new (server_name);
- g_signal_connect_object (dialog->samba_host,
+ self->samba_host = pp_samba_new (server_name);
+ g_signal_connect_object (self->samba_host,
"authentication-required",
G_CALLBACK (on_authentication_required),
- dialog, 0);
+ self, 0);
- dialog->samba_authenticated_searching = TRUE;
- update_dialog_state (dialog);
+ self->samba_authenticated_searching = TRUE;
+ update_dialog_state (self);
data = g_new (AuthSMBData, 1);
data->server_name = server_name;
- data->dialog = dialog;
+ data->dialog = self;
- pp_samba_get_devices_async (dialog->samba_host,
+ pp_samba_get_devices_async (self->samba_host,
TRUE,
- dialog->cancellable,
+ self->cancellable,
get_authenticated_samba_devices_cb,
data);
}
@@ -488,7 +482,7 @@ stack_key_press_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
gtk_widget_grab_focus (WID ("search-entry"));
gtk_main_do_event (event);
@@ -497,7 +491,7 @@ stack_key_press_cb (GtkWidget *widget,
}
static void
-pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
+pp_new_printer_dialog_init (PpNewPrinterDialog *self)
{
GtkStyleContext *context;
GtkWidget *widget;
@@ -508,9 +502,9 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
NULL };
guint builder_result;
- dialog->builder = gtk_builder_new ();
+ self->builder = gtk_builder_new ();
- builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
+ builder_result = gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/printers/new-printer-dialog.ui",
objects, &error);
@@ -520,33 +514,33 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
}
/* GCancellable for cancelling of async operations */
- dialog->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
/* Construct dialog */
- dialog->dialog = WID ("dialog");
+ self->dialog = WID ("dialog");
- dialog->treeview = GTK_TREE_VIEW (WID ("devices-treeview"));
+ self->treeview = GTK_TREE_VIEW (WID ("devices-treeview"));
- dialog->store = GTK_LIST_STORE (gtk_builder_get_object (dialog->builder, "devices-liststore"));
+ self->store = GTK_LIST_STORE (gtk_builder_get_object (self->builder, "devices-liststore"));
- dialog->filter = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (dialog->builder, "devices-model-filter"));
+ self->filter = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (self->builder, "devices-model-filter"));
/* Connect signals */
- g_signal_connect (dialog->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), dialog);
+ g_signal_connect (self->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), self);
widget = WID ("search-entry");
- g_signal_connect (widget, "activate", G_CALLBACK (search_entry_activated_cb), dialog);
- g_signal_connect (widget, "search-changed", G_CALLBACK (search_entry_changed_cb), dialog);
+ g_signal_connect (widget, "activate", G_CALLBACK (search_entry_activated_cb), self);
+ g_signal_connect (widget, "search-changed", G_CALLBACK (search_entry_changed_cb), self);
widget = WID ("unlock-button");
- g_signal_connect (widget, "clicked", G_CALLBACK (authenticate_samba_server), dialog);
+ g_signal_connect (widget, "clicked", G_CALLBACK (authenticate_samba_server), self);
- g_signal_connect (WID ("stack"), "key-press-event", G_CALLBACK (stack_key_press_cb), dialog);
+ g_signal_connect (WID ("stack"), "key-press-event", G_CALLBACK (stack_key_press_cb), self);
/* Authentication form widgets */
- g_signal_connect (WID ("username-entry"), "changed", G_CALLBACK (auth_entries_changed), dialog);
- g_signal_connect (WID ("password-entry"), "changed", G_CALLBACK (auth_entries_changed), dialog);
- g_signal_connect (WID ("go-back-button"), "clicked", G_CALLBACK (on_go_back_button_clicked), dialog);
+ g_signal_connect (WID ("username-entry"), "changed", G_CALLBACK (auth_entries_changed), self);
+ g_signal_connect (WID ("password-entry"), "changed", G_CALLBACK (auth_entries_changed), self);
+ g_signal_connect (WID ("go-back-button"), "clicked", G_CALLBACK (on_go_back_button_clicked), self);
/* Set junctions */
widget = WID ("scrolledwindow1");
@@ -558,7 +552,7 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
/* Fill with data */
- populate_devices_list (dialog);
+ populate_devices_list (self);
}
static void
@@ -570,30 +564,30 @@ free_devices_list (GList *devices)
static void
pp_new_printer_dialog_finalize (GObject *object)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (object);
-
- g_cancellable_cancel (dialog->remote_host_cancellable);
- g_cancellable_cancel (dialog->cancellable);
-
- dialog->text_renderer = NULL;
- dialog->icon_renderer = NULL;
-
- g_clear_handle_id (&dialog->host_search_timeout_id, g_source_remove);
- g_clear_object (&dialog->remote_host_cancellable);
- g_clear_object (&dialog->cancellable);
- g_clear_pointer (&dialog->dialog, gtk_widget_destroy);
- g_clear_pointer (&dialog->list, ppd_list_free);
- g_clear_object (&dialog->builder);
- g_clear_pointer (&dialog->local_cups_devices, free_devices_list);
- g_clear_object (&dialog->local_printer_icon);
- g_clear_object (&dialog->remote_printer_icon);
- g_clear_object (&dialog->authenticated_server_icon);
-
- if (dialog->num_of_dests > 0)
+ PpNewPrinterDialog *self = PP_NEW_PRINTER_DIALOG (object);
+
+ g_cancellable_cancel (self->remote_host_cancellable);
+ g_cancellable_cancel (self->cancellable);
+
+ self->text_renderer = NULL;
+ self->icon_renderer = NULL;
+
+ g_clear_handle_id (&self->host_search_timeout_id, g_source_remove);
+ g_clear_object (&self->remote_host_cancellable);
+ g_clear_object (&self->cancellable);
+ g_clear_pointer (&self->dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->list, ppd_list_free);
+ g_clear_object (&self->builder);
+ g_clear_pointer (&self->local_cups_devices, free_devices_list);
+ g_clear_object (&self->local_printer_icon);
+ g_clear_object (&self->remote_printer_icon);
+ g_clear_object (&self->authenticated_server_icon);
+
+ if (self->num_of_dests > 0)
{
- cupsFreeDests (dialog->num_of_dests, dialog->dests);
- dialog->num_of_dests = 0;
- dialog->dests = NULL;
+ cupsFreeDests (self->num_of_dests, self->dests);
+ self->num_of_dests = 0;
+ self->dests = NULL;
}
G_OBJECT_CLASS (pp_new_printer_dialog_parent_class)->finalize (object);
@@ -603,7 +597,7 @@ static void
device_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ PpNewPrinterDialog *self = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
@@ -611,7 +605,7 @@ device_selection_changed_cb (GtkTreeSelection *selection,
gboolean authentication_needed;
gboolean selected;
- selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview),
+ selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->treeview),
&model,
&iter);
@@ -637,33 +631,33 @@ device_selection_changed_cb (GtkTreeSelection *selection,
}
static void
-remove_device_from_list (PpNewPrinterDialog *dialog,
+remove_device_from_list (PpNewPrinterDialog *self,
const gchar *device_name)
{
PpPrintDevice *device;
GtkTreeIter iter;
gboolean cont;
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
DEVICE_COLUMN, &device,
-1);
if (g_strcmp0 (pp_print_device_get_device_name (device), device_name) == 0)
{
- gtk_list_store_remove (dialog->store, &iter);
+ gtk_list_store_remove (self->store, &iter);
g_object_unref (device);
break;
}
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
}
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
static gboolean
@@ -687,7 +681,7 @@ prepend_original_name (GtkTreeModel *model,
}
static void
-add_device_to_list (PpNewPrinterDialog *dialog,
+add_device_to_list (PpNewPrinterDialog *self,
PpPrintDevice *device)
{
PpPrintDevice *store_device;
@@ -720,16 +714,16 @@ add_device_to_list (PpNewPrinterDialog *dialog,
"device-original-name", pp_print_device_get_device_name (device),
NULL);
- gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store),
+ gtk_tree_model_foreach (GTK_TREE_MODEL (self->store),
prepend_original_name,
&original_names_list);
original_names_list = g_list_reverse (original_names_list);
canonicalized_name = canonicalize_device_name (original_names_list,
- dialog->local_cups_devices,
- dialog->dests,
- dialog->num_of_dests,
+ self->local_cups_devices,
+ self->dests,
+ self->num_of_dests,
device);
g_list_free_full (original_names_list, g_free);
@@ -742,9 +736,9 @@ add_device_to_list (PpNewPrinterDialog *dialog,
g_free (canonicalized_name);
if (pp_print_device_get_acquisition_method (device) == ACQUISITION_METHOD_DEFAULT_CUPS_SERVER)
- dialog->local_cups_devices = g_list_append (dialog->local_cups_devices, g_object_ref (device));
+ self->local_cups_devices = g_list_append (self->local_cups_devices, g_object_ref (device));
else
- set_device (dialog, device, NULL);
+ set_device (self, device, NULL);
}
else if (pp_print_device_is_authenticated_server (device) &&
pp_print_device_get_host_name (device) != NULL)
@@ -755,7 +749,7 @@ add_device_to_list (PpNewPrinterDialog *dialog,
"is-authenticated-server", pp_print_device_is_authenticated_server (device),
NULL);
- set_device (dialog, store_device, NULL);
+ set_device (self, store_device, NULL);
g_object_unref (store_device);
}
@@ -763,14 +757,14 @@ add_device_to_list (PpNewPrinterDialog *dialog,
}
static void
-add_devices_to_list (PpNewPrinterDialog *dialog,
+add_devices_to_list (PpNewPrinterDialog *self,
GList *devices)
{
GList *iter;
for (iter = devices; iter; iter = iter->next)
{
- add_device_to_list (dialog, (PpPrintDevice *) iter->data);
+ add_device_to_list (self, (PpPrintDevice *) iter->data);
}
}
@@ -824,21 +818,21 @@ device_in_liststore (gchar *device_uri,
}
static void
-update_dialog_state (PpNewPrinterDialog *dialog)
+update_dialog_state (PpNewPrinterDialog *self)
{
GtkTreeIter iter;
GtkWidget *header;
GtkWidget *stack;
gboolean searching;
- searching = dialog->cups_searching ||
- dialog->remote_cups_host != NULL ||
- dialog->snmp_host != NULL ||
- dialog->socket_host != NULL ||
- dialog->lpd_host != NULL ||
- dialog->samba_host != NULL ||
- dialog->samba_authenticated_searching ||
- dialog->samba_searching;
+ searching = self->cups_searching ||
+ self->remote_cups_host != NULL ||
+ self->snmp_host != NULL ||
+ self->socket_host != NULL ||
+ self->lpd_host != NULL ||
+ self->samba_host != NULL ||
+ self->samba_authenticated_searching ||
+ self->samba_searching;
header = WID ("headerbar");
stack = WID ("stack");
@@ -852,7 +846,7 @@ update_dialog_state (PpNewPrinterDialog *dialog)
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), NULL);
}
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter))
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter))
gtk_stack_set_visible_child_name (GTK_STACK (stack), "standard-page");
else
gtk_stack_set_visible_child_name (GTK_STACK (stack), searching ? "loading-page" : "no-printers-page");
@@ -862,7 +856,7 @@ static void
group_physical_devices_cb (gchar ***device_uris,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
PpPrintDevice *device, *better_device;
GList *iter;
gint i, j;
@@ -877,7 +871,7 @@ group_physical_devices_cb (gchar ***device_uris,
device = NULL;
for (j = 0; device_uris[i][j] != NULL; j++)
{
- device = device_in_liststore (device_uris[i][j], dialog->store);
+ device = device_in_liststore (device_uris[i][j], self->store);
if (device != NULL)
break;
}
@@ -888,8 +882,8 @@ group_physical_devices_cb (gchar ***device_uris,
/* Is there better device in the sublist? */
if (j != 0)
{
- better_device = device_in_list (device_uris[i][0], dialog->local_cups_devices);
- replace_device (dialog, device, better_device);
+ better_device = device_in_list (device_uris[i][0], self->local_cups_devices);
+ replace_device (self, device, better_device);
g_object_unref (better_device);
}
@@ -897,10 +891,10 @@ group_physical_devices_cb (gchar ***device_uris,
}
else
{
- device = device_in_list (device_uris[i][0], dialog->local_cups_devices);
+ device = device_in_list (device_uris[i][0], self->local_cups_devices);
if (device != NULL)
{
- set_device (dialog, device, NULL);
+ set_device (self, device, NULL);
g_object_unref (device);
}
}
@@ -914,12 +908,12 @@ group_physical_devices_cb (gchar ***device_uris,
}
else
{
- for (iter = dialog->local_cups_devices; iter != NULL; iter = iter->next)
- set_device (dialog, (PpPrintDevice *) iter->data, NULL);
- g_clear_pointer (&dialog->local_cups_devices, free_devices_list);
+ for (iter = self->local_cups_devices; iter != NULL; iter = iter->next)
+ set_device (self, (PpPrintDevice *) iter->data, NULL);
+ g_clear_pointer (&self->local_cups_devices, free_devices_list);
}
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
static void
@@ -1002,7 +996,7 @@ get_cups_devices_cb (GList *devices,
gboolean cancelled,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
GDBusConnection *bus;
GVariantBuilder device_list;
GVariantBuilder device_hash;
@@ -1019,27 +1013,25 @@ get_cups_devices_cb (GList *devices,
if (!cancelled)
{
- dialog = (PpNewPrinterDialog *) user_data;
-
if (finished)
{
- dialog->cups_searching = FALSE;
+ self->cups_searching = FALSE;
}
if (devices)
{
- add_devices_to_list (dialog, devices);
+ add_devices_to_list (self, devices);
- length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (dialog->store), NULL) + g_list_length (dialog->local_cups_devices);
+ length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (self->store), NULL) + g_list_length (self->local_cups_devices);
if (length > 0)
{
all_devices = g_new0 (PpPrintDevice *, length);
i = 0;
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
DEVICE_COLUMN, &device,
-1);
@@ -1053,10 +1045,10 @@ get_cups_devices_cb (GList *devices,
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
}
- for (liter = dialog->local_cups_devices; liter != NULL; liter = liter->next)
+ for (liter = self->local_cups_devices; liter != NULL; liter = liter->next)
{
pp_device = (PpPrintDevice *) liter->data;
if (pp_device != NULL)
@@ -1120,9 +1112,9 @@ get_cups_devices_cb (GList *devices,
G_VARIANT_TYPE ("(aas)"),
G_DBUS_CALL_FLAGS_NONE,
-1,
- dialog->cancellable,
+ self->cancellable,
group_physical_devices_dbus_cb,
- dialog);
+ self);
}
else
{
@@ -1136,12 +1128,12 @@ get_cups_devices_cb (GList *devices,
}
else
{
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
else
{
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
@@ -1153,7 +1145,7 @@ get_snmp_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpHost *host = (PpHost *) source_object;
g_autoptr(GError) error = NULL;
PpDevicesList *result;
@@ -1163,14 +1155,12 @@ get_snmp_devices_cb (GObject *source_object,
if (result)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- if ((gpointer) source_object == (gpointer) dialog->snmp_host)
- dialog->snmp_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->snmp_host)
+ self->snmp_host = NULL;
- add_devices_to_list (dialog, result->devices);
+ add_devices_to_list (self, result->devices);
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1178,14 +1168,12 @@ get_snmp_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) dialog->snmp_host)
- dialog->snmp_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->snmp_host)
+ self->snmp_host = NULL;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
@@ -1195,7 +1183,7 @@ get_remote_cups_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpHost *host = (PpHost *) source_object;
g_autoptr(GError) error = NULL;
PpDevicesList *result;
@@ -1205,14 +1193,12 @@ get_remote_cups_devices_cb (GObject *source_object,
if (result)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- if ((gpointer) source_object == (gpointer) dialog->remote_cups_host)
- dialog->remote_cups_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->remote_cups_host)
+ self->remote_cups_host = NULL;
- add_devices_to_list (dialog, result->devices);
+ add_devices_to_list (self, result->devices);
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1220,14 +1206,12 @@ get_remote_cups_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) dialog->remote_cups_host)
- dialog->remote_cups_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->remote_cups_host)
+ self->remote_cups_host = NULL;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
@@ -1237,7 +1221,7 @@ get_samba_host_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpDevicesList *result;
PpSamba *samba = (PpSamba *) source_object;
g_autoptr(GError) error = NULL;
@@ -1247,14 +1231,12 @@ get_samba_host_devices_cb (GObject *source_object,
if (result)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ if ((gpointer) source_object == (gpointer) self->samba_host)
+ self->samba_host = NULL;
- if ((gpointer) source_object == (gpointer) dialog->samba_host)
- dialog->samba_host = NULL;
+ add_devices_to_list (self, result->devices);
- add_devices_to_list (dialog, result->devices);
-
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1262,14 +1244,12 @@ get_samba_host_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) dialog->samba_host)
- dialog->samba_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->samba_host)
+ self->samba_host = NULL;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
@@ -1279,7 +1259,7 @@ get_samba_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpDevicesList *result;
PpSamba *samba = (PpSamba *) source_object;
g_autoptr(GError) error = NULL;
@@ -1289,13 +1269,11 @@ get_samba_devices_cb (GObject *source_object,
if (result)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
+ self->samba_searching = FALSE;
- dialog->samba_searching = FALSE;
+ add_devices_to_list (self, result->devices);
- add_devices_to_list (dialog, result->devices);
-
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1303,13 +1281,11 @@ get_samba_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- dialog->samba_searching = FALSE;
+ self->samba_searching = FALSE;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
@@ -1319,7 +1295,7 @@ get_jetdirect_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpHost *host = (PpHost *) source_object;
g_autoptr(GError) error = NULL;
PpDevicesList *result;
@@ -1329,14 +1305,12 @@ get_jetdirect_devices_cb (GObject *source_object,
if (result != NULL)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- if ((gpointer) source_object == (gpointer) dialog->socket_host)
- dialog->socket_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->socket_host)
+ self->socket_host = NULL;
- add_devices_to_list (dialog, result->devices);
+ add_devices_to_list (self, result->devices);
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1344,14 +1318,12 @@ get_jetdirect_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) dialog->socket_host)
- dialog->socket_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->socket_host)
+ self->socket_host = NULL;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
@@ -1361,7 +1333,7 @@ get_lpd_devices_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpHost *host = (PpHost *) source_object;
g_autoptr(GError) error = NULL;
PpDevicesList *result;
@@ -1371,14 +1343,12 @@ get_lpd_devices_cb (GObject *source_object,
if (result != NULL)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- if ((gpointer) source_object == (gpointer) dialog->lpd_host)
- dialog->lpd_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->lpd_host)
+ self->lpd_host = NULL;
- add_devices_to_list (dialog, result->devices);
+ add_devices_to_list (self, result->devices);
- update_dialog_state (dialog);
+ update_dialog_state (self);
pp_devices_list_free (result);
}
@@ -1386,27 +1356,25 @@ get_lpd_devices_cb (GObject *source_object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) dialog->lpd_host)
- dialog->lpd_host = NULL;
+ if ((gpointer) source_object == (gpointer) self->lpd_host)
+ self->lpd_host = NULL;
- update_dialog_state (dialog);
+ update_dialog_state (self);
}
}
}
static void
-get_cups_devices (PpNewPrinterDialog *dialog)
+get_cups_devices (PpNewPrinterDialog *self)
{
- dialog->cups_searching = TRUE;
- update_dialog_state (dialog);
+ self->cups_searching = TRUE;
+ update_dialog_state (self);
- get_cups_devices_async (dialog->cancellable,
+ get_cups_devices_async (self->cancellable,
get_cups_devices_cb,
- dialog);
+ self);
}
static gboolean
@@ -1480,73 +1448,73 @@ search_for_remote_printers_free (THostSearchData *data)
static gboolean
search_for_remote_printers (THostSearchData *data)
{
- PpNewPrinterDialog *dialog = data->dialog;
+ PpNewPrinterDialog *self = data->dialog;
- g_cancellable_cancel (dialog->remote_host_cancellable);
- g_clear_object (&dialog->remote_host_cancellable);
+ g_cancellable_cancel (self->remote_host_cancellable);
+ g_clear_object (&self->remote_host_cancellable);
- dialog->remote_host_cancellable = g_cancellable_new ();
+ self->remote_host_cancellable = g_cancellable_new ();
- dialog->remote_cups_host = pp_host_new (data->host_name);
- dialog->snmp_host = pp_host_new (data->host_name);
- dialog->socket_host = pp_host_new (data->host_name);
- dialog->lpd_host = pp_host_new (data->host_name);
+ self->remote_cups_host = pp_host_new (data->host_name);
+ self->snmp_host = pp_host_new (data->host_name);
+ self->socket_host = pp_host_new (data->host_name);
+ self->lpd_host = pp_host_new (data->host_name);
if (data->host_port != PP_HOST_UNSET_PORT)
{
- g_object_set (dialog->remote_cups_host, "port", data->host_port, NULL);
- g_object_set (dialog->snmp_host, "port", data->host_port, NULL);
+ g_object_set (self->remote_cups_host, "port", data->host_port, NULL);
+ g_object_set (self->snmp_host, "port", data->host_port, NULL);
/* Accept port different from the default one only if user specifies
* scheme (for socket and lpd printers).
*/
if (data->host_scheme != NULL &&
g_ascii_strcasecmp (data->host_scheme, "socket") == 0)
- g_object_set (dialog->socket_host, "port", data->host_port, NULL);
+ g_object_set (self->socket_host, "port", data->host_port, NULL);
if (data->host_scheme != NULL &&
g_ascii_strcasecmp (data->host_scheme, "lpd") == 0)
- g_object_set (dialog->lpd_host, "port", data->host_port, NULL);
+ g_object_set (self->lpd_host, "port", data->host_port, NULL);
}
- dialog->samba_host = pp_samba_new (data->host_name);
+ self->samba_host = pp_samba_new (data->host_name);
update_dialog_state (data->dialog);
- pp_host_get_remote_cups_devices_async (dialog->remote_cups_host,
- dialog->remote_host_cancellable,
+ pp_host_get_remote_cups_devices_async (self->remote_cups_host,
+ self->remote_host_cancellable,
get_remote_cups_devices_cb,
data->dialog);
- pp_host_get_snmp_devices_async (dialog->snmp_host,
- dialog->remote_host_cancellable,
+ pp_host_get_snmp_devices_async (self->snmp_host,
+ self->remote_host_cancellable,
get_snmp_devices_cb,
data->dialog);
- pp_host_get_jetdirect_devices_async (dialog->socket_host,
- dialog->remote_host_cancellable,
+ pp_host_get_jetdirect_devices_async (self->socket_host,
+ self->remote_host_cancellable,
get_jetdirect_devices_cb,
data->dialog);
- pp_host_get_lpd_devices_async (dialog->lpd_host,
- dialog->remote_host_cancellable,
+ pp_host_get_lpd_devices_async (self->lpd_host,
+ self->remote_host_cancellable,
get_lpd_devices_cb,
data->dialog);
- pp_samba_get_devices_async (dialog->samba_host,
+ pp_samba_get_devices_async (self->samba_host,
TRUE,
- dialog->remote_host_cancellable,
+ self->remote_host_cancellable,
get_samba_host_devices_cb,
data->dialog);
- dialog->host_search_timeout_id = 0;
+ self->host_search_timeout_id = 0;
return G_SOURCE_REMOVE;
}
static void
search_address (const gchar *text,
- PpNewPrinterDialog *dialog,
+ PpNewPrinterDialog *self,
gboolean delay_search)
{
PpPrintDevice *device;
@@ -1571,10 +1539,10 @@ search_address (const gchar *text,
{
words_length = g_strv_length (words);
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
DEVICE_COLUMN, &device,
-1);
@@ -1595,7 +1563,7 @@ search_address (const gchar *text,
if (subfound)
found = TRUE;
- gtk_list_store_set (GTK_LIST_STORE (dialog->store), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (self->store), &iter,
DEVICE_VISIBLE_COLUMN, subfound,
-1);
@@ -1603,7 +1571,7 @@ search_address (const gchar *text,
g_free (lowercase_name);
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
}
g_strfreev (words);
@@ -1615,15 +1583,15 @@ search_address (const gchar *text,
*/
if (!found && words_length == 1)
{
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
while (cont)
{
next_set = FALSE;
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
DEVICE_COLUMN, &device,
-1);
- gtk_list_store_set (GTK_LIST_STORE (dialog->store), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (self->store), &iter,
DEVICE_VISIBLE_COLUMN, TRUE,
-1);
@@ -1635,14 +1603,14 @@ search_address (const gchar *text,
acquisition_method == ACQUISITION_METHOD_LPD ||
acquisition_method == ACQUISITION_METHOD_SAMBA_HOST)
{
- if (!gtk_list_store_remove (dialog->store, &iter))
+ if (!gtk_list_store_remove (self->store, &iter))
break;
else
next_set = TRUE;
}
if (!next_set)
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
}
if (text && text[0] != '\0')
@@ -1661,17 +1629,17 @@ search_address (const gchar *text,
search_data->host_scheme = scheme;
search_data->host_name = host;
search_data->host_port = port;
- search_data->dialog = dialog;
+ search_data->dialog = self;
- if (dialog->host_search_timeout_id != 0)
+ if (self->host_search_timeout_id != 0)
{
- g_source_remove (dialog->host_search_timeout_id);
- dialog->host_search_timeout_id = 0;
+ g_source_remove (self->host_search_timeout_id);
+ self->host_search_timeout_id = 0;
}
if (delay_search)
{
- dialog->host_search_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
+ self->host_search_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
HOST_SEARCH_DELAY,
(GSourceFunc) search_for_remote_printers,
search_data,
@@ -1742,7 +1710,7 @@ get_local_scheme_description_from_uri (gchar *device_uri)
}
static void
-set_device (PpNewPrinterDialog *dialog,
+set_device (PpNewPrinterDialog *self,
PpPrintDevice *device,
GtkTreeIter *iter)
{
@@ -1780,10 +1748,10 @@ set_device (PpNewPrinterDialog *dialog,
}
if (iter == NULL)
- gtk_list_store_append (dialog->store, &titer);
+ gtk_list_store_append (self->store, &titer);
- gtk_list_store_set (dialog->store, iter == NULL ? &titer : iter,
- DEVICE_GICON_COLUMN, pp_print_device_is_network_device (device) ? dialog->remote_printer_icon : dialog->local_printer_icon,
+ gtk_list_store_set (self->store, iter == NULL ? &titer : iter,
+ DEVICE_GICON_COLUMN, pp_print_device_is_network_device (device) ? self->remote_printer_icon : self->local_printer_icon,
DEVICE_NAME_COLUMN, pp_print_device_get_device_name (device),
DEVICE_DISPLAY_NAME_COLUMN, pp_print_device_get_display_name (device),
DEVICE_DESCRIPTION_COLUMN, description,
@@ -1797,10 +1765,10 @@ set_device (PpNewPrinterDialog *dialog,
pp_print_device_get_host_name (device) != NULL)
{
if (iter == NULL)
- gtk_list_store_append (dialog->store, &titer);
+ gtk_list_store_append (self->store, &titer);
- gtk_list_store_set (dialog->store, iter == NULL ? &titer : iter,
- DEVICE_GICON_COLUMN, dialog->authenticated_server_icon,
+ gtk_list_store_set (self->store, iter == NULL ? &titer : iter,
+ DEVICE_GICON_COLUMN, self->authenticated_server_icon,
DEVICE_NAME_COLUMN, pp_print_device_get_host_name (device),
DEVICE_DISPLAY_NAME_COLUMN, pp_print_device_get_host_name (device),
/* Translators: This item is a server which needs authentication to show its printers */
@@ -1814,7 +1782,7 @@ set_device (PpNewPrinterDialog *dialog,
}
static void
-replace_device (PpNewPrinterDialog *dialog,
+replace_device (PpNewPrinterDialog *self,
PpPrintDevice *old_device,
PpPrintDevice *new_device)
{
@@ -1824,23 +1792,23 @@ replace_device (PpNewPrinterDialog *dialog,
if (old_device != NULL && new_device != NULL)
{
- cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
while (cont)
{
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
DEVICE_COLUMN, &device,
-1);
if (old_device == device)
{
- set_device (dialog, new_device, &iter);
+ set_device (self, new_device, &iter);
g_object_unref (device);
break;
}
g_object_unref (device);
- cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter);
+ cont = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
}
}
}
@@ -1850,7 +1818,7 @@ cups_get_dests_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
PpCupsDests *dests;
PpCups *cups = (PpCups *) source_object;
g_autoptr(GError) error = NULL;
@@ -1860,22 +1828,18 @@ cups_get_dests_cb (GObject *source_object,
if (dests)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- dialog->dests = dests->dests;
- dialog->num_of_dests = dests->num_of_dests;
+ self->dests = dests->dests;
+ self->num_of_dests = dests->num_of_dests;
- get_cups_devices (dialog);
+ get_cups_devices (self);
}
else
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
- get_cups_devices (dialog);
+ get_cups_devices (self);
}
}
}
@@ -1886,14 +1850,14 @@ row_activated_cb (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
gboolean authentication_needed;
gboolean selected;
- selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview),
+ selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->treeview),
&model,
&iter);
@@ -1904,11 +1868,11 @@ row_activated_cb (GtkTreeView *tree_view,
if (authentication_needed)
{
widget = WID ("unlock-button");
- authenticate_samba_server (GTK_BUTTON (widget), dialog);
+ authenticate_samba_server (GTK_BUTTON (widget), self);
}
else
{
- gtk_dialog_response (GTK_DIALOG (dialog->dialog), GTK_RESPONSE_OK);
+ gtk_dialog_response (GTK_DIALOG (self->dialog), GTK_RESPONSE_OK);
}
}
}
@@ -1920,13 +1884,13 @@ cell_data_func (GtkTreeViewColumn *tree_column,
GtkTreeIter *iter,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
gboolean selected = FALSE;
gchar *name = NULL;
gchar *description = NULL;
gchar *text;
- selected = gtk_tree_selection_iter_is_selected (gtk_tree_view_get_selection (dialog->treeview), iter);
+ selected = gtk_tree_selection_iter_is_selected (gtk_tree_view_get_selection (self->treeview), iter);
gtk_tree_model_get (tree_model, iter,
DEVICE_DISPLAY_NAME_COLUMN, &name,
@@ -1964,7 +1928,7 @@ cell_data_func (GtkTreeViewColumn *tree_column,
}
static void
-populate_devices_list (PpNewPrinterDialog *dialog)
+populate_devices_list (PpNewPrinterDialog *self)
{
GtkTreeViewColumn *column;
PpSamba *samba;
@@ -1972,53 +1936,53 @@ populate_devices_list (PpNewPrinterDialog *dialog)
PpCups *cups;
GIcon *icon, *emblem_icon;
- g_signal_connect (gtk_tree_view_get_selection (dialog->treeview),
- "changed", G_CALLBACK (device_selection_changed_cb), dialog);
+ g_signal_connect (gtk_tree_view_get_selection (self->treeview),
+ "changed", G_CALLBACK (device_selection_changed_cb), self);
- g_signal_connect (dialog->treeview,
- "row-activated", G_CALLBACK (row_activated_cb), dialog);
+ g_signal_connect (self->treeview,
+ "row-activated", G_CALLBACK (row_activated_cb), self);
- dialog->local_printer_icon = g_themed_icon_new ("printer");
- dialog->remote_printer_icon = g_themed_icon_new ("printer-network");
+ self->local_printer_icon = g_themed_icon_new ("printer");
+ self->remote_printer_icon = g_themed_icon_new ("printer-network");
icon = g_themed_icon_new ("network-server");
emblem_icon = g_themed_icon_new ("changes-prevent");
emblem = g_emblem_new (emblem_icon);
- dialog->authenticated_server_icon = g_emblemed_icon_new (icon, emblem);
+ self->authenticated_server_icon = g_emblemed_icon_new (icon, emblem);
g_object_unref (icon);
g_object_unref (emblem_icon);
g_object_unref (emblem);
- dialog->icon_renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (dialog->icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
- gtk_cell_renderer_set_alignment (dialog->icon_renderer, 1.0, 0.5);
- gtk_cell_renderer_set_padding (dialog->icon_renderer, 4, 4);
- column = gtk_tree_view_column_new_with_attributes ("Icon", dialog->icon_renderer,
+ self->icon_renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (self->icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
+ gtk_cell_renderer_set_alignment (self->icon_renderer, 1.0, 0.5);
+ gtk_cell_renderer_set_padding (self->icon_renderer, 4, 4);
+ column = gtk_tree_view_column_new_with_attributes ("Icon", self->icon_renderer,
"gicon", DEVICE_GICON_COLUMN, NULL);
gtk_tree_view_column_set_max_width (column, -1);
gtk_tree_view_column_set_min_width (column, 80);
- gtk_tree_view_append_column (dialog->treeview, column);
+ gtk_tree_view_append_column (self->treeview, column);
- dialog->text_renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Devices", dialog->text_renderer,
+ self->text_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Devices", self->text_renderer,
NULL);
- gtk_tree_view_column_set_cell_data_func (column, dialog->text_renderer, cell_data_func,
- dialog, NULL);
- gtk_tree_view_append_column (dialog->treeview, column);
+ gtk_tree_view_column_set_cell_data_func (column, self->text_renderer, cell_data_func,
+ self, NULL);
+ gtk_tree_view_append_column (self->treeview, column);
- gtk_tree_model_filter_set_visible_column (dialog->filter, DEVICE_VISIBLE_COLUMN);
+ gtk_tree_model_filter_set_visible_column (self->filter, DEVICE_VISIBLE_COLUMN);
cups = pp_cups_new ();
- pp_cups_get_dests_async (cups, dialog->cancellable, cups_get_dests_cb, dialog);
+ pp_cups_get_dests_async (cups, self->cancellable, cups_get_dests_cb, self);
- dialog->samba_searching = TRUE;
- update_dialog_state (dialog);
+ self->samba_searching = TRUE;
+ update_dialog_state (self);
samba = pp_samba_new (NULL);
- pp_samba_get_devices_async (samba, FALSE, dialog->cancellable, get_samba_devices_cb, dialog);
+ pp_samba_get_devices_async (samba, FALSE, self->cancellable, get_samba_devices_cb, self);
}
static void
@@ -2026,7 +1990,7 @@ printer_add_async_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinterDialog *dialog;
+ PpNewPrinterDialog *self = user_data;
GtkResponseType response_id = GTK_RESPONSE_OK;
PpNewPrinter *new_printer = (PpNewPrinter *) source_object;
gboolean success;
@@ -2037,21 +2001,17 @@ printer_add_async_cb (GObject *source_object,
if (success)
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
- emit_response (dialog, response_id);
+ emit_response (self, response_id);
}
else
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- dialog = PP_NEW_PRINTER_DIALOG (user_data);
-
g_warning ("%s", error->message);
response_id = GTK_RESPONSE_REJECT;
- emit_response (dialog, response_id);
+ emit_response (self, response_id);
}
}
}
@@ -2061,7 +2021,7 @@ ppd_selection_cb (GtkDialog *_dialog,
gint response_id,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
PpNewPrinter *new_printer;
GList *original_names_list = NULL;
gchar *ppd_name;
@@ -2070,40 +2030,40 @@ ppd_selection_cb (GtkDialog *_dialog,
guint window_id = 0;
gint acquisition_method;
- ppd_name = pp_ppd_selection_dialog_get_ppd_name (dialog->ppd_selection_dialog);
- ppd_display_name = pp_ppd_selection_dialog_get_ppd_display_name (dialog->ppd_selection_dialog);
- pp_ppd_selection_dialog_free (dialog->ppd_selection_dialog);
- dialog->ppd_selection_dialog = NULL;
+ ppd_name = pp_ppd_selection_dialog_get_ppd_name (self->ppd_selection_dialog);
+ ppd_display_name = pp_ppd_selection_dialog_get_ppd_display_name (self->ppd_selection_dialog);
+ pp_ppd_selection_dialog_free (self->ppd_selection_dialog);
+ self->ppd_selection_dialog = NULL;
if (ppd_name)
{
- g_object_set (dialog->new_device, "device-ppd", ppd_name, NULL);
+ g_object_set (self->new_device, "device-ppd", ppd_name, NULL);
- acquisition_method = pp_print_device_get_acquisition_method (dialog->new_device);
+ acquisition_method = pp_print_device_get_acquisition_method (self->new_device);
if ((acquisition_method == ACQUISITION_METHOD_JETDIRECT ||
acquisition_method == ACQUISITION_METHOD_LPD) &&
ppd_display_name != NULL)
{
- g_object_set (dialog->new_device,
+ g_object_set (self->new_device,
"device-name", ppd_display_name,
"device-original-name", ppd_display_name,
NULL);
- gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store),
+ gtk_tree_model_foreach (GTK_TREE_MODEL (self->store),
prepend_original_name,
&original_names_list);
original_names_list = g_list_reverse (original_names_list);
printer_name = canonicalize_device_name (original_names_list,
- dialog->local_cups_devices,
- dialog->dests,
- dialog->num_of_dests,
- dialog->new_device);
+ self->local_cups_devices,
+ self->dests,
+ self->num_of_dests,
+ self->new_device);
g_list_free_full (original_names_list, g_free);
- g_object_set (dialog->new_device,
+ g_object_set (self->new_device,
"device-name", printer_name,
"device-original-name", printer_name,
NULL);
@@ -2111,60 +2071,60 @@ ppd_selection_cb (GtkDialog *_dialog,
g_free (printer_name);
}
- emit_pre_response (dialog,
- pp_print_device_get_device_name (dialog->new_device),
- pp_print_device_get_device_location (dialog->new_device),
- pp_print_device_get_device_make_and_model (dialog->new_device),
- pp_print_device_is_network_device (dialog->new_device));
+ emit_pre_response (self,
+ pp_print_device_get_device_name (self->new_device),
+ pp_print_device_get_device_location (self->new_device),
+ pp_print_device_get_device_make_and_model (self->new_device),
+ pp_print_device_is_network_device (self->new_device));
- window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (dialog->dialog)))));
+ window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (self->dialog)))));
new_printer = pp_new_printer_new ();
g_object_set (new_printer,
- "name", pp_print_device_get_device_name (dialog->new_device),
- "original-name", pp_print_device_get_device_original_name (dialog->new_device),
- "device-uri", pp_print_device_get_device_uri (dialog->new_device),
- "device-id", pp_print_device_get_device_id (dialog->new_device),
- "ppd-name", pp_print_device_get_device_ppd (dialog->new_device),
- "ppd-file-name", pp_print_device_get_device_ppd (dialog->new_device),
- "info", pp_print_device_get_device_info (dialog->new_device),
- "location", pp_print_device_get_device_location (dialog->new_device),
- "make-and-model", pp_print_device_get_device_make_and_model (dialog->new_device),
- "host-name", pp_print_device_get_host_name (dialog->new_device),
- "host-port", pp_print_device_get_host_port (dialog->new_device),
- "is-network-device", pp_print_device_is_network_device (dialog->new_device),
+ "name", pp_print_device_get_device_name (self->new_device),
+ "original-name", pp_print_device_get_device_original_name (self->new_device),
+ "device-uri", pp_print_device_get_device_uri (self->new_device),
+ "device-id", pp_print_device_get_device_id (self->new_device),
+ "ppd-name", pp_print_device_get_device_ppd (self->new_device),
+ "ppd-file-name", pp_print_device_get_device_ppd (self->new_device),
+ "info", pp_print_device_get_device_info (self->new_device),
+ "location", pp_print_device_get_device_location (self->new_device),
+ "make-and-model", pp_print_device_get_device_make_and_model (self->new_device),
+ "host-name", pp_print_device_get_host_name (self->new_device),
+ "host-port", pp_print_device_get_host_port (self->new_device),
+ "is-network-device", pp_print_device_is_network_device (self->new_device),
"window-id", window_id,
NULL);
- dialog->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
pp_new_printer_add_async (new_printer,
- dialog->cancellable,
+ self->cancellable,
printer_add_async_cb,
- dialog);
+ self);
- g_clear_object (&dialog->new_device);
+ g_clear_object (&self->new_device);
}
}
static void
-new_printer_dialog_response_cb (GtkDialog *_dialog,
+new_printer_dialog_response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
- PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
+ PpNewPrinterDialog *self = user_data;
PpPrintDevice *device = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
gint acquisition_method;
- gtk_widget_hide (GTK_WIDGET (_dialog));
+ gtk_widget_hide (GTK_WIDGET (dialog));
if (response_id == GTK_RESPONSE_OK)
{
- g_cancellable_cancel (dialog->cancellable);
- g_clear_object (&dialog->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
- if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview), &model, &iter))
+ if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->treeview), &model, &iter))
{
gtk_tree_model_get (model, &iter,
DEVICE_COLUMN, &device,
@@ -2182,23 +2142,23 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
acquisition_method == ACQUISITION_METHOD_JETDIRECT ||
acquisition_method == ACQUISITION_METHOD_LPD)
{
- dialog->new_device = pp_print_device_copy (device);
- dialog->ppd_selection_dialog =
- pp_ppd_selection_dialog_new (dialog->parent,
- dialog->list,
+ self->new_device = pp_print_device_copy (device);
+ self->ppd_selection_dialog =
+ pp_ppd_selection_dialog_new (self->parent,
+ self->list,
NULL,
ppd_selection_cb,
- dialog);
+ self);
}
else
{
- emit_pre_response (dialog,
+ emit_pre_response (self,
pp_print_device_get_device_name (device),
pp_print_device_get_device_location (device),
pp_print_device_get_device_make_and_model (device),
pp_print_device_is_network_device (device));
- window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (_dialog)))));
+ window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (dialog)))));
new_printer = pp_new_printer_new ();
g_object_set (new_printer,
@@ -2217,12 +2177,12 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
"window-id", window_id,
NULL);
- dialog->cancellable = g_cancellable_new ();
+ self->cancellable = g_cancellable_new ();
pp_new_printer_add_async (new_printer,
- dialog->cancellable,
+ self->cancellable,
printer_add_async_cb,
- dialog);
+ self);
}
g_object_unref (device);
@@ -2230,6 +2190,6 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
}
else
{
- emit_response (dialog, GTK_RESPONSE_CANCEL);
+ emit_response (self, GTK_RESPONSE_CANCEL);
}
}
diff --git a/panels/printers/pp-new-printer.c b/panels/printers/pp-new-printer.c
index 76d0ae35d..3045a0ee4 100644
--- a/panels/printers/pp-new-printer.c
+++ b/panels/printers/pp-new-printer.c
@@ -114,9 +114,7 @@ pp_new_printer_get_property (GObject *object,
GValue *value,
GParamSpec *param_spec)
{
- PpNewPrinter *self;
-
- self = PP_NEW_PRINTER (object);
+ PpNewPrinter *self = PP_NEW_PRINTER (object);
switch (prop_id)
{
@@ -337,7 +335,7 @@ pp_new_printer_class_init (PpNewPrinterClass *klass)
}
static void
-pp_new_printer_init (PpNewPrinter *printer)
+pp_new_printer_init (PpNewPrinter *self)
{
}
@@ -347,29 +345,29 @@ pp_new_printer_new ()
return g_object_new (PP_TYPE_NEW_PRINTER, NULL);
}
-static void printer_configure_async (PpNewPrinter *new_printer);
+static void printer_configure_async (PpNewPrinter *self);
static void
_pp_new_printer_add_async_cb (gboolean success,
- PpNewPrinter *printer)
+ PpNewPrinter *self)
{
if (!success)
{
- g_task_return_new_error (printer->task,
+ g_task_return_new_error (self->task,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"Installation of the new printer failed.");
return;
}
- g_task_return_boolean (printer->task, success);
+ g_task_return_boolean (self->task, success);
}
static void
printer_add_real_async_cb (cups_dest_t *destination,
gpointer user_data)
{
- PpNewPrinter *printer = (PpNewPrinter *) user_data;
+ PpNewPrinter *self = user_data;
gboolean success = FALSE;
if (destination)
@@ -380,11 +378,11 @@ printer_add_real_async_cb (cups_dest_t *destination,
if (success)
{
- printer_configure_async (printer);
+ printer_configure_async (self);
}
else
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
@@ -393,7 +391,7 @@ printer_add_real_async_dbus_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinter *printer = (PpNewPrinter *) user_data;
+ PpNewPrinter *self = user_data;
GVariant *output;
g_autoptr(GError) error = NULL;
@@ -409,7 +407,7 @@ printer_add_real_async_dbus_cb (GObject *source_object,
g_variant_get (output, "(&s)", &ret_error);
if (ret_error[0] != '\0')
{
- g_warning ("cups-pk-helper: addition of printer %s failed: %s", printer->name, ret_error);
+ g_warning ("cups-pk-helper: addition of printer %s failed: %s", self->name, ret_error);
}
g_variant_unref (output);
@@ -422,21 +420,21 @@ printer_add_real_async_dbus_cb (GObject *source_object,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- get_named_dest_async (printer->name,
+ get_named_dest_async (self->name,
printer_add_real_async_cb,
- printer);
+ self);
}
}
static void
-printer_add_real_async (PpNewPrinter *printer)
+printer_add_real_async (PpNewPrinter *self)
{
GDBusConnection *bus;
g_autoptr(GError) error = NULL;
- if (!printer->ppd_name && !printer->ppd_file_name)
+ if (!self->ppd_name && !self->ppd_file_name)
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
return;
}
@@ -444,7 +442,7 @@ printer_add_real_async (PpNewPrinter *printer)
if (!bus)
{
g_warning ("Failed to get system bus: %s", error->message);
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
return;
}
@@ -452,19 +450,19 @@ printer_add_real_async (PpNewPrinter *printer)
MECHANISM_BUS,
"/",
MECHANISM_BUS,
- printer->ppd_name ? "PrinterAdd" : "PrinterAddWithPpdFile",
+ self->ppd_name ? "PrinterAdd" : "PrinterAddWithPpdFile",
g_variant_new ("(sssss)",
- printer->name,
- printer->device_uri,
- printer->ppd_name ? printer->ppd_name : printer->ppd_file_name,
- printer->info ? printer->info : "",
- printer->location ? printer->location : ""),
+ self->name,
+ self->device_uri,
+ self->ppd_name ? self->ppd_name : self->ppd_file_name,
+ self->info ? self->info : "",
+ self->location ? self->location : ""),
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT,
NULL,
printer_add_real_async_dbus_cb,
- printer);
+ self);
}
static PPDName *
@@ -532,7 +530,7 @@ printer_add_async_scb3 (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinter *printer = (PpNewPrinter *) user_data;
+ PpNewPrinter *self = user_data;
GVariant *output;
PPDName *ppd_item = NULL;
g_autoptr(GError) error = NULL;
@@ -556,12 +554,12 @@ printer_add_async_scb3 (GObject *source_object,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
ppd_item && ppd_item->ppd_name)
{
- printer->ppd_name = g_strdup (ppd_item->ppd_name);
- printer_add_real_async (printer);
+ self->ppd_name = g_strdup (ppd_item->ppd_name);
+ printer_add_real_async (self);
}
else
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
if (ppd_item)
@@ -576,7 +574,7 @@ install_printer_drivers_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinter *printer;
+ PpNewPrinter *self = user_data;
GVariant *output;
g_autoptr(GError) error = NULL;
@@ -600,8 +598,6 @@ install_printer_drivers_cb (GObject *source_object,
GDBusConnection *bus;
g_autoptr(GError) bus_error = NULL;
- printer = (PpNewPrinter *) user_data;
-
/* Try whether CUPS has a driver for the new printer */
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &bus_error);
if (bus)
@@ -612,20 +608,20 @@ install_printer_drivers_cb (GObject *source_object,
SCP_IFACE,
"GetBestDrivers",
g_variant_new ("(sss)",
- printer->device_id,
- printer->make_and_model ? printer->make_and_model : "",
- printer->device_uri ? printer->device_uri : ""),
+ self->device_id,
+ self->make_and_model ? self->make_and_model : "",
+ self->device_uri ? self->device_uri : ""),
G_VARIANT_TYPE ("(a(ss))"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT_LONG,
- printer->cancellable,
+ self->cancellable,
printer_add_async_scb3,
- printer);
+ self);
}
else
{
g_warning ("Failed to get system bus: %s", bus_error->message);
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
}
@@ -635,7 +631,7 @@ printer_add_async_scb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpNewPrinter *printer = (PpNewPrinter *) user_data;
+ PpNewPrinter *self = user_data;
GDBusConnection *bus;
GVariantBuilder array_builder;
GVariant *output;
@@ -671,7 +667,7 @@ printer_add_async_scb (GObject *source_object,
if (bus)
{
g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("as"));
- g_variant_builder_add (&array_builder, "s", printer->device_id);
+ g_variant_builder_add (&array_builder, "s", self->device_id);
g_dbus_connection_call (bus,
PACKAGE_KIT_BUS,
@@ -679,7 +675,7 @@ printer_add_async_scb (GObject *source_object,
PACKAGE_KIT_MODIFY_IFACE,
"InstallPrinterDrivers",
g_variant_new ("(uass)",
- printer->window_id,
+ self->window_id,
&array_builder,
"hide-finished"),
G_VARIANT_TYPE ("()"),
@@ -687,22 +683,22 @@ printer_add_async_scb (GObject *source_object,
DBUS_TIMEOUT_LONG,
NULL,
install_printer_drivers_cb,
- printer);
+ self);
}
else
{
g_warning ("Failed to get session bus: %s", bus_error->message);
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
else if (ppd_item && ppd_item->ppd_name)
{
- printer->ppd_name = g_strdup (ppd_item->ppd_name);
- printer_add_real_async (printer);
+ self->ppd_name = g_strdup (ppd_item->ppd_name);
+ printer_add_real_async (self);
}
else
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
@@ -717,17 +713,17 @@ static void
printer_add_async_scb4 (const gchar *ppd_filename,
gpointer user_data)
{
- PpNewPrinter *printer = (PpNewPrinter *) user_data;
+ PpNewPrinter *self = user_data;
- printer->ppd_file_name = g_strdup (ppd_filename);
- if (printer->ppd_file_name)
+ self->ppd_file_name = g_strdup (ppd_filename);
+ if (self->ppd_file_name)
{
- printer->unlink_ppd_file = TRUE;
- printer_add_real_async (printer);
+ self->unlink_ppd_file = TRUE;
+ printer_add_real_async (self);
}
else
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
@@ -767,11 +763,11 @@ typedef struct
static void
printer_configure_async_finish (PCData *data)
{
- PpNewPrinter *printer = data->new_printer;
+ PpNewPrinter *self = data->new_printer;
if (data->set_accept_jobs_finished &&
data->set_enabled_finished &&
- (data->autoconfigure_finished || printer->is_network_device) &&
+ (data->autoconfigure_finished || self->is_network_device) &&
data->set_media_size_finished &&
data->install_missing_executables_finished)
{
@@ -1180,7 +1176,7 @@ pp_maintenance_command_execute_cb (GObject *source_object,
}
static void
-printer_configure_async (PpNewPrinter *new_printer)
+printer_configure_async (PpNewPrinter *self)
{
GDBusConnection *bus;
PCData *data;
@@ -1189,7 +1185,7 @@ printer_configure_async (PpNewPrinter *new_printer)
g_autoptr(GError) error = NULL;
data = g_new0 (PCData, 1);
- data->new_printer = new_printer;
+ data->new_printer = self;
data->set_accept_jobs_finished = FALSE;
data->set_enabled_finished = FALSE;
data->autoconfigure_finished = FALSE;
@@ -1197,7 +1193,7 @@ printer_configure_async (PpNewPrinter *new_printer)
data->install_missing_executables_finished = FALSE;
/* Enable printer and make it accept jobs */
- if (new_printer->name)
+ if (self->name)
{
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (bus)
@@ -1208,7 +1204,7 @@ printer_configure_async (PpNewPrinter *new_printer)
MECHANISM_BUS,
"PrinterSetAcceptJobs",
g_variant_new ("(sbs)",
- new_printer->name,
+ self->name,
TRUE,
""),
G_VARIANT_TYPE ("(s)"),
@@ -1224,7 +1220,7 @@ printer_configure_async (PpNewPrinter *new_printer)
MECHANISM_BUS,
"PrinterSetEnabled",
g_variant_new ("(sb)",
- new_printer->name,
+ self->name,
TRUE),
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
@@ -1247,10 +1243,10 @@ printer_configure_async (PpNewPrinter *new_printer)
}
/* Run autoconfiguration of printer */
- if (!new_printer->is_network_device)
+ if (!self->is_network_device)
{
PpMaintenanceCommand *command;
- command = pp_maintenance_command_new (new_printer->name,
+ command = pp_maintenance_command_new (self->name,
"autoconfigure",
NULL,
/* Translators: Name of job which makes printer to autoconfigure itself */
@@ -1266,18 +1262,18 @@ printer_configure_async (PpNewPrinter *new_printer)
values = g_new0 (gchar *, 2);
values[0] = g_strdup (get_page_size_from_locale ());
- printer_add_option_async (new_printer->name, "PageSize", values, FALSE, NULL, pao_cb, data);
+ printer_add_option_async (self->name, "PageSize", values, FALSE, NULL, pao_cb, data);
g_strfreev (values);
/* Install missing executables for printer */
ime_data = g_new0 (IMEData, 1);
- ime_data->window_id = new_printer->window_id;
+ ime_data->window_id = self->window_id;
if (data->cancellable)
ime_data->cancellable = g_object_ref (data->cancellable);
ime_data->user_data = data;
- printer_get_ppd_async (new_printer->name,
+ printer_get_ppd_async (self->name,
NULL,
0,
printer_get_ppd_cb,
@@ -1285,22 +1281,22 @@ printer_configure_async (PpNewPrinter *new_printer)
}
void
-pp_new_printer_add_async (PpNewPrinter *printer,
+pp_new_printer_add_async (PpNewPrinter *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
- printer->task = g_task_new (printer, cancellable, callback, user_data);
- printer->cancellable = g_object_ref (cancellable);
+ self->task = g_task_new (self, cancellable, callback, user_data);
+ self->cancellable = g_object_ref (cancellable);
- if (printer->ppd_name || printer->ppd_file_name)
+ if (self->ppd_name || self->ppd_file_name)
{
/* We have everything we need */
- printer_add_real_async (printer);
+ printer_add_real_async (self);
}
- else if (printer->device_id)
+ else if (self->device_id)
{
GDBusConnection *bus;
g_autoptr(GError) error = NULL;
@@ -1315,43 +1311,43 @@ pp_new_printer_add_async (PpNewPrinter *printer,
SCP_IFACE,
"GetBestDrivers",
g_variant_new ("(sss)",
- printer->device_id,
- printer->make_and_model ? printer->make_and_model : "",
- printer->device_uri ? printer->device_uri : ""),
+ self->device_id,
+ self->make_and_model ? self->make_and_model : "",
+ self->device_uri ? self->device_uri : ""),
G_VARIANT_TYPE ("(a(ss))"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT_LONG,
cancellable,
printer_add_async_scb,
- printer);
+ self);
}
else
{
g_warning ("Failed to get system bus: %s", error->message);
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
- else if (printer->original_name && printer->host_name)
+ else if (self->original_name && self->host_name)
{
/* Try to get PPD from remote CUPS */
- printer_get_ppd_async (printer->original_name,
- printer->host_name,
- printer->host_port,
+ printer_get_ppd_async (self->original_name,
+ self->host_name,
+ self->host_port,
printer_add_async_scb4,
- printer);
+ self);
}
else
{
- _pp_new_printer_add_async_cb (FALSE, printer);
+ _pp_new_printer_add_async_cb (FALSE, self);
}
}
gboolean
-pp_new_printer_add_finish (PpNewPrinter *printer,
+pp_new_printer_add_finish (PpNewPrinter *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, printer), FALSE);
+ g_return_val_if_fail (g_task_is_valid (res, self), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return g_task_propagate_boolean (G_TASK (res), error);
}
diff --git a/panels/printers/pp-options-dialog.c b/panels/printers/pp-options-dialog.c
index c3773e7f8..d88980aca 100644
--- a/panels/printers/pp-options-dialog.c
+++ b/panels/printers/pp-options-dialog.c
@@ -67,7 +67,7 @@ struct _PpOptionsDialog {
gboolean sensitive;
};
-static void pp_options_dialog_hide (PpOptionsDialog *dialog);
+static void pp_options_dialog_hide (PpOptionsDialog *self);
enum
{
@@ -467,7 +467,7 @@ static void
category_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog *) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog *) user_data;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *options_notebook;
@@ -483,14 +483,14 @@ category_selection_changed_cb (GtkTreeSelection *selection,
if (id >= 0)
{
options_notebook = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "options-notebook");
+ gtk_builder_get_object (self->builder, "options-notebook");
gtk_notebook_set_current_page (GTK_NOTEBOOK (options_notebook), id);
}
}
static void
-populate_options_real (PpOptionsDialog *dialog)
+populate_options_real (PpOptionsDialog *self)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
@@ -511,69 +511,69 @@ populate_options_real (PpOptionsDialog *dialog)
gint i, j;
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "options-spinner");
+ gtk_builder_get_object (self->builder, "options-spinner");
gtk_spinner_stop (GTK_SPINNER (widget));
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "stack");
+ gtk_builder_get_object (self->builder, "stack");
gtk_stack_set_visible_child_name (GTK_STACK (widget), "main-box");
treeview = (GtkTreeView *)
- gtk_builder_get_object (dialog->builder, "options-categories-treeview");
+ gtk_builder_get_object (self->builder, "options-categories-treeview");
notebook = (GtkWidget *)
- gtk_builder_get_object (dialog->builder, "options-notebook");
+ gtk_builder_get_object (self->builder, "options-notebook");
- if (dialog->ipp_attributes)
+ if (self->ipp_attributes)
{
/* Add number-up option to Page Setup tab */
- ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
+ ipp_option_add (g_hash_table_lookup (self->ipp_attributes,
"number-up-supported"),
- g_hash_table_lookup (dialog->ipp_attributes,
+ g_hash_table_lookup (self->ipp_attributes,
"number-up-default"),
"number-up",
/* Translators: This option sets number of pages printed on one sheet */
_("Pages per side"),
- dialog->printer_name,
+ self->printer_name,
page_setup_tab_grid,
- dialog->sensitive);
+ self->sensitive);
/* Add sides option to Page Setup tab */
- ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
+ ipp_option_add (g_hash_table_lookup (self->ipp_attributes,
"sides-supported"),
- g_hash_table_lookup (dialog->ipp_attributes,
+ g_hash_table_lookup (self->ipp_attributes,
"sides-default"),
"sides",
/* Translators: This option sets whether to print on both sides of paper */
_("Two-sided"),
- dialog->printer_name,
+ self->printer_name,
page_setup_tab_grid,
- dialog->sensitive);
+ self->sensitive);
/* Add orientation-requested option to Page Setup tab */
- ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
+ ipp_option_add (g_hash_table_lookup (self->ipp_attributes,
"orientation-requested-supported"),
- g_hash_table_lookup (dialog->ipp_attributes,
+ g_hash_table_lookup (self->ipp_attributes,
"orientation-requested-default"),
"orientation-requested",
/* Translators: This option sets orientation of print (portrait, landscape...) */
_("Orientation"),
- dialog->printer_name,
+ self->printer_name,
page_setup_tab_grid,
- dialog->sensitive);
+ self->sensitive);
}
- if (dialog->destination && dialog->ppd_filename)
+ if (self->destination && self->ppd_filename)
{
- ppd_file = ppdOpenFile (dialog->ppd_filename);
+ ppd_file = ppdOpenFile (self->ppd_filename);
ppdLocalize (ppd_file);
if (ppd_file)
{
ppdMarkDefaults (ppd_file);
cupsMarkOptions (ppd_file,
- dialog->destination->num_options,
- dialog->destination->options);
+ self->destination->num_options,
+ self->destination->options);
for (i = 0; i < ppd_file->num_groups; i++)
{
@@ -620,9 +620,9 @@ populate_options_real (PpOptionsDialog *dialog)
grid = advanced_tab_grid;
ppd_option_add (ppd_file->groups[i].options[j],
- dialog->printer_name,
+ self->printer_name,
grid,
- dialog->sensitive);
+ self->sensitive);
}
}
}
@@ -631,26 +631,26 @@ populate_options_real (PpOptionsDialog *dialog)
}
}
- dialog->ppd_filename_set = FALSE;
- if (dialog->ppd_filename)
+ self->ppd_filename_set = FALSE;
+ if (self->ppd_filename)
{
- g_unlink (dialog->ppd_filename);
- g_free (dialog->ppd_filename);
- dialog->ppd_filename = NULL;
+ g_unlink (self->ppd_filename);
+ g_free (self->ppd_filename);
+ self->ppd_filename = NULL;
}
- dialog->destination_set = FALSE;
- if (dialog->destination)
+ self->destination_set = FALSE;
+ if (self->destination)
{
- cupsFreeDests (1, dialog->destination);
- dialog->destination = NULL;
+ cupsFreeDests (1, self->destination);
+ self->destination = NULL;
}
- dialog->ipp_attributes_set = FALSE;
- if (dialog->ipp_attributes)
+ self->ipp_attributes_set = FALSE;
+ if (self->ipp_attributes)
{
- g_hash_table_unref (dialog->ipp_attributes);
- dialog->ipp_attributes = NULL;
+ g_hash_table_unref (self->ipp_attributes);
+ self->ipp_attributes = NULL;
}
/* Translators: "General" tab contains general printer options */
@@ -684,17 +684,17 @@ populate_options_real (PpOptionsDialog *dialog)
{
g_signal_connect (selection,
"changed",
- G_CALLBACK (category_selection_changed_cb), dialog);
+ G_CALLBACK (category_selection_changed_cb), self);
if ((model = gtk_tree_view_get_model (treeview)) != NULL &&
gtk_tree_model_get_iter_first (model, &iter))
gtk_tree_selection_select_iter (selection, &iter);
}
- dialog->populating_dialog = FALSE;
- if (dialog->response != GTK_RESPONSE_NONE)
+ self->populating_dialog = FALSE;
+ if (self->response != GTK_RESPONSE_NONE)
{
- dialog->user_callback (GTK_DIALOG (dialog->dialog), dialog->response, dialog->user_data);
+ self->user_callback (GTK_DIALOG (self->dialog), self->response, self->user_data);
}
}
@@ -702,21 +702,21 @@ static void
printer_get_ppd_cb (const gchar *ppd_filename,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog *) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog *) user_data;
- if (dialog->ppd_filename)
+ if (self->ppd_filename)
{
- g_unlink (dialog->ppd_filename);
- g_free (dialog->ppd_filename);
+ g_unlink (self->ppd_filename);
+ g_free (self->ppd_filename);
}
- dialog->ppd_filename = g_strdup (ppd_filename);
- dialog->ppd_filename_set = TRUE;
+ self->ppd_filename = g_strdup (ppd_filename);
+ self->ppd_filename_set = TRUE;
- if (dialog->destination_set &&
- dialog->ipp_attributes_set)
+ if (self->destination_set &&
+ self->ipp_attributes_set)
{
- populate_options_real (dialog);
+ populate_options_real (self);
}
}
@@ -724,18 +724,18 @@ static void
get_named_dest_cb (cups_dest_t *dest,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog *) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog *) user_data;
- if (dialog->destination)
- cupsFreeDests (1, dialog->destination);
+ if (self->destination)
+ cupsFreeDests (1, self->destination);
- dialog->destination = dest;
- dialog->destination_set = TRUE;
+ self->destination = dest;
+ self->destination_set = TRUE;
- if (dialog->ppd_filename_set &&
- dialog->ipp_attributes_set)
+ if (self->ppd_filename_set &&
+ self->ipp_attributes_set)
{
- populate_options_real (dialog);
+ populate_options_real (self);
}
}
@@ -743,23 +743,23 @@ static void
get_ipp_attributes_cb (GHashTable *table,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog *) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog *) user_data;
- if (dialog->ipp_attributes)
- g_hash_table_unref (dialog->ipp_attributes);
+ if (self->ipp_attributes)
+ g_hash_table_unref (self->ipp_attributes);
- dialog->ipp_attributes = table;
- dialog->ipp_attributes_set = TRUE;
+ self->ipp_attributes = table;
+ self->ipp_attributes_set = TRUE;
- if (dialog->ppd_filename_set &&
- dialog->destination_set)
+ if (self->ppd_filename_set &&
+ self->destination_set)
{
- populate_options_real (dialog);
+ populate_options_real (self);
}
}
static void
-populate_options (PpOptionsDialog *dialog)
+populate_options (PpOptionsDialog *self)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
@@ -781,11 +781,11 @@ populate_options (PpOptionsDialog *dialog)
NULL};
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "stack");
+ gtk_builder_get_object (self->builder, "stack");
gtk_stack_set_visible_child_name (GTK_STACK (widget), "progress-box");
treeview = (GtkTreeView *)
- gtk_builder_get_object (dialog->builder, "options-categories-treeview");
+ gtk_builder_get_object (self->builder, "options-categories-treeview");
renderer = gtk_cell_renderer_text_new ();
@@ -795,23 +795,23 @@ populate_options (PpOptionsDialog *dialog)
gtk_tree_view_append_column (treeview, column);
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "options-spinner");
+ gtk_builder_get_object (self->builder, "options-spinner");
gtk_spinner_start (GTK_SPINNER (widget));
- printer_get_ppd_async (dialog->printer_name,
+ printer_get_ppd_async (self->printer_name,
NULL,
0,
printer_get_ppd_cb,
- dialog);
+ self);
- get_named_dest_async (dialog->printer_name,
+ get_named_dest_async (self->printer_name,
get_named_dest_cb,
- dialog);
+ self);
- get_ipp_attributes_async (dialog->printer_name,
+ get_ipp_attributes_async (self->printer_name,
(gchar **) attributes,
get_ipp_attributes_cb,
- dialog);
+ self);
}
static void
@@ -862,10 +862,10 @@ static void
test_page_cb (GtkButton *button,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog*) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog*) user_data;
gint i;
- if (dialog->printer_name)
+ if (self->printer_name)
{
const gchar *const dirs[] = { "/usr/share/cups",
"/usr/local/share/cups",
@@ -888,7 +888,7 @@ test_page_cb (GtkButton *button,
{
PpPrinter *printer;
- printer = pp_printer_new (dialog->printer_name);
+ printer = pp_printer_new (self->printer_name);
pp_printer_print_file_async (printer,
filename,
/* Translators: Name of job which makes printer to print test page */
@@ -903,7 +903,7 @@ test_page_cb (GtkButton *button,
{
PpMaintenanceCommand *command;
- command = pp_maintenance_command_new (dialog->printer_name,
+ command = pp_maintenance_command_new (self->printer_name,
"PrintSelfTestPage",
NULL,
/* Translators: Name of job which makes printer to print test page */
@@ -919,13 +919,13 @@ options_dialog_response_cb (GtkDialog *_dialog,
gint response_id,
gpointer user_data)
{
- PpOptionsDialog *dialog = (PpOptionsDialog*) user_data;
+ PpOptionsDialog *self = (PpOptionsDialog*) user_data;
- pp_options_dialog_hide (dialog);
- dialog->response = response_id;
+ pp_options_dialog_hide (self);
+ self->response = response_id;
- if (!dialog->populating_dialog)
- dialog->user_callback (GTK_DIALOG (dialog->dialog), response_id, dialog->user_data);
+ if (!self->populating_dialog)
+ self->user_callback (GTK_DIALOG (self->dialog), response_id, self->user_data);
}
PpOptionsDialog *
@@ -935,18 +935,18 @@ pp_options_dialog_new (GtkWindow *parent,
gchar *printer_name,
gboolean sensitive)
{
- PpOptionsDialog *dialog;
+ PpOptionsDialog *self;
GtkWidget *test_page_button;
g_autoptr(GError) error = NULL;
gchar *objects[] = { "options-dialog", NULL };
guint builder_result;
- dialog = g_new0 (PpOptionsDialog, 1);
+ self = g_new0 (PpOptionsDialog, 1);
- dialog->builder = gtk_builder_new ();
- dialog->parent = GTK_WIDGET (parent);
+ self->builder = gtk_builder_new ();
+ self->parent = GTK_WIDGET (parent);
- builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
+ builder_result = gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/printers/options-dialog.ui",
objects, &error);
@@ -956,90 +956,90 @@ pp_options_dialog_new (GtkWindow *parent,
return NULL;
}
- dialog->dialog = (GtkWidget *) gtk_builder_get_object (dialog->builder, "options-dialog");
- gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (parent));
+ self->dialog = (GtkWidget *) gtk_builder_get_object (self->builder, "options-dialog");
+ gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
- dialog->user_callback = user_callback;
- dialog->user_data = user_data;
+ self->user_callback = user_callback;
+ self->user_data = user_data;
- dialog->printer_name = g_strdup (printer_name);
+ self->printer_name = g_strdup (printer_name);
- dialog->ppd_filename = NULL;
- dialog->ppd_filename_set = FALSE;
+ self->ppd_filename = NULL;
+ self->ppd_filename_set = FALSE;
- dialog->destination = NULL;
- dialog->destination_set = FALSE;
+ self->destination = NULL;
+ self->destination_set = FALSE;
- dialog->ipp_attributes = NULL;
- dialog->ipp_attributes_set = FALSE;
+ self->ipp_attributes = NULL;
+ self->ipp_attributes_set = FALSE;
- dialog->response = GTK_RESPONSE_NONE;
+ self->response = GTK_RESPONSE_NONE;
- dialog->sensitive = sensitive;
+ self->sensitive = sensitive;
/* connect signals */
- g_signal_connect (dialog->dialog, "response", G_CALLBACK (options_dialog_response_cb), dialog);
- test_page_button = (GtkWidget*) gtk_builder_get_object (dialog->builder, "print-test-page");
- g_signal_connect (test_page_button, "clicked", G_CALLBACK (test_page_cb), dialog);
+ g_signal_connect (self->dialog, "response", G_CALLBACK (options_dialog_response_cb), self);
+ test_page_button = (GtkWidget*) gtk_builder_get_object (self->builder, "print-test-page");
+ g_signal_connect (test_page_button, "clicked", G_CALLBACK (test_page_cb), self);
- gtk_window_set_title (GTK_WINDOW (dialog->dialog), printer_name);
+ gtk_window_set_title (GTK_WINDOW (self->dialog), printer_name);
- gtk_widget_show_all (GTK_WIDGET (dialog->dialog));
+ gtk_widget_show_all (GTK_WIDGET (self->dialog));
- dialog->populating_dialog = TRUE;
- populate_options (dialog);
+ self->populating_dialog = TRUE;
+ populate_options (self);
- return dialog;
+ return self;
}
void
-pp_options_dialog_set_callback (PpOptionsDialog *dialog,
+pp_options_dialog_set_callback (PpOptionsDialog *self,
UserResponseCallback user_callback,
gpointer user_data)
{
- if (dialog != NULL)
+ if (self != NULL)
{
- dialog->user_callback = user_callback;
- dialog->user_data = user_data;
+ self->user_callback = user_callback;
+ self->user_data = user_data;
}
}
void
-pp_options_dialog_free (PpOptionsDialog *dialog)
+pp_options_dialog_free (PpOptionsDialog *self)
{
- gtk_widget_destroy (GTK_WIDGET (dialog->dialog));
- dialog->dialog = NULL;
+ gtk_widget_destroy (GTK_WIDGET (self->dialog));
+ self->dialog = NULL;
- g_object_unref (dialog->builder);
- dialog->builder = NULL;
+ g_object_unref (self->builder);
+ self->builder = NULL;
- g_free (dialog->printer_name);
- dialog->printer_name = NULL;
+ g_free (self->printer_name);
+ self->printer_name = NULL;
- if (dialog->ppd_filename)
+ if (self->ppd_filename)
{
- g_unlink (dialog->ppd_filename);
- g_free (dialog->ppd_filename);
- dialog->ppd_filename = NULL;
+ g_unlink (self->ppd_filename);
+ g_free (self->ppd_filename);
+ self->ppd_filename = NULL;
}
- if (dialog->destination)
+ if (self->destination)
{
- cupsFreeDests (1, dialog->destination);
- dialog->destination = NULL;
+ cupsFreeDests (1, self->destination);
+ self->destination = NULL;
}
- if (dialog->ipp_attributes)
+ if (self->ipp_attributes)
{
- g_hash_table_unref (dialog->ipp_attributes);
- dialog->ipp_attributes = NULL;
+ g_hash_table_unref (self->ipp_attributes);
+ self->ipp_attributes = NULL;
}
- g_free (dialog);
+ g_free (self);
}
static void
-pp_options_dialog_hide (PpOptionsDialog *dialog)
+pp_options_dialog_hide (PpOptionsDialog *self)
{
- gtk_widget_hide (GTK_WIDGET (dialog->dialog));
+ gtk_widget_hide (GTK_WIDGET (self->dialog));
}
diff --git a/panels/printers/pp-ppd-option-widget.c b/panels/printers/pp-ppd-option-widget.c
index 6beddc089..ae8b89369 100644
--- a/panels/printers/pp-ppd-option-widget.c
+++ b/panels/printers/pp-ppd-option-widget.c
@@ -31,9 +31,9 @@
static void pp_ppd_option_widget_finalize (GObject *object);
-static gboolean construct_widget (PpPPDOptionWidget *widget);
-static void update_widget (PpPPDOptionWidget *widget);
-static void update_widget_real (PpPPDOptionWidget *widget);
+static gboolean construct_widget (PpPPDOptionWidget *self);
+static void update_widget (PpPPDOptionWidget *self);
+static void update_widget_real (PpPPDOptionWidget *self);
struct _PpPPDOptionWidget
{
@@ -142,45 +142,45 @@ pp_ppd_option_widget_class_init (PpPPDOptionWidgetClass *class)
}
static void
-pp_ppd_option_widget_init (PpPPDOptionWidget *widget)
+pp_ppd_option_widget_init (PpPPDOptionWidget *self)
{
- gtk_orientable_set_orientation (GTK_ORIENTABLE (widget),
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (self),
GTK_ORIENTATION_HORIZONTAL);
- widget->switch_button = NULL;
- widget->combo = NULL;
- widget->image = NULL;
- widget->box = NULL;
+ self->switch_button = NULL;
+ self->combo = NULL;
+ self->image = NULL;
+ self->box = NULL;
- widget->printer_name = NULL;
- widget->option_name = NULL;
+ self->printer_name = NULL;
+ self->option_name = NULL;
- widget->destination = NULL;
- widget->destination_set = FALSE;
+ self->destination = NULL;
+ self->destination_set = FALSE;
- widget->ppd_filename = NULL;
- widget->ppd_filename_set = FALSE;
+ self->ppd_filename = NULL;
+ self->ppd_filename_set = FALSE;
}
static void
pp_ppd_option_widget_finalize (GObject *object)
{
- PpPPDOptionWidget *widget = PP_PPD_OPTION_WIDGET (object);
+ PpPPDOptionWidget *self = PP_PPD_OPTION_WIDGET (object);
- g_cancellable_cancel (widget->cancellable);
- if (widget->ppd_filename)
- g_unlink (widget->ppd_filename);
+ g_cancellable_cancel (self->cancellable);
+ if (self->ppd_filename)
+ g_unlink (self->ppd_filename);
- g_clear_pointer (&widget->option, cups_option_free);
- g_clear_pointer (&widget->printer_name, g_free);
- g_clear_pointer (&widget->option_name, g_free);
- if (widget->destination)
+ g_clear_pointer (&self->option, cups_option_free);
+ g_clear_pointer (&self->printer_name, g_free);
+ g_clear_pointer (&self->option_name, g_free);
+ if (self->destination)
{
- cupsFreeDests (1, widget->destination);
- widget->destination = NULL;
+ cupsFreeDests (1, self->destination);
+ self->destination = NULL;
}
- g_clear_pointer (&widget->ppd_filename, g_free);
- g_clear_object (&widget->cancellable);
+ g_clear_pointer (&self->ppd_filename, g_free);
+ g_clear_object (&self->cancellable);
G_OBJECT_CLASS (pp_ppd_option_widget_parent_class)->finalize (object);
}
@@ -205,29 +205,29 @@ GtkWidget *
pp_ppd_option_widget_new (ppd_option_t *option,
const gchar *printer_name)
{
- PpPPDOptionWidget *widget = NULL;
+ PpPPDOptionWidget *self = NULL;
if (option && printer_name)
{
- widget = g_object_new (PP_TYPE_PPD_OPTION_WIDGET, NULL);
+ self = g_object_new (PP_TYPE_PPD_OPTION_WIDGET, NULL);
- widget->printer_name = g_strdup (printer_name);
- widget->option = cups_option_copy (option);
- widget->option_name = g_strdup (option->keyword);
+ self->printer_name = g_strdup (printer_name);
+ self->option = cups_option_copy (option);
+ self->option_name = g_strdup (option->keyword);
- if (construct_widget (widget))
+ if (construct_widget (self))
{
- update_widget_real (widget);
+ update_widget_real (self);
}
else
{
- g_object_ref_sink (widget);
- g_object_unref (widget);
- widget = NULL;
+ g_object_ref_sink (self);
+ g_object_unref (self);
+ self = NULL;
}
}
- return (GtkWidget *) widget;
+ return (GtkWidget *) self;
}
enum {
@@ -335,16 +335,16 @@ static void
printer_add_option_async_cb (gboolean success,
gpointer user_data)
{
- PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
+ PpPPDOptionWidget *self = user_data;
update_widget (user_data);
- g_clear_object (&widget->cancellable);
+ g_clear_object (&self->cancellable);
}
static void
switch_changed_cb (GtkWidget *switch_button,
GParamSpec *pspec,
- PpPPDOptionWidget *widget)
+ PpPPDOptionWidget *self)
{
gchar **values;
@@ -355,104 +355,104 @@ switch_changed_cb (GtkWidget *switch_button,
else
values[0] = g_strdup ("False");
- if (widget->cancellable)
+ if (self->cancellable)
{
- g_cancellable_cancel (widget->cancellable);
- g_object_unref (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
}
- widget->cancellable = g_cancellable_new ();
- printer_add_option_async (widget->printer_name,
- widget->option_name,
+ self->cancellable = g_cancellable_new ();
+ printer_add_option_async (self->printer_name,
+ self->option_name,
values,
FALSE,
- widget->cancellable,
+ self->cancellable,
printer_add_option_async_cb,
- widget);
+ self);
g_strfreev (values);
}
static void
combo_changed_cb (GtkWidget *combo,
- PpPPDOptionWidget *widget)
+ PpPPDOptionWidget *self)
{
gchar **values;
values = g_new0 (gchar *, 2);
values[0] = combo_box_get (combo);
- if (widget->cancellable)
+ if (self->cancellable)
{
- g_cancellable_cancel (widget->cancellable);
- g_object_unref (widget->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_object_unref (self->cancellable);
}
- widget->cancellable = g_cancellable_new ();
- printer_add_option_async (widget->printer_name,
- widget->option_name,
+ self->cancellable = g_cancellable_new ();
+ printer_add_option_async (self->printer_name,
+ self->option_name,
values,
FALSE,
- widget->cancellable,
+ self->cancellable,
printer_add_option_async_cb,
- widget);
+ self);
g_strfreev (values);
}
static gboolean
-construct_widget (PpPPDOptionWidget *widget)
+construct_widget (PpPPDOptionWidget *self)
{
gint i;
/* Don't show options which has only one choice */
- if (widget->option && widget->option->num_choices > 1)
+ if (self->option && self->option->num_choices > 1)
{
- switch (widget->option->ui)
+ switch (self->option->ui)
{
case PPD_UI_BOOLEAN:
- widget->switch_button = gtk_switch_new ();
- g_signal_connect (widget->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), widget);
- gtk_box_pack_start (GTK_BOX (widget), widget->switch_button, FALSE, FALSE, 0);
+ self->switch_button = gtk_switch_new ();
+ g_signal_connect (self->switch_button, "notify::active", G_CALLBACK (switch_changed_cb), self);
+ gtk_box_pack_start (GTK_BOX (self), self->switch_button, FALSE, FALSE, 0);
break;
case PPD_UI_PICKONE:
- widget->combo = combo_box_new ();
+ self->combo = combo_box_new ();
- for (i = 0; i < widget->option->num_choices; i++)
+ for (i = 0; i < self->option->num_choices; i++)
{
- combo_box_append (widget->combo,
- ppd_choice_translate (&widget->option->choices[i]),
- widget->option->choices[i].choice);
+ combo_box_append (self->combo,
+ ppd_choice_translate (&self->option->choices[i]),
+ self->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (widget), widget->combo, FALSE, FALSE, 0);
- g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ g_signal_connect (self->combo, "changed", G_CALLBACK (combo_changed_cb), self);
break;
case PPD_UI_PICKMANY:
- widget->combo = combo_box_new ();
+ self->combo = combo_box_new ();
- for (i = 0; i < widget->option->num_choices; i++)
+ for (i = 0; i < self->option->num_choices; i++)
{
- combo_box_append (widget->combo,
- ppd_choice_translate (&widget->option->choices[i]),
- widget->option->choices[i].choice);
+ combo_box_append (self->combo,
+ ppd_choice_translate (&self->option->choices[i]),
+ self->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (widget), widget->combo, TRUE, TRUE, 0);
- g_signal_connect (widget->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
+ gtk_box_pack_start (GTK_BOX (self), self->combo, TRUE, TRUE, 0);
+ g_signal_connect (self->combo, "changed", G_CALLBACK (combo_changed_cb), self);
break;
default:
break;
}
- widget->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
- if (!widget->image)
- widget->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
- gtk_box_pack_start (GTK_BOX (widget), widget->image, FALSE, FALSE, 0);
- gtk_widget_set_no_show_all (GTK_WIDGET (widget->image), TRUE);
+ self->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
+ if (!self->image)
+ self->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (self), self->image, FALSE, FALSE, 0);
+ gtk_widget_set_no_show_all (GTK_WIDGET (self->image), TRUE);
return TRUE;
}
@@ -463,22 +463,22 @@ construct_widget (PpPPDOptionWidget *widget)
}
static void
-update_widget_real (PpPPDOptionWidget *widget)
+update_widget_real (PpPPDOptionWidget *self)
{
ppd_option_t *option = NULL, *iter;
ppd_file_t *ppd_file;
gchar *value = NULL;
gint i;
- if (widget->option)
+ if (self->option)
{
- option = cups_option_copy (widget->option);
- cups_option_free (widget->option);
- widget->option = NULL;
+ option = cups_option_copy (self->option);
+ cups_option_free (self->option);
+ self->option = NULL;
}
- else if (widget->ppd_filename)
+ else if (self->ppd_filename)
{
- ppd_file = ppdOpenFile (widget->ppd_filename);
+ ppd_file = ppdOpenFile (self->ppd_filename);
ppdLocalize (ppd_file);
if (ppd_file)
@@ -487,7 +487,7 @@ update_widget_real (PpPPDOptionWidget *widget)
for (iter = ppdFirstOption(ppd_file); iter; iter = ppdNextOption(ppd_file))
{
- if (g_str_equal (iter->keyword, widget->option_name))
+ if (g_str_equal (iter->keyword, self->option_name))
{
option = cups_option_copy (iter);
break;
@@ -497,9 +497,9 @@ update_widget_real (PpPPDOptionWidget *widget)
ppdClose (ppd_file);
}
- g_unlink (widget->ppd_filename);
- g_free (widget->ppd_filename);
- widget->ppd_filename = NULL;
+ g_unlink (self->ppd_filename);
+ g_free (self->ppd_filename);
+ self->ppd_filename = NULL;
}
if (option)
@@ -516,24 +516,24 @@ update_widget_real (PpPPDOptionWidget *widget)
switch (option->ui)
{
case PPD_UI_BOOLEAN:
- g_signal_handlers_block_by_func (widget->switch_button, switch_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->switch_button, switch_changed_cb, self);
if (g_ascii_strcasecmp (value, "True") == 0)
- gtk_switch_set_active (GTK_SWITCH (widget->switch_button), TRUE);
+ gtk_switch_set_active (GTK_SWITCH (self->switch_button), TRUE);
else
- gtk_switch_set_active (GTK_SWITCH (widget->switch_button), FALSE);
- g_signal_handlers_unblock_by_func (widget->switch_button, switch_changed_cb, widget);
+ gtk_switch_set_active (GTK_SWITCH (self->switch_button), FALSE);
+ g_signal_handlers_unblock_by_func (self->switch_button, switch_changed_cb, self);
break;
case PPD_UI_PICKONE:
- g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
- combo_box_set (widget->combo, value);
- g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
+ combo_box_set (self->combo, value);
+ g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
break;
case PPD_UI_PICKMANY:
- g_signal_handlers_block_by_func (widget->combo, combo_changed_cb, widget);
- combo_box_set (widget->combo, value);
- g_signal_handlers_unblock_by_func (widget->combo, combo_changed_cb, widget);
+ g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
+ combo_box_set (self->combo, value);
+ g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
break;
default:
@@ -544,9 +544,9 @@ update_widget_real (PpPPDOptionWidget *widget)
}
if (option->conflicted)
- gtk_widget_show (widget->image);
+ gtk_widget_show (self->image);
else
- gtk_widget_hide (widget->image);
+ gtk_widget_hide (self->image);
}
cups_option_free (option);
@@ -556,17 +556,17 @@ static void
get_named_dest_cb (cups_dest_t *dest,
gpointer user_data)
{
- PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
+ PpPPDOptionWidget *self = user_data;
- if (widget->destination)
- cupsFreeDests (1, widget->destination);
+ if (self->destination)
+ cupsFreeDests (1, self->destination);
- widget->destination = dest;
- widget->destination_set = TRUE;
+ self->destination = dest;
+ self->destination_set = TRUE;
- if (widget->ppd_filename_set)
+ if (self->ppd_filename_set)
{
- update_widget_real (widget);
+ update_widget_real (self);
}
}
@@ -574,36 +574,36 @@ static void
printer_get_ppd_cb (const gchar *ppd_filename,
gpointer user_data)
{
- PpPPDOptionWidget *widget = (PpPPDOptionWidget *) user_data;
+ PpPPDOptionWidget *self = user_data;
- if (widget->ppd_filename)
+ if (self->ppd_filename)
{
- g_unlink (widget->ppd_filename);
- g_free (widget->ppd_filename);
+ g_unlink (self->ppd_filename);
+ g_free (self->ppd_filename);
}
- widget->ppd_filename = g_strdup (ppd_filename);
- widget->ppd_filename_set = TRUE;
+ self->ppd_filename = g_strdup (ppd_filename);
+ self->ppd_filename_set = TRUE;
- if (widget->destination_set)
+ if (self->destination_set)
{
- update_widget_real (widget);
+ update_widget_real (self);
}
}
static void
-update_widget (PpPPDOptionWidget *widget)
+update_widget (PpPPDOptionWidget *self)
{
- widget->ppd_filename_set = FALSE;
- widget->destination_set = FALSE;
+ self->ppd_filename_set = FALSE;
+ self->destination_set = FALSE;
- get_named_dest_async (widget->printer_name,
+ get_named_dest_async (self->printer_name,
get_named_dest_cb,
- widget);
+ self);
- printer_get_ppd_async (widget->printer_name,
+ printer_get_ppd_async (self->printer_name,
NULL,
0,
printer_get_ppd_cb,
- widget);
+ self);
}
diff --git a/panels/printers/pp-ppd-selection-dialog.c b/panels/printers/pp-ppd-selection-dialog.c
index 62f9ae64c..9be6c4dfc 100644
--- a/panels/printers/pp-ppd-selection-dialog.c
+++ b/panels/printers/pp-ppd-selection-dialog.c
@@ -70,7 +70,7 @@ static void
manufacturer_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
- PpPPDSelectionDialog *dialog = (PpPPDSelectionDialog *) user_data;
+ PpPPDSelectionDialog *self = user_data;
GtkListStore *store;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -88,10 +88,10 @@ manufacturer_selection_changed_cb (GtkTreeSelection *selection,
if (manufacturer_name)
{
index = -1;
- for (i = 0; i < dialog->list->num_of_manufacturers; i++)
+ for (i = 0; i < self->list->num_of_manufacturers; i++)
{
if (g_strcmp0 (manufacturer_name,
- dialog->list->manufacturers[i]->manufacturer_name) == 0)
+ self->list->manufacturers[i]->manufacturer_name) == 0)
{
index = i;
break;
@@ -101,16 +101,16 @@ manufacturer_selection_changed_cb (GtkTreeSelection *selection,
if (index >= 0)
{
models_treeview = (GtkTreeView*)
- gtk_builder_get_object (dialog->builder, "ppd-selection-models-treeview");
+ gtk_builder_get_object (self->builder, "ppd-selection-models-treeview");
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
- for (i = 0; i < dialog->list->manufacturers[index]->num_of_ppds; i++)
+ for (i = 0; i < self->list->manufacturers[index]->num_of_ppds; i++)
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- PPD_NAMES_COLUMN, dialog->list->manufacturers[index]->ppds[i]->ppd_name,
- PPD_DISPLAY_NAMES_COLUMN, dialog->list->manufacturers[index]->ppds[i]->ppd_display_name,
+ PPD_NAMES_COLUMN, self->list->manufacturers[index]->ppds[i]->ppd_name,
+ PPD_DISPLAY_NAMES_COLUMN, self->list->manufacturers[index]->ppds[i]->ppd_display_name,
-1);
}
@@ -127,7 +127,7 @@ static void
model_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
{
- PpPPDSelectionDialog *dialog = (PpPPDSelectionDialog *) user_data;
+ PpPPDSelectionDialog *self = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
@@ -141,7 +141,7 @@ model_selection_changed_cb (GtkTreeSelection *selection,
}
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "ppd-selection-select-button");
+ gtk_builder_get_object (self->builder, "ppd-selection-select-button");
if (model_name)
{
@@ -155,7 +155,7 @@ model_selection_changed_cb (GtkTreeSelection *selection,
}
static void
-fill_ppds_list (PpPPDSelectionDialog *dialog)
+fill_ppds_list (PpPPDSelectionDialog *self)
{
GtkTreeSelection *selection;
GtkListStore *store;
@@ -167,31 +167,31 @@ fill_ppds_list (PpPPDSelectionDialog *dialog)
gint i;
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "ppd-spinner");
+ gtk_builder_get_object (self->builder, "ppd-spinner");
gtk_widget_hide (widget);
gtk_spinner_stop (GTK_SPINNER (widget));
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "progress-label");
+ gtk_builder_get_object (self->builder, "progress-label");
gtk_widget_hide (widget);
treeview = (GtkTreeView*)
- gtk_builder_get_object (dialog->builder, "ppd-selection-manufacturers-treeview");
+ gtk_builder_get_object (self->builder, "ppd-selection-manufacturers-treeview");
- if (dialog->list)
+ if (self->list)
{
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
- for (i = 0; i < dialog->list->num_of_manufacturers; i++)
+ for (i = 0; i < self->list->num_of_manufacturers; i++)
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- PPD_MANUFACTURERS_NAMES_COLUMN, dialog->list->manufacturers[i]->manufacturer_name,
- PPD_MANUFACTURERS_DISPLAY_NAMES_COLUMN, dialog->list->manufacturers[i]->manufacturer_display_name,
+ PPD_MANUFACTURERS_NAMES_COLUMN, self->list->manufacturers[i]->manufacturer_name,
+ PPD_MANUFACTURERS_DISPLAY_NAMES_COLUMN, self->list->manufacturers[i]->manufacturer_display_name,
-1);
- if (g_strcmp0 (dialog->manufacturer,
- dialog->list->manufacturers[i]->manufacturer_display_name) == 0)
+ if (g_strcmp0 (self->manufacturer,
+ self->list->manufacturers[i]->manufacturer_display_name) == 0)
{
preselect_iter = gtk_tree_iter_copy (&iter);
}
@@ -214,7 +214,7 @@ fill_ppds_list (PpPPDSelectionDialog *dialog)
}
static void
-populate_dialog (PpPPDSelectionDialog *dialog)
+populate_dialog (PpPPDSelectionDialog *self)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
@@ -224,7 +224,7 @@ populate_dialog (PpPPDSelectionDialog *dialog)
GtkWidget *header;
manufacturers_treeview = (GtkTreeView*)
- gtk_builder_get_object (dialog->builder, "ppd-selection-manufacturers-treeview");
+ gtk_builder_get_object (self->builder, "ppd-selection-manufacturers-treeview");
renderer = gtk_cell_renderer_text_new ();
gtk_cell_renderer_set_padding (renderer, 10, 0);
@@ -241,7 +241,7 @@ populate_dialog (PpPPDSelectionDialog *dialog)
models_treeview = (GtkTreeView*)
- gtk_builder_get_object (dialog->builder, "ppd-selection-models-treeview");
+ gtk_builder_get_object (self->builder, "ppd-selection-models-treeview");
renderer = gtk_cell_renderer_text_new ();
gtk_cell_renderer_set_padding (renderer, 10, 0);
@@ -259,27 +259,27 @@ populate_dialog (PpPPDSelectionDialog *dialog)
g_signal_connect (gtk_tree_view_get_selection (models_treeview),
- "changed", G_CALLBACK (model_selection_changed_cb), dialog);
+ "changed", G_CALLBACK (model_selection_changed_cb), self);
g_signal_connect (gtk_tree_view_get_selection (manufacturers_treeview),
- "changed", G_CALLBACK (manufacturer_selection_changed_cb), dialog);
+ "changed", G_CALLBACK (manufacturer_selection_changed_cb), self);
- gtk_widget_show_all (dialog->dialog);
+ gtk_widget_show_all (self->dialog);
- if (!dialog->list)
+ if (!self->list)
{
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "ppd-spinner");
+ gtk_builder_get_object (self->builder, "ppd-spinner");
gtk_widget_show (widget);
gtk_spinner_start (GTK_SPINNER (widget));
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "progress-label");
+ gtk_builder_get_object (self->builder, "progress-label");
gtk_widget_show (widget);
}
else
{
- fill_ppds_list (dialog);
+ fill_ppds_list (self);
}
}
@@ -288,19 +288,19 @@ ppd_selection_dialog_response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
- PpPPDSelectionDialog *ppd_selection_dialog = (PpPPDSelectionDialog*) user_data;
+ PpPPDSelectionDialog *self = user_data;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeView *models_treeview;
GtkTreeIter iter;
- pp_ppd_selection_dialog_hide (ppd_selection_dialog);
+ pp_ppd_selection_dialog_hide (self);
- ppd_selection_dialog->response = response_id;
+ self->response = response_id;
if (response_id == GTK_RESPONSE_OK)
{
models_treeview = (GtkTreeView*)
- gtk_builder_get_object (ppd_selection_dialog->builder, "ppd-selection-models-treeview");
+ gtk_builder_get_object (self->builder, "ppd-selection-models-treeview");
if (models_treeview)
{
@@ -311,17 +311,15 @@ ppd_selection_dialog_response_cb (GtkDialog *dialog,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
- PPD_NAMES_COLUMN, &ppd_selection_dialog->ppd_name,
- PPD_DISPLAY_NAMES_COLUMN, &ppd_selection_dialog->ppd_display_name,
+ PPD_NAMES_COLUMN, &self->ppd_name,
+ PPD_DISPLAY_NAMES_COLUMN, &self->ppd_display_name,
-1);
}
}
}
}
- ppd_selection_dialog->user_callback (GTK_DIALOG (ppd_selection_dialog->dialog),
- response_id,
- ppd_selection_dialog->user_data);
+ self->user_callback (GTK_DIALOG (self->dialog), response_id, self->user_data);
}
PpPPDSelectionDialog *
@@ -331,18 +329,18 @@ pp_ppd_selection_dialog_new (GtkWindow *parent,
UserResponseCallback user_callback,
gpointer user_data)
{
- PpPPDSelectionDialog *dialog;
+ PpPPDSelectionDialog *self;
GtkWidget *widget;
g_autoptr(GError) error = NULL;
gchar *objects[] = { "ppd-selection-dialog", NULL };
guint builder_result;
- dialog = g_new0 (PpPPDSelectionDialog, 1);
+ self = g_new0 (PpPPDSelectionDialog, 1);
- dialog->builder = gtk_builder_new ();
- dialog->parent = GTK_WIDGET (parent);
+ self->builder = gtk_builder_new ();
+ self->parent = GTK_WIDGET (parent);
- builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
+ builder_result = gtk_builder_add_objects_from_resource (self->builder,
"/org/gnome/control-center/printers/ppd-selection-dialog.ui",
objects, &error);
@@ -352,71 +350,71 @@ pp_ppd_selection_dialog_new (GtkWindow *parent,
return NULL;
}
- dialog->dialog = (GtkWidget *) gtk_builder_get_object (dialog->builder, "ppd-selection-dialog");
- dialog->user_callback = user_callback;
- dialog->user_data = user_data;
+ self->dialog = (GtkWidget *) gtk_builder_get_object (self->builder, "ppd-selection-dialog");
+ self->user_callback = user_callback;
+ self->user_data = user_data;
- dialog->response = GTK_RESPONSE_NONE;
- dialog->list = ppd_list_copy (ppd_list);
+ self->response = GTK_RESPONSE_NONE;
+ self->list = ppd_list_copy (ppd_list);
- dialog->manufacturer = get_standard_manufacturers_name (manufacturer);
+ self->manufacturer = get_standard_manufacturers_name (manufacturer);
/* connect signals */
- g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- g_signal_connect (dialog->dialog, "response", G_CALLBACK (ppd_selection_dialog_response_cb), dialog);
+ g_signal_connect (self->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+ g_signal_connect (self->dialog, "response", G_CALLBACK (ppd_selection_dialog_response_cb), self);
- gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (parent));
+ gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "ppd-spinner");
+ gtk_builder_get_object (self->builder, "ppd-spinner");
gtk_spinner_start (GTK_SPINNER (widget));
- populate_dialog (dialog);
+ populate_dialog (self);
- gtk_window_present (GTK_WINDOW (dialog->dialog));
- gtk_widget_show_all (GTK_WIDGET (dialog->dialog));
+ gtk_window_present (GTK_WINDOW (self->dialog));
+ gtk_widget_show_all (GTK_WIDGET (self->dialog));
- return dialog;
+ return self;
}
void
-pp_ppd_selection_dialog_free (PpPPDSelectionDialog *dialog)
+pp_ppd_selection_dialog_free (PpPPDSelectionDialog *self)
{
- gtk_widget_destroy (GTK_WIDGET (dialog->dialog));
+ gtk_widget_destroy (GTK_WIDGET (self->dialog));
- g_object_unref (dialog->builder);
+ g_object_unref (self->builder);
- g_free (dialog->ppd_name);
+ g_free (self->ppd_name);
- g_free (dialog->ppd_display_name);
+ g_free (self->ppd_display_name);
- g_free (dialog->manufacturer);
+ g_free (self->manufacturer);
- g_free (dialog);
+ g_free (self);
}
gchar *
-pp_ppd_selection_dialog_get_ppd_name (PpPPDSelectionDialog *dialog)
+pp_ppd_selection_dialog_get_ppd_name (PpPPDSelectionDialog *self)
{
- return g_strdup (dialog->ppd_name);
+ return g_strdup (self->ppd_name);
}
gchar *
-pp_ppd_selection_dialog_get_ppd_display_name (PpPPDSelectionDialog *dialog)
+pp_ppd_selection_dialog_get_ppd_display_name (PpPPDSelectionDialog *self)
{
- return g_strdup (dialog->ppd_display_name);
+ return g_strdup (self->ppd_display_name);
}
void
-pp_ppd_selection_dialog_set_ppd_list (PpPPDSelectionDialog *dialog,
+pp_ppd_selection_dialog_set_ppd_list (PpPPDSelectionDialog *self,
PPDList *list)
{
- dialog->list = list;
- fill_ppds_list (dialog);
+ self->list = list;
+ fill_ppds_list (self);
}
static void
-pp_ppd_selection_dialog_hide (PpPPDSelectionDialog *dialog)
+pp_ppd_selection_dialog_hide (PpPPDSelectionDialog *self)
{
- gtk_widget_hide (GTK_WIDGET (dialog->dialog));
+ gtk_widget_hide (GTK_WIDGET (self->dialog));
}
diff --git a/panels/printers/pp-print-device.c b/panels/printers/pp-print-device.c
index a75cbe394..8ebd1d446 100644
--- a/panels/printers/pp-print-device.c
+++ b/panels/printers/pp-print-device.c
@@ -334,7 +334,7 @@ pp_print_device_class_init (PpPrintDeviceClass *klass)
}
static void
-pp_print_device_init (PpPrintDevice *printer)
+pp_print_device_init (PpPrintDevice *self)
{
}
@@ -345,106 +345,106 @@ pp_print_device_new ()
}
gchar *
-pp_print_device_get_device_name (PpPrintDevice *device)
+pp_print_device_get_device_name (PpPrintDevice *self)
{
- return device->device_name;
+ return self->device_name;
}
gchar *
-pp_print_device_get_display_name (PpPrintDevice *device)
+pp_print_device_get_display_name (PpPrintDevice *self)
{
- return device->display_name;
+ return self->display_name;
}
gchar *
-pp_print_device_get_device_original_name (PpPrintDevice *device)
+pp_print_device_get_device_original_name (PpPrintDevice *self)
{
- return device->device_original_name;
+ return self->device_original_name;
}
gchar *
-pp_print_device_get_device_make_and_model (PpPrintDevice *device)
+pp_print_device_get_device_make_and_model (PpPrintDevice *self)
{
- return device->device_make_and_model;
+ return self->device_make_and_model;
}
gchar *
-pp_print_device_get_device_location (PpPrintDevice *device)
+pp_print_device_get_device_location (PpPrintDevice *self)
{
- return device->device_location;
+ return self->device_location;
}
gchar *
-pp_print_device_get_device_info (PpPrintDevice *device)
+pp_print_device_get_device_info (PpPrintDevice *self)
{
- return device->device_info;
+ return self->device_info;
}
gchar *
-pp_print_device_get_device_uri (PpPrintDevice *device)
+pp_print_device_get_device_uri (PpPrintDevice *self)
{
- return device->device_uri;
+ return self->device_uri;
}
gchar *
-pp_print_device_get_device_id (PpPrintDevice *device)
+pp_print_device_get_device_id (PpPrintDevice *self)
{
- return device->device_id;
+ return self->device_id;
}
gchar *
-pp_print_device_get_device_ppd (PpPrintDevice *device)
+pp_print_device_get_device_ppd (PpPrintDevice *self)
{
- return device->device_ppd;
+ return self->device_ppd;
}
gchar *
-pp_print_device_get_host_name (PpPrintDevice *device)
+pp_print_device_get_host_name (PpPrintDevice *self)
{
- return device->host_name;
+ return self->host_name;
}
gint
-pp_print_device_get_host_port (PpPrintDevice *device)
+pp_print_device_get_host_port (PpPrintDevice *self)
{
- return device->host_port;
+ return self->host_port;
}
gboolean
-pp_print_device_is_authenticated_server (PpPrintDevice *device)
+pp_print_device_is_authenticated_server (PpPrintDevice *self)
{
- return device->is_authenticated_server;
+ return self->is_authenticated_server;
}
gint
-pp_print_device_get_acquisition_method (PpPrintDevice *device)
+pp_print_device_get_acquisition_method (PpPrintDevice *self)
{
- return device->acquisition_method;
+ return self->acquisition_method;
}
gboolean
-pp_print_device_is_network_device (PpPrintDevice *device)
+pp_print_device_is_network_device (PpPrintDevice *self)
{
- return device->is_network_device;
+ return self->is_network_device;
}
PpPrintDevice *
-pp_print_device_copy (PpPrintDevice *device)
+pp_print_device_copy (PpPrintDevice *self)
{
return g_object_new (PP_TYPE_PRINT_DEVICE,
- "device-name", pp_print_device_get_device_name (device),
- "display-name", pp_print_device_get_display_name (device),
- "device-original-name", pp_print_device_get_device_original_name (device),
- "device-make-and-model", pp_print_device_get_device_make_and_model (device),
- "device-location", pp_print_device_get_device_location (device),
- "device-info", pp_print_device_get_device_info (device),
- "device-uri", pp_print_device_get_device_uri (device),
- "device-id", pp_print_device_get_device_id (device),
- "device-ppd", pp_print_device_get_device_ppd (device),
- "host-name", pp_print_device_get_host_name (device),
- "host-port", pp_print_device_get_host_port (device),
- "is-authenticated-server", pp_print_device_is_authenticated_server (device),
- "acquisition-method", pp_print_device_get_acquisition_method (device),
- "is-network-device", pp_print_device_is_network_device (device),
+ "device-name", pp_print_device_get_device_name (self),
+ "display-name", pp_print_device_get_display_name (self),
+ "device-original-name", pp_print_device_get_device_original_name (self),
+ "device-make-and-model", pp_print_device_get_device_make_and_model (self),
+ "device-location", pp_print_device_get_device_location (self),
+ "device-info", pp_print_device_get_device_info (self),
+ "device-uri", pp_print_device_get_device_uri (self),
+ "device-id", pp_print_device_get_device_id (self),
+ "device-ppd", pp_print_device_get_device_ppd (self),
+ "host-name", pp_print_device_get_host_name (self),
+ "host-port", pp_print_device_get_host_port (self),
+ "is-authenticated-server", pp_print_device_is_authenticated_server (self),
+ "acquisition-method", pp_print_device_get_acquisition_method (self),
+ "is-network-device", pp_print_device_is_network_device (self),
NULL);
}
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index f1649ac30..665550a80 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -414,7 +414,7 @@ printer_renamed_cb (PpDetailsDialog *dialog,
gchar *new_name,
gpointer user_data)
{
- PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
+ PpPrinterEntry *self = user_data;
g_signal_emit_by_name (self, "printer-renamed", new_name);
}
@@ -424,7 +424,7 @@ details_dialog_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
- PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
+ PpPrinterEntry *self = user_data;
pp_details_dialog_free (self->pp_details_dialog);
self->pp_details_dialog = NULL;
@@ -462,7 +462,7 @@ printer_options_dialog_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
- PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
+ PpPrinterEntry *self = user_data;
if (self->pp_options_dialog != NULL)
{
@@ -505,6 +505,7 @@ check_clean_heads_maintenance_command_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
+ PpPrinterEntry *self = user_data;
PpMaintenanceCommand *command = (PpMaintenanceCommand *) source_object;
gboolean is_supported = FALSE;
g_autoptr(GError) error = NULL;
@@ -518,7 +519,6 @@ check_clean_heads_maintenance_command_cb (GObject *source_object,
if (is_supported)
{
- PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
gtk_widget_show (GTK_WIDGET (self->clean_heads_menuitem));
}
@@ -546,7 +546,7 @@ clean_heads_maintenance_command_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
+ PpPrinterEntry *self = user_data;
PpMaintenanceCommand *command = (PpMaintenanceCommand *) source_object;
g_autoptr(GError) error = NULL;
@@ -583,7 +583,7 @@ get_jobs_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- PpPrinterEntry *self;
+ PpPrinterEntry *self = user_data;
PpPrinter *printer = PP_PRINTER (source_object);
g_autoptr(GError) error = NULL;
GList *jobs;
@@ -617,8 +617,6 @@ get_jobs_cb (GObject *source_object,
button_label = g_strdup_printf (ngettext ("%u Job", "%u Jobs", num_jobs), num_jobs);
}
- self = PP_PRINTER_ENTRY (user_data);
-
gtk_button_set_label (GTK_BUTTON (self->show_jobs_dialog_button), button_label);
gtk_widget_set_sensitive (self->show_jobs_dialog_button, num_jobs > 0);
diff --git a/panels/printers/pp-printer.c b/panels/printers/pp-printer.c
index adf0d5312..b21e7fa46 100644
--- a/panels/printers/pp-printer.c
+++ b/panels/printers/pp-printer.c
@@ -115,7 +115,7 @@ pp_printer_class_init (PpPrinterClass *klass)
}
static void
-pp_printer_init (PpPrinter *printer)
+pp_printer_init (PpPrinter *self)
{
}
@@ -133,18 +133,18 @@ printer_rename_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- PpPrinter *printer = PP_PRINTER (source_object);
+ PpPrinter *self = PP_PRINTER (source_object);
gboolean result;
gchar *new_printer_name = task_data;
gchar *old_printer_name;
- g_object_get (printer, "printer-name", &old_printer_name, NULL);
+ g_object_get (self, "printer-name", &old_printer_name, NULL);
result = printer_rename (old_printer_name, new_printer_name);
if (result)
{
- g_object_set (printer, "printer-name", new_printer_name, NULL);
+ g_object_set (self, "printer-name", new_printer_name, NULL);
}
g_free (old_printer_name);
@@ -157,7 +157,7 @@ printer_rename_dbus_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- PpPrinter *printer;
+ PpPrinter *self;
GVariant *output;
gboolean result = FALSE;
g_autoptr(GError) error = NULL;
@@ -173,8 +173,8 @@ printer_rename_dbus_cb (GObject *source_object,
{
const gchar *ret_error;
- printer = g_task_get_source_object (task);
- g_object_get (printer, "printer-name", &old_printer_name, NULL);
+ self = g_task_get_source_object (task);
+ g_object_get (self, "printer-name", &old_printer_name, NULL);
g_variant_get (output, "(&s)", &ret_error);
if (ret_error[0] != '\0')
@@ -184,7 +184,7 @@ printer_rename_dbus_cb (GObject *source_object,
else
{
result = TRUE;
- g_object_set (printer, "printer-name", g_task_get_task_data (task), NULL);
+ g_object_set (self, "printer-name", g_task_get_task_data (task), NULL);
}
g_task_return_boolean (task, result);
@@ -250,7 +250,7 @@ get_bus_cb (GObject *source_object,
}
void
-pp_printer_rename_async (PpPrinter *printer,
+pp_printer_rename_async (PpPrinter *self,
const gchar *new_printer_name,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -260,7 +260,7 @@ pp_printer_rename_async (PpPrinter *printer,
g_return_if_fail (new_printer_name != NULL);
- task = g_task_new (G_OBJECT (printer), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_task_data (task, g_strdup (new_printer_name), g_free);
g_bus_get (G_BUS_TYPE_SYSTEM,
@@ -270,11 +270,11 @@ pp_printer_rename_async (PpPrinter *printer,
}
gboolean
-pp_printer_rename_finish (PpPrinter *printer,
+pp_printer_rename_finish (PpPrinter *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, printer), FALSE);
+ g_return_val_if_fail (g_task_is_valid (res, self), FALSE);
g_object_unref (res);
return g_task_propagate_boolean (G_TASK (res), error);
@@ -296,7 +296,7 @@ get_jobs_thread (GTask *task,
static gchar *printer_attributes[] = { "auth-info-required" };
GetJobsData *get_jobs_data = task_data;
cups_job_t *jobs = NULL;
- PpPrinter *printer = PP_PRINTER (source_object);
+ PpPrinter *self = PP_PRINTER (source_object);
gboolean auth_info_is_required;
PpJob *job;
ipp_t *job_request;
@@ -311,7 +311,7 @@ get_jobs_thread (GTask *task,
gint num_jobs;
gint i, j;
- g_object_get (printer, "printer-name", &printer_name, NULL);
+ g_object_get (self, "printer-name", &printer_name, NULL);
num_jobs = cupsGetJobs (&jobs,
printer_name,
@@ -398,7 +398,7 @@ get_jobs_thread (GTask *task,
}
void
-pp_printer_get_jobs_async (PpPrinter *printer,
+pp_printer_get_jobs_async (PpPrinter *self,
gboolean myjobs,
gint which_jobs,
GCancellable *cancellable,
@@ -412,7 +412,7 @@ pp_printer_get_jobs_async (PpPrinter *printer,
get_jobs_data->myjobs = myjobs;
get_jobs_data->which_jobs = which_jobs;
- task = g_task_new (G_OBJECT (printer), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_task_data (task, get_jobs_data, g_free);
g_task_set_return_on_cancel (task, TRUE);
g_task_run_in_thread (task, get_jobs_thread);
@@ -420,11 +420,11 @@ pp_printer_get_jobs_async (PpPrinter *printer,
}
GList *
-pp_printer_get_jobs_finish (PpPrinter *printer,
+pp_printer_get_jobs_finish (PpPrinter *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, printer), NULL);
+ g_return_val_if_fail (g_task_is_valid (res, self), NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
@@ -510,14 +510,14 @@ pp_printer_delete_cb (GObject *source_object,
}
void
-pp_printer_delete_async (PpPrinter *printer,
+pp_printer_delete_async (PpPrinter *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- task = g_task_new (G_OBJECT (printer), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_bus_get (G_BUS_TYPE_SYSTEM,
cancellable,
@@ -526,11 +526,11 @@ pp_printer_delete_async (PpPrinter *printer,
}
gboolean
-pp_printer_delete_finish (PpPrinter *printer,
+pp_printer_delete_finish (PpPrinter *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, printer), FALSE);
+ g_return_val_if_fail (g_task_is_valid (res, self), FALSE);
return g_task_propagate_boolean (G_TASK (res), error);
}
@@ -556,11 +556,11 @@ print_file_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
+ PpPrinter *self = PP_PRINTER (source_object);
PrintFileData *print_file_data;
cups_ptype_t type = 0;
cups_dest_t *dest = NULL;
const gchar *printer_type = NULL;
- PpPrinter *printer;
gboolean ret = FALSE;
gchar *printer_name = NULL;
gchar *printer_uri = NULL;
@@ -568,9 +568,7 @@ print_file_thread (GTask *task,
ipp_t *response = NULL;
ipp_t *request;
- printer = PP_PRINTER (source_object);
-
- g_object_get (printer, "printer-name", &printer_name, NULL);
+ g_object_get (self, "printer-name", &printer_name, NULL);
dest = cupsGetNamedDest (CUPS_HTTP_DEFAULT, printer_name, NULL);
if (dest != NULL)
{
@@ -626,7 +624,7 @@ print_file_thread (GTask *task,
}
void
-pp_printer_print_file_async (PpPrinter *printer,
+pp_printer_print_file_async (PpPrinter *self,
const gchar *filename,
const gchar *job_name,
GCancellable *cancellable,
@@ -640,7 +638,7 @@ pp_printer_print_file_async (PpPrinter *printer,
print_file_data->filename = g_strdup (filename);
print_file_data->job_name = g_strdup (job_name);
- task = g_task_new (G_OBJECT (printer), cancellable, callback, user_data);
+ task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_return_on_cancel (task, TRUE);
g_task_set_task_data (task, print_file_data, (GDestroyNotify) print_file_data_free);
@@ -650,11 +648,11 @@ pp_printer_print_file_async (PpPrinter *printer,
}
gboolean
-pp_printer_print_file_finish (PpPrinter *printer,
+pp_printer_print_file_finish (PpPrinter *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (g_task_is_valid (res, printer), FALSE);
+ g_return_val_if_fail (g_task_is_valid (res, self), FALSE);
return g_task_propagate_boolean (G_TASK (res), error);
}