Merge lp:~ev/activity-log-manager/add-whoopsie-back into lp:activity-log-manager

Proposed by Evan
Status: Merged
Merged at revision: 47
Proposed branch: lp:~ev/activity-log-manager/add-whoopsie-back
Merge into: lp:activity-log-manager
Diff against target: 357 lines (+280/-5)
5 files modified
.bzrignore (+4/-1)
configure.ac (+2/-1)
src/Makefile.am (+18/-2)
src/alm-cc.c (+1/-1)
src/diagnostics-widget.c (+255/-0)
To merge this branch: bzr merge lp:~ev/activity-log-manager/add-whoopsie-back
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) Approve
Review via email: mp+169855@code.launchpad.net

Description of the change

This resurrects code for the Diagnostics panel (whoopsie) that appears to have been accidentally deleted in the move from the lp:~activity-log-manager/activity-log-manager/vala branch.

Namely, it brings back src/diagnostics-widget.c, which is not automatically generated code, unlike the rest of the C files that appear in that directory.

I'm working on a debdiff, with these changes incorporated, against 0.9.4-0ubuntu6.1, which is the version in Ubuntu Saucy.

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

It looks good, but still doesn't show up in System Settings.

http://i.imgur.com/xCTk5bR.png

review: Needs Fixing
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I did some more research and found that in alm-cc.c file, inside function "alm_main_window_panel_init"

the #ifdef section is not being called. I tried fixing that with changing

#ifdef HAVE_WHOOPSIE to
#ifdef WHOOPSIE

and changing in src/Makefile.am

if HAVE_WHOOPSIE
libactivity_log_manager_la_CFLAGS += \
 $(POLKIT_CFLAGS) \
 -DGNOMECC_UI_DIR=\""$(gnomeccuidir)"\"
endif

to
if HAVE_WHOOPSIE
libactivity_log_manager_la_CFLAGS += \
 $(POLKIT_CFLAGS) \
 -DGNOMECC_UI_DIR=\""$(gnomeccuidir)"\" \
 -DWHOOPSIE
endif

Now the section isnide #ifdef is built, but there is a segfault with bt

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6488c10 in g_type_check_instance_cast () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
(gdb) bt
#0 0x00007ffff6488c10 in g_type_check_instance_cast () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1 0x00007fffb99244b0 in alm_main_window_panel_init (self=0x5555557b9b40) at alm-cc.c:63
#2 0x00007ffff648795f in g_type_create_instance () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3 0x00007ffff646c718 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4 0x00007ffff646dce1 in g_object_newv () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff646e4d0 in g_object_new_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff646e804 in g_object_new () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x000055555555de8c in ?? ()
#8 0x000055555555be47 in ?? ()
#9 0x00007ffff6467620 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff6478f00 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007ffff6480d11 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007ffff6480f92 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x000055555555ebbb in ?? ()
#14 0x00007ffff646a7a0 in g_cclosure_marshal_VOID__BOXEDv () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff64678e7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff64802df in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007ffff6480f92 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x000055555555ed94 in ?? ()
#19 0x00007ffff76a849c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#20 0x00007ffff6467620 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff6478f00 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff6480996 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff6480f92 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff77d777e in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

#1 0x00007fffb99244b0 in alm_main_window_panel_init (self=0x5555557b9b40) at alm-cc.c:63
line 63 is
GtkWidget *whoopsie = GTK_WIDGET (whoopsie_daisy_preferences_new ());

tells that the issue is with macro GTK_WIDGET since if the problem was with whoopsie_daisy_preferences_new () then the backtrace would have included the function

GtkWidget*
whoopsie_daisy_preferences_new (void)
{
    return g_object_new (WHOOPSIE_DAISY_TYPE_PREFERENCES, NULL);
}

section from diagnostic-widget.c

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I tried it in a VM and I did not get any Segfault. Now this is weird. Evan, can you try it out with the above changes I mentioned

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Sorry, here is the branch where I pushed the minor changes with your merged branch
lp:~manishsinha/activity-log-manager/ev

51. By Evan

Tidy

52. By Evan

Merge Manish's branch with changes.

Revision history for this message
Evan (ev) wrote :

I've implemented the define for whoopsie in a slightly different way. It is working fine for me when I build it in a deb and install that way.

Can you please build with debugging symbols and provide a backtrace?

Revision history for this message
Evan (ev) wrote :
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :
Download full text (6.5 KiB)

Hello Evan, I am still getting crashes on another system, with backtrace

Program received signal SIGSEGV, Segmentation fault.
g_type_check_instance_cast (type_instance=0xffffffffe8006e00, iface_type=iface_type@entry=93824994480816) at /build/buildd/glib2.0-2.36.0/./gobject/gtype.c:4027
4027 /build/buildd/glib2.0-2.36.0/./gobject/gtype.c: No such file or directory.
(gdb) bt
#0 g_type_check_instance_cast (type_instance=0xffffffffe8006e00, iface_type=iface_type@entry=93824994480816) at /build/buildd/glib2.0-2.36.0/./gobject/gtype.c:4027
#1 0x00007fffe45f94b0 in alm_main_window_panel_init (self=0x555555b3ab40) at alm-cc.c:63
#2 0x00007ffff648795f in g_type_create_instance (type=<optimized out>) at /build/buildd/glib2.0-2.36.0/./gobject/gtype.c:1917
#3 0x00007ffff646c718 in g_object_constructor (type=<optimized out>, n_construct_properties=1, construct_params=0x555555b78110) at /build/buildd/glib2.0-2.36.0/./gobject/gobject.c:1855
#4 0x00007ffff646dce1 in g_object_newv (object_type=object_type@entry=93824997485168, n_parameters=n_parameters@entry=2, parameters=parameters@entry=0x555555b7dcf0)
    at /build/buildd/glib2.0-2.36.0/./gobject/gobject.c:1719
#5 0x00007ffff646e4d0 in g_object_new_valist (object_type=object_type@entry=93824997485168, first_property_name=first_property_name@entry=0x55555556019b "shell",
    var_args=var_args@entry=0x7fffffffca48) at /build/buildd/glib2.0-2.36.0/./gobject/gobject.c:1836
#6 0x00007ffff646e804 in g_object_new (object_type=93824997485168, first_property_name=0x55555556019b "shell") at /build/buildd/glib2.0-2.36.0/./gobject/gobject.c:1551
#7 0x000055555555de8c in ?? ()
#8 0x000055555555be47 in ?? ()
#9 0x00007ffff6467620 in g_closure_invoke (closure=0x555555931870, return_value=0x0, n_param_values=4, param_values=0x7fffffffce10, invocation_hint=0x7fffffffcdb0)
    at /build/buildd/glib2.0-2.36.0/./gobject/gclosure.c:777
#10 0x00007ffff6478f00 in signal_emit_unlocked_R (node=node@entry=0x555555931b20, detail=detail@entry=0, instance=instance@entry=0x555555a00000, emission_return=emission_return@entry=0x0,
    instance_and_params=instance_and_params@entry=0x7fffffffce10) at /build/buildd/glib2.0-2.36.0/./gobject/gsignal.c:3584
#11 0x00007ffff6480d11 in g_signal_emit_valist (instance=0x555555a00000, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd098)
    at /build/buildd/glib2.0-2.36.0/./gobject/gsignal.c:3328
#12 0x00007ffff6480f92 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at /build/buildd/glib2.0-2.36.0/./gobject/gsignal.c:3384
#13 0x000055555555ebbb in ?? ()
#14 0x00007ffff646a7a0 in g_cclosure_marshal_VOID__BOXEDv (closure=0x555555931ff0, return_value=<optimized out>, instance=<optimized out>, args=<optimized out>,
    marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x555555768ea0) at /build/buildd/glib2.0-2.36.0/./gobject/gmarshal.c:1160
#15 0x00007ffff64678e7 in _g_closure_invoke_va (closure=0x555555931ff0, return_value=0x0, instance=0x555555a00000, args=0x7fffffffd518, n_params=1, param_types=0x555555768ea0)
    at /build/buildd/glib2.0-2.36.0/./gobject/gclosure.c:840
#16 0x00007ffff64802df in g_s...

Read more...

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Used the debdiff and built the packages locally and installed it. Sadly, crashes again with exactly the same backtrace

53. By Evan

Some small cleanups. Debugging.

Revision history for this message
Evan (ev) wrote :

So whoopsie_daisy_preferences_new () is returning an invalid type from the looks of it.

Can you please build from my branch with the latest commits (r53) and try again? It should output something like "GType: 258458288" but will probably give you something bogus. Bonus points if you can use gdb to dig at what's going on in whoopsie_daisy_preferences_new ().

As far as I can see we're constructing the type properly, so I'm perplexed as to what's going on here.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

This fixes it. I guess it was solved by

- extern void* whoopsie_daisy_preferences_new (void);
+ extern GtkWidget* whoopsie_daisy_preferences_new (void);

I will still check it on another developer installation before merging

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-04-21 07:25:20 +0000
3+++ .bzrignore 2013-06-19 15:17:27 +0000
4@@ -28,7 +28,7 @@
5 src/activity-log-manager
6 src/alm
7 src/alm-switchboard
8-src/*.c
9+RE:src/(?!diagnostics-widget).*.c
10 src/*.h
11 src/*.la
12 src/*.lo
13@@ -41,3 +41,6 @@
14 po/.intltool-merge-cache
15 po/POTFILES
16 po/stamp-it
17+src/diagnostics/whoopsie-preferences
18+src/diagnostics/com.ubuntu.whoopsiepreferences.policy
19+src/diagnostics/.libs
20
21=== modified file 'configure.ac'
22--- configure.ac 2013-04-21 07:52:28 +0000
23+++ configure.ac 2013-06-19 15:17:27 +0000
24@@ -108,7 +108,7 @@
25
26 AM_CONDITIONAL([HAVE_CCPANEL], [test -n "$CCPANEL_LIBS" && test "x$with_ccpanel" != xno])
27
28-AM_CONDITIONAL([HAVE_WHOOPSIE], [test -n "$POLKIT_LIBS"])
29+AM_CONDITIONAL([HAVE_WHOOPSIE], [test -n "$POLKIT_LIBS" && test -n "$LIBWHOOPSIE_LIBS"])
30
31
32 AC_CONFIG_FILES([
33@@ -121,6 +121,7 @@
34
35
36 if test "x$with_whoopsie" != xno && test "x$HAVE_POLKIT" != xno && test "x$HAVE_LIBWHOOPSIE" != xno; then
37+ AC_DEFINE([HAVE_WHOOPSIE], 1, [Enable Whoopsie])
38 WHOOPSIE_ENABLE=yes
39 else
40 WHOOPSIE_ENABLE=no
41
42=== modified file 'src/Makefile.am'
43--- src/Makefile.am 2013-04-20 12:35:20 +0000
44+++ src/Makefile.am 2013-06-19 15:17:27 +0000
45@@ -79,14 +79,25 @@
46 $(SHARED_CFLAGS) \
47 $(CCPANEL_CFLAGS)
48
49+if HAVE_WHOOPSIE
50+libactivity_log_manager_la_CFLAGS += \
51+ $(POLKIT_CFLAGS) \
52+ -DGNOMECC_UI_DIR=\""$(gnomeccuidir)"\"
53+endif
54+
55 activity_log_manager_SOURCES = \
56 $(SHARED_SOURCES) \
57 alm.vala \
58 $(NULL)
59 libactivity_log_manager_la_SOURCES = \
60 $(SHARED_SOURCES:.vala=.c) \
61- alm-cc.c \
62- $(NULL)
63+ alm-cc.c
64+
65+if HAVE_WHOOPSIE
66+libactivity_log_manager_la_SOURCES += \
67+ diagnostics-widget.c \
68+ diagnostics/whoopsie-generated.c
69+endif
70
71
72 activity_log_manager_LDFLAGS = \
73@@ -99,6 +110,11 @@
74 $(SHARED_LIBS) \
75 $(CCPANEL_LIBS)
76
77+if HAVE_WHOOPSIE
78+libactivity_log_manager_la_LIBADD += \
79+ $(POLKIT_LIBS)
80+endif
81+
82 GENERATED_C_FILES = $(activity_log_manager_SOURCES:.vala=.c)
83
84 GENERATED_O_FILES = $(activity_log_manager_SOURCES:.vala=.o)
85
86=== modified file 'src/alm-cc.c'
87--- src/alm-cc.c 2013-02-16 02:56:21 +0000
88+++ src/alm-cc.c 2013-06-19 15:17:27 +0000
89@@ -24,7 +24,7 @@
90 extern void* alm_activity_log_manager_new (void);
91 #ifdef HAVE_WHOOPSIE
92 extern void alm_activity_log_manager_append_page (void* alm, GtkWidget* widget, const gchar* label);
93-extern void* whoopsie_daisy_preferences_new (void);
94+extern GtkWidget* whoopsie_daisy_preferences_new (void);
95 #endif
96
97 #define ALM_TYPE_MAIN_WINDOW_PANEL alm_main_window_panel_get_type()
98
99=== added file 'src/diagnostics-widget.c'
100--- src/diagnostics-widget.c 1970-01-01 00:00:00 +0000
101+++ src/diagnostics-widget.c 2013-06-19 15:17:27 +0000
102@@ -0,0 +1,255 @@
103+#include <gtk/gtk.h>
104+#include <gio/gio.h>
105+#include <polkit/polkit.h>
106+#include <stdlib.h>
107+
108+#define _GNU_SOURCE
109+#include <stdio.h>
110+
111+#include "diagnostics/whoopsie-generated.h"
112+
113+static WhoopsiePreferences* proxy = NULL;
114+
115+#define POL_PATH "com.ubuntu.whoopsiepreferences.change"
116+#define PRIVACY_URL "http://www.ubuntu.com/aboutus/privacypolicy?crashdb"
117+#define SYSTEM_ERRORS_URL "https://errors.ubuntu.com/user"
118+
119+#define WHOOPSIE_DAISY_TYPE_PREFERENCES (whoopsie_daisy_preferences_get_type())
120+#define WHOOPSIE_DAISY_PREFERENCES(obj) \
121+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
122+ WHOOPSIE_DAISY_TYPE_PREFERENCES, WhoopsieDaisyPreferences))
123+#define WHOOPSIE_DAISY_PREFERENCES_PRIVATE(o) \
124+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), WHOOPSIE_DAISY_TYPE_PREFERENCES, WhoopsieDaisyPreferencesPrivate))
125+
126+GType whoopsie_daisy_preferences_get_type (void) G_GNUC_CONST;
127+
128+typedef struct _WhoopsieDaisyPreferences WhoopsieDaisyPreferences;
129+typedef struct _WhoopsieDaisyPreferencesClass WhoopsieDaisyPreferencesClass;
130+typedef struct _WhoopsieDaisyPreferencesPrivate WhoopsieDaisyPreferencesPrivate;
131+
132+struct _WhoopsieDaisyPreferencesPrivate
133+{
134+ GtkBuilder* builder;
135+ GPermission* permission;
136+};
137+
138+struct _WhoopsieDaisyPreferences
139+{
140+ GtkBox parent;
141+ WhoopsieDaisyPreferencesPrivate* priv;
142+};
143+
144+struct _WhoopsieDaisyPreferencesClass
145+{
146+ GtkBoxClass parent_class;
147+};
148+
149+G_DEFINE_TYPE (WhoopsieDaisyPreferences, whoopsie_daisy_preferences, GTK_TYPE_BOX)
150+
151+static void
152+whoopsie_daisy_preferences_dispose (GObject* object)
153+{
154+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (object)->priv;
155+
156+ if (priv->builder) {
157+ g_object_unref (priv->builder);
158+ priv->builder = NULL;
159+ }
160+ if (priv->permission) {
161+ g_object_unref (priv->permission);
162+ priv->permission = NULL;
163+ }
164+}
165+
166+static void
167+whoopsie_daisy_preferences_class_init (WhoopsieDaisyPreferencesClass *klass)
168+{
169+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
170+ g_type_class_add_private (klass, sizeof (WhoopsieDaisyPreferencesPrivate));
171+ object_class->dispose = whoopsie_daisy_preferences_dispose;
172+}
173+
174+static void
175+on_privacy_policy_clicked (GtkWidget* button, gpointer user_data)
176+{
177+ if (system ("xdg-open " PRIVACY_URL) < 0)
178+ g_warning ("Error opening URL.\n");
179+}
180+
181+static void
182+on_show_previous_reports_clicked (GtkWidget* button, gpointer user_data)
183+{
184+ GError* error = NULL;
185+ gchar* identifier = NULL;
186+ gchar* command = NULL;
187+ whoopsie_preferences_call_get_identifier_sync (proxy, &identifier, NULL, &error);
188+
189+ if (!error) {
190+ asprintf (&command, "xdg-open " SYSTEM_ERRORS_URL "/%s", identifier);
191+ if (system (command) < 0)
192+ g_warning ("Error opening URL.\n");
193+ } else {
194+ g_printerr ("Error getting identifier: %s\n", error->message);
195+ g_error_free (error);
196+ }
197+}
198+
199+static void
200+on_permission_changed (GPermission* permission, GParamSpec* pspec, gpointer data)
201+{
202+ gboolean allowed;
203+ GtkWidget* error_reports_box = NULL;
204+ GtkWidget* metrics_reports_box = NULL;
205+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (data)->priv;
206+
207+ error_reports_box = GTK_WIDGET (gtk_builder_get_object (
208+ priv->builder, "error_reports_box"));
209+ metrics_reports_box = GTK_WIDGET (gtk_builder_get_object (
210+ priv->builder, "metrics_reports_box"));
211+
212+ allowed = g_permission_get_allowed (permission);
213+ gtk_widget_set_sensitive(error_reports_box, allowed);
214+ gtk_widget_set_sensitive(metrics_reports_box, allowed);
215+ gtk_container_foreach (GTK_CONTAINER (error_reports_box), (GtkCallback)gtk_widget_set_sensitive, allowed);
216+ gtk_container_foreach (GTK_CONTAINER (metrics_reports_box), (GtkCallback)gtk_widget_set_sensitive, allowed);
217+}
218+
219+static void
220+on_submit_error_reports_checked (GtkToggleButton* button, gpointer user_data)
221+{
222+ GError* error = NULL;
223+
224+ whoopsie_preferences_call_set_report_crashes_sync (proxy,
225+ gtk_toggle_button_get_active (button), NULL, &error);
226+ if (error != NULL) {
227+ g_printerr ("Error setting crash reporting: %s\n", error->message);
228+ g_error_free (error);
229+ }
230+}
231+
232+static void
233+on_submit_metrics_reports_checked (GtkToggleButton* button, gpointer user_data)
234+{
235+ GError* error = NULL;
236+
237+ whoopsie_preferences_call_set_report_metrics_sync (proxy,
238+ gtk_toggle_button_get_active (button), NULL, &error);
239+ if (error != NULL) {
240+ g_printerr ("Error setting metrics reporting: %s\n", error->message);
241+ g_error_free (error);
242+ }
243+}
244+
245+static void
246+on_properties_changed (WhoopsiePreferences* interface,
247+ GVariant* changed_properties,
248+ const gchar* const* invalidated_properties,
249+ gpointer user_data)
250+{
251+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (user_data)->priv;
252+ gboolean report_errors, report_metrics;
253+ GtkWidget* submit_error_reports = NULL;
254+ GtkWidget* submit_metrics_reports = NULL;
255+
256+ submit_error_reports = GTK_WIDGET (
257+ gtk_builder_get_object (priv->builder, "submit_error_reports"));
258+ submit_metrics_reports = GTK_WIDGET (
259+ gtk_builder_get_object (priv->builder, "submit_metrics_reports"));
260+
261+ report_errors = whoopsie_preferences_get_report_crashes (interface);
262+ report_metrics = whoopsie_preferences_get_report_metrics (interface);
263+
264+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (submit_error_reports), report_errors);
265+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (submit_metrics_reports), report_metrics);
266+}
267+
268+static void
269+whoopsie_daisy_preferences_setup_dbus (WhoopsieDaisyPreferences *self, GError *error)
270+{
271+ proxy = whoopsie_preferences_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
272+ G_DBUS_PROXY_FLAGS_NONE,
273+ "com.ubuntu.WhoopsiePreferences",
274+ "/com/ubuntu/WhoopsiePreferences",
275+ NULL, &error);
276+ if (!proxy)
277+ return;
278+
279+ g_signal_connect (proxy, "g-properties-changed",
280+ G_CALLBACK (on_properties_changed), self);
281+ on_properties_changed (proxy, NULL, NULL, self);
282+}
283+static void
284+whoopsie_daisy_preferences_init (WhoopsieDaisyPreferences *self)
285+{
286+ GError *error = NULL;
287+ GtkWidget* privacy_page = NULL;
288+ GtkWidget* unlock_align = NULL;
289+ GtkWidget* unlock_button = NULL;
290+ GtkWidget* submit_error_reports = NULL;
291+ GtkWidget* submit_metrics_reports = NULL;
292+ GtkWidget* privacy_policy = NULL;
293+ GtkWidget* show_previous_reports = NULL;
294+ WhoopsieDaisyPreferencesPrivate* priv;
295+ priv = self->priv = WHOOPSIE_DAISY_PREFERENCES_PRIVATE (self);
296+
297+ priv->builder = gtk_builder_new ();
298+ gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
299+ gtk_builder_add_from_file(priv->builder, GNOMECC_UI_DIR "/whoopsie.ui", &error);
300+ if (error != NULL) {
301+ g_warning ("Could not load interface file: %s", error->message);
302+ g_error_free (error);
303+ return;
304+ }
305+ submit_error_reports = GTK_WIDGET (
306+ gtk_builder_get_object (priv->builder, "submit_error_reports"));
307+ submit_metrics_reports = GTK_WIDGET (
308+ gtk_builder_get_object (priv->builder, "submit_metrics_reports"));
309+ gtk_widget_hide (submit_metrics_reports);
310+ privacy_page = GTK_WIDGET (
311+ gtk_builder_get_object (priv->builder, "privacy_page_box"));
312+ unlock_align = GTK_WIDGET (
313+ gtk_builder_get_object (priv->builder, "unlock_alignment"));
314+ privacy_policy = GTK_WIDGET (
315+ gtk_builder_get_object (priv->builder, "privacy_policy"));
316+ show_previous_reports = GTK_WIDGET (
317+ gtk_builder_get_object (priv->builder, "show_previous_reports"));
318+
319+ gtk_widget_reparent (privacy_page, (GtkWidget *) self);
320+ g_object_set (self, "valign", GTK_ALIGN_START, NULL);
321+
322+ priv->permission = polkit_permission_new_sync (POL_PATH, NULL, NULL, &error);
323+ if (!priv->permission) {
324+ g_warning ("Could not acquire permission: %s", error->message);
325+ g_error_free (error);
326+ }
327+
328+ unlock_button = gtk_lock_button_new (priv->permission);
329+ gtk_container_add (GTK_CONTAINER (unlock_align), GTK_WIDGET (unlock_button));
330+ gtk_widget_show (unlock_button);
331+
332+ g_signal_connect (priv->permission, "notify", G_CALLBACK (on_permission_changed), self);
333+ on_permission_changed (priv->permission, NULL, self);
334+
335+ whoopsie_daisy_preferences_setup_dbus (self, error);
336+ if (error) {
337+ g_warning ("Could not set up DBus connection: %s", error->message);
338+ g_error_free (error);
339+ }
340+
341+ g_signal_connect (submit_error_reports, "toggled",
342+ G_CALLBACK (on_submit_error_reports_checked), NULL);
343+ g_signal_connect (submit_metrics_reports, "toggled",
344+ G_CALLBACK (on_submit_metrics_reports_checked), NULL);
345+ g_signal_connect (privacy_policy, "clicked",
346+ G_CALLBACK (on_privacy_policy_clicked), NULL);
347+ g_signal_connect (show_previous_reports, "clicked",
348+ G_CALLBACK (on_show_previous_reports_clicked), NULL);
349+}
350+
351+GtkWidget*
352+whoopsie_daisy_preferences_new (void)
353+{
354+ printf ("GType: %d\n", (int)WHOOPSIE_DAISY_TYPE_PREFERENCES);
355+ return g_object_new (WHOOPSIE_DAISY_TYPE_PREFERENCES, NULL);
356+}
357+

Subscribers

People subscribed via source and target branches