Merge lp:~robert-ancell/unity-settings-daemon/no-print-notification into lp:unity-settings-daemon
- no-print-notification
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~robert-ancell/unity-settings-daemon/no-print-notification |
Merge into: | lp:unity-settings-daemon |
Diff against target: |
3241 lines (+0/-3145) 12 files modified
configure.ac (+0/-46) debian/control (+0/-1) gnome-settings-daemon/gnome-settings-plugin-info.c (+0/-29) plugins/Makefile.am (+0/-6) plugins/print-notifications/Makefile.am (+0/-87) plugins/print-notifications/gsd-print-notifications-manager.c (+0/-1467) plugins/print-notifications/gsd-print-notifications-manager.h (+0/-57) plugins/print-notifications/gsd-print-notifications-plugin.c (+0/-29) plugins/print-notifications/gsd-printer.c (+0/-1403) plugins/print-notifications/print-notifications.gnome-settings-plugin.in (+0/-10) plugins/print-notifications/test-print-notifications.c (+0/-7) po/POTFILES.in (+0/-3) |
To merge this branch: | bzr merge lp:~robert-ancell/unity-settings-daemon/no-print-notification |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Needs Fixing | ||
Marco Trevisan (Treviño) | Needs Fixing | ||
Review via email: mp+289103@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-05-24.
Commit message
Drop print notifications - not used under Unity.
Description of the change
Robert Ancell (robert-ancell) wrote : | # |
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
This doesn't build, I think you forgot to remove a reference in configure.ac:
See this patch: http://
Robert Ancell (robert-ancell) wrote : | # |
Also was in po/POTFILES.in
Sebastien Bacher (seb128) wrote : | # |
looks good this time right?
Sebastien Bacher (seb128) wrote : | # |
in fact the change to the info plugin seems from https:/
Robert Ancell (robert-ancell) wrote : | # |
The change in gnome-settings-
Sebastien Bacher (seb128) wrote : | # |
sorry you are right, the issue though is
- bzr merge lp:~robert-ancell/unity-settings-daemon/no-gnome-shell
- bzr commit
- bzr merge lp:~robert-ancell/unity-settings-daemon/no-print-notification
-> conflicts in gnome-settings-
(which is what Trevinhp tried to point in the other merge when it said there was a conflict)
Could you rebase one of top of the other?
- 4135. By Robert Ancell
-
Merge with no-gnome-shell
Unmerged revisions
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2015-02-12 15:37:32 +0000 |
3 | +++ configure.ac 2016-05-24 21:12:24 +0000 |
4 | @@ -377,51 +377,6 @@ |
5 | |
6 | |
7 | # --------------------------------------------------------------------------- |
8 | -# CUPS |
9 | -# --------------------------------------------------------------------------- |
10 | - |
11 | -AC_ARG_ENABLE(cups, |
12 | - AS_HELP_STRING([--disable-cups], [disable CUPS support (default: enabled)]),, |
13 | - enable_cups=yes) |
14 | - |
15 | -if test x"$enable_cups" != x"no" ; then |
16 | - AC_PROG_SED |
17 | - |
18 | - AC_PATH_PROG(CUPS_CONFIG, cups-config) |
19 | - |
20 | - if test x$CUPS_CONFIG = x; then |
21 | - AC_MSG_ERROR([cups-config not found but CUPS support requested]) |
22 | - fi |
23 | - |
24 | - CUPS_API_VERSION=`$CUPS_CONFIG --api-version` |
25 | - CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` |
26 | - CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` |
27 | - |
28 | - AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h],, |
29 | - AC_MSG_ERROR([CUPS headers not found but CUPS support requested])) |
30 | - |
31 | - if ! test $CUPS_API_MAJOR -gt 1 -o \ |
32 | - $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then |
33 | - AC_MSG_ERROR([CUPS 1.4 or newer not found, but CUPS support requested]) |
34 | - fi |
35 | - |
36 | - # https://bugzilla.gnome.org/show_bug.cgi?id=696571 |
37 | - CUPS_CPPFLAGS="" |
38 | - if test $CUPS_API_MAJOR -gt 1 -o \ |
39 | - $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 6 ; then |
40 | - CUPS_CPPFLAGS=-D_PPD_DEPRECATED="" |
41 | - fi |
42 | - |
43 | - CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` |
44 | - CUPS_LIBS=`$CUPS_CONFIG --libs` |
45 | - AC_SUBST(CUPS_CPPFLAGS) |
46 | - AC_SUBST(CUPS_CFLAGS) |
47 | - AC_SUBST(CUPS_LIBS) |
48 | -fi |
49 | - |
50 | -AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x"$enable_cups" = x"yes"]) |
51 | - |
52 | -# --------------------------------------------------------------------------- |
53 | # Enable Profiling |
54 | # --------------------------------------------------------------------------- |
55 | AC_ARG_ENABLE(profiling, |
56 | @@ -539,7 +494,6 @@ |
57 | plugins/media-keys/gvc/Makefile |
58 | plugins/mouse/Makefile |
59 | plugins/orientation/Makefile |
60 | -plugins/print-notifications/Makefile |
61 | plugins/remote-display/Makefile |
62 | plugins/screensaver-proxy/Makefile |
63 | plugins/smartcard/Makefile |
64 | |
65 | === modified file 'debian/control' |
66 | --- debian/control 2016-01-29 18:10:00 +0000 |
67 | +++ debian/control 2016-05-24 21:12:24 +0000 |
68 | @@ -25,7 +25,6 @@ |
69 | libasound2-dev, |
70 | librsvg2-dev (>= 2.36.2), |
71 | libcanberra-gtk3-dev, |
72 | - libcups2-dev, |
73 | libpolkit-gobject-1-dev, |
74 | libaccountsservice-dev (>= 0.6.34), |
75 | libappindicator3-dev (>= 0.4.90), |
76 | |
77 | === modified file 'gnome-settings-daemon/gnome-settings-plugin-info.c' |
78 | --- gnome-settings-daemon/gnome-settings-plugin-info.c 2013-11-13 01:45:23 +0000 |
79 | +++ gnome-settings-daemon/gnome-settings-plugin-info.c 2016-05-24 21:12:24 +0000 |
80 | @@ -381,35 +381,6 @@ |
81 | goto out; |
82 | } |
83 | |
84 | - if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0 |
85 | - && g_strcmp0 (info->priv->name, "Print-notifications") == 0) { |
86 | - |
87 | - g_warning ("Disable print plugin under Unity"); |
88 | - |
89 | - g_object_unref (G_OBJECT (info->priv->module)); |
90 | - info->priv->module = NULL; |
91 | - |
92 | - /* Mark plugin as unavailable */ |
93 | - info->priv->available = FALSE; |
94 | - |
95 | - goto out; |
96 | - } |
97 | - |
98 | - if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "GNOME") == 0 |
99 | - && g_strcmp0 (info->priv->name, "Background") == 0) { |
100 | - |
101 | - g_warning ("Disable background plugin when under gnome-shell"); |
102 | - |
103 | - g_object_unref (G_OBJECT (info->priv->module)); |
104 | - info->priv->module = NULL; |
105 | - |
106 | - /* Mark plugin as unavailable */ |
107 | - info->priv->available = FALSE; |
108 | - |
109 | - goto out; |
110 | - } |
111 | - |
112 | - |
113 | info->priv->plugin = GNOME_SETTINGS_PLUGIN (gnome_settings_module_new_object (GNOME_SETTINGS_MODULE (info->priv->module))); |
114 | |
115 | g_type_module_unuse (info->priv->module); |
116 | |
117 | === modified file 'plugins/Makefile.am' |
118 | --- plugins/Makefile.am 2013-11-13 01:59:14 +0000 |
119 | +++ plugins/Makefile.am 2016-05-24 21:12:24 +0000 |
120 | @@ -47,11 +47,5 @@ |
121 | disabled_plugins += wacom |
122 | endif |
123 | |
124 | -if BUILD_PRINT_NOTIFICATIONS |
125 | -enabled_plugins += print-notifications |
126 | -else |
127 | -disabled_plugins += print-notifications |
128 | -endif |
129 | - |
130 | SUBDIRS = common $(enabled_plugins) |
131 | DIST_SUBDIRS = $(SUBDIRS) $(disabled_plugins) |
132 | |
133 | === removed directory 'plugins/print-notifications' |
134 | === removed file 'plugins/print-notifications/Makefile.am' |
135 | --- plugins/print-notifications/Makefile.am 2013-12-04 23:55:26 +0000 |
136 | +++ plugins/print-notifications/Makefile.am 1970-01-01 00:00:00 +0000 |
137 | @@ -1,87 +0,0 @@ |
138 | -plugin_name = print-notifications |
139 | - |
140 | -plugin_LTLIBRARIES = \ |
141 | - libprint-notifications.la |
142 | - |
143 | -libprint_notifications_la_SOURCES = \ |
144 | - gsd-print-notifications-manager.c \ |
145 | - gsd-print-notifications-manager.h \ |
146 | - gsd-print-notifications-plugin.c |
147 | - |
148 | -libprint_notifications_la_CPPFLAGS = \ |
149 | - -I$(top_srcdir)/gnome-settings-daemon \ |
150 | - -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ |
151 | - -DLIBEXECDIR=\""$(libexecdir)"\" \ |
152 | - $(AM_CPPFLAGS) \ |
153 | - $(CUPS_CPPFLAGS) |
154 | - |
155 | -libprint_notifications_la_CFLAGS = \ |
156 | - $(PLUGIN_CFLAGS) \ |
157 | - $(SETTINGS_PLUGIN_CFLAGS) \ |
158 | - $(AM_CFLAGS) |
159 | - |
160 | -libprint_notifications_la_LDFLAGS = \ |
161 | - $(GSD_PLUGIN_LDFLAGS) |
162 | - |
163 | -libprint_notifications_la_LIBADD = \ |
164 | - $(CUPS_LIBS) \ |
165 | - $(SETTINGS_PLUGIN_LIBS) |
166 | - |
167 | -plugin_in_files = \ |
168 | - print-notifications.gnome-settings-plugin.in |
169 | - |
170 | -plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) |
171 | - |
172 | -libexec_PROGRAMS = usd-printer |
173 | - |
174 | -usd_printer_SOURCES = \ |
175 | - gsd-printer.c |
176 | - |
177 | -usd_printer_CFLAGS = \ |
178 | - $(SETTINGS_PLUGIN_CFLAGS) \ |
179 | - $(LIBNOTIFY_CFLAGS) \ |
180 | - -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ |
181 | - $(AM_CFLAGS) |
182 | - |
183 | -usd_printer_LDADD = \ |
184 | - $(SETTINGS_PLUGIN_LIBS) \ |
185 | - $(CUPS_LIBS) \ |
186 | - $(LIBNOTIFY_LIBS) |
187 | - |
188 | -libexec_PROGRAMS += usd-test-print-notifications |
189 | - |
190 | -usd_test_print_notifications_SOURCES = \ |
191 | - gsd-print-notifications-manager.c \ |
192 | - gsd-print-notifications-manager.h \ |
193 | - test-print-notifications.c |
194 | - |
195 | -usd_test_print_notifications_CPPFLAGS = \ |
196 | - -I$(top_srcdir)/gnome-settings-daemon \ |
197 | - -I$(top_srcdir)/plugins/common \ |
198 | - -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ |
199 | - -DLIBEXECDIR=\""$(libexecdir)"\" \ |
200 | - $(AM_CPPFLAGS) \ |
201 | - $(CUPS_CPPFLAGS) |
202 | - |
203 | -usd_test_print_notifications_CFLAGS = \ |
204 | - $(PLUGIN_CFLAGS) \ |
205 | - $(SETTINGS_PLUGIN_CFLAGS) \ |
206 | - $(AM_CFLAGS) |
207 | - |
208 | -usd_test_print_notifications_LDADD = \ |
209 | - $(top_builddir)/gnome-settings-daemon/libgsd.la \ |
210 | - $(SETTINGS_DAEMON_LIBS) \ |
211 | - $(SETTINGS_PLUGIN_LIBS) \ |
212 | - $(CUPS_LIBS) \ |
213 | - $(LIBNOTIFY_LIBS) |
214 | - |
215 | -EXTRA_DIST = \ |
216 | - $(plugin_in_files) |
217 | - |
218 | -CLEANFILES = \ |
219 | - $(plugin_DATA) |
220 | - |
221 | -DISTCLEANFILES = \ |
222 | - $(plugin_DATA) |
223 | - |
224 | -@GSD_INTLTOOL_PLUGIN_RULE@ |
225 | |
226 | === removed file 'plugins/print-notifications/gsd-print-notifications-manager.c' |
227 | --- plugins/print-notifications/gsd-print-notifications-manager.c 2013-12-04 23:55:26 +0000 |
228 | +++ plugins/print-notifications/gsd-print-notifications-manager.c 1970-01-01 00:00:00 +0000 |
229 | @@ -1,1467 +0,0 @@ |
230 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
231 | - * |
232 | - * Copyright (C) 2011 Red Hat, Inc. |
233 | - * |
234 | - * This program is free software; you can redistribute it and/or modify |
235 | - * it under the terms of the GNU General Public License as published by |
236 | - * the Free Software Foundation; either version 2 of the License, or |
237 | - * (at your option) any later version. |
238 | - * |
239 | - * This program is distributed in the hope that it will be useful, |
240 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
241 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
242 | - * GNU General Public License for more details. |
243 | - * |
244 | - * You should have received a copy of the GNU General Public License |
245 | - * along with this program; if not, write to the Free Software |
246 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
247 | - * |
248 | - */ |
249 | - |
250 | -#include "config.h" |
251 | - |
252 | -#include <sys/types.h> |
253 | -#include <sys/wait.h> |
254 | -#include <stdlib.h> |
255 | -#include <stdio.h> |
256 | -#include <unistd.h> |
257 | -#include <string.h> |
258 | -#include <errno.h> |
259 | - |
260 | -#include <locale.h> |
261 | - |
262 | -#include <glib.h> |
263 | -#include <glib/gi18n.h> |
264 | -#include <glib/gstdio.h> |
265 | - |
266 | -#include <cups/cups.h> |
267 | -#include <cups/ppd.h> |
268 | -#include <libnotify/notify.h> |
269 | - |
270 | -#include "gnome-settings-profile.h" |
271 | -#include "gsd-print-notifications-manager.h" |
272 | - |
273 | -#define GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerPrivate)) |
274 | - |
275 | -#define CUPS_DBUS_NAME "org.cups.cupsd.Notifier" |
276 | -#define CUPS_DBUS_PATH "/org/cups/cupsd/Notifier" |
277 | -#define CUPS_DBUS_INTERFACE "org.cups.cupsd.Notifier" |
278 | - |
279 | -#define RENEW_INTERVAL 3500 |
280 | -#define SUBSCRIPTION_DURATION 3600 |
281 | -#define CONNECTING_TIMEOUT 60 |
282 | -#define REASON_TIMEOUT 15000 |
283 | -#define CUPS_CONNECTION_TEST_INTERVAL 300 |
284 | -#define CHECK_INTERVAL 60 /* secs */ |
285 | - |
286 | -#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) |
287 | -#define HAVE_CUPS_1_6 1 |
288 | -#endif |
289 | - |
290 | -#ifndef HAVE_CUPS_1_6 |
291 | -#define ippGetStatusCode(ipp) ipp->request.status.status_code |
292 | -#define ippGetInteger(attr, element) attr->values[element].integer |
293 | -#define ippGetString(attr, element, language) attr->values[element].string.text |
294 | -#define ippGetName(attr) attr->name |
295 | -#define ippGetCount(attr) attr->num_values |
296 | -#define ippGetBoolean(attr, index) attr->values[index].boolean |
297 | - |
298 | -static ipp_attribute_t * |
299 | -ippNextAttribute (ipp_t *ipp) |
300 | -{ |
301 | - if (!ipp || !ipp->current) |
302 | - return (NULL); |
303 | - return (ipp->current = ipp->current->next); |
304 | -} |
305 | -#endif |
306 | - |
307 | -struct GsdPrintNotificationsManagerPrivate |
308 | -{ |
309 | - GDBusConnection *cups_bus_connection; |
310 | - gint subscription_id; |
311 | - cups_dest_t *dests; |
312 | - gint num_dests; |
313 | - gboolean scp_handler_spawned; |
314 | - GPid scp_handler_pid; |
315 | - GList *timeouts; |
316 | - GHashTable *printing_printers; |
317 | - GList *active_notifications; |
318 | - guint cups_connection_timeout_id; |
319 | - guint check_source_id; |
320 | - guint cups_dbus_subscription_id; |
321 | - guint renew_source_id; |
322 | - gint last_notify_sequence_number; |
323 | -}; |
324 | - |
325 | -enum { |
326 | - PROP_0, |
327 | -}; |
328 | - |
329 | -static void gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass); |
330 | -static void gsd_print_notifications_manager_init (GsdPrintNotificationsManager *print_notifications_manager); |
331 | -static void gsd_print_notifications_manager_finalize (GObject *object); |
332 | -static gboolean cups_connection_test (gpointer user_data); |
333 | -static gboolean process_new_notifications (gpointer user_data); |
334 | - |
335 | -G_DEFINE_TYPE (GsdPrintNotificationsManager, gsd_print_notifications_manager, G_TYPE_OBJECT) |
336 | - |
337 | -static gpointer manager_object = NULL; |
338 | - |
339 | -static char * |
340 | -get_dest_attr (const char *dest_name, |
341 | - const char *attr, |
342 | - cups_dest_t *dests, |
343 | - int num_dests) |
344 | -{ |
345 | - cups_dest_t *dest; |
346 | - const char *value; |
347 | - char *ret; |
348 | - |
349 | - if (dest_name == NULL) |
350 | - return NULL; |
351 | - |
352 | - ret = NULL; |
353 | - |
354 | - dest = cupsGetDest (dest_name, NULL, num_dests, dests); |
355 | - if (dest == NULL) { |
356 | - g_debug ("Unable to find a printer named '%s'", dest_name); |
357 | - goto out; |
358 | - } |
359 | - |
360 | - value = cupsGetOption (attr, dest->num_options, dest->options); |
361 | - if (value == NULL) { |
362 | - g_debug ("Unable to get %s for '%s'", attr, dest_name); |
363 | - goto out; |
364 | - } |
365 | - ret = g_strdup (value); |
366 | - out: |
367 | - return ret; |
368 | -} |
369 | - |
370 | -static gboolean |
371 | -is_local_dest (const char *name, |
372 | - cups_dest_t *dests, |
373 | - int num_dests) |
374 | -{ |
375 | - char *type_str; |
376 | - cups_ptype_t type; |
377 | - gboolean is_remote; |
378 | - |
379 | - is_remote = TRUE; |
380 | - |
381 | - type_str = get_dest_attr (name, "printer-type", dests, num_dests); |
382 | - if (type_str == NULL) { |
383 | - goto out; |
384 | - } |
385 | - |
386 | - type = atoi (type_str); |
387 | - is_remote = type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT); |
388 | - g_free (type_str); |
389 | - out: |
390 | - return !is_remote; |
391 | -} |
392 | - |
393 | -static gboolean |
394 | -server_is_local (const gchar *server_name) |
395 | -{ |
396 | - if (server_name != NULL && |
397 | - (g_ascii_strncasecmp (server_name, "localhost", 9) == 0 || |
398 | - g_ascii_strncasecmp (server_name, "127.0.0.1", 9) == 0 || |
399 | - g_ascii_strncasecmp (server_name, "::1", 3) == 0 || |
400 | - server_name[0] == '/')) { |
401 | - return TRUE; |
402 | - } else { |
403 | - return FALSE; |
404 | - } |
405 | -} |
406 | - |
407 | -static int |
408 | -strcmp0(const void *a, const void *b) |
409 | -{ |
410 | - return g_strcmp0 (*((gchar **) a), *((gchar **) b)); |
411 | -} |
412 | - |
413 | -struct |
414 | -{ |
415 | - gchar *printer_name; |
416 | - gchar *primary_text; |
417 | - gchar *secondary_text; |
418 | - guint timeout_id; |
419 | - GsdPrintNotificationsManager *manager; |
420 | -} typedef TimeoutData; |
421 | - |
422 | -struct |
423 | -{ |
424 | - gchar *printer_name; |
425 | - gchar *reason; |
426 | - NotifyNotification *notification; |
427 | - gulong notification_close_id; |
428 | - GsdPrintNotificationsManager *manager; |
429 | -} typedef ReasonData; |
430 | - |
431 | -static void |
432 | -free_timeout_data (gpointer user_data) |
433 | -{ |
434 | - TimeoutData *data = (TimeoutData *) user_data; |
435 | - |
436 | - if (data) { |
437 | - g_free (data->printer_name); |
438 | - g_free (data->primary_text); |
439 | - g_free (data->secondary_text); |
440 | - g_free (data); |
441 | - } |
442 | -} |
443 | - |
444 | -static void |
445 | -free_reason_data (gpointer user_data) |
446 | -{ |
447 | - ReasonData *data = (ReasonData *) user_data; |
448 | - |
449 | - if (data) { |
450 | - if (data->notification_close_id > 0 && |
451 | - g_signal_handler_is_connected (data->notification, |
452 | - data->notification_close_id)) |
453 | - g_signal_handler_disconnect (data->notification, data->notification_close_id); |
454 | - |
455 | - g_object_unref (data->notification); |
456 | - |
457 | - g_free (data->printer_name); |
458 | - g_free (data->reason); |
459 | - |
460 | - g_free (data); |
461 | - } |
462 | -} |
463 | - |
464 | -static void |
465 | -notification_closed_cb (NotifyNotification *notification, |
466 | - gpointer user_data) |
467 | -{ |
468 | - ReasonData *data = (ReasonData *) user_data; |
469 | - |
470 | - if (data) { |
471 | - data->manager->priv->active_notifications = |
472 | - g_list_remove (data->manager->priv->active_notifications, data); |
473 | - |
474 | - free_reason_data (data); |
475 | - } |
476 | -} |
477 | - |
478 | -static gboolean |
479 | -show_notification (gpointer user_data) |
480 | -{ |
481 | - NotifyNotification *notification; |
482 | - TimeoutData *data = (TimeoutData *) user_data; |
483 | - ReasonData *reason_data; |
484 | - GList *tmp; |
485 | - |
486 | - if (!data) |
487 | - return FALSE; |
488 | - |
489 | - notification = notify_notification_new (data->primary_text, |
490 | - data->secondary_text, |
491 | - "printer-symbolic"); |
492 | - |
493 | - notify_notification_set_app_name (notification, _("Printers")); |
494 | - notify_notification_set_hint (notification, |
495 | - "resident", |
496 | - g_variant_new_boolean (TRUE)); |
497 | - notify_notification_set_timeout (notification, REASON_TIMEOUT); |
498 | - |
499 | - reason_data = g_new0 (ReasonData, 1); |
500 | - reason_data->printer_name = g_strdup (data->printer_name); |
501 | - reason_data->reason = g_strdup ("connecting-to-device"); |
502 | - reason_data->notification = notification; |
503 | - reason_data->manager = data->manager; |
504 | - |
505 | - reason_data->notification_close_id = |
506 | - g_signal_connect (notification, |
507 | - "closed", |
508 | - G_CALLBACK (notification_closed_cb), |
509 | - reason_data); |
510 | - |
511 | - reason_data->manager->priv->active_notifications = |
512 | - g_list_append (reason_data->manager->priv->active_notifications, reason_data); |
513 | - |
514 | - notify_notification_show (notification, NULL); |
515 | - |
516 | - tmp = g_list_find (data->manager->priv->timeouts, data); |
517 | - if (tmp) { |
518 | - data->manager->priv->timeouts = g_list_remove_link (data->manager->priv->timeouts, tmp); |
519 | - g_list_free_full (tmp, free_timeout_data); |
520 | - } |
521 | - |
522 | - return FALSE; |
523 | -} |
524 | - |
525 | -static gboolean |
526 | -reason_is_blacklisted (const gchar *reason) { |
527 | - if (g_str_equal (reason, "none")) |
528 | - return TRUE; |
529 | - if (g_str_equal (reason, "other")) |
530 | - return TRUE; |
531 | - if (g_str_equal (reason, "com.apple.print.recoverable")) |
532 | - return TRUE; |
533 | - /* https://bugzilla.redhat.com/show_bug.cgi?id=883401 */ |
534 | - if (g_str_has_prefix (reason, "cups-remote-")) |
535 | - return TRUE; |
536 | - return FALSE; |
537 | -} |
538 | - |
539 | -static void |
540 | -on_cups_notification (GDBusConnection *connection, |
541 | - const char *sender_name, |
542 | - const char *object_path, |
543 | - const char *interface_name, |
544 | - const char *signal_name, |
545 | - GVariant *parameters, |
546 | - gpointer user_data) |
547 | -{ |
548 | - process_new_notifications (user_data); |
549 | -} |
550 | - |
551 | -static void |
552 | -process_cups_notification (GsdPrintNotificationsManager *manager, |
553 | - const char *notify_subscribed_event, |
554 | - const char *notify_text, |
555 | - const char *notify_printer_uri, |
556 | - const char *printer_name, |
557 | - gint printer_state, |
558 | - const char *printer_state_reasons, |
559 | - gboolean printer_is_accepting_jobs, |
560 | - guint notify_job_id, |
561 | - gint job_state, |
562 | - const char *job_state_reasons, |
563 | - const char *job_name, |
564 | - gint job_impressions_completed) |
565 | -{ |
566 | - ipp_attribute_t *attr; |
567 | - gboolean my_job = FALSE; |
568 | - gboolean known_reason; |
569 | - http_t *http; |
570 | - gchar *primary_text = NULL; |
571 | - gchar *secondary_text = NULL; |
572 | - gchar *job_uri = NULL; |
573 | - ipp_t *request, *response; |
574 | - static const char * const reasons[] = { |
575 | - "toner-low", |
576 | - "toner-empty", |
577 | - /*"connecting-to-device",*/ |
578 | - "cover-open", |
579 | - "cups-missing-filter", |
580 | - "door-open", |
581 | - "marker-supply-low", |
582 | - "marker-supply-empty", |
583 | - "media-low", |
584 | - "media-empty", |
585 | - "offline", |
586 | - "other"}; |
587 | - |
588 | - static const char * statuses_first[] = { |
589 | - /* Translators: The printer is low on toner (same as in system-config-printer) */ |
590 | - N_("Toner low"), |
591 | - /* Translators: The printer has no toner left (same as in system-config-printer) */ |
592 | - N_("Toner empty"), |
593 | - /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ |
594 | - /*N_("Not connected?"),*/ |
595 | - /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ |
596 | - N_("Cover open"), |
597 | - /* Translators: A filter or backend is not installed (same as in system-config-printer) */ |
598 | - N_("Printer configuration error"), |
599 | - /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ |
600 | - N_("Door open"), |
601 | - /* Translators: "marker" is one color bin of the printer */ |
602 | - N_("Marker supply low"), |
603 | - /* Translators: "marker" is one color bin of the printer */ |
604 | - N_("Out of a marker supply"), |
605 | - /* Translators: At least one input tray is low on media (same as in system-config-printer) */ |
606 | - N_("Paper low"), |
607 | - /* Translators: At least one input tray is empty (same as in system-config-printer) */ |
608 | - N_("Out of paper"), |
609 | - /* Translators: The printer is offline (same as in system-config-printer) */ |
610 | - N_("Printer off-line"), |
611 | - /* Translators: The printer has detected an error (same as in system-config-printer) */ |
612 | - N_("Printer error") }; |
613 | - |
614 | - static const char * statuses_second[] = { |
615 | - /* Translators: The printer is low on toner (same as in system-config-printer) */ |
616 | - N_("Printer '%s' is low on toner."), |
617 | - /* Translators: The printer has no toner left (same as in system-config-printer) */ |
618 | - N_("Printer '%s' has no toner left."), |
619 | - /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ |
620 | - /*N_("Printer '%s' may not be connected."),*/ |
621 | - /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ |
622 | - N_("The cover is open on printer '%s'."), |
623 | - /* Translators: A filter or backend is not installed (same as in system-config-printer) */ |
624 | - N_("There is a missing print filter for " |
625 | - "printer '%s'."), |
626 | - /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ |
627 | - N_("The door is open on printer '%s'."), |
628 | - /* Translators: "marker" is one color bin of the printer */ |
629 | - N_("Printer '%s' is low on a marker supply."), |
630 | - /* Translators: "marker" is one color bin of the printer */ |
631 | - N_("Printer '%s' is out of a marker supply."), |
632 | - /* Translators: At least one input tray is low on media (same as in system-config-printer) */ |
633 | - N_("Printer '%s' is low on paper."), |
634 | - /* Translators: At least one input tray is empty (same as in system-config-printer) */ |
635 | - N_("Printer '%s' is out of paper."), |
636 | - /* Translators: The printer is offline (same as in system-config-printer) */ |
637 | - N_("Printer '%s' is currently off-line."), |
638 | - /* Translators: The printer has detected an error (same as in system-config-printer) */ |
639 | - N_("There is a problem on printer '%s'.") }; |
640 | - |
641 | - if (g_strcmp0 (notify_subscribed_event, "printer-added") != 0 && |
642 | - g_strcmp0 (notify_subscribed_event, "printer-deleted") != 0 && |
643 | - g_strcmp0 (notify_subscribed_event, "printer-state-changed") != 0 && |
644 | - g_strcmp0 (notify_subscribed_event, "job-completed") != 0 && |
645 | - g_strcmp0 (notify_subscribed_event, "job-state-changed") != 0 && |
646 | - g_strcmp0 (notify_subscribed_event, "job-created") != 0) |
647 | - return; |
648 | - |
649 | - if (notify_job_id > 0) { |
650 | - if ((http = httpConnectEncrypt (cupsServer (), ippPort (), |
651 | - cupsEncryption ())) == NULL) { |
652 | - g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); |
653 | - } else { |
654 | - job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", notify_job_id); |
655 | - |
656 | - request = ippNewRequest (IPP_GET_JOB_ATTRIBUTES); |
657 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, |
658 | - "job-uri", NULL, job_uri); |
659 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, |
660 | - "requesting-user-name", NULL, cupsUser ()); |
661 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, |
662 | - "requested-attributes", NULL, "job-originating-user-name"); |
663 | - response = cupsDoRequest (http, request, "/"); |
664 | - |
665 | - if (response) { |
666 | - if (ippGetStatusCode (response) <= IPP_OK_CONFLICT && |
667 | - (attr = ippFindAttribute(response, "job-originating-user-name", |
668 | - IPP_TAG_NAME))) { |
669 | - if (g_strcmp0 (ippGetString (attr, 0, NULL), cupsUser ()) == 0) |
670 | - my_job = TRUE; |
671 | - } |
672 | - ippDelete(response); |
673 | - } |
674 | - g_free (job_uri); |
675 | - } |
676 | - } |
677 | - |
678 | - if (g_strcmp0 (notify_subscribed_event, "printer-added") == 0) { |
679 | - cupsFreeDests (manager->priv->num_dests, manager->priv->dests); |
680 | - manager->priv->num_dests = cupsGetDests (&manager->priv->dests); |
681 | - |
682 | - if (is_local_dest (printer_name, |
683 | - manager->priv->dests, |
684 | - manager->priv->num_dests)) { |
685 | - /* Translators: New printer has been added */ |
686 | - primary_text = g_strdup (_("Printer added")); |
687 | - secondary_text = g_strdup (printer_name); |
688 | - } |
689 | - } else if (g_strcmp0 (notify_subscribed_event, "printer-deleted") == 0) { |
690 | - if (is_local_dest (printer_name, |
691 | - manager->priv->dests, |
692 | - manager->priv->num_dests)) { |
693 | - /* Translators: A printer has been removed */ |
694 | - primary_text = g_strdup (_("Printer removed")); |
695 | - secondary_text = g_strdup (printer_name); |
696 | - } |
697 | - |
698 | - cupsFreeDests (manager->priv->num_dests, manager->priv->dests); |
699 | - manager->priv->num_dests = cupsGetDests (&manager->priv->dests); |
700 | - } else if (g_strcmp0 (notify_subscribed_event, "job-completed") == 0 && my_job) { |
701 | - g_hash_table_remove (manager->priv->printing_printers, |
702 | - printer_name); |
703 | - |
704 | - switch (job_state) { |
705 | - case IPP_JOB_PENDING: |
706 | - case IPP_JOB_HELD: |
707 | - case IPP_JOB_PROCESSING: |
708 | - break; |
709 | - case IPP_JOB_STOPPED: |
710 | - /* Translators: A print job has been stopped */ |
711 | - primary_text = g_strdup (_("Printing stopped")); |
712 | - /* Translators: "print-job xy" on a printer */ |
713 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
714 | - break; |
715 | - case IPP_JOB_CANCELED: |
716 | - /* Translators: A print job has been canceled */ |
717 | - primary_text = g_strdup (_("Printing canceled")); |
718 | - /* Translators: "print-job xy" on a printer */ |
719 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
720 | - break; |
721 | - case IPP_JOB_ABORTED: |
722 | - /* Translators: A print job has been aborted */ |
723 | - primary_text = g_strdup (_("Printing aborted")); |
724 | - /* Translators: "print-job xy" on a printer */ |
725 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
726 | - break; |
727 | - case IPP_JOB_COMPLETED: |
728 | - /* Translators: A print job has been completed */ |
729 | - primary_text = g_strdup (_("Printing completed")); |
730 | - /* Translators: "print-job xy" on a printer */ |
731 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
732 | - break; |
733 | - } |
734 | - } else if (g_strcmp0 (notify_subscribed_event, "job-state-changed") == 0 && my_job) { |
735 | - switch (job_state) { |
736 | - case IPP_JOB_PROCESSING: |
737 | - g_hash_table_insert (manager->priv->printing_printers, |
738 | - g_strdup (printer_name), NULL); |
739 | - |
740 | - /* Translators: A job is printing */ |
741 | - primary_text = g_strdup (_("Printing")); |
742 | - /* Translators: "print-job xy" on a printer */ |
743 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
744 | - break; |
745 | - case IPP_JOB_STOPPED: |
746 | - g_hash_table_remove (manager->priv->printing_printers, |
747 | - printer_name); |
748 | - /* Translators: A print job has been stopped */ |
749 | - primary_text = g_strdup (_("Printing stopped")); |
750 | - /* Translators: "print-job xy" on a printer */ |
751 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
752 | - break; |
753 | - case IPP_JOB_CANCELED: |
754 | - g_hash_table_remove (manager->priv->printing_printers, |
755 | - printer_name); |
756 | - /* Translators: A print job has been canceled */ |
757 | - primary_text = g_strdup (_("Printing canceled")); |
758 | - /* Translators: "print-job xy" on a printer */ |
759 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
760 | - break; |
761 | - case IPP_JOB_ABORTED: |
762 | - g_hash_table_remove (manager->priv->printing_printers, |
763 | - printer_name); |
764 | - /* Translators: A print job has been aborted */ |
765 | - primary_text = g_strdup (_("Printing aborted")); |
766 | - /* Translators: "print-job xy" on a printer */ |
767 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
768 | - break; |
769 | - case IPP_JOB_COMPLETED: |
770 | - g_hash_table_remove (manager->priv->printing_printers, |
771 | - printer_name); |
772 | - /* Translators: A print job has been completed */ |
773 | - primary_text = g_strdup (_("Printing completed")); |
774 | - /* Translators: "print-job xy" on a printer */ |
775 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
776 | - break; |
777 | - default: |
778 | - break; |
779 | - } |
780 | - } else if (g_strcmp0 (notify_subscribed_event, "job-created") == 0 && my_job) { |
781 | - if (job_state == IPP_JOB_PROCESSING) { |
782 | - g_hash_table_insert (manager->priv->printing_printers, |
783 | - g_strdup (printer_name), NULL); |
784 | - |
785 | - /* Translators: A job is printing */ |
786 | - primary_text = g_strdup (_("Printing")); |
787 | - /* Translators: "print-job xy" on a printer */ |
788 | - secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); |
789 | - } |
790 | - } else if (g_strcmp0 (notify_subscribed_event, "printer-state-changed") == 0) { |
791 | - cups_dest_t *dest = NULL; |
792 | - const gchar *tmp_printer_state_reasons = NULL; |
793 | - GSList *added_reasons = NULL; |
794 | - GSList *tmp_list = NULL; |
795 | - GList *tmp; |
796 | - gchar **old_state_reasons = NULL; |
797 | - gchar **new_state_reasons = NULL; |
798 | - gint i, j; |
799 | - |
800 | - /* Remove timeout which shows notification about possible disconnection of printer |
801 | - * if "connecting-to-device" has vanished. |
802 | - */ |
803 | - if (printer_state_reasons == NULL || |
804 | - g_strrstr (printer_state_reasons, "connecting-to-device") == NULL) { |
805 | - TimeoutData *data; |
806 | - |
807 | - for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { |
808 | - data = (TimeoutData *) tmp->data; |
809 | - if (g_strcmp0 (printer_name, data->printer_name) == 0) { |
810 | - g_source_remove (data->timeout_id); |
811 | - manager->priv->timeouts = g_list_remove_link (manager->priv->timeouts, tmp); |
812 | - g_list_free_full (tmp, free_timeout_data); |
813 | - break; |
814 | - } |
815 | - } |
816 | - } |
817 | - |
818 | - for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { |
819 | - ReasonData *reason_data = (ReasonData *) tmp->data; |
820 | - GList *remove_list; |
821 | - |
822 | - if (printer_state_reasons == NULL || |
823 | - (g_strcmp0 (printer_name, reason_data->printer_name) == 0 && |
824 | - g_strrstr (printer_state_reasons, reason_data->reason) == NULL)) { |
825 | - |
826 | - if (reason_data->notification_close_id > 0 && |
827 | - g_signal_handler_is_connected (reason_data->notification, |
828 | - reason_data->notification_close_id)) { |
829 | - g_signal_handler_disconnect (reason_data->notification, |
830 | - reason_data->notification_close_id); |
831 | - reason_data->notification_close_id = 0; |
832 | - } |
833 | - |
834 | - notify_notification_close (reason_data->notification, NULL); |
835 | - |
836 | - remove_list = tmp; |
837 | - tmp = g_list_next (tmp); |
838 | - manager->priv->active_notifications = |
839 | - g_list_remove_link (manager->priv->active_notifications, remove_list); |
840 | - |
841 | - g_list_free_full (remove_list, free_reason_data); |
842 | - } |
843 | - } |
844 | - |
845 | - /* Check whether we are printing on this printer right now. */ |
846 | - if (g_hash_table_lookup_extended (manager->priv->printing_printers, printer_name, NULL, NULL)) { |
847 | - dest = cupsGetDest (printer_name, |
848 | - NULL, |
849 | - manager->priv->num_dests, |
850 | - manager->priv->dests); |
851 | - if (dest) |
852 | - tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", |
853 | - dest->num_options, |
854 | - dest->options); |
855 | - |
856 | - if (tmp_printer_state_reasons) |
857 | - old_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); |
858 | - |
859 | - cupsFreeDests (manager->priv->num_dests, manager->priv->dests); |
860 | - manager->priv->num_dests = cupsGetDests (&manager->priv->dests); |
861 | - |
862 | - dest = cupsGetDest (printer_name, |
863 | - NULL, |
864 | - manager->priv->num_dests, |
865 | - manager->priv->dests); |
866 | - if (dest) |
867 | - tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", |
868 | - dest->num_options, |
869 | - dest->options); |
870 | - |
871 | - if (tmp_printer_state_reasons) |
872 | - new_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); |
873 | - |
874 | - if (new_state_reasons) |
875 | - qsort (new_state_reasons, |
876 | - g_strv_length (new_state_reasons), |
877 | - sizeof (gchar *), |
878 | - strcmp0); |
879 | - |
880 | - if (old_state_reasons) { |
881 | - qsort (old_state_reasons, |
882 | - g_strv_length (old_state_reasons), |
883 | - sizeof (gchar *), |
884 | - strcmp0); |
885 | - |
886 | - j = 0; |
887 | - for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { |
888 | - while (old_state_reasons[j] && |
889 | - g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) < 0) |
890 | - j++; |
891 | - |
892 | - if (old_state_reasons[j] == NULL || |
893 | - g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) != 0) |
894 | - added_reasons = g_slist_append (added_reasons, |
895 | - new_state_reasons[i]); |
896 | - } |
897 | - } else { |
898 | - for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { |
899 | - added_reasons = g_slist_append (added_reasons, |
900 | - new_state_reasons[i]); |
901 | - } |
902 | - } |
903 | - |
904 | - for (tmp_list = added_reasons; tmp_list; tmp_list = tmp_list->next) { |
905 | - gchar *data = (gchar *) tmp_list->data; |
906 | - known_reason = FALSE; |
907 | - for (j = 0; j < G_N_ELEMENTS (reasons); j++) { |
908 | - if (strncmp (data, |
909 | - reasons[j], |
910 | - strlen (reasons[j])) == 0) { |
911 | - NotifyNotification *notification; |
912 | - known_reason = TRUE; |
913 | - |
914 | - if (g_strcmp0 (reasons[j], "connecting-to-device") == 0) { |
915 | - TimeoutData *data; |
916 | - |
917 | - data = g_new0 (TimeoutData, 1); |
918 | - data->printer_name = g_strdup (printer_name); |
919 | - data->primary_text = g_strdup ( _(statuses_first[j])); |
920 | - data->secondary_text = g_strdup_printf ( _(statuses_second[j]), printer_name); |
921 | - data->manager = manager; |
922 | - |
923 | - data->timeout_id = g_timeout_add_seconds (CONNECTING_TIMEOUT, show_notification, data); |
924 | - manager->priv->timeouts = g_list_append (manager->priv->timeouts, data); |
925 | - } else { |
926 | - ReasonData *reason_data; |
927 | - gchar *second_row = g_strdup_printf ( _(statuses_second[j]), printer_name); |
928 | - |
929 | - notification = notify_notification_new ( _(statuses_first[j]), |
930 | - second_row, |
931 | - "printer-symbolic"); |
932 | - notify_notification_set_app_name (notification, _("Printers")); |
933 | - notify_notification_set_hint (notification, |
934 | - "resident", |
935 | - g_variant_new_boolean (TRUE)); |
936 | - notify_notification_set_timeout (notification, REASON_TIMEOUT); |
937 | - |
938 | - reason_data = g_new0 (ReasonData, 1); |
939 | - reason_data->printer_name = g_strdup (printer_name); |
940 | - reason_data->reason = g_strdup (reasons[j]); |
941 | - reason_data->notification = notification; |
942 | - reason_data->manager = manager; |
943 | - |
944 | - reason_data->notification_close_id = |
945 | - g_signal_connect (notification, |
946 | - "closed", |
947 | - G_CALLBACK (notification_closed_cb), |
948 | - reason_data); |
949 | - |
950 | - manager->priv->active_notifications = |
951 | - g_list_append (manager->priv->active_notifications, reason_data); |
952 | - |
953 | - notify_notification_show (notification, NULL); |
954 | - |
955 | - g_free (second_row); |
956 | - } |
957 | - } |
958 | - } |
959 | - |
960 | - if (!known_reason && |
961 | - !reason_is_blacklisted (data)) { |
962 | - NotifyNotification *notification; |
963 | - ReasonData *reason_data; |
964 | - gchar *first_row; |
965 | - gchar *second_row; |
966 | - gchar *text = NULL; |
967 | - gchar *ppd_file_name; |
968 | - ppd_file_t *ppd_file; |
969 | - char buffer[8192]; |
970 | - |
971 | - ppd_file_name = g_strdup (cupsGetPPD (printer_name)); |
972 | - if (ppd_file_name) { |
973 | - ppd_file = ppdOpenFile (ppd_file_name); |
974 | - if (ppd_file) { |
975 | - gchar **tmpv; |
976 | - static const char * const schemes[] = { |
977 | - "text", "http", "help", "file" |
978 | - }; |
979 | - |
980 | - tmpv = g_new0 (gchar *, G_N_ELEMENTS (schemes) + 1); |
981 | - i = 0; |
982 | - for (j = 0; j < G_N_ELEMENTS (schemes); j++) { |
983 | - if (ppdLocalizeIPPReason (ppd_file, data, schemes[j], buffer, sizeof (buffer))) { |
984 | - tmpv[i++] = g_strdup (buffer); |
985 | - } |
986 | - } |
987 | - |
988 | - if (i > 0) |
989 | - text = g_strjoinv (", ", tmpv); |
990 | - g_strfreev (tmpv); |
991 | - |
992 | - ppdClose (ppd_file); |
993 | - } |
994 | - |
995 | - g_unlink (ppd_file_name); |
996 | - g_free (ppd_file_name); |
997 | - } |
998 | - |
999 | - |
1000 | - if (g_str_has_suffix (data, "-report")) |
1001 | - /* Translators: This is a title of a report notification for a printer */ |
1002 | - first_row = g_strdup (_("Printer report")); |
1003 | - else if (g_str_has_suffix (data, "-warning")) |
1004 | - /* Translators: This is a title of a warning notification for a printer */ |
1005 | - first_row = g_strdup (_("Printer warning")); |
1006 | - else |
1007 | - /* Translators: This is a title of an error notification for a printer */ |
1008 | - first_row = g_strdup (_("Printer error")); |
1009 | - |
1010 | - |
1011 | - if (text == NULL) |
1012 | - text = g_strdup (data); |
1013 | - |
1014 | - /* Translators: "Printer 'MyPrinterName': 'Description of the report/warning/error from a PPD file'." */ |
1015 | - second_row = g_strdup_printf (_("Printer '%s': '%s'."), printer_name, text); |
1016 | - g_free (text); |
1017 | - |
1018 | - |
1019 | - notification = notify_notification_new (first_row, |
1020 | - second_row, |
1021 | - "printer-symbolic"); |
1022 | - notify_notification_set_app_name (notification, _("Printers")); |
1023 | - notify_notification_set_hint (notification, |
1024 | - "resident", |
1025 | - g_variant_new_boolean (TRUE)); |
1026 | - notify_notification_set_timeout (notification, REASON_TIMEOUT); |
1027 | - |
1028 | - reason_data = g_new0 (ReasonData, 1); |
1029 | - reason_data->printer_name = g_strdup (printer_name); |
1030 | - reason_data->reason = g_strdup (data); |
1031 | - reason_data->notification = notification; |
1032 | - reason_data->manager = manager; |
1033 | - |
1034 | - reason_data->notification_close_id = |
1035 | - g_signal_connect (notification, |
1036 | - "closed", |
1037 | - G_CALLBACK (notification_closed_cb), |
1038 | - reason_data); |
1039 | - |
1040 | - manager->priv->active_notifications = |
1041 | - g_list_append (manager->priv->active_notifications, reason_data); |
1042 | - |
1043 | - notify_notification_show (notification, NULL); |
1044 | - |
1045 | - g_free (first_row); |
1046 | - g_free (second_row); |
1047 | - } |
1048 | - } |
1049 | - g_slist_free (added_reasons); |
1050 | - } |
1051 | - |
1052 | - if (new_state_reasons) |
1053 | - g_strfreev (new_state_reasons); |
1054 | - |
1055 | - if (old_state_reasons) |
1056 | - g_strfreev (old_state_reasons); |
1057 | - } |
1058 | - |
1059 | - |
1060 | - if (primary_text) { |
1061 | - NotifyNotification *notification; |
1062 | - notification = notify_notification_new (primary_text, |
1063 | - secondary_text, |
1064 | - "printer-symbolic"); |
1065 | - notify_notification_set_app_name (notification, _("Printers")); |
1066 | - notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); |
1067 | - notify_notification_show (notification, NULL); |
1068 | - g_object_unref (notification); |
1069 | - g_free (primary_text); |
1070 | - g_free (secondary_text); |
1071 | - } |
1072 | -} |
1073 | - |
1074 | -static gboolean |
1075 | -process_new_notifications (gpointer user_data) |
1076 | -{ |
1077 | - GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; |
1078 | - ipp_attribute_t *attr; |
1079 | - const gchar *notify_subscribed_event = NULL; |
1080 | - const gchar *printer_name = NULL; |
1081 | - const gchar *notify_text = NULL; |
1082 | - const gchar *notify_printer_uri = NULL; |
1083 | - const gchar *job_state_reasons = NULL; |
1084 | - const gchar *job_name = NULL; |
1085 | - const char *attr_name; |
1086 | - gboolean printer_is_accepting_jobs = FALSE; |
1087 | - gchar *printer_state_reasons = NULL; |
1088 | - gchar **reasons; |
1089 | - guint notify_job_id = 0; |
1090 | - ipp_t *request; |
1091 | - ipp_t *response; |
1092 | - gint printer_state = -1; |
1093 | - gint job_state = -1; |
1094 | - gint job_impressions_completed = -1; |
1095 | - gint notify_sequence_number = -1; |
1096 | - gint i; |
1097 | - |
1098 | - request = ippNewRequest (IPP_GET_NOTIFICATIONS); |
1099 | - |
1100 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, |
1101 | - "requesting-user-name", NULL, cupsUser ()); |
1102 | - |
1103 | - ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, |
1104 | - "notify-subscription-ids", manager->priv->subscription_id); |
1105 | - |
1106 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, |
1107 | - "/printers/"); |
1108 | - |
1109 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, |
1110 | - "/jobs/"); |
1111 | - |
1112 | - ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, |
1113 | - "notify-sequence-numbers", |
1114 | - manager->priv->last_notify_sequence_number + 1); |
1115 | - |
1116 | - |
1117 | - response = cupsDoRequest (CUPS_HTTP_DEFAULT, request, "/"); |
1118 | - |
1119 | - |
1120 | - for (attr = ippFindAttribute (response, "notify-sequence-number", IPP_TAG_INTEGER); |
1121 | - attr != NULL; |
1122 | - attr = ippNextAttribute (response)) { |
1123 | - |
1124 | - attr_name = ippGetName (attr); |
1125 | - if (g_strcmp0 (attr_name, "notify-sequence-number") == 0) { |
1126 | - notify_sequence_number = ippGetInteger (attr, 0); |
1127 | - |
1128 | - if (notify_sequence_number > manager->priv->last_notify_sequence_number) |
1129 | - manager->priv->last_notify_sequence_number = notify_sequence_number; |
1130 | - |
1131 | - if (notify_subscribed_event != NULL) { |
1132 | - process_cups_notification (manager, |
1133 | - notify_subscribed_event, |
1134 | - notify_text, |
1135 | - notify_printer_uri, |
1136 | - printer_name, |
1137 | - printer_state, |
1138 | - printer_state_reasons, |
1139 | - printer_is_accepting_jobs, |
1140 | - notify_job_id, |
1141 | - job_state, |
1142 | - job_state_reasons, |
1143 | - job_name, |
1144 | - job_impressions_completed); |
1145 | - |
1146 | - g_clear_pointer (&printer_state_reasons, g_free); |
1147 | - g_clear_pointer (&job_state_reasons, g_free); |
1148 | - } |
1149 | - |
1150 | - notify_subscribed_event = NULL; |
1151 | - notify_text = NULL; |
1152 | - notify_printer_uri = NULL; |
1153 | - printer_name = NULL; |
1154 | - printer_state = -1; |
1155 | - printer_state_reasons = NULL; |
1156 | - printer_is_accepting_jobs = FALSE; |
1157 | - notify_job_id = 0; |
1158 | - job_state = -1; |
1159 | - job_state_reasons = NULL; |
1160 | - job_name = NULL; |
1161 | - job_impressions_completed = -1; |
1162 | - } else if (g_strcmp0 (attr_name, "notify-subscribed-event") == 0) { |
1163 | - notify_subscribed_event = ippGetString (attr, 0, NULL); |
1164 | - } else if (g_strcmp0 (attr_name, "notify-text") == 0) { |
1165 | - notify_text = ippGetString (attr, 0, NULL); |
1166 | - } else if (g_strcmp0 (attr_name, "notify-printer-uri") == 0) { |
1167 | - notify_printer_uri = ippGetString (attr, 0, NULL); |
1168 | - } else if (g_strcmp0 (attr_name, "printer-name") == 0) { |
1169 | - printer_name = ippGetString (attr, 0, NULL); |
1170 | - } else if (g_strcmp0 (attr_name, "printer-state") == 0) { |
1171 | - printer_state = ippGetInteger (attr, 0); |
1172 | - } else if (g_strcmp0 (attr_name, "printer-state-reasons") == 0) { |
1173 | - reasons = g_new0 (gchar *, ippGetCount (attr) + 1); |
1174 | - for (i = 0; i < ippGetCount (attr); i++) |
1175 | - reasons[i] = g_strdup (ippGetString (attr, i, NULL)); |
1176 | - printer_state_reasons = g_strjoinv (",", reasons); |
1177 | - g_strfreev (reasons); |
1178 | - } else if (g_strcmp0 (attr_name, "printer-is-accepting-jobs") == 0) { |
1179 | - printer_is_accepting_jobs = ippGetBoolean (attr, 0); |
1180 | - } else if (g_strcmp0 (attr_name, "notify-job-id") == 0) { |
1181 | - notify_job_id = ippGetInteger (attr, 0); |
1182 | - } else if (g_strcmp0 (attr_name, "job-state") == 0) { |
1183 | - job_state = ippGetInteger (attr, 0); |
1184 | - } else if (g_strcmp0 (attr_name, "job-state-reasons") == 0) { |
1185 | - reasons = g_new0 (gchar *, ippGetCount (attr) + 1); |
1186 | - for (i = 0; i < ippGetCount (attr); i++) |
1187 | - reasons[i] = g_strdup (ippGetString (attr, i, NULL)); |
1188 | - job_state_reasons = g_strjoinv (",", reasons); |
1189 | - g_strfreev (reasons); |
1190 | - } else if (g_strcmp0 (attr_name, "job-name") == 0) { |
1191 | - job_name = ippGetString (attr, 0, NULL); |
1192 | - } else if (g_strcmp0 (attr_name, "job-impressions-completed") == 0) { |
1193 | - job_impressions_completed = ippGetInteger (attr, 0); |
1194 | - } |
1195 | - } |
1196 | - |
1197 | - if (notify_subscribed_event != NULL) { |
1198 | - process_cups_notification (manager, |
1199 | - notify_subscribed_event, |
1200 | - notify_text, |
1201 | - notify_printer_uri, |
1202 | - printer_name, |
1203 | - printer_state, |
1204 | - printer_state_reasons, |
1205 | - printer_is_accepting_jobs, |
1206 | - notify_job_id, |
1207 | - job_state, |
1208 | - job_state_reasons, |
1209 | - job_name, |
1210 | - job_impressions_completed); |
1211 | - |
1212 | - g_clear_pointer (&printer_state_reasons, g_free); |
1213 | - g_clear_pointer (&job_state_reasons, g_free); |
1214 | - } |
1215 | - |
1216 | - if (response != NULL) |
1217 | - ippDelete (response); |
1218 | - |
1219 | - return TRUE; |
1220 | -} |
1221 | - |
1222 | -static void |
1223 | -scp_handler (GsdPrintNotificationsManager *manager, |
1224 | - gboolean start) |
1225 | -{ |
1226 | - if (start) { |
1227 | - GError *error = NULL; |
1228 | - char *args[2]; |
1229 | - |
1230 | - if (manager->priv->scp_handler_spawned) |
1231 | - return; |
1232 | - |
1233 | - args[0] = LIBEXECDIR "/usd-printer"; |
1234 | - args[1] = NULL; |
1235 | - |
1236 | - g_spawn_async (NULL, args, NULL, |
1237 | - 0, NULL, NULL, |
1238 | - &manager->priv->scp_handler_pid, &error); |
1239 | - |
1240 | - manager->priv->scp_handler_spawned = (error == NULL); |
1241 | - |
1242 | - if (error) { |
1243 | - g_warning ("Could not execute system-config-printer-udev handler: %s", |
1244 | - error->message); |
1245 | - g_error_free (error); |
1246 | - } |
1247 | - } else if (manager->priv->scp_handler_spawned) { |
1248 | - kill (manager->priv->scp_handler_pid, SIGHUP); |
1249 | - g_spawn_close_pid (manager->priv->scp_handler_pid); |
1250 | - manager->priv->scp_handler_spawned = FALSE; |
1251 | - } |
1252 | -} |
1253 | - |
1254 | -static void |
1255 | -cancel_subscription (gint id) |
1256 | -{ |
1257 | - http_t *http; |
1258 | - ipp_t *request; |
1259 | - |
1260 | - if (id >= 0 && |
1261 | - ((http = httpConnectEncrypt (cupsServer (), ippPort (), |
1262 | - cupsEncryption ())) != NULL)) { |
1263 | - request = ippNewRequest (IPP_CANCEL_SUBSCRIPTION); |
1264 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, |
1265 | - "printer-uri", NULL, "/"); |
1266 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, |
1267 | - "requesting-user-name", NULL, cupsUser ()); |
1268 | - ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, |
1269 | - "notify-subscription-id", id); |
1270 | - ippDelete (cupsDoRequest (http, request, "/")); |
1271 | - } |
1272 | -} |
1273 | - |
1274 | -static gboolean |
1275 | -renew_subscription (gpointer data) |
1276 | -{ |
1277 | - GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) data; |
1278 | - ipp_attribute_t *attr = NULL; |
1279 | - http_t *http; |
1280 | - ipp_t *request; |
1281 | - ipp_t *response; |
1282 | - gint num_events = 7; |
1283 | - static const char * const events[] = { |
1284 | - "job-created", |
1285 | - "job-completed", |
1286 | - "job-state-changed", |
1287 | - "job-state", |
1288 | - "printer-added", |
1289 | - "printer-deleted", |
1290 | - "printer-state-changed"}; |
1291 | - |
1292 | - if ((http = httpConnectEncrypt (cupsServer (), ippPort (), |
1293 | - cupsEncryption ())) == NULL) { |
1294 | - g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); |
1295 | - } else { |
1296 | - if (manager->priv->subscription_id >= 0) { |
1297 | - request = ippNewRequest (IPP_RENEW_SUBSCRIPTION); |
1298 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, |
1299 | - "printer-uri", NULL, "/"); |
1300 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, |
1301 | - "requesting-user-name", NULL, cupsUser ()); |
1302 | - ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, |
1303 | - "notify-subscription-id", manager->priv->subscription_id); |
1304 | - ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, |
1305 | - "notify-lease-duration", SUBSCRIPTION_DURATION); |
1306 | - ippDelete (cupsDoRequest (http, request, "/")); |
1307 | - } else { |
1308 | - request = ippNewRequest (IPP_CREATE_PRINTER_SUBSCRIPTION); |
1309 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, |
1310 | - "printer-uri", NULL, |
1311 | - "/"); |
1312 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, |
1313 | - "requesting-user-name", NULL, cupsUser ()); |
1314 | - ippAddStrings (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, |
1315 | - "notify-events", num_events, NULL, events); |
1316 | - ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, |
1317 | - "notify-pull-method", NULL, "ippget"); |
1318 | - if (server_is_local (cupsServer ())) { |
1319 | - ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI, |
1320 | - "notify-recipient-uri", NULL, "dbus://"); |
1321 | - } |
1322 | - ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, |
1323 | - "notify-lease-duration", SUBSCRIPTION_DURATION); |
1324 | - response = cupsDoRequest (http, request, "/"); |
1325 | - |
1326 | - if (response != NULL && ippGetStatusCode (response) <= IPP_OK_CONFLICT) { |
1327 | - if ((attr = ippFindAttribute (response, "notify-subscription-id", |
1328 | - IPP_TAG_INTEGER)) == NULL) |
1329 | - g_debug ("No notify-subscription-id in response!\n"); |
1330 | - else |
1331 | - manager->priv->subscription_id = ippGetInteger (attr, 0); |
1332 | - } |
1333 | - |
1334 | - if (response) |
1335 | - ippDelete (response); |
1336 | - } |
1337 | - httpClose (http); |
1338 | - } |
1339 | - return TRUE; |
1340 | -} |
1341 | - |
1342 | -static void |
1343 | -renew_subscription_with_connection_test_cb (GObject *source_object, |
1344 | - GAsyncResult *res, |
1345 | - gpointer user_data) |
1346 | -{ |
1347 | - GSocketConnection *connection; |
1348 | - GError *error = NULL; |
1349 | - |
1350 | - connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), |
1351 | - res, |
1352 | - &error); |
1353 | - |
1354 | - if (connection) { |
1355 | - g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); |
1356 | - |
1357 | - g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); |
1358 | - g_object_unref (connection); |
1359 | - |
1360 | - renew_subscription (user_data); |
1361 | - } else { |
1362 | - g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); |
1363 | - } |
1364 | -} |
1365 | - |
1366 | -static gboolean |
1367 | -renew_subscription_with_connection_test (gpointer user_data) |
1368 | -{ |
1369 | - GSocketClient *client; |
1370 | - gchar *address; |
1371 | - int port; |
1372 | - |
1373 | - port = ippPort (); |
1374 | - |
1375 | - address = g_strdup_printf ("%s:%d", cupsServer (), port); |
1376 | - |
1377 | - if (address && address[0] != '/') { |
1378 | - client = g_socket_client_new (); |
1379 | - |
1380 | - g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), port); |
1381 | - |
1382 | - g_socket_client_connect_to_host_async (client, |
1383 | - address, |
1384 | - port, |
1385 | - NULL, |
1386 | - renew_subscription_with_connection_test_cb, |
1387 | - user_data); |
1388 | - |
1389 | - g_object_unref (client); |
1390 | - } else { |
1391 | - renew_subscription (user_data); |
1392 | - } |
1393 | - |
1394 | - g_free (address); |
1395 | - |
1396 | - return TRUE; |
1397 | -} |
1398 | - |
1399 | -static void |
1400 | -renew_subscription_timeout_enable (GsdPrintNotificationsManager *manager, |
1401 | - gboolean enable, |
1402 | - gboolean with_connection_test) |
1403 | -{ |
1404 | - if (manager->priv->renew_source_id > 0) |
1405 | - g_source_remove (manager->priv->renew_source_id); |
1406 | - |
1407 | - if (enable) { |
1408 | - renew_subscription (manager); |
1409 | - if (with_connection_test) |
1410 | - manager->priv->renew_source_id = |
1411 | - g_timeout_add_seconds (RENEW_INTERVAL, |
1412 | - renew_subscription_with_connection_test, |
1413 | - manager); |
1414 | - else |
1415 | - manager->priv->renew_source_id = |
1416 | - g_timeout_add_seconds (RENEW_INTERVAL, |
1417 | - renew_subscription, |
1418 | - manager); |
1419 | - } else { |
1420 | - manager->priv->renew_source_id = 0; |
1421 | - } |
1422 | -} |
1423 | - |
1424 | -static void |
1425 | -cups_connection_test_cb (GObject *source_object, |
1426 | - GAsyncResult *res, |
1427 | - gpointer user_data) |
1428 | -{ |
1429 | - GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; |
1430 | - GSocketConnection *connection; |
1431 | - GError *error = NULL; |
1432 | - |
1433 | - connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), |
1434 | - res, |
1435 | - &error); |
1436 | - |
1437 | - if (connection) { |
1438 | - g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); |
1439 | - |
1440 | - g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); |
1441 | - g_object_unref (connection); |
1442 | - |
1443 | - manager->priv->num_dests = cupsGetDests (&manager->priv->dests); |
1444 | - g_debug ("Got dests from remote CUPS server."); |
1445 | - |
1446 | - renew_subscription_timeout_enable (manager, TRUE, TRUE); |
1447 | - manager->priv->check_source_id = g_timeout_add_seconds (CHECK_INTERVAL, process_new_notifications, manager); |
1448 | - } else { |
1449 | - g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); |
1450 | - if (manager->priv->cups_connection_timeout_id == 0) |
1451 | - manager->priv->cups_connection_timeout_id = |
1452 | - g_timeout_add_seconds (CUPS_CONNECTION_TEST_INTERVAL, cups_connection_test, manager); |
1453 | - } |
1454 | -} |
1455 | - |
1456 | -static gboolean |
1457 | -cups_connection_test (gpointer user_data) |
1458 | -{ |
1459 | - GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; |
1460 | - GSocketClient *client; |
1461 | - gchar *address; |
1462 | - int port = ippPort (); |
1463 | - |
1464 | - if (!manager->priv->dests) { |
1465 | - address = g_strdup_printf ("%s:%d", cupsServer (), port); |
1466 | - |
1467 | - client = g_socket_client_new (); |
1468 | - |
1469 | - g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), port); |
1470 | - |
1471 | - g_socket_client_connect_to_host_async (client, |
1472 | - address, |
1473 | - port, |
1474 | - NULL, |
1475 | - cups_connection_test_cb, |
1476 | - manager); |
1477 | - |
1478 | - g_object_unref (client); |
1479 | - g_free (address); |
1480 | - } |
1481 | - |
1482 | - if (manager->priv->dests) { |
1483 | - manager->priv->cups_connection_timeout_id = 0; |
1484 | - |
1485 | - return FALSE; |
1486 | - } else { |
1487 | - return TRUE; |
1488 | - } |
1489 | -} |
1490 | - |
1491 | -static void |
1492 | -gsd_print_notifications_manager_got_dbus_connection (GObject *source_object, |
1493 | - GAsyncResult *res, |
1494 | - gpointer user_data) |
1495 | -{ |
1496 | - GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; |
1497 | - GError *error = NULL; |
1498 | - |
1499 | - manager->priv->cups_bus_connection = g_bus_get_finish (res, &error); |
1500 | - |
1501 | - if (manager->priv->cups_bus_connection != NULL) { |
1502 | - manager->priv->cups_dbus_subscription_id = |
1503 | - g_dbus_connection_signal_subscribe (manager->priv->cups_bus_connection, |
1504 | - NULL, |
1505 | - CUPS_DBUS_INTERFACE, |
1506 | - NULL, |
1507 | - CUPS_DBUS_PATH, |
1508 | - NULL, |
1509 | - 0, |
1510 | - on_cups_notification, |
1511 | - manager, |
1512 | - NULL); |
1513 | - } else { |
1514 | - g_warning ("Connection to message bus failed: %s", error->message); |
1515 | - g_error_free (error); |
1516 | - } |
1517 | -} |
1518 | - |
1519 | -static gboolean |
1520 | -gsd_print_notifications_manager_start_idle (gpointer data) |
1521 | -{ |
1522 | - GsdPrintNotificationsManager *manager = data; |
1523 | - |
1524 | - gnome_settings_profile_start (NULL); |
1525 | - |
1526 | - manager->priv->printing_printers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); |
1527 | - |
1528 | - |
1529 | - if (server_is_local (cupsServer ())) { |
1530 | - manager->priv->num_dests = cupsGetDests (&manager->priv->dests); |
1531 | - g_debug ("Got dests from local CUPS server."); |
1532 | - |
1533 | - renew_subscription_timeout_enable (manager, TRUE, FALSE); |
1534 | - |
1535 | - g_bus_get (G_BUS_TYPE_SYSTEM, |
1536 | - NULL, |
1537 | - gsd_print_notifications_manager_got_dbus_connection, |
1538 | - data); |
1539 | - } else { |
1540 | - cups_connection_test (manager); |
1541 | - } |
1542 | - |
1543 | - scp_handler (manager, TRUE); |
1544 | - |
1545 | - gnome_settings_profile_end (NULL); |
1546 | - |
1547 | - return G_SOURCE_REMOVE; |
1548 | -} |
1549 | - |
1550 | -gboolean |
1551 | -gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager, |
1552 | - GError **error) |
1553 | -{ |
1554 | - g_debug ("Starting print-notifications manager"); |
1555 | - |
1556 | - gnome_settings_profile_start (NULL); |
1557 | - |
1558 | - manager->priv->subscription_id = -1; |
1559 | - manager->priv->dests = NULL; |
1560 | - manager->priv->num_dests = 0; |
1561 | - manager->priv->scp_handler_spawned = FALSE; |
1562 | - manager->priv->timeouts = NULL; |
1563 | - manager->priv->printing_printers = NULL; |
1564 | - manager->priv->active_notifications = NULL; |
1565 | - manager->priv->cups_bus_connection = NULL; |
1566 | - manager->priv->cups_connection_timeout_id = 0; |
1567 | - manager->priv->last_notify_sequence_number = -1; |
1568 | - |
1569 | - g_idle_add (gsd_print_notifications_manager_start_idle, manager); |
1570 | - |
1571 | - gnome_settings_profile_end (NULL); |
1572 | - |
1573 | - return TRUE; |
1574 | -} |
1575 | - |
1576 | -void |
1577 | -gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager) |
1578 | -{ |
1579 | - TimeoutData *data; |
1580 | - ReasonData *reason_data; |
1581 | - GList *tmp; |
1582 | - |
1583 | - g_debug ("Stopping print-notifications manager"); |
1584 | - |
1585 | - cupsFreeDests (manager->priv->num_dests, manager->priv->dests); |
1586 | - manager->priv->num_dests = 0; |
1587 | - manager->priv->dests = NULL; |
1588 | - |
1589 | - if (manager->priv->cups_dbus_subscription_id > 0 && |
1590 | - manager->priv->cups_bus_connection != NULL) { |
1591 | - g_dbus_connection_signal_unsubscribe (manager->priv->cups_bus_connection, |
1592 | - manager->priv->cups_dbus_subscription_id); |
1593 | - manager->priv->cups_dbus_subscription_id = 0; |
1594 | - } |
1595 | - |
1596 | - renew_subscription_timeout_enable (manager, FALSE, FALSE); |
1597 | - |
1598 | - if (manager->priv->check_source_id > 0) { |
1599 | - g_source_remove (manager->priv->check_source_id); |
1600 | - manager->priv->check_source_id = 0; |
1601 | - } |
1602 | - |
1603 | - if (manager->priv->subscription_id >= 0) |
1604 | - cancel_subscription (manager->priv->subscription_id); |
1605 | - |
1606 | - if (manager->priv->printing_printers) |
1607 | - g_hash_table_destroy (manager->priv->printing_printers); |
1608 | - |
1609 | - g_clear_object (&manager->priv->cups_bus_connection); |
1610 | - |
1611 | - for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { |
1612 | - data = (TimeoutData *) tmp->data; |
1613 | - if (data) |
1614 | - g_source_remove (data->timeout_id); |
1615 | - } |
1616 | - g_list_free_full (manager->priv->timeouts, free_timeout_data); |
1617 | - |
1618 | - for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { |
1619 | - reason_data = (ReasonData *) tmp->data; |
1620 | - if (reason_data) { |
1621 | - if (reason_data->notification_close_id > 0 && |
1622 | - g_signal_handler_is_connected (reason_data->notification, |
1623 | - reason_data->notification_close_id)) { |
1624 | - g_signal_handler_disconnect (reason_data->notification, |
1625 | - reason_data->notification_close_id); |
1626 | - reason_data->notification_close_id = 0; |
1627 | - } |
1628 | - |
1629 | - notify_notification_close (reason_data->notification, NULL); |
1630 | - } |
1631 | - } |
1632 | - g_list_free_full (manager->priv->active_notifications, free_reason_data); |
1633 | - |
1634 | - scp_handler (manager, FALSE); |
1635 | -} |
1636 | - |
1637 | -static GObject * |
1638 | -gsd_print_notifications_manager_constructor (GType type, |
1639 | - guint n_construct_properties, |
1640 | - GObjectConstructParam *construct_properties) |
1641 | -{ |
1642 | - GsdPrintNotificationsManager *print_notifications_manager; |
1643 | - |
1644 | - print_notifications_manager = GSD_PRINT_NOTIFICATIONS_MANAGER (G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->constructor (type, |
1645 | - n_construct_properties, |
1646 | - construct_properties)); |
1647 | - |
1648 | - return G_OBJECT (print_notifications_manager); |
1649 | -} |
1650 | - |
1651 | -static void |
1652 | -gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass) |
1653 | -{ |
1654 | - GObjectClass *object_class = G_OBJECT_CLASS (klass); |
1655 | - |
1656 | - object_class->constructor = gsd_print_notifications_manager_constructor; |
1657 | - object_class->finalize = gsd_print_notifications_manager_finalize; |
1658 | - |
1659 | - g_type_class_add_private (klass, sizeof (GsdPrintNotificationsManagerPrivate)); |
1660 | -} |
1661 | - |
1662 | -static void |
1663 | -gsd_print_notifications_manager_init (GsdPrintNotificationsManager *manager) |
1664 | -{ |
1665 | - manager->priv = GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE (manager); |
1666 | - |
1667 | -} |
1668 | - |
1669 | -static void |
1670 | -gsd_print_notifications_manager_finalize (GObject *object) |
1671 | -{ |
1672 | - GsdPrintNotificationsManager *manager; |
1673 | - |
1674 | - g_return_if_fail (object != NULL); |
1675 | - g_return_if_fail (GSD_IS_PRINT_NOTIFICATIONS_MANAGER (object)); |
1676 | - |
1677 | - manager = GSD_PRINT_NOTIFICATIONS_MANAGER (object); |
1678 | - |
1679 | - g_return_if_fail (manager->priv != NULL); |
1680 | - |
1681 | - G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->finalize (object); |
1682 | -} |
1683 | - |
1684 | -GsdPrintNotificationsManager * |
1685 | -gsd_print_notifications_manager_new (void) |
1686 | -{ |
1687 | - if (manager_object != NULL) { |
1688 | - g_object_ref (manager_object); |
1689 | - } else { |
1690 | - manager_object = g_object_new (GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, NULL); |
1691 | - g_object_add_weak_pointer (manager_object, |
1692 | - (gpointer *) &manager_object); |
1693 | - } |
1694 | - |
1695 | - return GSD_PRINT_NOTIFICATIONS_MANAGER (manager_object); |
1696 | -} |
1697 | |
1698 | === removed file 'plugins/print-notifications/gsd-print-notifications-manager.h' |
1699 | --- plugins/print-notifications/gsd-print-notifications-manager.h 2011-01-29 00:21:34 +0000 |
1700 | +++ plugins/print-notifications/gsd-print-notifications-manager.h 1970-01-01 00:00:00 +0000 |
1701 | @@ -1,57 +0,0 @@ |
1702 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
1703 | - * |
1704 | - * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> |
1705 | - * |
1706 | - * This program is free software; you can redistribute it and/or modify |
1707 | - * it under the terms of the GNU General Public License as published by |
1708 | - * the Free Software Foundation; either version 2 of the License, or |
1709 | - * (at your option) any later version. |
1710 | - * |
1711 | - * This program is distributed in the hope that it will be useful, |
1712 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1713 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1714 | - * GNU General Public License for more details. |
1715 | - * |
1716 | - * You should have received a copy of the GNU General Public License |
1717 | - * along with this program; if not, write to the Free Software |
1718 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1719 | - * |
1720 | - */ |
1721 | - |
1722 | -#ifndef __GSD_PRINT_NOTIFICATIONS_MANAGER_H |
1723 | -#define __GSD_PRINT_NOTIFICATIONS_MANAGER_H |
1724 | - |
1725 | -#include <glib-object.h> |
1726 | - |
1727 | -G_BEGIN_DECLS |
1728 | - |
1729 | -#define GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER (gsd_print_notifications_manager_get_type ()) |
1730 | -#define GSD_PRINT_NOTIFICATIONS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManager)) |
1731 | -#define GSD_PRINT_NOTIFICATIONS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerClass)) |
1732 | -#define GSD_IS_PRINT_NOTIFICATIONS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER)) |
1733 | -#define GSD_IS_PRINT_NOTIFICATIONS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER)) |
1734 | -#define GSD_PRINT_NOTIFICATIONS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerClass)) |
1735 | - |
1736 | -typedef struct GsdPrintNotificationsManagerPrivate GsdPrintNotificationsManagerPrivate; |
1737 | - |
1738 | -typedef struct |
1739 | -{ |
1740 | - GObject parent; |
1741 | - GsdPrintNotificationsManagerPrivate *priv; |
1742 | -} GsdPrintNotificationsManager; |
1743 | - |
1744 | -typedef struct |
1745 | -{ |
1746 | - GObjectClass parent_class; |
1747 | -} GsdPrintNotificationsManagerClass; |
1748 | - |
1749 | -GType gsd_print_notifications_manager_get_type (void); |
1750 | - |
1751 | -GsdPrintNotificationsManager *gsd_print_notifications_manager_new (void); |
1752 | -gboolean gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager, |
1753 | - GError **error); |
1754 | -void gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager); |
1755 | - |
1756 | -G_END_DECLS |
1757 | - |
1758 | -#endif /* __GSD_PRINT_NOTIFICATIONS_MANAGER_H */ |
1759 | |
1760 | === removed file 'plugins/print-notifications/gsd-print-notifications-plugin.c' |
1761 | --- plugins/print-notifications/gsd-print-notifications-plugin.c 2012-12-13 16:25:59 +0000 |
1762 | +++ plugins/print-notifications/gsd-print-notifications-plugin.c 1970-01-01 00:00:00 +0000 |
1763 | @@ -1,29 +0,0 @@ |
1764 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
1765 | - * |
1766 | - * Copyright (C) 2011 Red Hat, Inc. |
1767 | - * |
1768 | - * This program is free software; you can redistribute it and/or modify |
1769 | - * it under the terms of the GNU General Public License as published by |
1770 | - * the Free Software Foundation; either version 2, or (at your option) |
1771 | - * any later version. |
1772 | - * |
1773 | - * This program is distributed in the hope that it will be useful, |
1774 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1775 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1776 | - * GNU General Public License for more details. |
1777 | - * |
1778 | - * You should have received a copy of the GNU General Public License |
1779 | - * along with this program; if not, write to the Free Software |
1780 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1781 | - * |
1782 | - */ |
1783 | - |
1784 | -#include "config.h" |
1785 | - |
1786 | -#include <glib/gi18n-lib.h> |
1787 | -#include <gmodule.h> |
1788 | - |
1789 | -#include "gnome-settings-plugin.h" |
1790 | -#include "gsd-print-notifications-manager.h" |
1791 | - |
1792 | -GNOME_SETTINGS_PLUGIN_REGISTER (GsdPrintNotifications, gsd_print_notifications) |
1793 | |
1794 | === removed file 'plugins/print-notifications/gsd-printer.c' |
1795 | --- plugins/print-notifications/gsd-printer.c 2013-12-04 23:55:26 +0000 |
1796 | +++ plugins/print-notifications/gsd-printer.c 1970-01-01 00:00:00 +0000 |
1797 | @@ -1,1403 +0,0 @@ |
1798 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
1799 | - * |
1800 | - * Copyright (C) 2011 Red Hat, Inc. |
1801 | - * |
1802 | - * This program is free software; you can redistribute it and/or modify |
1803 | - * it under the terms of the GNU General Public License as published by |
1804 | - * the Free Software Foundation; either version 2, or (at your option) |
1805 | - * any later version. |
1806 | - * |
1807 | - * This program is distributed in the hope that it will be useful, |
1808 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1809 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1810 | - * GNU General Public License for more details. |
1811 | - * |
1812 | - * You should have received a copy of the GNU General Public License |
1813 | - * along with this program; if not, write to the Free Software |
1814 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1815 | - * |
1816 | - */ |
1817 | - |
1818 | -#include "config.h" |
1819 | -#include <gio/gio.h> |
1820 | -#include <stdlib.h> |
1821 | -#include <libnotify/notify.h> |
1822 | -#include <glib/gi18n.h> |
1823 | -#include <glib/gstdio.h> |
1824 | -#include <gtk/gtk.h> |
1825 | -#include <cups/cups.h> |
1826 | -#include <cups/ppd.h> |
1827 | - |
1828 | -static GDBusNodeInfo *npn_introspection_data = NULL; |
1829 | -static GDBusNodeInfo *pdi_introspection_data = NULL; |
1830 | - |
1831 | -#define SCP_DBUS_NPN_NAME "com.redhat.NewPrinterNotification" |
1832 | -#define SCP_DBUS_NPN_PATH "/com/redhat/NewPrinterNotification" |
1833 | -#define SCP_DBUS_NPN_INTERFACE "com.redhat.NewPrinterNotification" |
1834 | - |
1835 | -#define SCP_DBUS_PDI_NAME "com.redhat.PrinterDriversInstaller" |
1836 | -#define SCP_DBUS_PDI_PATH "/com/redhat/PrinterDriversInstaller" |
1837 | -#define SCP_DBUS_PDI_INTERFACE "com.redhat.PrinterDriversInstaller" |
1838 | - |
1839 | -#define PACKAGE_KIT_BUS "org.freedesktop.PackageKit" |
1840 | -#define PACKAGE_KIT_PATH "/org/freedesktop/PackageKit" |
1841 | -#define PACKAGE_KIT_MODIFY_IFACE "org.freedesktop.PackageKit.Modify" |
1842 | -#define PACKAGE_KIT_QUERY_IFACE "org.freedesktop.PackageKit.Query" |
1843 | - |
1844 | -#define SCP_BUS "org.fedoraproject.Config.Printing" |
1845 | -#define SCP_PATH "/org/fedoraproject/Config/Printing" |
1846 | -#define SCP_IFACE "org.fedoraproject.Config.Printing" |
1847 | - |
1848 | -#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism" |
1849 | - |
1850 | -#define ALLOWED_CHARACTERS "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_" |
1851 | - |
1852 | -#define DBUS_TIMEOUT 60000 |
1853 | -#define DBUS_INSTALL_TIMEOUT 3600000 |
1854 | - |
1855 | -#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" |
1856 | -#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" |
1857 | -#define GNOME_SESSION_DBUS_IFACE "org.gnome.SessionManager" |
1858 | -#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_IFACE "org.gnome.SessionManager.ClientPrivate" |
1859 | - |
1860 | -#define GNOME_SESSION_PRESENCE_DBUS_PATH "/org/gnome/SessionManager/Presence" |
1861 | -#define GNOME_SESSION_PRESENCE_DBUS_IFACE "org.gnome.SessionManager.Presence" |
1862 | - |
1863 | -#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) |
1864 | -#define HAVE_CUPS_1_6 1 |
1865 | -#endif |
1866 | - |
1867 | -#ifndef HAVE_CUPS_1_6 |
1868 | -#define ippGetState(ipp) ipp->state |
1869 | -#endif |
1870 | - |
1871 | -enum { |
1872 | - PRESENCE_STATUS_AVAILABLE = 0, |
1873 | - PRESENCE_STATUS_INVISIBLE, |
1874 | - PRESENCE_STATUS_BUSY, |
1875 | - PRESENCE_STATUS_IDLE, |
1876 | - PRESENCE_STATUS_UNKNOWN |
1877 | -}; |
1878 | - |
1879 | -static const gchar npn_introspection_xml[] = |
1880 | - "<node name='/com/redhat/NewPrinterNotification'>" |
1881 | - " <interface name='com.redhat.NewPrinterNotification'>" |
1882 | - " <method name='GetReady'>" |
1883 | - " </method>" |
1884 | - " <method name='NewPrinter'>" |
1885 | - " <arg type='i' name='status' direction='in'/>" |
1886 | - " <arg type='s' name='name' direction='in'/>" |
1887 | - " <arg type='s' name='mfg' direction='in'/>" |
1888 | - " <arg type='s' name='mdl' direction='in'/>" |
1889 | - " <arg type='s' name='des' direction='in'/>" |
1890 | - " <arg type='s' name='cmd' direction='in'/>" |
1891 | - " </method>" |
1892 | - " </interface>" |
1893 | - "</node>"; |
1894 | - |
1895 | -static const gchar pdi_introspection_xml[] = |
1896 | - "<node name='/com/redhat/PrinterDriversInstaller'>" |
1897 | - " <interface name='com.redhat.PrinterDriversInstaller'>" |
1898 | - " <method name='InstallDrivers'>" |
1899 | - " <arg type='s' name='mfg' direction='in'/>" |
1900 | - " <arg type='s' name='mdl' direction='in'/>" |
1901 | - " <arg type='s' name='cmd' direction='in'/>" |
1902 | - " </method>" |
1903 | - " </interface>" |
1904 | - "</node>"; |
1905 | - |
1906 | -static GMainLoop *main_loop; |
1907 | -static guint npn_registration_id; |
1908 | -static guint pdi_registration_id; |
1909 | -static guint npn_owner_id; |
1910 | -static guint pdi_owner_id; |
1911 | - |
1912 | -static GHashTable * |
1913 | -get_missing_executables (const gchar *ppd_file_name) |
1914 | -{ |
1915 | - GHashTable *executables = NULL; |
1916 | - GDBusProxy *proxy; |
1917 | - GVariant *output; |
1918 | - GVariant *array; |
1919 | - GError *error = NULL; |
1920 | - gint i; |
1921 | - |
1922 | - if (!ppd_file_name) |
1923 | - return NULL; |
1924 | - |
1925 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
1926 | - G_DBUS_PROXY_FLAGS_NONE, |
1927 | - NULL, |
1928 | - SCP_BUS, |
1929 | - SCP_PATH, |
1930 | - SCP_IFACE, |
1931 | - NULL, |
1932 | - &error); |
1933 | - |
1934 | - if (!proxy) { |
1935 | - g_warning ("%s", error->message); |
1936 | - g_error_free (error); |
1937 | - return NULL; |
1938 | - } |
1939 | - |
1940 | - output = g_dbus_proxy_call_sync (proxy, |
1941 | - "MissingExecutables", |
1942 | - g_variant_new ("(s)", |
1943 | - ppd_file_name), |
1944 | - G_DBUS_CALL_FLAGS_NONE, |
1945 | - DBUS_TIMEOUT, |
1946 | - NULL, |
1947 | - &error); |
1948 | - |
1949 | - if (output && g_variant_n_children (output) == 1) { |
1950 | - array = g_variant_get_child_value (output, 0); |
1951 | - if (array) { |
1952 | - executables = g_hash_table_new_full (g_str_hash, g_str_equal, |
1953 | - g_free, NULL); |
1954 | - for (i = 0; i < g_variant_n_children (array); i++) { |
1955 | - g_hash_table_insert (executables, |
1956 | - g_strdup (g_variant_get_string ( |
1957 | - g_variant_get_child_value (array, i), |
1958 | - NULL)), |
1959 | - NULL); |
1960 | - } |
1961 | - } |
1962 | - } |
1963 | - |
1964 | - if (output) { |
1965 | - g_variant_unref (output); |
1966 | - } else { |
1967 | - g_warning ("%s", error->message); |
1968 | - g_error_free (error); |
1969 | - } |
1970 | - |
1971 | - g_object_unref (proxy); |
1972 | - |
1973 | - return executables; |
1974 | -} |
1975 | - |
1976 | -static GHashTable * |
1977 | -find_packages_for_executables (GHashTable *executables) |
1978 | -{ |
1979 | - GHashTableIter exec_iter; |
1980 | - GHashTable *packages = NULL; |
1981 | - GDBusProxy *proxy; |
1982 | - GVariant *output; |
1983 | - gpointer key, value; |
1984 | - GError *error = NULL; |
1985 | - |
1986 | - if (!executables || g_hash_table_size (executables) <= 0) |
1987 | - return NULL; |
1988 | - |
1989 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
1990 | - G_DBUS_PROXY_FLAGS_NONE, |
1991 | - NULL, |
1992 | - PACKAGE_KIT_BUS, |
1993 | - PACKAGE_KIT_PATH, |
1994 | - PACKAGE_KIT_QUERY_IFACE, |
1995 | - NULL, |
1996 | - &error); |
1997 | - |
1998 | - if (!proxy) { |
1999 | - g_warning ("%s", error->message); |
2000 | - g_error_free (error); |
2001 | - return NULL; |
2002 | - } |
2003 | - |
2004 | - packages = g_hash_table_new_full (g_str_hash, g_str_equal, |
2005 | - g_free, NULL); |
2006 | - |
2007 | - g_hash_table_iter_init (&exec_iter, executables); |
2008 | - while (g_hash_table_iter_next (&exec_iter, &key, &value)) { |
2009 | - output = g_dbus_proxy_call_sync (proxy, |
2010 | - "SearchFile", |
2011 | - g_variant_new ("(ss)", |
2012 | - (gchar *) key, |
2013 | - ""), |
2014 | - G_DBUS_CALL_FLAGS_NONE, |
2015 | - DBUS_TIMEOUT, |
2016 | - NULL, |
2017 | - &error); |
2018 | - |
2019 | - if (output) { |
2020 | - gboolean installed; |
2021 | - gchar *package; |
2022 | - |
2023 | - g_variant_get (output, |
2024 | - "(bs)", |
2025 | - &installed, |
2026 | - &package); |
2027 | - if (!installed) |
2028 | - g_hash_table_insert (packages, g_strdup (package), NULL); |
2029 | - |
2030 | - g_variant_unref (output); |
2031 | - } else { |
2032 | - g_warning ("%s", error->message); |
2033 | - g_error_free (error); |
2034 | - } |
2035 | - } |
2036 | - |
2037 | - g_object_unref (proxy); |
2038 | - |
2039 | - return packages; |
2040 | -} |
2041 | - |
2042 | -static void |
2043 | -install_packages (GHashTable *packages) |
2044 | -{ |
2045 | - GVariantBuilder array_builder; |
2046 | - GHashTableIter pkg_iter; |
2047 | - GDBusProxy *proxy; |
2048 | - GVariant *output; |
2049 | - gpointer key, value; |
2050 | - GError *error = NULL; |
2051 | - |
2052 | - if (!packages || g_hash_table_size (packages) <= 0) |
2053 | - return; |
2054 | - |
2055 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
2056 | - G_DBUS_PROXY_FLAGS_NONE, |
2057 | - NULL, |
2058 | - PACKAGE_KIT_BUS, |
2059 | - PACKAGE_KIT_PATH, |
2060 | - PACKAGE_KIT_MODIFY_IFACE, |
2061 | - NULL, |
2062 | - &error); |
2063 | - |
2064 | - if (!proxy) { |
2065 | - g_warning ("%s", error->message); |
2066 | - g_error_free (error); |
2067 | - return; |
2068 | - } |
2069 | - |
2070 | - g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("as")); |
2071 | - |
2072 | - g_hash_table_iter_init (&pkg_iter, packages); |
2073 | - while (g_hash_table_iter_next (&pkg_iter, &key, &value)) { |
2074 | - g_variant_builder_add (&array_builder, |
2075 | - "s", |
2076 | - (gchar *) key); |
2077 | - } |
2078 | - |
2079 | - output = g_dbus_proxy_call_sync (proxy, |
2080 | - "InstallPackageNames", |
2081 | - g_variant_new ("(uass)", |
2082 | - 0, |
2083 | - &array_builder, |
2084 | - "hide-finished"), |
2085 | - G_DBUS_CALL_FLAGS_NONE, |
2086 | - DBUS_INSTALL_TIMEOUT, |
2087 | - NULL, |
2088 | - &error); |
2089 | - |
2090 | - if (output) { |
2091 | - g_variant_unref (output); |
2092 | - } else { |
2093 | - g_warning ("%s", error->message); |
2094 | - g_error_free (error); |
2095 | - } |
2096 | - |
2097 | - g_object_unref (proxy); |
2098 | -} |
2099 | - |
2100 | -static gchar * |
2101 | -get_best_ppd (gchar *device_id, |
2102 | - gchar *device_make_and_model, |
2103 | - gchar *device_uri) |
2104 | -{ |
2105 | - GDBusProxy *proxy; |
2106 | - GVariant *output; |
2107 | - GVariant *array; |
2108 | - GVariant *tuple; |
2109 | - GError *error = NULL; |
2110 | - gchar *ppd_name = NULL; |
2111 | - gint i, j; |
2112 | - static const char * const match_levels[] = { |
2113 | - "exact-cmd", |
2114 | - "exact", |
2115 | - "close", |
2116 | - "generic", |
2117 | - "none"}; |
2118 | - |
2119 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
2120 | - G_DBUS_PROXY_FLAGS_NONE, |
2121 | - NULL, |
2122 | - SCP_BUS, |
2123 | - SCP_PATH, |
2124 | - SCP_IFACE, |
2125 | - NULL, |
2126 | - &error); |
2127 | - |
2128 | - if (!proxy) { |
2129 | - g_warning ("%s", error->message); |
2130 | - g_error_free (error); |
2131 | - return NULL; |
2132 | - } |
2133 | - |
2134 | - output = g_dbus_proxy_call_sync (proxy, |
2135 | - "GetBestDrivers", |
2136 | - g_variant_new ("(sss)", |
2137 | - device_id ? device_id : "", |
2138 | - device_make_and_model ? device_make_and_model : "", |
2139 | - device_uri ? device_uri : ""), |
2140 | - G_DBUS_CALL_FLAGS_NONE, |
2141 | - DBUS_TIMEOUT, |
2142 | - NULL, |
2143 | - &error); |
2144 | - |
2145 | - if (output && g_variant_n_children (output) >= 1) { |
2146 | - array = g_variant_get_child_value (output, 0); |
2147 | - if (array) |
2148 | - for (j = 0; j < G_N_ELEMENTS (match_levels) && ppd_name == NULL; j++) |
2149 | - for (i = 0; i < g_variant_n_children (array) && ppd_name == NULL; i++) { |
2150 | - tuple = g_variant_get_child_value (array, i); |
2151 | - if (tuple && g_variant_n_children (tuple) == 2) { |
2152 | - if (g_strcmp0 (g_variant_get_string ( |
2153 | - g_variant_get_child_value (tuple, 1), |
2154 | - NULL), match_levels[j]) == 0) |
2155 | - ppd_name = g_strdup (g_variant_get_string ( |
2156 | - g_variant_get_child_value (tuple, 0), |
2157 | - NULL)); |
2158 | - } |
2159 | - } |
2160 | - } |
2161 | - |
2162 | - if (output) { |
2163 | - g_variant_unref (output); |
2164 | - } else { |
2165 | - g_warning ("%s", error->message); |
2166 | - g_error_free (error); |
2167 | - } |
2168 | - |
2169 | - g_object_unref (proxy); |
2170 | - |
2171 | - return ppd_name; |
2172 | -} |
2173 | - |
2174 | -static gchar * |
2175 | -get_tag_value (const gchar *tag_string, |
2176 | - const gchar *tag_name) |
2177 | -{ |
2178 | - gchar **tag_string_splitted; |
2179 | - gchar *tag_value = NULL; |
2180 | - gint tag_name_length; |
2181 | - gint i; |
2182 | - |
2183 | - if (!tag_string || |
2184 | - !tag_name) |
2185 | - return NULL; |
2186 | - |
2187 | - tag_name_length = strlen (tag_name); |
2188 | - tag_string_splitted = g_strsplit (tag_string, ";", 0); |
2189 | - if (tag_string_splitted) { |
2190 | - for (i = 0; i < g_strv_length (tag_string_splitted); i++) |
2191 | - if (g_ascii_strncasecmp (tag_string_splitted[i], tag_name, tag_name_length) == 0) |
2192 | - if (strlen (tag_string_splitted[i]) > tag_name_length + 1) |
2193 | - tag_value = g_strdup (tag_string_splitted[i] + tag_name_length + 1); |
2194 | - |
2195 | - g_strfreev (tag_string_splitted); |
2196 | - } |
2197 | - |
2198 | - return tag_value; |
2199 | -} |
2200 | - |
2201 | -static gchar * |
2202 | -create_name (gchar *device_id) |
2203 | -{ |
2204 | - cups_dest_t *dests; |
2205 | - gboolean already_present = FALSE; |
2206 | - gchar *name = NULL; |
2207 | - gchar *new_name = NULL; |
2208 | - gint num_dests; |
2209 | - gint name_index = 2; |
2210 | - gint j; |
2211 | - |
2212 | - g_return_val_if_fail (device_id != NULL, NULL); |
2213 | - |
2214 | - name = get_tag_value (device_id, "mdl"); |
2215 | - if (!name) |
2216 | - name = get_tag_value (device_id, "model"); |
2217 | - |
2218 | - if (name) |
2219 | - name = g_strcanon (name, ALLOWED_CHARACTERS, '-'); |
2220 | - |
2221 | - num_dests = cupsGetDests (&dests); |
2222 | - do { |
2223 | - if (already_present) { |
2224 | - new_name = g_strdup_printf ("%s-%d", name, name_index); |
2225 | - name_index++; |
2226 | - } else { |
2227 | - new_name = g_strdup (name); |
2228 | - } |
2229 | - |
2230 | - already_present = FALSE; |
2231 | - for (j = 0; j < num_dests; j++) |
2232 | - if (g_strcmp0 (dests[j].name, new_name) == 0) |
2233 | - already_present = TRUE; |
2234 | - |
2235 | - if (already_present) { |
2236 | - g_free (new_name); |
2237 | - } else { |
2238 | - g_free (name); |
2239 | - name = new_name; |
2240 | - } |
2241 | - } while (already_present); |
2242 | - cupsFreeDests (num_dests, dests); |
2243 | - |
2244 | - return name; |
2245 | -} |
2246 | - |
2247 | -static gboolean |
2248 | -add_printer (gchar *printer_name, |
2249 | - gchar *device_uri, |
2250 | - gchar *ppd_name, |
2251 | - gchar *info, |
2252 | - gchar *location) |
2253 | -{ |
2254 | - cups_dest_t *dests; |
2255 | - GDBusProxy *proxy; |
2256 | - gboolean success = FALSE; |
2257 | - GVariant *output; |
2258 | - GError *error = NULL; |
2259 | - gint num_dests; |
2260 | - gint i; |
2261 | - |
2262 | - if (!printer_name || !device_uri || !ppd_name) |
2263 | - return FALSE; |
2264 | - |
2265 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2266 | - G_DBUS_PROXY_FLAGS_NONE, |
2267 | - NULL, |
2268 | - MECHANISM_BUS, |
2269 | - "/", |
2270 | - MECHANISM_BUS, |
2271 | - NULL, |
2272 | - &error); |
2273 | - |
2274 | - if (!proxy) { |
2275 | - g_warning ("%s", error->message); |
2276 | - g_error_free (error); |
2277 | - return FALSE; |
2278 | - } |
2279 | - |
2280 | - output = g_dbus_proxy_call_sync (proxy, |
2281 | - "PrinterAdd", |
2282 | - g_variant_new ("(sssss)", |
2283 | - printer_name, |
2284 | - device_uri, |
2285 | - ppd_name, |
2286 | - info ? info : "", |
2287 | - location ? location : ""), |
2288 | - G_DBUS_CALL_FLAGS_NONE, |
2289 | - DBUS_TIMEOUT, |
2290 | - NULL, |
2291 | - &error); |
2292 | - |
2293 | - if (output) { |
2294 | - g_variant_unref (output); |
2295 | - } else { |
2296 | - g_warning ("%s", error->message); |
2297 | - g_error_free (error); |
2298 | - } |
2299 | - |
2300 | - g_object_unref (proxy); |
2301 | - |
2302 | - num_dests = cupsGetDests (&dests); |
2303 | - for (i = 0; i < num_dests; i++) |
2304 | - if (g_strcmp0 (dests[i].name, printer_name) == 0) |
2305 | - success = TRUE; |
2306 | - cupsFreeDests (num_dests, dests); |
2307 | - |
2308 | - return success; |
2309 | -} |
2310 | - |
2311 | -static gboolean |
2312 | -printer_set_enabled (const gchar *printer_name, |
2313 | - gboolean enabled) |
2314 | -{ |
2315 | - GDBusProxy *proxy; |
2316 | - gboolean result = TRUE; |
2317 | - GVariant *output; |
2318 | - GError *error = NULL; |
2319 | - |
2320 | - if (!printer_name) |
2321 | - return FALSE; |
2322 | - |
2323 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2324 | - G_DBUS_PROXY_FLAGS_NONE, |
2325 | - NULL, |
2326 | - MECHANISM_BUS, |
2327 | - "/", |
2328 | - MECHANISM_BUS, |
2329 | - NULL, |
2330 | - &error); |
2331 | - |
2332 | - if (!proxy) { |
2333 | - g_warning ("%s", error->message); |
2334 | - g_error_free (error); |
2335 | - return FALSE; |
2336 | - } |
2337 | - |
2338 | - output = g_dbus_proxy_call_sync (proxy, |
2339 | - "PrinterSetEnabled", |
2340 | - g_variant_new ("(sb)", |
2341 | - printer_name, |
2342 | - enabled), |
2343 | - G_DBUS_CALL_FLAGS_NONE, |
2344 | - DBUS_TIMEOUT, |
2345 | - NULL, |
2346 | - &error); |
2347 | - |
2348 | - if (output) { |
2349 | - g_variant_unref (output); |
2350 | - } else { |
2351 | - g_warning ("%s", error->message); |
2352 | - g_error_free (error); |
2353 | - result = FALSE; |
2354 | - } |
2355 | - |
2356 | - g_object_unref (proxy); |
2357 | - |
2358 | - return result; |
2359 | -} |
2360 | - |
2361 | -static gboolean |
2362 | -printer_set_accepting_jobs (const gchar *printer_name, |
2363 | - gboolean accepting_jobs, |
2364 | - const gchar *reason) |
2365 | -{ |
2366 | - GDBusProxy *proxy; |
2367 | - gboolean result = TRUE; |
2368 | - GVariant *output; |
2369 | - GError *error = NULL; |
2370 | - |
2371 | - if (!printer_name) |
2372 | - return FALSE; |
2373 | - |
2374 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2375 | - G_DBUS_PROXY_FLAGS_NONE, |
2376 | - NULL, |
2377 | - MECHANISM_BUS, |
2378 | - "/", |
2379 | - MECHANISM_BUS, |
2380 | - NULL, |
2381 | - &error); |
2382 | - |
2383 | - if (!proxy) { |
2384 | - g_warning ("%s", error->message); |
2385 | - g_error_free (error); |
2386 | - return FALSE; |
2387 | - } |
2388 | - |
2389 | - output = g_dbus_proxy_call_sync (proxy, |
2390 | - "PrinterSetAcceptJobs", |
2391 | - g_variant_new ("(sbs)", |
2392 | - printer_name, |
2393 | - accepting_jobs, |
2394 | - reason ? reason : ""), |
2395 | - G_DBUS_CALL_FLAGS_NONE, |
2396 | - DBUS_TIMEOUT, |
2397 | - NULL, |
2398 | - &error); |
2399 | - |
2400 | - if (output) { |
2401 | - g_variant_unref (output); |
2402 | - } else { |
2403 | - g_warning ("%s", error->message); |
2404 | - g_error_free (error); |
2405 | - result = FALSE; |
2406 | - } |
2407 | - |
2408 | - g_object_unref (proxy); |
2409 | - |
2410 | - return result; |
2411 | -} |
2412 | - |
2413 | -static ipp_t * |
2414 | -execute_maintenance_command (const char *printer_name, |
2415 | - const char *command, |
2416 | - const char *title) |
2417 | -{ |
2418 | - http_t *http; |
2419 | - GError *error = NULL; |
2420 | - ipp_t *request = NULL; |
2421 | - ipp_t *response = NULL; |
2422 | - gchar *file_name = NULL; |
2423 | - char *uri; |
2424 | - int fd = -1; |
2425 | - |
2426 | - http = httpConnectEncrypt (cupsServer (), |
2427 | - ippPort (), |
2428 | - cupsEncryption ()); |
2429 | - |
2430 | - if (!http) |
2431 | - return NULL; |
2432 | - |
2433 | - request = ippNewRequest (IPP_PRINT_JOB); |
2434 | - |
2435 | - uri = g_strdup_printf ("ipp://localhost/printers/%s", |
2436 | - printer_name); |
2437 | - |
2438 | - ippAddString (request, |
2439 | - IPP_TAG_OPERATION, |
2440 | - IPP_TAG_URI, |
2441 | - "printer-uri", |
2442 | - NULL, |
2443 | - uri); |
2444 | - |
2445 | - g_free (uri); |
2446 | - |
2447 | - ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", |
2448 | - NULL, title); |
2449 | - |
2450 | - ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format", |
2451 | - NULL, "application/vnd.cups-command"); |
2452 | - |
2453 | - fd = g_file_open_tmp ("ccXXXXXX", &file_name, &error); |
2454 | - |
2455 | - if (fd != -1) { |
2456 | - FILE *file; |
2457 | - |
2458 | - file = fdopen (fd, "w"); |
2459 | - fprintf (file, "#CUPS-COMMAND\n"); |
2460 | - fprintf (file, "%s\n", command); |
2461 | - fclose (file); |
2462 | - |
2463 | - response = cupsDoFileRequest (http, request, "/", file_name); |
2464 | - g_unlink (file_name); |
2465 | - } else { |
2466 | - g_warning ("%s", error->message); |
2467 | - g_error_free (error); |
2468 | - } |
2469 | - |
2470 | - g_free (file_name); |
2471 | - httpClose (http); |
2472 | - |
2473 | - return response; |
2474 | -} |
2475 | - |
2476 | -static char * |
2477 | -get_dest_attr (const char *dest_name, |
2478 | - const char *attr) |
2479 | -{ |
2480 | - cups_dest_t *dests; |
2481 | - int num_dests; |
2482 | - cups_dest_t *dest; |
2483 | - const char *value; |
2484 | - char *ret; |
2485 | - |
2486 | - if (dest_name == NULL) |
2487 | - return NULL; |
2488 | - |
2489 | - ret = NULL; |
2490 | - |
2491 | - num_dests = cupsGetDests (&dests); |
2492 | - if (num_dests < 1) { |
2493 | - g_debug ("Unable to get printer destinations"); |
2494 | - return NULL; |
2495 | - } |
2496 | - |
2497 | - dest = cupsGetDest (dest_name, NULL, num_dests, dests); |
2498 | - if (dest == NULL) { |
2499 | - g_debug ("Unable to find a printer named '%s'", dest_name); |
2500 | - goto out; |
2501 | - } |
2502 | - |
2503 | - value = cupsGetOption (attr, dest->num_options, dest->options); |
2504 | - if (value == NULL) { |
2505 | - g_debug ("Unable to get %s for '%s'", attr, dest_name); |
2506 | - goto out; |
2507 | - } |
2508 | - ret = g_strdup (value); |
2509 | -out: |
2510 | - cupsFreeDests (num_dests, dests); |
2511 | - |
2512 | - return ret; |
2513 | -} |
2514 | - |
2515 | -static void |
2516 | -printer_autoconfigure (gchar *printer_name) |
2517 | -{ |
2518 | - gchar *commands; |
2519 | - gchar *commands_lowercase; |
2520 | - ipp_t *response = NULL; |
2521 | - |
2522 | - if (!printer_name) |
2523 | - return; |
2524 | - |
2525 | - commands = get_dest_attr (printer_name, "printer-commands"); |
2526 | - commands_lowercase = g_ascii_strdown (commands, -1); |
2527 | - |
2528 | - if (g_strrstr (commands_lowercase, "autoconfigure")) { |
2529 | - response = execute_maintenance_command (printer_name, |
2530 | - "AutoConfigure", |
2531 | - ("Automatic configuration")); |
2532 | - if (response) { |
2533 | - if (ippGetState (response) == IPP_ERROR) |
2534 | - g_warning ("An error has occured during automatic configuration of new printer."); |
2535 | - ippDelete (response); |
2536 | - } |
2537 | - } |
2538 | - g_free (commands); |
2539 | - g_free (commands_lowercase); |
2540 | -} |
2541 | - |
2542 | -/* Return default media size for current locale */ |
2543 | -static const gchar * |
2544 | -get_paper_size_from_locale () |
2545 | -{ |
2546 | - if (g_str_equal (gtk_paper_size_get_default (), GTK_PAPER_NAME_LETTER)) |
2547 | - return "na-letter"; |
2548 | - else |
2549 | - return "iso-a4"; |
2550 | -} |
2551 | - |
2552 | -static void |
2553 | -set_default_paper_size (const gchar *printer_name, |
2554 | - const gchar *ppd_file_name) |
2555 | -{ |
2556 | - GDBusProxy *proxy; |
2557 | - GVariant *output; |
2558 | - GError *error = NULL; |
2559 | - GVariantBuilder *builder; |
2560 | - |
2561 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
2562 | - G_DBUS_PROXY_FLAGS_NONE, |
2563 | - NULL, |
2564 | - MECHANISM_BUS, |
2565 | - "/", |
2566 | - MECHANISM_BUS, |
2567 | - NULL, |
2568 | - &error); |
2569 | - |
2570 | - if (!proxy) { |
2571 | - g_warning ("%s", error->message); |
2572 | - g_error_free (error); |
2573 | - return; |
2574 | - } |
2575 | - |
2576 | - /* Set default media size according to the locale |
2577 | - * FIXME: Handle more than A4 and Letter: |
2578 | - * https://bugzilla.gnome.org/show_bug.cgi?id=660769 */ |
2579 | - builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); |
2580 | - g_variant_builder_add (builder, "s", get_paper_size_from_locale ()); |
2581 | - |
2582 | - output = g_dbus_proxy_call_sync (proxy, |
2583 | - "PrinterAddOption", |
2584 | - g_variant_new ("(ssas)", |
2585 | - printer_name ? printer_name : "", |
2586 | - "media", |
2587 | - builder), |
2588 | - G_DBUS_CALL_FLAGS_NONE, |
2589 | - DBUS_TIMEOUT, |
2590 | - NULL, |
2591 | - &error); |
2592 | - |
2593 | - if (output) { |
2594 | - g_variant_unref (output); |
2595 | - } else { |
2596 | - if (!(error->domain == G_DBUS_ERROR && |
2597 | - (error->code == G_DBUS_ERROR_SERVICE_UNKNOWN || |
2598 | - error->code == G_DBUS_ERROR_UNKNOWN_METHOD))) |
2599 | - g_warning ("%s", error->message); |
2600 | - g_error_free (error); |
2601 | - } |
2602 | - |
2603 | - g_object_unref (proxy); |
2604 | -} |
2605 | - |
2606 | -/* |
2607 | - * Setup new printer and returns TRUE if successful. |
2608 | - */ |
2609 | -static gboolean |
2610 | -setup_printer (gchar *device_id, |
2611 | - gchar *device_make_and_model, |
2612 | - gchar *device_uri) |
2613 | -{ |
2614 | - gboolean success = FALSE; |
2615 | - gchar *ppd_name; |
2616 | - gchar *printer_name; |
2617 | - |
2618 | - ppd_name = get_best_ppd (device_id, device_make_and_model, device_uri); |
2619 | - printer_name = create_name (device_id); |
2620 | - |
2621 | - if (!ppd_name || !printer_name || !device_uri) { |
2622 | - g_free (ppd_name); |
2623 | - g_free (printer_name); |
2624 | - return FALSE; |
2625 | - } |
2626 | - |
2627 | - success = add_printer (printer_name, device_uri, |
2628 | - ppd_name, NULL, NULL); |
2629 | - |
2630 | - /* Set some options of the new printer */ |
2631 | - if (success) { |
2632 | - const char *ppd_file_name; |
2633 | - |
2634 | - printer_set_accepting_jobs (printer_name, TRUE, NULL); |
2635 | - printer_set_enabled (printer_name, TRUE); |
2636 | - printer_autoconfigure (printer_name); |
2637 | - |
2638 | - ppd_file_name = cupsGetPPD (printer_name); |
2639 | - |
2640 | - if (ppd_file_name) { |
2641 | - GHashTable *executables; |
2642 | - GHashTable *packages; |
2643 | - |
2644 | - set_default_paper_size (printer_name, ppd_file_name); |
2645 | - |
2646 | - executables = get_missing_executables (ppd_file_name); |
2647 | - packages = find_packages_for_executables (executables); |
2648 | - install_packages (packages); |
2649 | - |
2650 | - if (executables) |
2651 | - g_hash_table_destroy (executables); |
2652 | - if (packages) |
2653 | - g_hash_table_destroy (packages); |
2654 | - g_unlink (ppd_file_name); |
2655 | - } |
2656 | - } |
2657 | - |
2658 | - g_free (printer_name); |
2659 | - g_free (ppd_name); |
2660 | - |
2661 | - return success; |
2662 | -} |
2663 | - |
2664 | -static void |
2665 | -handle_method_call (GDBusConnection *connection, |
2666 | - const gchar *sender, |
2667 | - const gchar *object_path, |
2668 | - const gchar *interface_name, |
2669 | - const gchar *method_name, |
2670 | - GVariant *parameters, |
2671 | - GDBusMethodInvocation *invocation, |
2672 | - gpointer user_data) |
2673 | -{ |
2674 | - gchar *primary_text = NULL; |
2675 | - gchar *secondary_text = NULL; |
2676 | - gchar *name = NULL; |
2677 | - gchar *mfg = NULL; |
2678 | - gchar *mdl = NULL; |
2679 | - gchar *des = NULL; |
2680 | - gchar *cmd = NULL; |
2681 | - gchar *device = NULL; |
2682 | - gchar *device_id; |
2683 | - gchar *make_and_model; |
2684 | - gint status = 0; |
2685 | - |
2686 | - if (g_strcmp0 (method_name, "GetReady") == 0) { |
2687 | - /* Translators: We are configuring new printer */ |
2688 | - primary_text = g_strdup (_("Configuring new printer")); |
2689 | - /* Translators: Just wait */ |
2690 | - secondary_text = g_strdup (_("Please wait...")); |
2691 | - |
2692 | - g_dbus_method_invocation_return_value (invocation, |
2693 | - NULL); |
2694 | - } |
2695 | - else if (g_strcmp0 (method_name, "NewPrinter") == 0) { |
2696 | - if (g_variant_n_children (parameters) == 6) { |
2697 | - g_variant_get (parameters, "(i&s&s&s&s&s)", |
2698 | - &status, |
2699 | - &name, |
2700 | - &mfg, |
2701 | - &mdl, |
2702 | - &des, |
2703 | - &cmd); |
2704 | - } |
2705 | - |
2706 | - if (g_strrstr (name, "/")) { |
2707 | - /* name is a URI, no queue was generated, because no suitable |
2708 | - * driver was found |
2709 | - */ |
2710 | - |
2711 | - device_id = g_strdup_printf ("MFG:%s;MDL:%s;DES:%s;CMD:%s;", mfg, mdl, des, cmd); |
2712 | - make_and_model = g_strdup_printf ("%s %s", mfg, mdl); |
2713 | - |
2714 | - if (!setup_printer (device_id, make_and_model, name)) { |
2715 | - |
2716 | - /* Translators: We have no driver installed for this printer */ |
2717 | - primary_text = g_strdup (_("Missing printer driver")); |
2718 | - |
2719 | - if ((mfg && mdl) || des) { |
2720 | - if (mfg && mdl) |
2721 | - device = g_strdup_printf ("%s %s", mfg, mdl); |
2722 | - else |
2723 | - device = g_strdup (des); |
2724 | - |
2725 | - /* Translators: We have no driver installed for the device */ |
2726 | - secondary_text = g_strdup_printf (_("No printer driver for %s."), device); |
2727 | - g_free (device); |
2728 | - } |
2729 | - else |
2730 | - /* Translators: We have no driver installed for this printer */ |
2731 | - secondary_text = g_strdup (_("No driver for this printer.")); |
2732 | - } |
2733 | - |
2734 | - g_free (make_and_model); |
2735 | - g_free (device_id); |
2736 | - } |
2737 | - else { |
2738 | - /* name is the name of the queue which hal_lpadmin has set up |
2739 | - * automatically. |
2740 | - */ |
2741 | - |
2742 | - const char *ppd_file_name; |
2743 | - |
2744 | - ppd_file_name = cupsGetPPD (name); |
2745 | - if (ppd_file_name) { |
2746 | - GHashTable *executables; |
2747 | - GHashTable *packages; |
2748 | - |
2749 | - executables = get_missing_executables (ppd_file_name); |
2750 | - packages = find_packages_for_executables (executables); |
2751 | - install_packages (packages); |
2752 | - |
2753 | - if (executables) |
2754 | - g_hash_table_destroy (executables); |
2755 | - if (packages) |
2756 | - g_hash_table_destroy (packages); |
2757 | - g_unlink (ppd_file_name); |
2758 | - } |
2759 | - } |
2760 | - |
2761 | - g_dbus_method_invocation_return_value (invocation, |
2762 | - NULL); |
2763 | - } |
2764 | - else if (g_strcmp0 (method_name, "InstallDrivers") == 0) { |
2765 | - GDBusProxy *proxy; |
2766 | - GError *error = NULL; |
2767 | - |
2768 | - if (g_variant_n_children (parameters) == 3) { |
2769 | - g_variant_get (parameters, "(&s&s&s)", |
2770 | - &mfg, |
2771 | - &mdl, |
2772 | - &cmd); |
2773 | - } |
2774 | - |
2775 | - if (mfg && mdl) |
2776 | - device = g_strdup_printf ("MFG:%s;MDL:%s;", mfg, mdl); |
2777 | - |
2778 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
2779 | - G_DBUS_PROXY_FLAGS_NONE, |
2780 | - NULL, |
2781 | - PACKAGE_KIT_BUS, |
2782 | - PACKAGE_KIT_PATH, |
2783 | - PACKAGE_KIT_MODIFY_IFACE, |
2784 | - NULL, |
2785 | - &error); |
2786 | - |
2787 | - if (!proxy) { |
2788 | - g_warning ("%s", error->message); |
2789 | - g_error_free (error); |
2790 | - } |
2791 | - |
2792 | - if (proxy && device) { |
2793 | - GVariantBuilder *builder; |
2794 | - GVariant *output; |
2795 | - |
2796 | - builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); |
2797 | - g_variant_builder_add (builder, "s", device); |
2798 | - |
2799 | - output = g_dbus_proxy_call_sync (proxy, |
2800 | - "InstallPrinterDrivers", |
2801 | - g_variant_new ("(uass)", |
2802 | - 0, |
2803 | - builder, |
2804 | - "hide-finished"), |
2805 | - G_DBUS_CALL_FLAGS_NONE, |
2806 | - DBUS_INSTALL_TIMEOUT, |
2807 | - NULL, |
2808 | - &error); |
2809 | - |
2810 | - if (output) { |
2811 | - g_variant_unref (output); |
2812 | - } else { |
2813 | - g_warning ("%s", error->message); |
2814 | - g_error_free (error); |
2815 | - } |
2816 | - |
2817 | - g_object_unref (proxy); |
2818 | - } |
2819 | - |
2820 | - g_dbus_method_invocation_return_value (invocation, |
2821 | - NULL); |
2822 | - } |
2823 | - |
2824 | - if (primary_text) { |
2825 | - NotifyNotification *notification; |
2826 | - notification = notify_notification_new (primary_text, |
2827 | - secondary_text, |
2828 | - "printer-symbolic"); |
2829 | - notify_notification_set_app_name (notification, _("Printers")); |
2830 | - notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); |
2831 | - |
2832 | - notify_notification_show (notification, NULL); |
2833 | - g_object_unref (notification); |
2834 | - g_free (primary_text); |
2835 | - g_free (secondary_text); |
2836 | - } |
2837 | -} |
2838 | - |
2839 | -static const GDBusInterfaceVTable interface_vtable = |
2840 | -{ |
2841 | - handle_method_call, |
2842 | - NULL, |
2843 | - NULL |
2844 | -}; |
2845 | - |
2846 | -static void |
2847 | -unregister_objects () |
2848 | -{ |
2849 | - GDBusConnection *system_connection; |
2850 | - GError *error = NULL; |
2851 | - |
2852 | - system_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); |
2853 | - |
2854 | - if (npn_registration_id > 0) { |
2855 | - g_dbus_connection_unregister_object (system_connection, npn_registration_id); |
2856 | - npn_registration_id = 0; |
2857 | - } |
2858 | - |
2859 | - if (pdi_registration_id > 0) { |
2860 | - g_dbus_connection_unregister_object (system_connection, pdi_registration_id); |
2861 | - pdi_registration_id = 0; |
2862 | - } |
2863 | -} |
2864 | - |
2865 | -static void |
2866 | -unown_names () |
2867 | -{ |
2868 | - if (npn_owner_id > 0) { |
2869 | - g_bus_unown_name (npn_owner_id); |
2870 | - npn_owner_id = 0; |
2871 | - } |
2872 | - |
2873 | - if (pdi_owner_id > 0) { |
2874 | - g_bus_unown_name (pdi_owner_id); |
2875 | - pdi_owner_id = 0; |
2876 | - } |
2877 | -} |
2878 | - |
2879 | -static void |
2880 | -on_npn_bus_acquired (GDBusConnection *connection, |
2881 | - const gchar *name, |
2882 | - gpointer user_data) |
2883 | -{ |
2884 | - GError *error = NULL; |
2885 | - |
2886 | - npn_registration_id = g_dbus_connection_register_object (connection, |
2887 | - SCP_DBUS_NPN_PATH, |
2888 | - npn_introspection_data->interfaces[0], |
2889 | - &interface_vtable, |
2890 | - NULL, |
2891 | - NULL, |
2892 | - &error); |
2893 | - |
2894 | - if (npn_registration_id == 0) { |
2895 | - g_warning ("Failed to register object: %s\n", error->message); |
2896 | - g_error_free (error); |
2897 | - } |
2898 | -} |
2899 | - |
2900 | -static void |
2901 | -on_pdi_bus_acquired (GDBusConnection *connection, |
2902 | - const gchar *name, |
2903 | - gpointer user_data) |
2904 | -{ |
2905 | - GError *error = NULL; |
2906 | - |
2907 | - pdi_registration_id = g_dbus_connection_register_object (connection, |
2908 | - SCP_DBUS_PDI_PATH, |
2909 | - pdi_introspection_data->interfaces[0], |
2910 | - &interface_vtable, |
2911 | - NULL, |
2912 | - NULL, |
2913 | - &error); |
2914 | - |
2915 | - if (pdi_registration_id == 0) { |
2916 | - g_warning ("Failed to register object: %s\n", error->message); |
2917 | - g_error_free (error); |
2918 | - } |
2919 | -} |
2920 | - |
2921 | -static void |
2922 | -on_name_acquired (GDBusConnection *connection, |
2923 | - const gchar *name, |
2924 | - gpointer user_data) |
2925 | -{ |
2926 | -} |
2927 | - |
2928 | -static void |
2929 | -on_name_lost (GDBusConnection *connection, |
2930 | - const gchar *name, |
2931 | - gpointer user_data) |
2932 | -{ |
2933 | - unregister_objects (); |
2934 | -} |
2935 | - |
2936 | -static void |
2937 | -session_signal_handler (GDBusConnection *connection, |
2938 | - const gchar *sender_name, |
2939 | - const gchar *object_path, |
2940 | - const gchar *interface_name, |
2941 | - const gchar *signal_name, |
2942 | - GVariant *parameters, |
2943 | - gpointer user_data) |
2944 | -{ |
2945 | - guint new_status; |
2946 | - |
2947 | - g_variant_get (parameters, "(u)", &new_status); |
2948 | - |
2949 | - if (new_status == PRESENCE_STATUS_IDLE || |
2950 | - new_status == PRESENCE_STATUS_AVAILABLE) { |
2951 | - unregister_objects (); |
2952 | - unown_names (); |
2953 | - |
2954 | - if (new_status == PRESENCE_STATUS_AVAILABLE) { |
2955 | - npn_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, |
2956 | - SCP_DBUS_NPN_NAME, |
2957 | - G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | |
2958 | - G_BUS_NAME_OWNER_FLAGS_REPLACE, |
2959 | - on_npn_bus_acquired, |
2960 | - on_name_acquired, |
2961 | - on_name_lost, |
2962 | - NULL, |
2963 | - NULL); |
2964 | - |
2965 | - pdi_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, |
2966 | - SCP_DBUS_PDI_NAME, |
2967 | - G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | |
2968 | - G_BUS_NAME_OWNER_FLAGS_REPLACE, |
2969 | - on_pdi_bus_acquired, |
2970 | - on_name_acquired, |
2971 | - on_name_lost, |
2972 | - NULL, |
2973 | - NULL); |
2974 | - } |
2975 | - } |
2976 | -} |
2977 | - |
2978 | -static void |
2979 | -client_signal_handler (GDBusConnection *connection, |
2980 | - const gchar *sender_name, |
2981 | - const gchar *object_path, |
2982 | - const gchar *interface_name, |
2983 | - const gchar *signal_name, |
2984 | - GVariant *parameters, |
2985 | - gpointer user_data) |
2986 | -{ |
2987 | - GDBusProxy *proxy; |
2988 | - GError *error = NULL; |
2989 | - GVariant *output; |
2990 | - |
2991 | - if (g_strcmp0 (signal_name, "QueryEndSession") == 0 || |
2992 | - g_strcmp0 (signal_name, "EndSession") == 0) { |
2993 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
2994 | - G_DBUS_PROXY_FLAGS_NONE, |
2995 | - NULL, |
2996 | - sender_name, |
2997 | - object_path, |
2998 | - interface_name, |
2999 | - NULL, |
3000 | - &error); |
3001 | - |
3002 | - if (proxy) { |
3003 | - output = g_dbus_proxy_call_sync (proxy, |
3004 | - "EndSessionResponse", |
3005 | - g_variant_new ("(bs)", TRUE, ""), |
3006 | - G_DBUS_CALL_FLAGS_NONE, |
3007 | - -1, |
3008 | - NULL, |
3009 | - &error); |
3010 | - |
3011 | - if (output) { |
3012 | - g_variant_unref (output); |
3013 | - } |
3014 | - else { |
3015 | - g_warning ("%s", error->message); |
3016 | - g_error_free (error); |
3017 | - } |
3018 | - |
3019 | - g_object_unref (proxy); |
3020 | - } |
3021 | - else { |
3022 | - g_warning ("%s", error->message); |
3023 | - g_error_free (error); |
3024 | - } |
3025 | - |
3026 | - if (g_strcmp0 (signal_name, "EndSession") == 0) { |
3027 | - g_main_loop_quit (main_loop); |
3028 | - g_debug ("Exiting usd-printer"); |
3029 | - } |
3030 | - } |
3031 | -} |
3032 | - |
3033 | -static gchar * |
3034 | -register_gnome_session_client (const gchar *app_id, |
3035 | - const gchar *client_startup_id) |
3036 | -{ |
3037 | - GDBusProxy *proxy; |
3038 | - GVariant *output = NULL; |
3039 | - GError *error = NULL; |
3040 | - const gchar *client_id = NULL; |
3041 | - gchar *result = NULL; |
3042 | - |
3043 | - proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, |
3044 | - G_DBUS_PROXY_FLAGS_NONE, |
3045 | - NULL, |
3046 | - GNOME_SESSION_DBUS_NAME, |
3047 | - GNOME_SESSION_DBUS_PATH, |
3048 | - GNOME_SESSION_DBUS_IFACE, |
3049 | - NULL, |
3050 | - &error); |
3051 | - |
3052 | - if (proxy) { |
3053 | - output = g_dbus_proxy_call_sync (proxy, |
3054 | - "RegisterClient", |
3055 | - g_variant_new ("(ss)", app_id, client_startup_id), |
3056 | - G_DBUS_CALL_FLAGS_NONE, |
3057 | - -1, |
3058 | - NULL, |
3059 | - &error); |
3060 | - |
3061 | - if (output) { |
3062 | - g_variant_get (output, "(o)", &client_id); |
3063 | - if (client_id) |
3064 | - result = g_strdup (client_id); |
3065 | - g_variant_unref (output); |
3066 | - } |
3067 | - else { |
3068 | - g_warning ("%s", error->message); |
3069 | - g_error_free (error); |
3070 | - } |
3071 | - |
3072 | - g_object_unref (proxy); |
3073 | - } |
3074 | - else { |
3075 | - g_warning ("%s", error->message); |
3076 | - g_error_free (error); |
3077 | - } |
3078 | - |
3079 | - return result; |
3080 | -} |
3081 | - |
3082 | -int |
3083 | -main (int argc, char *argv[]) |
3084 | -{ |
3085 | - GDBusConnection *connection; |
3086 | - gboolean client_signal_subscription_set = FALSE; |
3087 | - GError *error = NULL; |
3088 | - guint client_signal_subscription_id; |
3089 | - guint session_signal_subscription_id; |
3090 | - gchar *object_path; |
3091 | - |
3092 | - bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); |
3093 | - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
3094 | - textdomain (GETTEXT_PACKAGE); |
3095 | - setlocale (LC_ALL, ""); |
3096 | - |
3097 | - npn_registration_id = 0; |
3098 | - pdi_registration_id = 0; |
3099 | - npn_owner_id = 0; |
3100 | - pdi_owner_id = 0; |
3101 | - |
3102 | - notify_init ("gnome-settings-daemon-printer"); |
3103 | - |
3104 | - npn_introspection_data = |
3105 | - g_dbus_node_info_new_for_xml (npn_introspection_xml, &error); |
3106 | - |
3107 | - if (npn_introspection_data == NULL) { |
3108 | - g_warning ("Error parsing introspection XML: %s\n", error->message); |
3109 | - g_error_free (error); |
3110 | - goto error; |
3111 | - } |
3112 | - |
3113 | - pdi_introspection_data = |
3114 | - g_dbus_node_info_new_for_xml (pdi_introspection_xml, &error); |
3115 | - |
3116 | - if (pdi_introspection_data == NULL) { |
3117 | - g_warning ("Error parsing introspection XML: %s\n", error->message); |
3118 | - g_error_free (error); |
3119 | - goto error; |
3120 | - } |
3121 | - |
3122 | - connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); |
3123 | - |
3124 | - session_signal_subscription_id = |
3125 | - g_dbus_connection_signal_subscribe (connection, |
3126 | - NULL, |
3127 | - GNOME_SESSION_PRESENCE_DBUS_IFACE, |
3128 | - "StatusChanged", |
3129 | - GNOME_SESSION_PRESENCE_DBUS_PATH, |
3130 | - NULL, |
3131 | - G_DBUS_SIGNAL_FLAGS_NONE, |
3132 | - session_signal_handler, |
3133 | - NULL, |
3134 | - NULL); |
3135 | - |
3136 | - object_path = register_gnome_session_client ("usd-printer", ""); |
3137 | - if (object_path) { |
3138 | - client_signal_subscription_id = |
3139 | - g_dbus_connection_signal_subscribe (connection, |
3140 | - NULL, |
3141 | - GNOME_SESSION_CLIENT_PRIVATE_DBUS_IFACE, |
3142 | - NULL, |
3143 | - object_path, |
3144 | - NULL, |
3145 | - G_DBUS_SIGNAL_FLAGS_NONE, |
3146 | - client_signal_handler, |
3147 | - NULL, |
3148 | - NULL); |
3149 | - client_signal_subscription_set = TRUE; |
3150 | - } |
3151 | - |
3152 | - if (npn_owner_id == 0) |
3153 | - npn_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, |
3154 | - SCP_DBUS_NPN_NAME, |
3155 | - G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | |
3156 | - G_BUS_NAME_OWNER_FLAGS_REPLACE, |
3157 | - on_npn_bus_acquired, |
3158 | - on_name_acquired, |
3159 | - on_name_lost, |
3160 | - NULL, |
3161 | - NULL); |
3162 | - |
3163 | - if (pdi_owner_id == 0) |
3164 | - pdi_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, |
3165 | - SCP_DBUS_PDI_NAME, |
3166 | - G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | |
3167 | - G_BUS_NAME_OWNER_FLAGS_REPLACE, |
3168 | - on_pdi_bus_acquired, |
3169 | - on_name_acquired, |
3170 | - on_name_lost, |
3171 | - NULL, |
3172 | - NULL); |
3173 | - |
3174 | - main_loop = g_main_loop_new (NULL, FALSE); |
3175 | - g_main_loop_run (main_loop); |
3176 | - |
3177 | - unregister_objects (); |
3178 | - unown_names (); |
3179 | - |
3180 | - if (client_signal_subscription_set) |
3181 | - g_dbus_connection_signal_unsubscribe (connection, client_signal_subscription_id); |
3182 | - g_dbus_connection_signal_unsubscribe (connection, session_signal_subscription_id); |
3183 | - |
3184 | - g_free (object_path); |
3185 | - |
3186 | - g_dbus_node_info_unref (npn_introspection_data); |
3187 | - g_dbus_node_info_unref (pdi_introspection_data); |
3188 | - |
3189 | - return 0; |
3190 | - |
3191 | -error: |
3192 | - |
3193 | - if (npn_introspection_data) |
3194 | - g_dbus_node_info_unref (npn_introspection_data); |
3195 | - |
3196 | - if (pdi_introspection_data) |
3197 | - g_dbus_node_info_unref (pdi_introspection_data); |
3198 | - |
3199 | - return 1; |
3200 | -} |
3201 | |
3202 | === removed file 'plugins/print-notifications/print-notifications.gnome-settings-plugin.in' |
3203 | --- plugins/print-notifications/print-notifications.gnome-settings-plugin.in 2013-02-20 23:32:45 +0000 |
3204 | +++ plugins/print-notifications/print-notifications.gnome-settings-plugin.in 1970-01-01 00:00:00 +0000 |
3205 | @@ -1,10 +0,0 @@ |
3206 | -[GNOME Settings Plugin] |
3207 | -Module=print-notifications |
3208 | -IAge=0 |
3209 | -# Default Priority |
3210 | -# Priority=100 |
3211 | -_Name=Print-notifications |
3212 | -_Description=Print-notifications plugin |
3213 | -Authors=Marek Kasik |
3214 | -Copyright=Copyright © 2011 Marek Kasik <mkasik@redhat.com> |
3215 | -Website= |
3216 | |
3217 | === removed file 'plugins/print-notifications/test-print-notifications.c' |
3218 | --- plugins/print-notifications/test-print-notifications.c 2012-05-25 13:00:54 +0000 |
3219 | +++ plugins/print-notifications/test-print-notifications.c 1970-01-01 00:00:00 +0000 |
3220 | @@ -1,7 +0,0 @@ |
3221 | -#define NEW gsd_print_notifications_manager_new |
3222 | -#define START gsd_print_notifications_manager_start |
3223 | -#define STOP gsd_print_notifications_manager_stop |
3224 | -#define MANAGER GsdPrintNotificationsManager |
3225 | -#include "gsd-print-notifications-manager.h" |
3226 | - |
3227 | -#include "test-plugin.h" |
3228 | |
3229 | === modified file 'po/POTFILES.in' |
3230 | --- po/POTFILES.in 2014-02-15 08:33:21 +0000 |
3231 | +++ po/POTFILES.in 2016-05-24 21:12:24 +0000 |
3232 | @@ -33,9 +33,6 @@ |
3233 | plugins/power/gsd-power-manager.c |
3234 | plugins/power/com.ubuntu.unity-settings-daemon.plugins.power.policy.in.in |
3235 | [type: gettext/ini]plugins/power/power.gnome-settings-plugin.in |
3236 | -plugins/print-notifications/gsd-printer.c |
3237 | -plugins/print-notifications/gsd-print-notifications-manager.c |
3238 | -[type: gettext/ini]plugins/print-notifications/print-notifications.gnome-settings-plugin.in |
3239 | [type: gettext/ini]plugins/remote-display/remote-display.gnome-settings-plugin.in |
3240 | [type: gettext/ini]plugins/screensaver-proxy/screensaver-proxy.gnome-settings-plugin.in |
3241 | plugins/smartcard/gsd-smartcard.c |
Drop print notifications - not used under Unity.