GError *error = NULL;
CupsPrintStreamData *ps = user_data;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
GTK_NOTE (PRINTING,
g_print ("CUPS Backend: %s\n", G_STRFUNC));
if (error)
g_error_free (error);
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
}
typedef struct {
}
}
- /* Add "Custom." prefix to custom values. */
- if (custom_value)
+ /* Add "Custom." prefix to custom values if not already added. */
+ if (custom_value && !g_str_has_prefix (value, "Custom."))
{
new_value = g_strdup_printf ("Custom.%s", value);
gtk_cups_request_encode_option (request, key, new_value);
int state;
gboolean done;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
if (data->job == NULL)
{
cups_job_poll_data_free (data);
done:
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
}
static void
const gchar *member_uris;
const gchar *location;
const gchar *description;
- const gchar *state_msg;
+ gchar *state_msg;
const gchar *reason_msg;
PrinterStateLevel reason_level;
gint state;
else if (strcmp (ippGetName (attr), "printer-info") == 0)
info->description = ippGetString (attr, 0, NULL);
else if (strcmp (ippGetName (attr), "printer-state-message") == 0)
- info->state_msg = ippGetString (attr, 0, NULL);
+ info->state_msg = g_strdup (ippGetString (attr, 0, NULL));
else if (strcmp (ippGetName (attr), "printer-state-reasons") == 0)
/* Store most important reason to reason_msg and set
its importance at printer_state_reason_level */
info->auth_info_required[i] = g_strdup (ippGetString (attr, i, NULL));
}
}
- else if (strcmp (attr->name, "number-up-default") == 0)
+ else if (strcmp (ippGetName (attr), "number-up-default") == 0)
{
- info->default_number_up = attr->values[0].integer;
+ info->default_number_up = ippGetInteger (attr, 0);
}
else
{
GList *removed_printer_checklist;
gchar *remote_default_printer = NULL;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
list_has_changed = FALSE;
if (tmp_msg2 != NULL)
{
+ g_free (info->state_msg);
info->state_msg = tmp_msg2;
- g_free (tmp_msg2);
}
}
if (info->reason_level >= GTK_PRINTER_STATE_LEVEL_WARNING)
{
if (strlen (info->state_msg) == 0)
- info->state_msg = reason_msg_desc;
+ {
+ g_free (info->state_msg);
+ info->state_msg = reason_msg_desc;
+ reason_msg_desc = NULL;
+ }
else
{
gchar *tmp_msg = NULL;
tmp_msg = g_strjoin (" ; ", info->state_msg,
reason_msg_desc, NULL);
+ g_free (info->state_msg);
info->state_msg = tmp_msg;
- g_free (tmp_msg);
}
}
if (reason_msg_desc != NULL)
/* The ref is held by GtkPrintBackend, in add_printer() */
g_object_unref (printer);
+ g_free (info->state_msg);
g_slice_free (PrinterSetupInfo, info);
if (attr == NULL)
as inactive if it is in the list, emitting a printer_removed signal */
if (removed_printer_checklist != NULL)
{
- g_list_free_full (removed_printer_checklist, (GDestroyNotify) mark_printer_inactive);
+ g_list_foreach (removed_printer_checklist, (GFunc) mark_printer_inactive, backend);
+ g_list_free (removed_printer_checklist);
list_has_changed = TRUE;
}
}
}
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
}
static void
{
GtkPrinter *printer;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
GTK_NOTE (PRINTING,
g_print ("CUPS Backend: %s\n", G_STRFUNC));
g_signal_emit_by_name (printer, "details-acquired", TRUE);
done:
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
}
static gboolean
ipp_attribute_t *attr;
GtkPrinter *printer;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
if (gtk_cups_result_is_error (result))
{
if (print_backend->list_printers_poll != 0)
cups_request_printer_list (print_backend);
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
}
static gboolean
static char *
ppd_group_name (ppd_group_t *group)
{
- return group->text;
+ return group->name;
}
static int