summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2018-02-21 18:05:55 +0100
committerMarek Kasik <mkasik@redhat.com>2018-02-26 14:33:30 +0100
commit873c2c68390ce0545a86604e200bd4d196ca1af9 (patch)
tree31645e7d7abc82950fc8a62245f48786dbda14a6
parent91328078fee7046eed7bb506e97fa42497fcf414 (diff)
downloadgnome-control-center-873c2c68390ce0545a86604e200bd4d196ca1af9.tar.gz
Printers: Add commandline action "show-jobs"
Add action "show-jobs" to printers panel which gets printer name as a parameter and shows user jobs dialog. Syntax for trigerring this action looks like: "gnome-control-center printers show-jobs my-local-printer". https://bugzilla.gnome.org/show_bug.cgi?id=758170
-rw-r--r--panels/printers/cc-printers-panel.c14
-rw-r--r--panels/printers/pp-printer-entry.c2
-rw-r--r--panels/printers/pp-printer-entry.h2
3 files changed, 17 insertions, 1 deletions
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 64cc32c90..55a1682b4 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -166,6 +166,20 @@ execute_action (CcPrintersPanel *self,
g_variant_unref (variant);
}
+ /* show-jobs printer-name */
+ else if (g_strcmp0 (action_name, "show-jobs") == 0)
+ {
+ g_variant_get_child (action, 1, "v", &variant);
+ printer_name = g_variant_get_string (variant, NULL);
+
+ printer_entry = PP_PRINTER_ENTRY (g_hash_table_lookup (priv->printer_entries, printer_name));
+ if (printer_entry != NULL)
+ pp_printer_entry_show_jobs_dialog (printer_entry);
+ else
+ g_warning ("Could not find printer \"%s\"!", printer_name);
+
+ g_variant_unref (variant);
+ }
g_variant_unref (action_variant);
}
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index 827ee837a..19ea924fc 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -662,7 +662,7 @@ printer_jobs_dialog_free_cb (GtkDialog *dialog,
pp_jobs_dialog_free ((PpJobsDialog *) user_data);
}
-static void
+void
pp_printer_entry_show_jobs_dialog (PpPrinterEntry *self)
{
if (self->pp_jobs_dialog == NULL)
diff --git a/panels/printers/pp-printer-entry.h b/panels/printers/pp-printer-entry.h
index e8ea41d94..d56424ffd 100644
--- a/panels/printers/pp-printer-entry.h
+++ b/panels/printers/pp-printer-entry.h
@@ -38,6 +38,8 @@ void pp_printer_entry_update_jobs_count (PpPrinterEntry *self);
GSList *pp_printer_entry_get_size_group_widgets (PpPrinterEntry *self);
+void pp_printer_entry_show_jobs_dialog (PpPrinterEntry *self);
+
void pp_printer_entry_authenticate_jobs (PpPrinterEntry *self);
#endif /* PP_PRINTER_ENTRY_H */