summaryrefslogtreecommitdiff
path: root/modules/printbackends
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2012-02-19 13:45:17 -0800
committerJohn Ralls <jralls@ceridwen.us>2012-04-23 12:44:06 -0700
commit3e354a17efbaea9374a54ae0de0745392f72c2d5 (patch)
tree5d84a961e0b3831b27a0a786834e21bf01978285 /modules/printbackends
parent58ca84584a4d811591428111fe5b5a335c49f075 (diff)
downloadgtk+-3e354a17efbaea9374a54ae0de0745392f72c2d5.tar.gz
Move some variable declarations into the scopes in which they're used.
Diffstat (limited to 'modules/printbackends')
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index 115912577a..0b2e2c27a5 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -2014,10 +2014,6 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
gboolean status_changed = FALSE;
GList *node;
gint i;
- gchar *reason_msg_desc = NULL;
- gchar *tmp_msg = NULL;
- gchar *tmp_msg2 = NULL;
- gboolean found = FALSE;
PrinterSetupInfo *info = g_slice_new0 (PrinterSetupInfo);
info->default_number_up = 1;
@@ -2117,23 +2113,30 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
if (info->state_msg != NULL && strlen (info->state_msg) == 0)
{
- if (info->is_paused && !info->is_accepting_jobs)
- /* Translators: this is a printer status. */
+ gchar *tmp_msg2 = NULL;
+ if (info->is_paused && !info->is_accepting_jobs)
+ /* Translators: this is a printer status. */
tmp_msg2 = g_strdup ( N_("Paused ; Rejecting Jobs"));
if (info->is_paused && info->is_accepting_jobs)
- /* Translators: this is a printer status. */
+ /* Translators: this is a printer status. */
tmp_msg2 = g_strdup ( N_("Paused"));
if (!info->is_paused && !info->is_accepting_jobs)
- /* Translators: this is a printer status. */
+ /* Translators: this is a printer status. */
tmp_msg2 = g_strdup ( N_("Rejecting Jobs"));
if (tmp_msg2 != NULL)
- info->state_msg = tmp_msg2;
- }
+ {
+ info->state_msg = tmp_msg2;
+ g_free (tmp_msg2);
+ }
+ }
/* Set description of the reason and combine it with printer-state-message. */
if ( (info->reason_msg != NULL))
{
+ gchar *reason_msg_desc = NULL;
+ gboolean found = FALSE;
+
for (i = 0; i < G_N_ELEMENTS (printer_messages); i++)
{
if (strncmp (info->reason_msg, printer_messages[i],
@@ -2155,23 +2158,21 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
info->state_msg = reason_msg_desc;
else
{
- tmp_msg = g_strjoin (" ; ", info->state_msg, reason_msg_desc, NULL);
+ gchar *tmp_msg = NULL;
+ tmp_msg = g_strjoin (" ; ", info->state_msg,
+ reason_msg_desc, NULL);
info->state_msg = tmp_msg;
+ g_free (tmp_msg);
}
}
+ if (reason_msg_desc != NULL)
+ g_free (reason_msg_desc);
}
status_changed |= gtk_printer_set_state_message (printer, info->state_msg);
status_changed |= gtk_printer_set_is_accepting_jobs (printer, info->is_accepting_jobs);
- if (tmp_msg != NULL)
- g_free (tmp_msg);
-
- if (tmp_msg2 != NULL)
- g_free (tmp_msg2);
- if (reason_msg_desc != NULL)
- g_free (reason_msg_desc);
/* Set printer icon according to importance
(none, report, warning, error - report is omitted). */