Merge lp:~ev/activity-log-manager/split-out-diagnostics-service into lp:activity-log-manager

Proposed by Evan
Status: Merged
Merged at revision: 82
Proposed branch: lp:~ev/activity-log-manager/split-out-diagnostics-service
Merge into: lp:activity-log-manager
Diff against target: 660 lines (+19/-498)
11 files modified
configure.ac (+3/-7)
data/Makefile.am (+6/-1)
po/POTFILES.in (+1/-2)
src/Makefile.am (+8/-11)
src/diagnostics-widget.c (+1/-1)
src/diagnostics/Makefile.am (+0/-50)
src/diagnostics/com.ubuntu.WhoopsiePreferences.conf (+0/-26)
src/diagnostics/com.ubuntu.WhoopsiePreferences.service (+0/-4)
src/diagnostics/com.ubuntu.whoopsiepreferences.policy.in (+0/-18)
src/diagnostics/whoopsie-preferences.c (+0/-363)
src/diagnostics/whoopsie-preferences.xml (+0/-15)
To merge this branch: bzr merge lp:~ev/activity-log-manager/split-out-diagnostics-service
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) merge-conflict, distcheck Needs Fixing
Review via email: mp+175820@code.launchpad.net

Description of the change

This branch removes the code for the whoopsie-preferences DBus service as it now lives in the whoopsie-preferences package (http://bazaar.launchpad.net/~ev/whoopsie-preferences/trunk/files).

See also:
https://bugs.launchpad.net/ubuntu/+source/activity-log-manager/+bug/1203042

To post a comment you must log in.
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

First, it give a conflict that it cannot delete directory src/diagnostic

Second, even after I manually delete the folder and resolve conflict, distcheck fails because 2 files in po/POTFILES.in still reference the older ui file and C file in diagnostic folder

Please take care of these two issues and make sure that it still works as you expected it to work

review: Needs Fixing (merge-conflict, distcheck)
81. By Evan

Merge with trunk.

82. By Evan

Point at the right locations for whoopsie in the translations.

Revision history for this message
Evan (ev) wrote :

I just tried merging it against lp:activity-log-manager locally and it went fine. It'd also show conflicts here if there were some.

I've merged the branch against tip and updated the references in POTFILES.in. make distcheck is now working fine locally.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2013-07-10 04:22:15 +0000
3+++ configure.ac 2013-07-20 20:43:24 +0000
4@@ -46,7 +46,7 @@
5 PKG_CHECK_MODULES(GEE, gee-1.0, [HAVE_GEE=yes])
6 PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0, [HAVE_GIO_UNIX=yes])
7 PKG_CHECK_MODULES(POLKIT, polkit-gobject-1, [HAVE_POLKIT=yes], [HAVE_POLKIT=no])
8-PKG_CHECK_MODULES(LIBWHOOPSIE, libwhoopsie, [HAVE_LIBWHOOPSIE=yes], [HAVE_LIBWHOOPSIE=no])
9+PKG_CHECK_MODULES(LIBWHOOPSIEPREFS, libwhoopsie-preferences, [HAVE_LIBWHOOPSIE=yes], [HAVE_LIBWHOOPSIE=no])
10 PKG_CHECK_MODULES(PANTHEON, pantheon, [HAVE_PANTHEON=yes], [HAVE_PANTHEON=no])
11
12 PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0)
13@@ -89,7 +89,7 @@
14 fi
15 if test "x$with_whoopsie" != xcheck && test "x$HAVE_LIBWHOOPSIE" != xyes; then
16 AC_MSG_FAILURE(
17- [--with-whoopsie was given, but libwhoopsie was not found])
18+ [--with-whoopsie was given, but libwhoopsie or libwhoopsie-preferences was not found])
19 fi
20 ]
21
22@@ -103,19 +103,15 @@
23 )
24
25 AM_CONDITIONAL([HAVE_CCPANEL], [test -n "$CCPANEL_LIBS" && test "x$with_ccpanel" != xno])
26-
27-AM_CONDITIONAL([HAVE_WHOOPSIE], [test -n "$POLKIT_LIBS" && test -n "$LIBWHOOPSIE_LIBS"])
28-
29+AM_CONDITIONAL([HAVE_WHOOPSIE], [test -n "$POLKIT_LIBS" && test -n "$LIBWHOOPSIEPREFS_LIBS"])
30
31 AC_CONFIG_FILES([
32 Makefile
33 data/Makefile
34 src/Makefile
35-src/diagnostics/Makefile
36 po/Makefile.in
37 ])
38
39-
40 if test "x$with_whoopsie" != xno && test "x$HAVE_POLKIT" != xno && test "x$HAVE_LIBWHOOPSIE" != xno; then
41 AC_DEFINE([HAVE_WHOOPSIE], 1, [Enable Whoopsie])
42 WHOOPSIE_ENABLE=yes
43
44=== modified file 'data/Makefile.am'
45--- data/Makefile.am 2013-06-12 23:31:37 +0000
46+++ data/Makefile.am 2013-07-20 20:43:24 +0000
47@@ -33,10 +33,15 @@
48 switchboard_DATA = alm-switchboard.plug
49 endif
50
51+if HAVE_WHOOPSIE
52+ gnomeccuidir = $(datadir)/gnome-control-center/ui
53+ gnomeccui_DATA = whoopsie.ui
54+endif
55+
56 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
57 @INTLTOOL_DESKTOP_RULE@
58
59-EXTRA_DIST = activity-log-manager.desktop.in gnome-activity-log-manager-panel.desktop.in alm-switchboard.plug
60+EXTRA_DIST = activity-log-manager.desktop.in gnome-activity-log-manager-panel.desktop.in alm-switchboard.plug whoopsie.ui
61 CLEANFILES = activity-log-manager.desktop gnome-activity-log-manager-panel.desktop
62
63 check: $(desktop_DATA)
64
65=== renamed file 'src/diagnostics/whoopsie.ui' => 'data/whoopsie.ui'
66=== modified file 'po/POTFILES.in'
67--- po/POTFILES.in 2013-07-08 01:37:43 +0000
68+++ po/POTFILES.in 2013-07-20 20:43:24 +0000
69@@ -9,5 +9,4 @@
70 src/unified-privacy-applications.vala
71 src/unified-privacy-history.vala
72 src/unified-privacy.vala
73-src/diagnostics/com.ubuntu.whoopsiepreferences.policy.in
74-[type: gettext/glade]src/diagnostics/whoopsie.ui
75+[type: gettext/glade]data/whoopsie.ui
76
77=== modified file 'src/Makefile.am'
78--- src/Makefile.am 2013-07-09 01:34:49 +0000
79+++ src/Makefile.am 2013-07-20 20:43:24 +0000
80@@ -42,6 +42,11 @@
81 $(POLKIT_LIBS) \
82 -lm
83
84+if HAVE_WHOOPSIE
85+SHARED_LIBS += \
86+ $(LIBWHOOPSIEPREFS_LIBS)
87+endif
88+
89 alm_switchboard_SOURCES = \
90 $(SHARED_SOURCES) \
91 alm-plug.vala \
92@@ -49,8 +54,7 @@
93
94 if HAVE_WHOOPSIE
95 alm_switchboard_SOURCES += \
96- diagnostics-widget.c \
97- diagnostics/whoopsie-generated.c
98+ diagnostics-widget.c
99 endif
100
101 if HAVE_SWITCHBOARD
102@@ -74,7 +78,6 @@
103 AM_VALAFLAGS += \
104 -D DIAGNOSTIC
105 gnomeccuidir = $(datadir)/gnome-control-center/ui/
106-SUBDIRS = diagnostics
107 endif
108
109
110@@ -103,8 +106,7 @@
111
112 if HAVE_WHOOPSIE
113 activity_log_manager_SOURCES += \
114- diagnostics-widget.c \
115- diagnostics/whoopsie-generated.c
116+ diagnostics-widget.c
117 endif
118
119 libactivity_log_manager_la_SOURCES = \
120@@ -113,8 +115,7 @@
121
122 if HAVE_WHOOPSIE
123 libactivity_log_manager_la_SOURCES += \
124- diagnostics-widget.c \
125- diagnostics/whoopsie-generated.c
126+ diagnostics-widget.c
127 endif
128
129
130@@ -128,10 +129,6 @@
131 $(SHARED_LIBS) \
132 $(CCPANEL_LIBS)
133
134-if HAVE_WHOOPSIE
135-libactivity_log_manager_la_LIBADD += \
136- $(POLKIT_LIBS)
137-endif
138
139 GENERATED_C_FILES = $(SHARED_SOURCES:.vala=.c)
140 GENERATED_O_FILES = $(SHARED_SOURCES:.vala=.o)
141
142=== removed directory 'src/diagnostics'
143=== modified file 'src/diagnostics-widget.c'
144--- src/diagnostics-widget.c 2013-06-20 02:06:00 +0000
145+++ src/diagnostics-widget.c 2013-07-20 20:43:24 +0000
146@@ -6,7 +6,7 @@
147 #define _GNU_SOURCE
148 #include <stdio.h>
149
150-#include "diagnostics/whoopsie-generated.h"
151+#include "whoopsie-preferences/libwhoopsie-preferences.h"
152
153 static WhoopsiePreferences* proxy = NULL;
154
155
156=== removed file 'src/diagnostics/Makefile.am'
157--- src/diagnostics/Makefile.am 2013-04-16 11:25:34 +0000
158+++ src/diagnostics/Makefile.am 1970-01-01 00:00:00 +0000
159@@ -1,50 +0,0 @@
160-if HAVE_CCPANEL
161-ccpaneldir = $(CCPANEL_DIR)
162-bin_PROGRAMS = whoopsie-preferences
163-endif
164-
165-policykitdir = $(datadir)/polkit-1/actions/
166-dbussystemdir = $(sysconfdir)/dbus-1/system.d/
167-dbusservicedir = $(datadir)/dbus-1/system-services/
168-gnomeccuidir = $(datadir)/gnome-control-center/ui/
169-
170-whoopsie_preferences_CFLAGS = \
171- -Wall \
172- -g \
173- $(POLKIT_CFLAGS) $(GIO_UNIX_CFLAGS) \
174- $(LIBWHOOPSIE_CFLAGS)
175-
176-whoopsie_preferences_SOURCES = \
177- whoopsie-generated.c whoopsie-generated.h whoopsie-preferences.c
178-
179-whoopsie_preferences_LDADD = \
180- $(POLKIT_LIBS) \
181- $(GIO_UNIX_LIBS) \
182- $(LIBWHOOPSIE_LIBS)
183-
184-policykit_in_files = com.ubuntu.whoopsiepreferences.policy.in
185-
186-EXTRA_DIST = \
187- whoopsie-preferences.xml \
188- com.ubuntu.WhoopsiePreferences.service \
189- com.ubuntu.WhoopsiePreferences.conf \
190- $(policykit_in_files) \
191- whoopsie.ui
192-
193-gnomeccui_DATA = \
194- whoopsie.ui
195-policykit_DATA = \
196- $(policykit_in_files:.policy.in=.policy)
197-dbussystem_DATA = \
198- com.ubuntu.WhoopsiePreferences.conf
199-dbusservice_DATA = \
200- com.ubuntu.WhoopsiePreferences.service
201-
202-whoopsie-generated.c: whoopsie-preferences.xml
203- gdbus-codegen --interface-prefix com.ubuntu. \
204- --generate-c-code whoopsie-generated \
205- $<
206-
207-CLEANFILES = whoopsie-generated.[ch] \
208- $(policykit_DATA)
209-@INTLTOOL_POLICY_RULE@
210
211=== removed file 'src/diagnostics/com.ubuntu.WhoopsiePreferences.conf'
212--- src/diagnostics/com.ubuntu.WhoopsiePreferences.conf 2013-04-16 11:25:34 +0000
213+++ src/diagnostics/com.ubuntu.WhoopsiePreferences.conf 1970-01-01 00:00:00 +0000
214@@ -1,26 +0,0 @@
215-<!DOCTYPE busconfig PUBLIC
216- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
217- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
218-<busconfig>
219-
220- <!-- This configuration file specifies the required security policies
221- for configuring the crash daemon. -->
222-
223- <!-- Only root can own the service -->
224- <policy user="root">
225- <allow own="com.ubuntu.WhoopsiePreferences"/>
226- </policy>
227-
228- <!-- Allow anyone to invoke methods (further constrained by
229- PolicyKit privileges -->
230- <policy context="default">
231- <allow send_destination="com.ubuntu.WhoopsiePreferences"
232- send_interface="com.ubuntu.WhoopsiePreferences"/>
233- <allow send_destination="com.ubuntu.WhoopsiePreferences"
234- send_interface="org.freedesktop.DBus.Introspectable"/>
235- <allow send_destination="com.ubuntu.WhoopsiePreferences"
236- send_interface="org.freedesktop.DBus.Properties"/>
237- </policy>
238-
239-</busconfig>
240-
241
242=== removed file 'src/diagnostics/com.ubuntu.WhoopsiePreferences.service'
243--- src/diagnostics/com.ubuntu.WhoopsiePreferences.service 2013-04-16 11:25:34 +0000
244+++ src/diagnostics/com.ubuntu.WhoopsiePreferences.service 1970-01-01 00:00:00 +0000
245@@ -1,4 +0,0 @@
246-[D-BUS Service]
247-Name=com.ubuntu.WhoopsiePreferences
248-Exec=/usr/bin/whoopsie-preferences
249-User=root
250
251=== removed file 'src/diagnostics/com.ubuntu.whoopsiepreferences.policy.in'
252--- src/diagnostics/com.ubuntu.whoopsiepreferences.policy.in 2013-04-16 11:25:34 +0000
253+++ src/diagnostics/com.ubuntu.whoopsiepreferences.policy.in 1970-01-01 00:00:00 +0000
254@@ -1,18 +0,0 @@
255-<?xml version="1.0" encoding="UTF-8"?>
256-<!DOCTYPE policyconfig PUBLIC
257- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
258- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
259-<policyconfig>
260- <vendor>Ubuntu crash reporting</vendor>
261- <vendor_url>https://launchpad.net/whoopsie</vendor_url>
262- <icon_name>stock_lock</icon_name>
263- <action id="com.ubuntu.whoopsiepreferences.change">
264- <_description>Privacy settings</_description>
265- <_message>To change your privacy settings you need to authenticate.</_message>
266- <defaults>
267- <allow_any>auth_admin</allow_any>
268- <allow_inactive>auth_admin</allow_inactive>
269- <allow_active>auth_admin_keep</allow_active>
270- </defaults>
271- </action>
272-</policyconfig>
273
274=== removed file 'src/diagnostics/whoopsie-preferences.c'
275--- src/diagnostics/whoopsie-preferences.c 2013-04-16 11:25:34 +0000
276+++ src/diagnostics/whoopsie-preferences.c 1970-01-01 00:00:00 +0000
277@@ -1,363 +0,0 @@
278-/* whoopsie
279- *
280- * Copyright © 2011 Canonical Ltd.
281- * Author: Evan Dandrea <evan.dandrea@canonical.com>
282- *
283- * This program is free software: you can redistribute it and/or modify
284- * it under the terms of the GNU General Public License as published by
285- * the Free Software Foundation, either version 3 of the License, or
286- * (at your option) any later version.
287- *
288- * This program is distributed in the hope that it will be useful,
289- * but WITHOUT ANY WARRANTY; without even the implied warranty of
290- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
291- * GNU General Public License for more details.
292- *
293- * You should have received a copy of the GNU General Public License
294- * along with this program. If not, see <http://www.gnu.org/licenses/>.
295- */
296-
297-#include <gio/gio.h>
298-#include <stdlib.h>
299-#include <polkit/polkit.h>
300-
301-#include "whoopsie-generated.h"
302-
303-#define CONFIG_PATH "/etc/default/whoopsie"
304-
305-static GMainLoop* loop = NULL;
306-static guint loop_shutdown = 0;
307-static GKeyFile* key_file = NULL;
308-static PolkitAuthority* authority = NULL;
309-
310-/* Eventually, it might make sense to move to gsettings with the dconf
311- * backend, once it gains PolicyKit support, rather than have a program just
312- * to expose an interface to a small configuration file over DBus/PolicyKit.
313- * */
314-
315-/* Once upstart has an interface for disabiling jobs via initctl, we wont need
316- * a configuration file anymore */
317-
318-gboolean
319-whoopsie_preferences_load_configuration (void)
320-{
321- char* data;
322- gsize data_size;
323- gboolean ret = TRUE;
324- GError* error = NULL;
325-
326- if (g_key_file_load_from_file (key_file, CONFIG_PATH,
327- G_KEY_FILE_KEEP_COMMENTS, NULL)) {
328- return TRUE;
329- }
330-
331- g_key_file_set_boolean (key_file, "General", "report_crashes", TRUE);
332- g_key_file_set_boolean (key_file, "General", "report_metrics", TRUE);
333- data = g_key_file_to_data (key_file, &data_size, &error);
334- if (error) {
335- g_print ("Could not process configuration: %s\n", error->message);
336- ret = FALSE;
337- goto out;
338- }
339- if (!g_file_set_contents (CONFIG_PATH, data, data_size, &error)) {
340- g_print ("Could not write configuration: %s\n", error->message);
341- ret = FALSE;
342- goto out;
343- }
344-
345-out:
346- if (data)
347- g_free (data);
348- if (error)
349- g_error_free (error);
350- return ret;
351-}
352-
353-static void
354-whoopsie_preferences_dbus_notify (WhoopsiePreferences* interface)
355-{
356- GError* error = NULL;
357- gboolean report_crashes = FALSE;
358- gboolean report_metrics = FALSE;
359-
360- report_crashes = g_key_file_get_boolean (key_file, "General",
361- "report_crashes", &error);
362- if (error) {
363- g_warning ("Could not get crashes: %s", error->message);
364- g_error_free (error);
365- }
366-
367- error = NULL;
368- report_metrics = g_key_file_get_boolean (key_file, "General",
369- "report_metrics", &error);
370- if (error) {
371- g_warning ("Could not get metrics: %s", error->message);
372- g_error_free (error);
373- }
374- whoopsie_preferences_set_report_crashes (interface, report_crashes);
375- whoopsie_preferences_set_report_metrics (interface, report_metrics);
376-}
377-
378-static void
379-whoopsie_preferences_file_changed (GFileMonitor *monitor, GFile *file,
380- GFile *other_file,
381- GFileMonitorEvent event_type,
382- gpointer user_data)
383-{
384- if (event_type == G_FILE_MONITOR_EVENT_CHANGED) {
385- whoopsie_preferences_load_configuration ();
386- whoopsie_preferences_dbus_notify (user_data);
387- }
388-}
389-
390-void
391-whoopsie_preferences_load (WhoopsiePreferences* interface)
392-{
393- GError* error = NULL;
394- GFile* fp = NULL;
395- GFileMonitor* file_monitor = NULL;
396-
397- fp = g_file_new_for_path (CONFIG_PATH);
398- file_monitor = g_file_monitor_file (fp, G_FILE_MONITOR_NONE,
399- NULL, &error);
400- g_signal_connect (file_monitor, "changed",
401- G_CALLBACK (whoopsie_preferences_file_changed),
402- interface);
403- if (error) {
404- g_print ("Could not set up file monitor: %s\n", error->message);
405- g_error_free (error);
406- }
407- g_object_unref (fp);
408-
409- key_file = g_key_file_new ();
410- whoopsie_preferences_load_configuration ();
411-}
412-
413-void
414-whoopsie_preferences_notify_upstart (gboolean run_whoopsie)
415-{
416- GError* error = NULL;
417- char* command[] = { "/sbin/initctl", run_whoopsie ? "start" : "stop", "whoopsie", NULL };
418- if (!g_spawn_sync (NULL, command, NULL, 0, NULL, NULL, NULL, NULL, NULL, &error)) {
419- g_print ("Could not run initctl: %s\n", error->message);
420- }
421-}
422-
423-gboolean
424-whoopsie_preferences_changed (WhoopsiePreferences* object, GParamSpec* pspec,
425- gpointer user_data)
426-{
427- WhoopsiePreferencesIface* iface;
428- gboolean saved_value, new_value;
429- GError* error = NULL;
430- char* data;
431- gsize data_size;
432- gboolean crashes = !g_strcmp0(user_data, "report_crashes");
433-
434- if (loop_shutdown) {
435- g_source_remove (loop_shutdown);
436- loop_shutdown = 0;
437- }
438- loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit,
439- loop);
440-
441- iface = WHOOPSIE_PREFERENCES_GET_IFACE (object);
442- saved_value = g_key_file_get_boolean (key_file, "General", user_data,
443- &error);
444- if (error) {
445- g_print ("Could not process configuration: %s\n", error->message);
446- }
447- if (crashes)
448- new_value = iface->get_report_crashes (object);
449- else
450- new_value = iface->get_report_metrics (object);
451-
452- if (error || (saved_value != new_value)) {
453- if (error)
454- g_error_free (error);
455- g_key_file_set_boolean (key_file, "General", user_data, new_value);
456- data = g_key_file_to_data (key_file, &data_size, &error);
457- if (error) {
458- g_print ("Could not process configuration: %s\n", error->message);
459- return FALSE;
460- }
461- if (!g_file_set_contents (CONFIG_PATH, data, data_size, &error)) {
462- g_print ("Could not write configuration: %s\n", error->message);
463- return FALSE;
464- }
465- }
466- if (crashes)
467- whoopsie_preferences_notify_upstart (new_value);
468-
469- return TRUE;
470-}
471-
472-static gboolean
473-whoopsie_preferences_on_set_report_crashes (WhoopsiePreferences* object,
474- GDBusMethodInvocation* invocation,
475- gboolean report,
476- gpointer user_data)
477-{
478- whoopsie_preferences_set_report_crashes (object, report);
479- whoopsie_preferences_complete_set_report_crashes (object, invocation);
480- return TRUE;
481-}
482-
483-static gboolean
484-whoopsie_preferences_on_set_report_metrics (WhoopsiePreferences* object,
485- GDBusMethodInvocation* invocation,
486- gboolean report,
487- gpointer user_data)
488-{
489- whoopsie_preferences_set_report_metrics (object, report);
490- whoopsie_preferences_complete_set_report_metrics (object, invocation);
491- return TRUE;
492-}
493-
494-static gboolean
495-whoopsie_preferences_on_get_identifier (WhoopsiePreferences* object,
496- GDBusMethodInvocation* invocation)
497-{
498- char* identifier = NULL;
499- GError* error = NULL;
500-
501- whoopsie_identifier_generate (&identifier, &error);
502- if (error) {
503- g_printerr ("Error getting identifier: %s\n", error->message);
504- g_error_free (error);
505- }
506- whoopsie_preferences_complete_get_identifier (object, invocation, identifier);
507- return TRUE;
508-}
509-
510-static gboolean
511-whoopsie_preferences_authorize_method (GDBusInterfaceSkeleton* interface,
512- GDBusMethodInvocation* invocation,
513- gpointer user_data)
514-{
515- PolkitSubject* subject = NULL;
516- PolkitAuthorizationResult* result = NULL;
517- GError* error = NULL;
518- const char* sender = NULL;
519- gboolean ret = FALSE;
520-
521- sender = g_dbus_method_invocation_get_sender (invocation);
522- subject = polkit_system_bus_name_new (sender);
523- result = polkit_authority_check_authorization_sync (authority, subject,
524- "com.ubuntu.whoopsiepreferences.change",
525- NULL,
526- POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
527- NULL, &error);
528- if (result == NULL) {
529- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
530- G_DBUS_ERROR_AUTH_FAILED, "Could not authorize: %s",
531- error->message);
532- g_error_free (error);
533- goto out;
534- }
535- if (!polkit_authorization_result_get_is_authorized (result)) {
536- g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
537- G_DBUS_ERROR_AUTH_FAILED, "Not authorized.");
538- goto out;
539- }
540- ret = TRUE;
541- out:
542- if (result != NULL)
543- g_object_unref (result);
544- g_object_unref (subject);
545- return ret;
546-}
547-
548-static void
549-on_bus_acquired (GDBusConnection* connection, const gchar* name,
550- gpointer user_data)
551-{
552- WhoopsiePreferences* interface;
553- GError* error = NULL;
554-
555- interface = whoopsie_preferences_skeleton_new ();
556- if (!g_dbus_interface_skeleton_export (
557- G_DBUS_INTERFACE_SKELETON (interface),
558- connection,
559- "/com/ubuntu/WhoopsiePreferences", &error)) {
560-
561- g_print ("Could not export path: %s\n", error->message);
562- g_error_free (error);
563- g_main_loop_quit (loop);
564- return;
565- }
566-
567- authority = polkit_authority_get_sync (NULL, &error);
568- if (authority == NULL) {
569- g_print ("Could not get authority: %s\n", error->message);
570- g_error_free (error);
571- g_main_loop_quit (loop);
572- return;
573- }
574- loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit,
575- loop);
576-
577- g_signal_connect (interface, "notify::report-crashes",
578- G_CALLBACK (whoopsie_preferences_changed),
579- "report_crashes");
580- g_signal_connect (interface, "notify::report-metrics",
581- G_CALLBACK (whoopsie_preferences_changed),
582- "report_metrics");
583- g_signal_connect (interface, "handle-set-report-crashes",
584- G_CALLBACK (whoopsie_preferences_on_set_report_crashes),
585- NULL);
586- g_signal_connect (interface, "handle-set-report-metrics",
587- G_CALLBACK (whoopsie_preferences_on_set_report_metrics),
588- NULL);
589- g_signal_connect (interface, "handle-get-identifier",
590- G_CALLBACK (whoopsie_preferences_on_get_identifier),
591- NULL);
592- g_signal_connect (interface, "g-authorize-method", G_CALLBACK
593- (whoopsie_preferences_authorize_method), authority);
594-
595- whoopsie_preferences_load (interface);
596- whoopsie_preferences_dbus_notify (interface);
597-}
598-
599-static void
600-on_name_acquired (GDBusConnection* connection, const gchar* name,
601- gpointer user_data)
602-{
603- g_print ("Acquired the name: %s\n", name);
604-}
605-
606-static void
607-on_name_lost (GDBusConnection* connection, const gchar* name,
608- gpointer user_data)
609-{
610- g_print ("Lost the name: %s\n", name);
611-}
612-
613-int
614-main (int argc, char** argv)
615-{
616- guint owner_id;
617-
618- if (getuid () != 0) {
619- g_print ("This program must be run as root.\n");
620- return 1;
621- }
622-
623- g_type_init();
624-
625- owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
626- "com.ubuntu.WhoopsiePreferences",
627- G_BUS_NAME_OWNER_FLAGS_NONE,
628- on_bus_acquired,
629- on_name_acquired,
630- on_name_lost,
631- NULL, NULL);
632-
633- loop = g_main_loop_new (NULL, FALSE);
634- g_main_loop_run (loop);
635- g_bus_unown_name (owner_id);
636- g_main_loop_unref (loop);
637- if (key_file)
638- g_key_file_free (key_file);
639- return 0;
640-}
641
642=== removed file 'src/diagnostics/whoopsie-preferences.xml'
643--- src/diagnostics/whoopsie-preferences.xml 2013-04-16 11:25:34 +0000
644+++ src/diagnostics/whoopsie-preferences.xml 1970-01-01 00:00:00 +0000
645@@ -1,15 +0,0 @@
646-<node>
647- <interface name="com.ubuntu.WhoopsiePreferences">
648- <property name="ReportCrashes" type="b" access="read" />
649- <property name="ReportMetrics" type="b" access="read" />
650- <method name="SetReportCrashes">
651- <arg direction="in" type="b" name="report" />
652- </method>
653- <method name="SetReportMetrics">
654- <arg direction="in" type="b" name="report" />
655- </method>
656- <method name="GetIdentifier">
657- <arg direction="out" type="s" name="identifier" />
658- </method>
659- </interface>
660-</node>

Subscribers

People subscribed via source and target branches