diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-06 15:38:27 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-06 15:38:27 +0100 |
commit | c1c9dd8191ae8490b169071860fdacf442195077 (patch) | |
tree | 967ba1cf847f7c9ab581d0dd114a189b7bf48c82 /src/indicator-printers-menu.c | |
parent | 75df9f6c041c84ea6b01ec1f1937c9804712dbe6 (diff) | |
download | ayatana-indicator-printers-c1c9dd8191ae8490b169071860fdacf442195077.tar.gz ayatana-indicator-printers-c1c9dd8191ae8490b169071860fdacf442195077.tar.bz2 ayatana-indicator-printers-c1c9dd8191ae8490b169071860fdacf442195077.zip |
Use g_spawn_command_line_async to launch g-c-c
Diffstat (limited to 'src/indicator-printers-menu.c')
-rw-r--r-- | src/indicator-printers-menu.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/indicator-printers-menu.c b/src/indicator-printers-menu.c index f9e0e35..1548610 100644 --- a/src/indicator-printers-menu.c +++ b/src/indicator-printers-menu.c @@ -1,7 +1,6 @@ #include "indicator-printers-menu.h" -#include "show-printer-settings.h" #include <cups/cups.h> @@ -117,12 +116,37 @@ get_number_of_active_jobs (const gchar *printer) static void -show_system_settings (DbusmenuMenuitem *menuitem, - guint timestamp, - gpointer user_data) +spawn_command_line_async_f (const gchar *fmt, + ...) +{ + va_list args; + gchar *cmdline; + GError *err = NULL; + + va_start (args, fmt); + cmdline = g_strdup_vprintf (fmt, args); + va_end (args); + + g_spawn_command_line_async (cmdline, &err); + if (err) { + g_warning ("Couldn't execute command `%s`: %s", + cmdline, err->message); + g_error_free (err); + } + + g_free (cmdline); +} + + +static void +on_printer_item_activated (DbusmenuMenuitem *menuitem, + guint timestamp, + gpointer user_data) { const gchar *printer = user_data; - show_printer_settings (printer); + + spawn_command_line_async_f ("gnome-control-center printers show-printer %s", + printer); } @@ -142,7 +166,7 @@ update_printer_menuitem (IndicatorPrintersMenu *self, dbusmenu_menuitem_property_set (item, "indicator-icon-name", "printer"); dbusmenu_menuitem_property_set (item, "indicator-label", printer); g_signal_connect_data (item, "item-activated", - G_CALLBACK (show_system_settings), + G_CALLBACK (on_printer_item_activated), g_strdup (printer), (GClosureNotify) g_free, 0); dbusmenu_menuitem_child_append(self->priv->root, item); |