[gnome-control-center] printers: Fix compilation error
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Fix compilation error
- Date: Fri, 15 Apr 2016 10:21:49 +0000 (UTC)
commit 1fbc8de8bdbdebc704bbbf41618d5f825baed75f
Author: Marek Kasik <mkasik redhat com>
Date: Fri Apr 15 12:08:27 2016 +0200
printers: Fix compilation error
Fix "format not a string literal" error by not using
formatted print.
https://bugzilla.gnome.org/show_bug.cgi?id=764153
panels/printers/cc-printers-panel.c | 46 +++++++++++++++++++---------------
1 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 66529de..fe1e618 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -2517,6 +2517,27 @@ pp_maintenance_command_execute_cb (GObject *source_object,
g_object_unref (command);
}
+static gchar *
+get_testprint_filename (const gchar *datadir)
+{
+ const gchar *testprint[] = { "/data/testprint",
+ "/data/testprint.ps",
+ NULL };
+ gchar *filename = NULL;
+ gint i;
+
+ for (i = 0; testprint[i] != NULL; i++)
+ {
+ filename = g_strconcat (datadir, testprint[i], NULL);
+ if (g_access (filename, R_OK) == 0)
+ break;
+
+ g_clear_pointer (&filename, g_free);
+ }
+
+ return filename;
+}
+
static void
test_page_cb (GtkButton *button,
gpointer user_data)
@@ -2555,30 +2576,15 @@ test_page_cb (GtkButton *button,
ipp_t *response = NULL;
ipp_t *request;
- if ((datadir = getenv ("CUPS_DATADIR")) != NULL)
+ datadir = getenv ("CUPS_DATADIR");
+ if (datadir != NULL)
{
- filename = g_strdup_printf ("%s/data/testprint", datadir);
- if (g_access (filename, R_OK) != 0)
- {
- g_free (filename);
- filename = g_strdup_printf ("%s/data/testprint.ps", datadir);
- if (g_access (filename, R_OK) != 0)
- g_clear_pointer (&filename, g_free);
- }
+ filename = get_testprint_filename (datadir);
}
else
{
- for (i = 0; (datadir = dirs[i]) != NULL && filename == NULL; i++)
- {
- filename = g_strdup_printf ("%s/data/testprint", datadir);
- if (g_access (filename, R_OK) != 0)
- {
- g_free (filename);
- filename = g_strdup_printf ("%s/data/testprint.ps", datadir);
- if (g_access (filename, R_OK) != 0)
- g_clear_pointer (&filename, g_free);
- }
- }
+ for (i = 0; dirs[i] != NULL && filename == NULL; i++)
+ filename = get_testprint_filename (dirs[i]);
}
if (filename)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]