Merge lp:~ev/activity-log-manager/whoopsie into lp:~activity-log-manager/activity-log-manager/vala
- whoopsie
- Merge into vala
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 85 | ||||
Proposed branch: | lp:~ev/activity-log-manager/whoopsie | ||||
Merge into: | lp:~activity-log-manager/activity-log-manager/vala | ||||
Diff against target: |
984 lines (+808/-7) 14 files modified
.bzrignore (+1/-0) configure.ac (+16/-1) po/POTFILES.in (+1/-0) src/Makefile.am (+23/-6) src/activity-log-manager.vala (+4/-0) src/alm-cc.c (+8/-0) src/diagnostics-widget.c (+193/-0) src/diagnostics/Makefile.am (+44/-0) src/diagnostics/com.ubuntu.WhoopsiePreferences.conf (+26/-0) src/diagnostics/com.ubuntu.WhoopsiePreferences.service (+4/-0) src/diagnostics/com.ubuntu.whoopsiepreferences.policy (+18/-0) src/diagnostics/whoopsie-preferences.c (+297/-0) src/diagnostics/whoopsie-preferences.xml (+8/-0) src/diagnostics/whoopsie.ui (+165/-0) |
||||
To merge this branch: | bzr merge lp:~ev/activity-log-manager/whoopsie | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manish Sinha (मनीष सिन्हा) | Approve | ||
Review via email: mp+93899@code.launchpad.net |
Commit message
Description of the change
As discussed with Seif and the Canonical design team, we should merge the two existing privacy pages in GNOME Control Center into a single entity, under activity-
Christian has provided the following mockup as guidance:
http://
The privacy page for the Ubuntu crash report settings, hereafter referred to as "diagnostics," provides a small DBus daemon for writing the root-owned /etc/default/
This also adds a dependency on PolicyKit.
I've only made one change to activity-
As stated previously in #ubuntu-release and #ubuntu-devel, this code already exists in another form in the archive (whoopsie-daisy), and it is the release team's belief that it therefore falls under UI Freeze and not Feature Freeze. However, care will have to be taken to coordinate a release of whoopsie-daisy that does not have the aforementioned files.
Seif Lotfy (seif) wrote : | # |
On Mon, Feb 20, 2012 at 8:51 PM, Seif Lotfy <email address hidden> wrote:
> Can you please make sure that the makefile is complete... I can't compile it due to
>
> make[3]: *** No rule to make target `diagnostics/
> make[3]: Leaving directory `/home/
Fixed in r85. This was due to the autogenerated vala targets pulling
in libactivity-
worked around that by explicitly building against the C source
targets:
activity_
$(SOURCES:
diagnostics
diagnostics
Seif Lotfy (seif) wrote : | # |
Since this is upstream work that will be deployed elsewhere I would like to
have this part optional...
Which means if possible can you make it so if i pass --enable-whoopsie or
--mode=ubuntu upon configuring that the whoopsie widget appears. It should
be disabled by default
cheers
Seif
On Mon, Feb 20, 2012 at 10:48 PM, Evan Dandrea
<email address hidden>wrote:
> On Mon, Feb 20, 2012 at 8:51 PM, Seif Lotfy <email address hidden> wrote:
> > Can you please make sure that the makefile is complete... I can't
> compile it due to
> >
> > make[3]: *** No rule to make target `diagnostics/
> needed by `libactivity_
> > make[3]: Leaving directory `/home/
>
> Fixed in r85. This was due to the autogenerated vala targets pulling
> in libactivity-
> worked around that by explicitly building against the C source
> targets:
>
> activity_
> $(SOURCES:.vala=.c) alm-cc.c \
> diagnostics-
> diagnostics/
>
> --
> https:/
> Your team Activity Log Manager is requested to review the proposed merge
> of lp:~ev/activity-log-manager/whoopsie into lp:activity-log-manager.
>
Seif Lotfy (seif) wrote : | # |
Also I cant seem to see the panel anywhere...
Since this is being merged into an upstream project can you please make it so it is disabled by default..
It should be enabled upon configuring by passing a -enable-whoopsie parameter
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Please make this as optional (--enable-whoopsie) otherwise it cannot be packaged in other distributions without whoopsie being packaged
On Mon, Feb 20, 2012 at 10:05 PM, Seif Lotfy <email address hidden> wrote:
> Also I cant seem to see the panel anywhere...
> Since this is being merged into an upstream project can you please make it so it is disabled by default..
> It should be enabled upon configuring by passing a -enable-whoopsie parameter
Okay, I've made the diagnostics tab optional. Enable it by passing
--with-whoopsie to configure. You should then see a "Diagnostics" tab
on the GNOME Control Center Privacy page's GtkNotebook.
On Tue, Feb 21, 2012 at 10:31 AM, Evan Dandrea
<email address hidden> wrote:
> Okay, I've made the diagnostics tab optional. Enable it by passing
> --with-whoopsie to configure. You should then see a "Diagnostics" tab
> on the GNOME Control Center Privacy page's GtkNotebook.
That's r86.
Seif Lotfy (seif) wrote : | # |
Evan I dont mind also having it in the standalone version :D
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
I get symbol lookup error. This is what I did
./autogen.sh --prefix=/usr --with-ccpanel --with-whoopsie
sudo make install
Running as
$ gnome-control-
gnome-control-
----------------
Running strace
$ strace gnome-control-
futex(0x20f578b4, FUTEX_WAKE_
futex(0x20f57fe0, FUTEX_WAKE_PRIVATE, 1) = 1
writev(2, [{"gnome-
) = 153
exit_group(127)
On Tue, Feb 21, 2012 at 3:00 PM, Manish Sinha (मनीष सिन्हा
<email address hidden> wrote:
> Review: Needs Fixing symbols
>
> I get symbol lookup error. This is what I did
>
> ./autogen.sh --prefix=/usr --with-ccpanel --with-whoopsie
> sudo make install
This should be fixed in r87. You don't have to specify both
--with-ccpanel and --with-whoopsie. Setting --with-whoopsie will
imply --with-ccpanel.
On Tue, Feb 21, 2012 at 2:55 PM, Seif Lotfy <email address hidden> wrote:
> Evan I dont mind also having it in the standalone version :D
Sure, but presumably that requires building the whoopsie code as a
library and generating a vapi, as you cannot directly call C code from
vala source.
So could we get that in a second pass, given that UI freeze is tomorrow?
Seif Lotfy (seif) wrote : | # |
Yep merging tomorrow first thing
On Wed, Feb 22, 2012 at 12:41 AM, Evan Dandrea
<email address hidden>wrote:
> On Tue, Feb 21, 2012 at 2:55 PM, Seif Lotfy <email address hidden> wrote:
> > Evan I dont mind also having it in the standalone version :D
>
> Sure, but presumably that requires building the whoopsie code as a
> library and generating a vapi, as you cannot directly call C code from
> vala source.
>
> So could we get that in a second pass, given that UI freeze is tomorrow?
>
> --
> https:/
> Your team Activity Log Manager is subscribed to branch
> lp:activity-log-manager.
>
- 85. By Seif Lotfy
-
merge
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Will try it out in a few hours (when back from work) and getting it merged. alm needs to be released today so that it can be uploaded before UIF hits
Manish Sinha (मनीष सिन्हा) (manishsinha) : | # |
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2012-02-15 19:55:47 +0000 | |||
3 | +++ .bzrignore 2012-02-21 23:40:22 +0000 | |||
4 | @@ -31,6 +31,7 @@ | |||
5 | 31 | src/applications-widget.c | 31 | src/applications-widget.c |
6 | 32 | src/files-widget.c | 32 | src/files-widget.c |
7 | 33 | src/history-widget.c | 33 | src/history-widget.c |
8 | 34 | src/diagnostics/Makefile | ||
9 | 34 | po/*.gmo | 35 | po/*.gmo |
10 | 35 | src/*.lo | 36 | src/*.lo |
11 | 36 | po/stamp-it | 37 | po/stamp-it |
12 | 37 | 38 | ||
13 | === modified file 'configure.ac' | |||
14 | --- configure.ac 2012-02-14 20:20:46 +0000 | |||
15 | +++ configure.ac 2012-02-21 23:40:22 +0000 | |||
16 | @@ -35,6 +35,7 @@ | |||
17 | 35 | PKG_CHECK_MODULES(GTK, gtk+-3.0, [HAVE_GTK=yes], [HAVE_GTK=no]) | 35 | PKG_CHECK_MODULES(GTK, gtk+-3.0, [HAVE_GTK=yes], [HAVE_GTK=no]) |
18 | 36 | PKG_CHECK_MODULES(GEE, gee-1.0, [HAVE_GEE=yes], [HAVE_GEE=no]) | 36 | PKG_CHECK_MODULES(GEE, gee-1.0, [HAVE_GEE=yes], [HAVE_GEE=no]) |
19 | 37 | PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0, [HAVE_GIO_UNIX=yes], [HAVE_GIO_UNIX=no]) | 37 | PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0, [HAVE_GIO_UNIX=yes], [HAVE_GIO_UNIX=no]) |
20 | 38 | PKG_CHECK_MODULES(POLKIT, polkit-gobject-1, [HAVE_POLKIT=yes], [HAVE_POLKIT=no]) | ||
21 | 38 | 39 | ||
22 | 39 | AC_ARG_WITH([extensiondir], | 40 | AC_ARG_WITH([extensiondir], |
23 | 40 | [AS_HELP_STRING([--with-extensiondir], | 41 | [AS_HELP_STRING([--with-extensiondir], |
24 | @@ -42,6 +43,11 @@ | |||
25 | 42 | [], | 43 | [], |
26 | 43 | [with_extensiondir=yes]) | 44 | [with_extensiondir=yes]) |
27 | 44 | 45 | ||
28 | 46 | AC_ARG_WITH([whoopsie], | ||
29 | 47 | [AS_HELP_STRING([--with-whoopsie], | ||
30 | 48 | [build control-center plugin Ubuntu crash reporting page @<:@default=check@:>@])], | ||
31 | 49 | [with_ccpanel=yes], | ||
32 | 50 | [with_whoopsie=check]) | ||
33 | 45 | AC_ARG_WITH([ccpanel], | 51 | AC_ARG_WITH([ccpanel], |
34 | 46 | [AS_HELP_STRING([--with-ccpanel], | 52 | [AS_HELP_STRING([--with-ccpanel], |
35 | 47 | [build control-center plugin @<:@default=check@:>@])], | 53 | [build control-center plugin @<:@default=check@:>@])], |
36 | @@ -56,7 +62,11 @@ | |||
37 | 56 | [CCPANEL_DIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center`], | 62 | [CCPANEL_DIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center`], |
38 | 57 | [CCPANEL_DIR="${PREFIX}/lib/control-center-1/panels"]) | 63 | [CCPANEL_DIR="${PREFIX}/lib/control-center-1/panels"]) |
39 | 58 | AC_SUBST(CCPANEL_DIR), | 64 | AC_SUBST(CCPANEL_DIR), |
41 | 59 | [if test "x$with_ccpanel" != xcheck; then | 65 | [if test "x$with_whoopsie" != xcheck; then |
42 | 66 | AC_MSG_FAILURE( | ||
43 | 67 | [--with-whoopsie was given, but test for libgnome-control-center failed]) | ||
44 | 68 | fi | ||
45 | 69 | if test "x$with_ccpanel" != xcheck; then | ||
46 | 60 | AC_MSG_FAILURE( | 70 | AC_MSG_FAILURE( |
47 | 61 | [--with-ccpanel was given, but test for libgnome-control-center failed]) | 71 | [--with-ccpanel was given, but test for libgnome-control-center failed]) |
48 | 62 | fi | 72 | fi |
49 | @@ -64,6 +74,10 @@ | |||
50 | 64 | )] | 74 | )] |
51 | 65 | ) | 75 | ) |
52 | 66 | AM_CONDITIONAL([HAVE_CCPANEL], [test -n "$CCPANEL_LIBS"]) | 76 | AM_CONDITIONAL([HAVE_CCPANEL], [test -n "$CCPANEL_LIBS"]) |
53 | 77 | AM_CONDITIONAL([HAVE_WHOOPSIE], [test "x$with_whoopsie" != xcheck]) | ||
54 | 78 | AS_IF([test "x$with_whoopsie" != xcheck], | ||
55 | 79 | AC_DEFINE([HAVE_WHOOPSIE], [1], | ||
56 | 80 | [Build control-center plugin Ubuntu crash reporting page]), []) | ||
57 | 67 | 81 | ||
58 | 68 | 82 | ||
59 | 69 | 83 | ||
60 | @@ -71,5 +85,6 @@ | |||
61 | 71 | Makefile | 85 | Makefile |
62 | 72 | data/Makefile | 86 | data/Makefile |
63 | 73 | src/Makefile | 87 | src/Makefile |
64 | 88 | src/diagnostics/Makefile | ||
65 | 74 | po/Makefile.in | 89 | po/Makefile.in |
66 | 75 | ]) | 90 | ]) |
67 | 76 | 91 | ||
68 | === modified file 'po/POTFILES.in' | |||
69 | --- po/POTFILES.in 2012-02-14 20:20:46 +0000 | |||
70 | +++ po/POTFILES.in 2012-02-21 23:40:22 +0000 | |||
71 | @@ -6,3 +6,4 @@ | |||
72 | 6 | src/applications-widget.vala | 6 | src/applications-widget.vala |
73 | 7 | src/files-widget.vala | 7 | src/files-widget.vala |
74 | 8 | src/history-widget.vala | 8 | src/history-widget.vala |
75 | 9 | src/diagnostics/whoopsie.ui | ||
76 | 9 | 10 | ||
77 | === modified file 'src/Makefile.am' | |||
78 | --- src/Makefile.am 2012-02-08 14:19:18 +0000 | |||
79 | +++ src/Makefile.am 2012-02-21 23:40:22 +0000 | |||
80 | @@ -2,6 +2,11 @@ | |||
81 | 2 | ccpaneldir = $(CCPANEL_DIR) | 2 | ccpaneldir = $(CCPANEL_DIR) |
82 | 3 | ccpanel_LTLIBRARIES = libactivity-log-manager.la | 3 | ccpanel_LTLIBRARIES = libactivity-log-manager.la |
83 | 4 | endif | 4 | endif |
84 | 5 | if HAVE_WHOOPSIE | ||
85 | 6 | gnomeccuidir = $(datadir)/gnome-control-center/ui/ | ||
86 | 7 | endif | ||
87 | 8 | |||
88 | 9 | SUBDIRS = diagnostics | ||
89 | 5 | 10 | ||
90 | 6 | VALAFLAGS = \ | 11 | VALAFLAGS = \ |
91 | 7 | --pkg zeitgeist-1.0 \ | 12 | --pkg zeitgeist-1.0 \ |
92 | @@ -9,7 +14,7 @@ | |||
93 | 9 | --pkg gee-1.0 \ | 14 | --pkg gee-1.0 \ |
94 | 10 | --target-glib=2.26 \ | 15 | --target-glib=2.26 \ |
95 | 11 | --pkg gio-unix-2.0 \ | 16 | --pkg gio-unix-2.0 \ |
97 | 12 | config.vapi | 17 | config.vapi |
98 | 13 | 18 | ||
99 | 14 | bin_PROGRAMS = activity-log-manager | 19 | bin_PROGRAMS = activity-log-manager |
100 | 15 | 20 | ||
101 | @@ -28,6 +33,11 @@ | |||
102 | 28 | $(SHARED_CFLAGS) \ | 33 | $(SHARED_CFLAGS) \ |
103 | 29 | $(CCPANEL_CFLAGS) | 34 | $(CCPANEL_CFLAGS) |
104 | 30 | 35 | ||
105 | 36 | if HAVE_WHOOPSIE | ||
106 | 37 | libactivity_log_manager_la_CFLAGS += \ | ||
107 | 38 | $(POLKIT_CFLAGS) \ | ||
108 | 39 | -DGNOMECC_UI_DIR=\""$(gnomeccuidir)"\" | ||
109 | 40 | endif | ||
110 | 31 | 41 | ||
111 | 32 | SOURCES = \ | 42 | SOURCES = \ |
112 | 33 | activity-log-manager.vala \ | 43 | activity-log-manager.vala \ |
113 | @@ -38,7 +48,13 @@ | |||
114 | 38 | activity_log_manager_SOURCES = \ | 48 | activity_log_manager_SOURCES = \ |
115 | 39 | $(SOURCES) alm.vala | 49 | $(SOURCES) alm.vala |
116 | 40 | libactivity_log_manager_la_SOURCES = \ | 50 | libactivity_log_manager_la_SOURCES = \ |
118 | 41 | $(SOURCES) alm-cc.c | 51 | $(SOURCES:.vala=.c) alm-cc.c |
119 | 52 | |||
120 | 53 | if HAVE_WHOOPSIE | ||
121 | 54 | libactivity_log_manager_la_SOURCES += \ | ||
122 | 55 | diagnostics-widget.c \ | ||
123 | 56 | diagnostics/whoopsie-generated.c | ||
124 | 57 | endif | ||
125 | 42 | 58 | ||
126 | 43 | activity_log_manager_LDFLAGS = \ | 59 | activity_log_manager_LDFLAGS = \ |
127 | 44 | -Wl,--export-dynamic | 60 | -Wl,--export-dynamic |
128 | @@ -55,6 +71,11 @@ | |||
129 | 55 | $(SHARED_LIBS) \ | 71 | $(SHARED_LIBS) \ |
130 | 56 | $(CCPANEL_LIBS) | 72 | $(CCPANEL_LIBS) |
131 | 57 | 73 | ||
132 | 74 | if HAVE_WHOOPSIE | ||
133 | 75 | libactivity_log_manager_la_LIBADD += \ | ||
134 | 76 | $(POLKIT_LIBS) | ||
135 | 77 | endif | ||
136 | 78 | |||
137 | 58 | GENERATED_C_FILES = $(alm_SOURCES:.vala=.c) | 79 | GENERATED_C_FILES = $(alm_SOURCES:.vala=.c) |
138 | 59 | 80 | ||
139 | 60 | GENERATED_O_FILES = $(alm_SOURCES:.vala=.o) | 81 | GENERATED_O_FILES = $(alm_SOURCES:.vala=.o) |
140 | @@ -62,7 +83,3 @@ | |||
141 | 62 | CLEANFILES = \ | 83 | CLEANFILES = \ |
142 | 63 | $(GENERATED_C_FILES) \ | 84 | $(GENERATED_C_FILES) \ |
143 | 64 | $(GENERATED_O_FILES) | 85 | $(GENERATED_O_FILES) |
144 | 65 | |||
145 | 66 | |||
146 | 67 | |||
147 | 68 | |||
148 | 69 | 86 | ||
149 | === modified file 'src/activity-log-manager.vala' | |||
150 | --- src/activity-log-manager.vala 2012-02-18 21:38:27 +0000 | |||
151 | +++ src/activity-log-manager.vala 2012-02-21 23:40:22 +0000 | |||
152 | @@ -71,6 +71,10 @@ | |||
153 | 71 | this.show_all(); | 71 | this.show_all(); |
154 | 72 | } | 72 | } |
155 | 73 | 73 | ||
156 | 74 | public void append_page (Gtk.Widget widget, string label) { | ||
157 | 75 | var app_label = new Gtk.Label(_(label)); | ||
158 | 76 | notebook.append_page(widget, app_label); | ||
159 | 77 | } | ||
160 | 74 | public void on_incognito_toggled(bool status) { | 78 | public void on_incognito_toggled(bool status) { |
161 | 75 | this.logging_switch.set_active(!status); | 79 | this.logging_switch.set_active(!status); |
162 | 76 | } | 80 | } |
163 | 77 | 81 | ||
164 | === modified file 'src/alm-cc.c' | |||
165 | --- src/alm-cc.c 2012-02-11 16:53:55 +0000 | |||
166 | +++ src/alm-cc.c 2012-02-21 23:40:22 +0000 | |||
167 | @@ -21,6 +21,10 @@ | |||
168 | 21 | #include "config.h" | 21 | #include "config.h" |
169 | 22 | 22 | ||
170 | 23 | extern void* alm_activity_log_manager_new (void); | 23 | extern void* alm_activity_log_manager_new (void); |
171 | 24 | #ifdef HAVE_WHOOPSIE | ||
172 | 25 | extern void alm_activity_log_manager_append_page (void* alm, GtkWidget* widget, const gchar* label); | ||
173 | 26 | extern void* whoopsie_daisy_preferences_new (void); | ||
174 | 27 | #endif | ||
175 | 24 | 28 | ||
176 | 25 | #define ALM_TYPE_MAIN_WINDOW_PANEL alm_main_window_panel_get_type() | 29 | #define ALM_TYPE_MAIN_WINDOW_PANEL alm_main_window_panel_get_type() |
177 | 26 | 30 | ||
178 | @@ -53,6 +57,10 @@ | |||
179 | 53 | alm_main_window_panel_init (AlmMainWindowPanel *self) | 57 | alm_main_window_panel_init (AlmMainWindowPanel *self) |
180 | 54 | { | 58 | { |
181 | 55 | GtkWidget *widget = GTK_WIDGET (alm_activity_log_manager_new ()); | 59 | GtkWidget *widget = GTK_WIDGET (alm_activity_log_manager_new ()); |
182 | 60 | #ifdef HAVE_WHOOPSIE | ||
183 | 61 | GtkWidget *whoopsie = GTK_WIDGET (whoopsie_daisy_preferences_new ()); | ||
184 | 62 | alm_activity_log_manager_append_page (widget, whoopsie, "Diagnostics"); | ||
185 | 63 | #endif | ||
186 | 56 | gtk_widget_show_all (widget); | 64 | gtk_widget_show_all (widget); |
187 | 57 | gtk_container_add (GTK_CONTAINER (self), widget); | 65 | gtk_container_add (GTK_CONTAINER (self), widget); |
188 | 58 | } | 66 | } |
189 | 59 | 67 | ||
190 | === added directory 'src/diagnostics' | |||
191 | === added file 'src/diagnostics-widget.c' | |||
192 | --- src/diagnostics-widget.c 1970-01-01 00:00:00 +0000 | |||
193 | +++ src/diagnostics-widget.c 2012-02-21 23:40:22 +0000 | |||
194 | @@ -0,0 +1,193 @@ | |||
195 | 1 | #include <gtk/gtk.h> | ||
196 | 2 | #include <gio/gio.h> | ||
197 | 3 | #include <polkit/polkit.h> | ||
198 | 4 | |||
199 | 5 | #include "diagnostics/whoopsie-generated.h" | ||
200 | 6 | |||
201 | 7 | static WhoopsiePreferences* proxy = NULL; | ||
202 | 8 | |||
203 | 9 | #define POL_PATH "com.ubuntu.whoopsiepreferences.change" | ||
204 | 10 | #define PRIVACY_URL "http://www.ubuntu.com/aboutus/privacypolicy" | ||
205 | 11 | |||
206 | 12 | #define WHOOPSIE_DAISY_TYPE_PREFERENCES whoopsie_daisy_preferences_get_type() | ||
207 | 13 | #define WHOOPSIE_DAISY_PREFERENCES(obj) \ | ||
208 | 14 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | ||
209 | 15 | WHOOPSIE_DAISY_TYPE_PREFERENCES, WhoopsieDaisyPreferences)) | ||
210 | 16 | #define WHOOPSIE_DAISY_PREFERENCES_PRIVATE(o) \ | ||
211 | 17 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), WHOOPSIE_DAISY_TYPE_PREFERENCES, WhoopsieDaisyPreferencesPrivate)) | ||
212 | 18 | |||
213 | 19 | GType whoopsie_daisy_preferences_get_type (void) G_GNUC_CONST; | ||
214 | 20 | |||
215 | 21 | typedef struct _WhoopsieDaisyPreferences WhoopsieDaisyPreferences; | ||
216 | 22 | typedef struct _WhoopsieDaisyPreferencesClass WhoopsieDaisyPreferencesClass; | ||
217 | 23 | typedef struct _WhoopsieDaisyPreferencesPrivate WhoopsieDaisyPreferencesPrivate; | ||
218 | 24 | |||
219 | 25 | struct _WhoopsieDaisyPreferencesPrivate | ||
220 | 26 | { | ||
221 | 27 | GtkBuilder* builder; | ||
222 | 28 | GPermission* permission; | ||
223 | 29 | }; | ||
224 | 30 | |||
225 | 31 | struct _WhoopsieDaisyPreferences | ||
226 | 32 | { | ||
227 | 33 | GtkBox parent; | ||
228 | 34 | WhoopsieDaisyPreferencesPrivate* priv; | ||
229 | 35 | }; | ||
230 | 36 | |||
231 | 37 | struct _WhoopsieDaisyPreferencesClass | ||
232 | 38 | { | ||
233 | 39 | GtkBoxClass parent_class; | ||
234 | 40 | }; | ||
235 | 41 | |||
236 | 42 | G_DEFINE_TYPE (WhoopsieDaisyPreferences, whoopsie_daisy_preferences, GTK_TYPE_BOX) | ||
237 | 43 | |||
238 | 44 | static void | ||
239 | 45 | whoopsie_daisy_preferences_dispose (GObject* object) | ||
240 | 46 | { | ||
241 | 47 | WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (object)->priv; | ||
242 | 48 | |||
243 | 49 | if (priv->builder) { | ||
244 | 50 | g_object_unref (priv->builder); | ||
245 | 51 | priv->builder = NULL; | ||
246 | 52 | } | ||
247 | 53 | if (priv->permission) { | ||
248 | 54 | g_object_unref (priv->permission); | ||
249 | 55 | priv->permission = NULL; | ||
250 | 56 | } | ||
251 | 57 | } | ||
252 | 58 | |||
253 | 59 | static void | ||
254 | 60 | whoopsie_daisy_preferences_class_init (WhoopsieDaisyPreferencesClass *klass) | ||
255 | 61 | { | ||
256 | 62 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
257 | 63 | g_type_class_add_private (klass, sizeof (WhoopsieDaisyPreferencesPrivate)); | ||
258 | 64 | object_class->dispose = whoopsie_daisy_preferences_dispose; | ||
259 | 65 | } | ||
260 | 66 | |||
261 | 67 | static void | ||
262 | 68 | on_privacy_policy_clicked (GtkWidget* button, gpointer user_data) | ||
263 | 69 | { | ||
264 | 70 | system ("xdg-open " PRIVACY_URL); | ||
265 | 71 | } | ||
266 | 72 | |||
267 | 73 | static void | ||
268 | 74 | on_permission_changed (GPermission* permission, GParamSpec* pspec, gpointer data) | ||
269 | 75 | { | ||
270 | 76 | gboolean allowed; | ||
271 | 77 | GtkWidget* error_reports_box = NULL; | ||
272 | 78 | WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (data)->priv; | ||
273 | 79 | |||
274 | 80 | error_reports_box = GTK_WIDGET (gtk_builder_get_object ( | ||
275 | 81 | priv->builder, "error_reports_box")); | ||
276 | 82 | |||
277 | 83 | allowed = g_permission_get_allowed (permission); | ||
278 | 84 | gtk_widget_set_sensitive (error_reports_box, allowed); | ||
279 | 85 | } | ||
280 | 86 | |||
281 | 87 | static void | ||
282 | 88 | on_submit_error_reports_checked (GtkToggleButton* button, gpointer user_data) | ||
283 | 89 | { | ||
284 | 90 | GError* error = NULL; | ||
285 | 91 | |||
286 | 92 | whoopsie_preferences_call_set_report_crashes_sync (proxy, | ||
287 | 93 | gtk_toggle_button_get_active (button), NULL, &error); | ||
288 | 94 | if (error != NULL) { | ||
289 | 95 | g_printerr ("Error setting crash reporting: %s\n", error->message); | ||
290 | 96 | g_error_free (error); | ||
291 | 97 | } | ||
292 | 98 | } | ||
293 | 99 | |||
294 | 100 | static void | ||
295 | 101 | on_properties_changed (WhoopsiePreferences* interface, | ||
296 | 102 | GVariant* changed_properties, | ||
297 | 103 | const gchar* const* invalidated_properties, | ||
298 | 104 | gpointer user_data) | ||
299 | 105 | { | ||
300 | 106 | WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (user_data)->priv; | ||
301 | 107 | gboolean report_errors; | ||
302 | 108 | GtkWidget* submit_error_reports = NULL; | ||
303 | 109 | |||
304 | 110 | submit_error_reports = GTK_WIDGET ( | ||
305 | 111 | gtk_builder_get_object (priv->builder, "submit_error_reports")); | ||
306 | 112 | report_errors = whoopsie_preferences_get_report_crashes (interface); | ||
307 | 113 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (submit_error_reports), report_errors); | ||
308 | 114 | } | ||
309 | 115 | |||
310 | 116 | static void | ||
311 | 117 | whoopsie_daisy_preferences_setup_dbus (WhoopsieDaisyPreferences *self, GError *error) | ||
312 | 118 | { | ||
313 | 119 | WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (self)->priv; | ||
314 | 120 | proxy = whoopsie_preferences_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, | ||
315 | 121 | G_DBUS_PROXY_FLAGS_NONE, | ||
316 | 122 | "com.ubuntu.WhoopsiePreferences", | ||
317 | 123 | "/com/ubuntu/WhoopsiePreferences", | ||
318 | 124 | NULL, &error); | ||
319 | 125 | if (!proxy) | ||
320 | 126 | return | ||
321 | 127 | |||
322 | 128 | g_signal_connect (proxy, "g-properties-changed", | ||
323 | 129 | G_CALLBACK (on_properties_changed), self); | ||
324 | 130 | on_properties_changed (proxy, NULL, NULL, self); | ||
325 | 131 | } | ||
326 | 132 | static void | ||
327 | 133 | whoopsie_daisy_preferences_init (WhoopsieDaisyPreferences *self) | ||
328 | 134 | { | ||
329 | 135 | GError *error = NULL; | ||
330 | 136 | GtkWidget* privacy_page = NULL; | ||
331 | 137 | GtkWidget* unlock_align = NULL; | ||
332 | 138 | GtkWidget* unlock_button = NULL; | ||
333 | 139 | GtkWidget* submit_error_reports = NULL; | ||
334 | 140 | GtkWidget* privacy_policy = NULL; | ||
335 | 141 | WhoopsieDaisyPreferencesPrivate* priv; | ||
336 | 142 | priv = self->priv = WHOOPSIE_DAISY_PREFERENCES_PRIVATE (self); | ||
337 | 143 | |||
338 | 144 | priv->builder = gtk_builder_new (); | ||
339 | 145 | gtk_builder_add_from_file(priv->builder, GNOMECC_UI_DIR "/whoopsie.ui", &error); | ||
340 | 146 | if (error != NULL) { | ||
341 | 147 | g_warning ("Could not load interface file: %s", error->message); | ||
342 | 148 | g_error_free (error); | ||
343 | 149 | return; | ||
344 | 150 | } | ||
345 | 151 | submit_error_reports = GTK_WIDGET ( | ||
346 | 152 | gtk_builder_get_object (priv->builder, "submit_error_reports")); | ||
347 | 153 | privacy_page = GTK_WIDGET ( | ||
348 | 154 | gtk_builder_get_object (priv->builder, "privacy_page_box")); | ||
349 | 155 | unlock_align = GTK_WIDGET ( | ||
350 | 156 | gtk_builder_get_object (priv->builder, "unlock_alignment")); | ||
351 | 157 | privacy_policy = GTK_WIDGET ( | ||
352 | 158 | gtk_builder_get_object (priv->builder, "privacy_policy")); | ||
353 | 159 | |||
354 | 160 | gtk_widget_reparent (privacy_page, (GtkWidget *) self); | ||
355 | 161 | g_object_set (self, "valign", GTK_ALIGN_START, NULL); | ||
356 | 162 | |||
357 | 163 | priv->permission = polkit_permission_new_sync (POL_PATH, NULL, NULL, &error); | ||
358 | 164 | if (!priv->permission) { | ||
359 | 165 | g_warning ("Could not acquire permission: %s", error->message); | ||
360 | 166 | g_error_free (error); | ||
361 | 167 | } | ||
362 | 168 | |||
363 | 169 | unlock_button = gtk_lock_button_new (priv->permission); | ||
364 | 170 | gtk_container_add (GTK_CONTAINER (unlock_align), GTK_WIDGET (unlock_button)); | ||
365 | 171 | gtk_widget_show (unlock_button); | ||
366 | 172 | |||
367 | 173 | g_signal_connect (priv->permission, "notify", G_CALLBACK (on_permission_changed), self); | ||
368 | 174 | on_permission_changed (priv->permission, NULL, self); | ||
369 | 175 | |||
370 | 176 | whoopsie_daisy_preferences_setup_dbus (self, error); | ||
371 | 177 | if (error) { | ||
372 | 178 | g_warning ("Could not set up DBus connection: %s", error->message); | ||
373 | 179 | g_error_free (error); | ||
374 | 180 | } | ||
375 | 181 | |||
376 | 182 | g_signal_connect (submit_error_reports, "toggled", | ||
377 | 183 | G_CALLBACK (on_submit_error_reports_checked), NULL); | ||
378 | 184 | g_signal_connect (privacy_policy, "clicked", | ||
379 | 185 | G_CALLBACK (on_privacy_policy_clicked), NULL); | ||
380 | 186 | } | ||
381 | 187 | |||
382 | 188 | GtkWidget* | ||
383 | 189 | whoopsie_daisy_preferences_new (void) | ||
384 | 190 | { | ||
385 | 191 | return g_object_new (WHOOPSIE_DAISY_TYPE_PREFERENCES, NULL); | ||
386 | 192 | } | ||
387 | 193 | |||
388 | 0 | 194 | ||
389 | === added file 'src/diagnostics/Makefile.am' | |||
390 | --- src/diagnostics/Makefile.am 1970-01-01 00:00:00 +0000 | |||
391 | +++ src/diagnostics/Makefile.am 2012-02-21 23:40:22 +0000 | |||
392 | @@ -0,0 +1,44 @@ | |||
393 | 1 | if HAVE_CCPANEL | ||
394 | 2 | ccpaneldir = $(CCPANEL_DIR) | ||
395 | 3 | bin_PROGRAMS = whoopsie-preferences | ||
396 | 4 | endif | ||
397 | 5 | |||
398 | 6 | policykitdir = $(datadir)/polkit-1/actions/ | ||
399 | 7 | dbussystemdir = $(sysconfdir)/dbus-1/system.d/ | ||
400 | 8 | dbusservicedir = $(datadir)/dbus-1/system-services/ | ||
401 | 9 | gnomeccuidir = $(datadir)/gnome-control-center/ui/ | ||
402 | 10 | |||
403 | 11 | whoopsie_preferences_CFLAGS = \ | ||
404 | 12 | -Wall \ | ||
405 | 13 | -g \ | ||
406 | 14 | $(POLKIT_CFLAGS) $(GIO_UNIX_CFLAGS) | ||
407 | 15 | |||
408 | 16 | whoopsie_preferences_SOURCES = \ | ||
409 | 17 | whoopsie-generated.c whoopsie-generated.h whoopsie-preferences.c | ||
410 | 18 | |||
411 | 19 | whoopsie_preferences_LDADD = \ | ||
412 | 20 | $(POLKIT_LIBS) \ | ||
413 | 21 | $(GIO_UNIX_LIBS) | ||
414 | 22 | |||
415 | 23 | EXTRA_DIST = \ | ||
416 | 24 | whoopsie-preferences.xml \ | ||
417 | 25 | com.ubuntu.WhoopsiePreferences.service \ | ||
418 | 26 | com.ubuntu.WhoopsiePreferences.conf \ | ||
419 | 27 | com.ubuntu.whoopsiepreferences.policy \ | ||
420 | 28 | whoopsie.ui | ||
421 | 29 | |||
422 | 30 | gnomeccui_DATA = \ | ||
423 | 31 | whoopsie.ui | ||
424 | 32 | policykit_DATA = \ | ||
425 | 33 | com.ubuntu.whoopsiepreferences.policy | ||
426 | 34 | dbussystem_DATA = \ | ||
427 | 35 | com.ubuntu.WhoopsiePreferences.conf | ||
428 | 36 | dbusservice_DATA = \ | ||
429 | 37 | com.ubuntu.WhoopsiePreferences.service | ||
430 | 38 | |||
431 | 39 | whoopsie-generated.c: whoopsie-preferences.xml | ||
432 | 40 | gdbus-codegen --interface-prefix com.ubuntu. \ | ||
433 | 41 | --generate-c-code whoopsie-generated \ | ||
434 | 42 | $< | ||
435 | 43 | |||
436 | 44 | CLEANFILES = whoopsie-generated.[ch] | ||
437 | 0 | 45 | ||
438 | === added file 'src/diagnostics/com.ubuntu.WhoopsiePreferences.conf' | |||
439 | --- src/diagnostics/com.ubuntu.WhoopsiePreferences.conf 1970-01-01 00:00:00 +0000 | |||
440 | +++ src/diagnostics/com.ubuntu.WhoopsiePreferences.conf 2012-02-21 23:40:22 +0000 | |||
441 | @@ -0,0 +1,26 @@ | |||
442 | 1 | <!DOCTYPE busconfig PUBLIC | ||
443 | 2 | "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
444 | 3 | "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
445 | 4 | <busconfig> | ||
446 | 5 | |||
447 | 6 | <!-- This configuration file specifies the required security policies | ||
448 | 7 | for configuring the crash daemon. --> | ||
449 | 8 | |||
450 | 9 | <!-- Only root can own the service --> | ||
451 | 10 | <policy user="root"> | ||
452 | 11 | <allow own="com.ubuntu.WhoopsiePreferences"/> | ||
453 | 12 | </policy> | ||
454 | 13 | |||
455 | 14 | <!-- Allow anyone to invoke methods (further constrained by | ||
456 | 15 | PolicyKit privileges --> | ||
457 | 16 | <policy context="default"> | ||
458 | 17 | <allow send_destination="com.ubuntu.WhoopsiePreferences" | ||
459 | 18 | send_interface="com.ubuntu.WhoopsiePreferences"/> | ||
460 | 19 | <allow send_destination="com.ubuntu.WhoopsiePreferences" | ||
461 | 20 | send_interface="org.freedesktop.DBus.Introspectable"/> | ||
462 | 21 | <allow send_destination="com.ubuntu.WhoopsiePreferences" | ||
463 | 22 | send_interface="org.freedesktop.DBus.Properties"/> | ||
464 | 23 | </policy> | ||
465 | 24 | |||
466 | 25 | </busconfig> | ||
467 | 26 | |||
468 | 0 | 27 | ||
469 | === added file 'src/diagnostics/com.ubuntu.WhoopsiePreferences.service' | |||
470 | --- src/diagnostics/com.ubuntu.WhoopsiePreferences.service 1970-01-01 00:00:00 +0000 | |||
471 | +++ src/diagnostics/com.ubuntu.WhoopsiePreferences.service 2012-02-21 23:40:22 +0000 | |||
472 | @@ -0,0 +1,4 @@ | |||
473 | 1 | [D-BUS Service] | ||
474 | 2 | Name=com.ubuntu.WhoopsiePreferences | ||
475 | 3 | Exec=/usr/lib/whoopsie/whoopsie-preferences | ||
476 | 4 | User=root | ||
477 | 0 | 5 | ||
478 | === added file 'src/diagnostics/com.ubuntu.whoopsiepreferences.policy' | |||
479 | --- src/diagnostics/com.ubuntu.whoopsiepreferences.policy 1970-01-01 00:00:00 +0000 | |||
480 | +++ src/diagnostics/com.ubuntu.whoopsiepreferences.policy 2012-02-21 23:40:22 +0000 | |||
481 | @@ -0,0 +1,18 @@ | |||
482 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
483 | 2 | <!DOCTYPE policyconfig PUBLIC | ||
484 | 3 | "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" | ||
485 | 4 | "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> | ||
486 | 5 | <policyconfig> | ||
487 | 6 | <vendor>Ubuntu crash reporting</vendor> | ||
488 | 7 | <vendor_url>https://launchpad.net/whoopsie-daisy</vendor_url> | ||
489 | 8 | <icon_name>stock_lock</icon_name> | ||
490 | 9 | <action id="com.ubuntu.whoopsiepreferences.change"> | ||
491 | 10 | <description gettext-domain="whoopsie">Privacy settings</description> | ||
492 | 11 | <message gettext-domain="whoopsie">To change your privacy settings you need to authenticate.</message> | ||
493 | 12 | <defaults> | ||
494 | 13 | <allow_any>auth_admin</allow_any> | ||
495 | 14 | <allow_inactive>auth_admin</allow_inactive> | ||
496 | 15 | <allow_active>auth_admin_keep</allow_active> | ||
497 | 16 | </defaults> | ||
498 | 17 | </action> | ||
499 | 18 | </policyconfig> | ||
500 | 0 | 19 | ||
501 | === added file 'src/diagnostics/whoopsie-preferences.c' | |||
502 | --- src/diagnostics/whoopsie-preferences.c 1970-01-01 00:00:00 +0000 | |||
503 | +++ src/diagnostics/whoopsie-preferences.c 2012-02-21 23:40:22 +0000 | |||
504 | @@ -0,0 +1,297 @@ | |||
505 | 1 | /* whoopsie | ||
506 | 2 | * | ||
507 | 3 | * Copyright © 2011 Canonical Ltd. | ||
508 | 4 | * Author: Evan Dandrea <evan.dandrea@canonical.com> | ||
509 | 5 | * | ||
510 | 6 | * This program is free software: you can redistribute it and/or modify | ||
511 | 7 | * it under the terms of the GNU General Public License as published by | ||
512 | 8 | * the Free Software Foundation, either version 3 of the License, or | ||
513 | 9 | * (at your option) any later version. | ||
514 | 10 | * | ||
515 | 11 | * This program is distributed in the hope that it will be useful, | ||
516 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
517 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
518 | 14 | * GNU General Public License for more details. | ||
519 | 15 | * | ||
520 | 16 | * You should have received a copy of the GNU General Public License | ||
521 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
522 | 18 | */ | ||
523 | 19 | |||
524 | 20 | #include <gio/gio.h> | ||
525 | 21 | #include <stdlib.h> | ||
526 | 22 | #include <polkit/polkit.h> | ||
527 | 23 | |||
528 | 24 | #include "whoopsie-generated.h" | ||
529 | 25 | |||
530 | 26 | #define CONFIG_PATH "/etc/default/whoopsie" | ||
531 | 27 | |||
532 | 28 | static GMainLoop* loop = NULL; | ||
533 | 29 | static guint loop_shutdown = 0; | ||
534 | 30 | static GKeyFile* key_file = NULL; | ||
535 | 31 | static PolkitAuthority* authority = NULL; | ||
536 | 32 | |||
537 | 33 | /* Eventually, it might make sense to move to gsettings with the dconf | ||
538 | 34 | * backend, once it gains PolicyKit support, rather than have a program just | ||
539 | 35 | * to expose an interface to a small configuration file over DBus/PolicyKit. | ||
540 | 36 | * */ | ||
541 | 37 | |||
542 | 38 | /* Once upstart has an interface for disabiling jobs via initctl, we wont need | ||
543 | 39 | * a configuration file anymore */ | ||
544 | 40 | |||
545 | 41 | gboolean | ||
546 | 42 | whoopsie_preferences_load_configuration (void) | ||
547 | 43 | { | ||
548 | 44 | char* data; | ||
549 | 45 | gsize data_size; | ||
550 | 46 | gboolean ret = TRUE; | ||
551 | 47 | GError* error = NULL; | ||
552 | 48 | |||
553 | 49 | if (g_key_file_load_from_file (key_file, CONFIG_PATH, | ||
554 | 50 | G_KEY_FILE_KEEP_COMMENTS, NULL)) { | ||
555 | 51 | return TRUE; | ||
556 | 52 | } | ||
557 | 53 | |||
558 | 54 | g_key_file_set_boolean (key_file, "General", "report_crashes", TRUE); | ||
559 | 55 | data = g_key_file_to_data (key_file, &data_size, &error); | ||
560 | 56 | if (error) { | ||
561 | 57 | g_print ("Could not process configuration: %s\n", error->message); | ||
562 | 58 | ret = FALSE; | ||
563 | 59 | goto out; | ||
564 | 60 | } | ||
565 | 61 | if (!g_file_set_contents (CONFIG_PATH, data, data_size, &error)) { | ||
566 | 62 | g_print ("Could not write configuration: %s\n", error->message); | ||
567 | 63 | ret = FALSE; | ||
568 | 64 | goto out; | ||
569 | 65 | } | ||
570 | 66 | |||
571 | 67 | out: | ||
572 | 68 | if (data) | ||
573 | 69 | g_free (data); | ||
574 | 70 | if (error) | ||
575 | 71 | g_error_free (error); | ||
576 | 72 | return ret; | ||
577 | 73 | } | ||
578 | 74 | |||
579 | 75 | static void | ||
580 | 76 | whoopsie_preferences_dbus_notify (WhoopsiePreferences* interface) | ||
581 | 77 | { | ||
582 | 78 | GError* error = NULL; | ||
583 | 79 | gboolean report_crashes = FALSE; | ||
584 | 80 | |||
585 | 81 | report_crashes = g_key_file_get_boolean (key_file, "General", | ||
586 | 82 | "report_crashes", &error); | ||
587 | 83 | if (error) { | ||
588 | 84 | g_warning ("Could not get crashes: %s", error->message); | ||
589 | 85 | g_error_free (error); | ||
590 | 86 | } | ||
591 | 87 | whoopsie_preferences_set_report_crashes (interface, report_crashes); | ||
592 | 88 | } | ||
593 | 89 | |||
594 | 90 | static void | ||
595 | 91 | whoopsie_preferences_file_changed (GFileMonitor *monitor, GFile *file, | ||
596 | 92 | GFile *other_file, | ||
597 | 93 | GFileMonitorEvent event_type, | ||
598 | 94 | gpointer user_data) | ||
599 | 95 | { | ||
600 | 96 | if (event_type == G_FILE_MONITOR_EVENT_CHANGED) { | ||
601 | 97 | whoopsie_preferences_load_configuration (); | ||
602 | 98 | whoopsie_preferences_dbus_notify (user_data); | ||
603 | 99 | } | ||
604 | 100 | } | ||
605 | 101 | |||
606 | 102 | gboolean | ||
607 | 103 | whoopsie_preferences_load (WhoopsiePreferences* interface) | ||
608 | 104 | { | ||
609 | 105 | GError* error = NULL; | ||
610 | 106 | GFile* fp = NULL; | ||
611 | 107 | GFileMonitor* file_monitor = NULL; | ||
612 | 108 | |||
613 | 109 | fp = g_file_new_for_path (CONFIG_PATH); | ||
614 | 110 | file_monitor = g_file_monitor_file (fp, G_FILE_MONITOR_NONE, | ||
615 | 111 | NULL, &error); | ||
616 | 112 | g_signal_connect (file_monitor, "changed", | ||
617 | 113 | G_CALLBACK (whoopsie_preferences_file_changed), | ||
618 | 114 | interface); | ||
619 | 115 | if (error) { | ||
620 | 116 | g_print ("Could not set up file monitor: %s\n", error->message); | ||
621 | 117 | g_error_free (error); | ||
622 | 118 | } | ||
623 | 119 | g_object_unref (fp); | ||
624 | 120 | |||
625 | 121 | key_file = g_key_file_new (); | ||
626 | 122 | whoopsie_preferences_load_configuration (); | ||
627 | 123 | } | ||
628 | 124 | |||
629 | 125 | gboolean | ||
630 | 126 | whoopsie_preferences_changed (WhoopsiePreferences* object, GParamSpec* pspec, | ||
631 | 127 | gpointer user_data) | ||
632 | 128 | { | ||
633 | 129 | WhoopsiePreferencesIface* iface; | ||
634 | 130 | gboolean saved_value, new_value; | ||
635 | 131 | GError* error = NULL; | ||
636 | 132 | char* data; | ||
637 | 133 | gsize data_size; | ||
638 | 134 | |||
639 | 135 | if (loop_shutdown) { | ||
640 | 136 | g_source_remove (loop_shutdown); | ||
641 | 137 | loop_shutdown = 0; | ||
642 | 138 | } | ||
643 | 139 | loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit, | ||
644 | 140 | loop); | ||
645 | 141 | |||
646 | 142 | iface = WHOOPSIE_PREFERENCES_GET_IFACE (object); | ||
647 | 143 | saved_value = g_key_file_get_boolean (key_file, "General", user_data, | ||
648 | 144 | &error); | ||
649 | 145 | if (error) { | ||
650 | 146 | g_print ("Could not process configuration: %s\n", error->message); | ||
651 | 147 | return FALSE; | ||
652 | 148 | } | ||
653 | 149 | new_value = iface->get_report_crashes (object); | ||
654 | 150 | |||
655 | 151 | if (saved_value != new_value) { | ||
656 | 152 | g_key_file_set_boolean (key_file, "General", user_data, new_value); | ||
657 | 153 | data = g_key_file_to_data (key_file, &data_size, &error); | ||
658 | 154 | if (error) { | ||
659 | 155 | g_print ("Could not process configuration: %s\n", error->message); | ||
660 | 156 | return FALSE; | ||
661 | 157 | } | ||
662 | 158 | if (!g_file_set_contents (CONFIG_PATH, data, data_size, &error)) { | ||
663 | 159 | g_print ("Could not write configuration: %s\n", error->message); | ||
664 | 160 | return FALSE; | ||
665 | 161 | } | ||
666 | 162 | } | ||
667 | 163 | } | ||
668 | 164 | |||
669 | 165 | static gboolean | ||
670 | 166 | whoopsie_preferences_on_set_report_crashes (WhoopsiePreferences* object, | ||
671 | 167 | GDBusMethodInvocation* invocation, | ||
672 | 168 | gboolean report, | ||
673 | 169 | gpointer user_data) | ||
674 | 170 | { | ||
675 | 171 | whoopsie_preferences_set_report_crashes (object, report); | ||
676 | 172 | whoopsie_preferences_complete_set_report_crashes (object, invocation); | ||
677 | 173 | return TRUE; | ||
678 | 174 | } | ||
679 | 175 | |||
680 | 176 | static gboolean | ||
681 | 177 | whoopsie_preferences_authorize_method (GDBusInterfaceSkeleton* interface, | ||
682 | 178 | GDBusMethodInvocation* invocation, | ||
683 | 179 | gpointer user_data) | ||
684 | 180 | { | ||
685 | 181 | PolkitSubject* subject = NULL; | ||
686 | 182 | PolkitAuthorizationResult* result = NULL; | ||
687 | 183 | GError* error = NULL; | ||
688 | 184 | const char* sender = NULL; | ||
689 | 185 | gboolean ret = FALSE; | ||
690 | 186 | |||
691 | 187 | sender = g_dbus_method_invocation_get_sender (invocation); | ||
692 | 188 | subject = polkit_system_bus_name_new (sender); | ||
693 | 189 | result = polkit_authority_check_authorization_sync (authority, subject, | ||
694 | 190 | "com.ubuntu.whoopsiepreferences.change", | ||
695 | 191 | NULL, | ||
696 | 192 | POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, | ||
697 | 193 | NULL, &error); | ||
698 | 194 | if (result == NULL) { | ||
699 | 195 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, | ||
700 | 196 | G_DBUS_ERROR_AUTH_FAILED, "Could not authorize: %s", | ||
701 | 197 | error->message); | ||
702 | 198 | g_error_free (error); | ||
703 | 199 | goto out; | ||
704 | 200 | } | ||
705 | 201 | if (!polkit_authorization_result_get_is_authorized (result)) { | ||
706 | 202 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, | ||
707 | 203 | G_DBUS_ERROR_AUTH_FAILED, "Not authorized."); | ||
708 | 204 | goto out; | ||
709 | 205 | } | ||
710 | 206 | ret = TRUE; | ||
711 | 207 | out: | ||
712 | 208 | if (result != NULL) | ||
713 | 209 | g_object_unref (result); | ||
714 | 210 | g_object_unref (subject); | ||
715 | 211 | return ret; | ||
716 | 212 | } | ||
717 | 213 | |||
718 | 214 | static void | ||
719 | 215 | on_bus_acquired (GDBusConnection* connection, const gchar* name, | ||
720 | 216 | gpointer user_data) | ||
721 | 217 | { | ||
722 | 218 | WhoopsiePreferences* interface; | ||
723 | 219 | GError* error = NULL; | ||
724 | 220 | |||
725 | 221 | interface = whoopsie_preferences_skeleton_new (); | ||
726 | 222 | if (!g_dbus_interface_skeleton_export ( | ||
727 | 223 | G_DBUS_INTERFACE_SKELETON (interface), | ||
728 | 224 | connection, | ||
729 | 225 | "/com/ubuntu/WhoopsiePreferences", &error)) { | ||
730 | 226 | |||
731 | 227 | g_print ("Could not export path: %s\n", error->message); | ||
732 | 228 | g_error_free (error); | ||
733 | 229 | g_main_loop_quit (loop); | ||
734 | 230 | return; | ||
735 | 231 | } | ||
736 | 232 | |||
737 | 233 | authority = polkit_authority_get_sync (NULL, &error); | ||
738 | 234 | if (authority == NULL) { | ||
739 | 235 | g_print ("Could not get authority: %s\n", error->message); | ||
740 | 236 | g_error_free (error); | ||
741 | 237 | g_main_loop_quit (loop); | ||
742 | 238 | return; | ||
743 | 239 | } | ||
744 | 240 | loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit, | ||
745 | 241 | loop); | ||
746 | 242 | |||
747 | 243 | g_signal_connect (interface, "notify::report-crashes", | ||
748 | 244 | G_CALLBACK (whoopsie_preferences_changed), | ||
749 | 245 | "report_crashes"); | ||
750 | 246 | g_signal_connect (interface, "handle-set-report-crashes", | ||
751 | 247 | G_CALLBACK (whoopsie_preferences_on_set_report_crashes), | ||
752 | 248 | NULL); | ||
753 | 249 | g_signal_connect (interface, "g-authorize-method", G_CALLBACK | ||
754 | 250 | (whoopsie_preferences_authorize_method), authority); | ||
755 | 251 | |||
756 | 252 | whoopsie_preferences_load (interface); | ||
757 | 253 | whoopsie_preferences_dbus_notify (interface); | ||
758 | 254 | } | ||
759 | 255 | |||
760 | 256 | static void | ||
761 | 257 | on_name_acquired (GDBusConnection* connection, const gchar* name, | ||
762 | 258 | gpointer user_data) | ||
763 | 259 | { | ||
764 | 260 | g_print ("Acquired the name: %s\n", name); | ||
765 | 261 | } | ||
766 | 262 | |||
767 | 263 | static void | ||
768 | 264 | on_name_lost (GDBusConnection* connection, const gchar* name, | ||
769 | 265 | gpointer user_data) | ||
770 | 266 | { | ||
771 | 267 | g_print ("Lost the name: %s\n", name); | ||
772 | 268 | } | ||
773 | 269 | |||
774 | 270 | int | ||
775 | 271 | main (int argc, char** argv) | ||
776 | 272 | { | ||
777 | 273 | guint owner_id; | ||
778 | 274 | |||
779 | 275 | if (getuid () != 0) { | ||
780 | 276 | g_print ("This program must be run as root.\n"); | ||
781 | 277 | return 1; | ||
782 | 278 | } | ||
783 | 279 | |||
784 | 280 | g_type_init(); | ||
785 | 281 | |||
786 | 282 | owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, | ||
787 | 283 | "com.ubuntu.WhoopsiePreferences", | ||
788 | 284 | G_BUS_NAME_OWNER_FLAGS_NONE, | ||
789 | 285 | on_bus_acquired, | ||
790 | 286 | on_name_acquired, | ||
791 | 287 | on_name_lost, | ||
792 | 288 | NULL, NULL); | ||
793 | 289 | |||
794 | 290 | loop = g_main_loop_new (NULL, FALSE); | ||
795 | 291 | g_main_loop_run (loop); | ||
796 | 292 | g_bus_unown_name (owner_id); | ||
797 | 293 | g_main_loop_unref (loop); | ||
798 | 294 | if (key_file) | ||
799 | 295 | g_key_file_free (key_file); | ||
800 | 296 | return 0; | ||
801 | 297 | } | ||
802 | 0 | 298 | ||
803 | === added file 'src/diagnostics/whoopsie-preferences.xml' | |||
804 | --- src/diagnostics/whoopsie-preferences.xml 1970-01-01 00:00:00 +0000 | |||
805 | +++ src/diagnostics/whoopsie-preferences.xml 2012-02-21 23:40:22 +0000 | |||
806 | @@ -0,0 +1,8 @@ | |||
807 | 1 | <node> | ||
808 | 2 | <interface name="com.ubuntu.WhoopsiePreferences"> | ||
809 | 3 | <property name="ReportCrashes" type="b" access="read" /> | ||
810 | 4 | <method name="SetReportCrashes"> | ||
811 | 5 | <arg direction="in" type="b" name="report" /> | ||
812 | 6 | </method> | ||
813 | 7 | </interface> | ||
814 | 8 | </node> | ||
815 | 0 | 9 | ||
816 | === added file 'src/diagnostics/whoopsie.ui' | |||
817 | --- src/diagnostics/whoopsie.ui 1970-01-01 00:00:00 +0000 | |||
818 | +++ src/diagnostics/whoopsie.ui 2012-02-21 23:40:22 +0000 | |||
819 | @@ -0,0 +1,165 @@ | |||
820 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
821 | 2 | <interface> | ||
822 | 3 | <!-- interface-requires gtk+ 3.0 --> | ||
823 | 4 | <object class="GtkWindow" id="window1"> | ||
824 | 5 | <property name="can_focus">False</property> | ||
825 | 6 | <property name="has_resize_grip">False</property> | ||
826 | 7 | <child> | ||
827 | 8 | <object class="GtkBox" id="privacy_page_box"> | ||
828 | 9 | <property name="visible">True</property> | ||
829 | 10 | <property name="can_focus">False</property> | ||
830 | 11 | <property name="border_width">12</property> | ||
831 | 12 | <property name="orientation">vertical</property> | ||
832 | 13 | <property name="spacing">12</property> | ||
833 | 14 | <child> | ||
834 | 15 | <object class="GtkBox" id="privacy_box"> | ||
835 | 16 | <property name="visible">True</property> | ||
836 | 17 | <property name="can_focus">False</property> | ||
837 | 18 | <property name="orientation">vertical</property> | ||
838 | 19 | <property name="spacing">12</property> | ||
839 | 20 | <child> | ||
840 | 21 | <object class="GtkLabel" id="privacy_heading"> | ||
841 | 22 | <property name="visible">True</property> | ||
842 | 23 | <property name="can_focus">False</property> | ||
843 | 24 | <property name="xalign">0</property> | ||
844 | 25 | <property name="label" translatable="yes">Ubuntu can collect anonymous information that helps developers improve it. All information collected is covered by our privacy policy.</property> | ||
845 | 26 | <property name="wrap">True</property> | ||
846 | 27 | </object> | ||
847 | 28 | <packing> | ||
848 | 29 | <property name="expand">False</property> | ||
849 | 30 | <property name="fill">True</property> | ||
850 | 31 | <property name="position">0</property> | ||
851 | 32 | </packing> | ||
852 | 33 | </child> | ||
853 | 34 | <child> | ||
854 | 35 | <object class="GtkAlignment" id="privacy_policy_alignment"> | ||
855 | 36 | <property name="visible">True</property> | ||
856 | 37 | <property name="can_focus">False</property> | ||
857 | 38 | <property name="xalign">0</property> | ||
858 | 39 | <property name="xscale">0</property> | ||
859 | 40 | <child> | ||
860 | 41 | <object class="GtkButton" id="privacy_policy"> | ||
861 | 42 | <property name="label" translatable="yes">Privacy Policy</property> | ||
862 | 43 | <property name="use_action_appearance">False</property> | ||
863 | 44 | <property name="visible">True</property> | ||
864 | 45 | <property name="can_focus">True</property> | ||
865 | 46 | <property name="receives_default">True</property> | ||
866 | 47 | <property name="use_action_appearance">False</property> | ||
867 | 48 | </object> | ||
868 | 49 | </child> | ||
869 | 50 | </object> | ||
870 | 51 | <packing> | ||
871 | 52 | <property name="expand">False</property> | ||
872 | 53 | <property name="fill">True</property> | ||
873 | 54 | <property name="position">1</property> | ||
874 | 55 | </packing> | ||
875 | 56 | </child> | ||
876 | 57 | </object> | ||
877 | 58 | <packing> | ||
878 | 59 | <property name="expand">False</property> | ||
879 | 60 | <property name="fill">True</property> | ||
880 | 61 | <property name="position">0</property> | ||
881 | 62 | </packing> | ||
882 | 63 | </child> | ||
883 | 64 | <child> | ||
884 | 65 | <object class="GtkBox" id="reports_box"> | ||
885 | 66 | <property name="visible">True</property> | ||
886 | 67 | <property name="can_focus">False</property> | ||
887 | 68 | <property name="orientation">vertical</property> | ||
888 | 69 | <property name="spacing">12</property> | ||
889 | 70 | <child> | ||
890 | 71 | <object class="GtkBox" id="reports_heading_box"> | ||
891 | 72 | <property name="visible">True</property> | ||
892 | 73 | <property name="can_focus">False</property> | ||
893 | 74 | <child> | ||
894 | 75 | <object class="GtkLabel" id="reports_heading"> | ||
895 | 76 | <property name="visible">True</property> | ||
896 | 77 | <property name="can_focus">False</property> | ||
897 | 78 | <property name="label" translatable="yes">People using this computer can:</property> | ||
898 | 79 | </object> | ||
899 | 80 | <packing> | ||
900 | 81 | <property name="expand">False</property> | ||
901 | 82 | <property name="fill">True</property> | ||
902 | 83 | <property name="position">0</property> | ||
903 | 84 | </packing> | ||
904 | 85 | </child> | ||
905 | 86 | <child> | ||
906 | 87 | <object class="GtkAlignment" id="unlock_alignment"> | ||
907 | 88 | <property name="visible">True</property> | ||
908 | 89 | <property name="can_focus">False</property> | ||
909 | 90 | <property name="xalign">1</property> | ||
910 | 91 | <property name="xscale">0</property> | ||
911 | 92 | <child> | ||
912 | 93 | <placeholder/> | ||
913 | 94 | </child> | ||
914 | 95 | </object> | ||
915 | 96 | <packing> | ||
916 | 97 | <property name="expand">True</property> | ||
917 | 98 | <property name="fill">True</property> | ||
918 | 99 | <property name="position">1</property> | ||
919 | 100 | </packing> | ||
920 | 101 | </child> | ||
921 | 102 | </object> | ||
922 | 103 | <packing> | ||
923 | 104 | <property name="expand">False</property> | ||
924 | 105 | <property name="fill">True</property> | ||
925 | 106 | <property name="position">0</property> | ||
926 | 107 | </packing> | ||
927 | 108 | </child> | ||
928 | 109 | <child> | ||
929 | 110 | <object class="GtkBox" id="error_reports_box"> | ||
930 | 111 | <property name="visible">True</property> | ||
931 | 112 | <property name="can_focus">False</property> | ||
932 | 113 | <property name="orientation">vertical</property> | ||
933 | 114 | <property name="spacing">3</property> | ||
934 | 115 | <child> | ||
935 | 116 | <object class="GtkCheckButton" id="submit_error_reports"> | ||
936 | 117 | <property name="label" translatable="yes">Send error reports to Canonical</property> | ||
937 | 118 | <property name="use_action_appearance">False</property> | ||
938 | 119 | <property name="visible">True</property> | ||
939 | 120 | <property name="can_focus">True</property> | ||
940 | 121 | <property name="receives_default">False</property> | ||
941 | 122 | <property name="use_action_appearance">False</property> | ||
942 | 123 | <property name="xalign">0</property> | ||
943 | 124 | <property name="draw_indicator">True</property> | ||
944 | 125 | </object> | ||
945 | 126 | <packing> | ||
946 | 127 | <property name="expand">False</property> | ||
947 | 128 | <property name="fill">True</property> | ||
948 | 129 | <property name="position">0</property> | ||
949 | 130 | </packing> | ||
950 | 131 | </child> | ||
951 | 132 | <child> | ||
952 | 133 | <object class="GtkLabel" id="error_reports_description"> | ||
953 | 134 | <property name="visible">True</property> | ||
954 | 135 | <property name="can_focus">False</property> | ||
955 | 136 | <property name="xalign">0</property> | ||
956 | 137 | <property name="xpad">24</property> | ||
957 | 138 | <property name="label" translatable="yes"><small>Error reports include information about what a program was doing when it failed. You always have the choice to send or cancel an error report.</small></property> | ||
958 | 139 | <property name="use_markup">True</property> | ||
959 | 140 | <property name="wrap">True</property> | ||
960 | 141 | </object> | ||
961 | 142 | <packing> | ||
962 | 143 | <property name="expand">False</property> | ||
963 | 144 | <property name="fill">True</property> | ||
964 | 145 | <property name="position">1</property> | ||
965 | 146 | </packing> | ||
966 | 147 | </child> | ||
967 | 148 | </object> | ||
968 | 149 | <packing> | ||
969 | 150 | <property name="expand">False</property> | ||
970 | 151 | <property name="fill">True</property> | ||
971 | 152 | <property name="position">1</property> | ||
972 | 153 | </packing> | ||
973 | 154 | </child> | ||
974 | 155 | </object> | ||
975 | 156 | <packing> | ||
976 | 157 | <property name="expand">False</property> | ||
977 | 158 | <property name="fill">True</property> | ||
978 | 159 | <property name="position">1</property> | ||
979 | 160 | </packing> | ||
980 | 161 | </child> | ||
981 | 162 | </object> | ||
982 | 163 | </child> | ||
983 | 164 | </object> | ||
984 | 165 | </interface> |
Can you please make sure that the makefile is complete... I can't compile it due to
make[3]: *** No rule to make target `diagnostics/ whoopsie- generated. c', needed by `libactivity_ log_manager_ la_vala. stamp'. Stop. seif/Projects/ whoopsie/ src'
make[3]: Leaving directory `/home/