aboutsummaryrefslogtreecommitdiff
path: root/src/show-printer-settings.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-02-03 16:07:18 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-02-03 16:07:18 +0100
commit75df9f6c041c84ea6b01ec1f1937c9804712dbe6 (patch)
treed53c66befc1e88e6ef995d7c90f99a1bd27d25a3 /src/show-printer-settings.c
parent0b0215ae0af11634a648412cc5cb927379bd333b (diff)
downloadayatana-indicator-printers-75df9f6c041c84ea6b01ec1f1937c9804712dbe6.tar.gz
ayatana-indicator-printers-75df9f6c041c84ea6b01ec1f1937c9804712dbe6.tar.bz2
ayatana-indicator-printers-75df9f6c041c84ea6b01ec1f1937c9804712dbe6.zip
Move g-c-c invocation out of indicator-printers-menu
Diffstat (limited to 'src/show-printer-settings.c')
-rw-r--r--src/show-printer-settings.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/show-printer-settings.c b/src/show-printer-settings.c
new file mode 100644
index 0000000..b213bb2
--- /dev/null
+++ b/src/show-printer-settings.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2012 Canonical Ltd.
+ *
+ * Authors: Lars Uebernickel <lars.uebernickel@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gio/gio.h>
+
+
+void
+show_printer_settings (const gchar *printer)
+{
+ GAppInfo *appinfo;
+ GError *err = NULL;
+ gchar *cmdline;
+
+ if (printer)
+ cmdline = g_strdup_printf ("gnome-control-center printers show-printer %s",
+ printer);
+ else
+ cmdline = g_strdup_printf ("gnome-control-center printers");
+
+ appinfo = g_app_info_create_from_commandline (cmdline,
+ "gnome-control-center",
+ G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION,
+ &err);
+ g_free (cmdline);
+
+ if (err) {
+ g_warning ("failed to create application info: %s", err->message);
+ g_error_free (err);
+ return;
+ }
+
+ g_app_info_launch (appinfo, NULL, NULL, &err);
+ if (err) {
+ g_warning ("failed to launch gnome-control-center: %s", err->message);
+ g_error_free (err);
+ }
+
+ g_object_unref (appinfo);
+}
+