Merge lp:~khurshid-alam/unity-control-center/uoa-panel into lp:unity-control-center
- uoa-panel
- Merge into trunk
Proposed by
Khurshid Alam
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jeremy Bícha | ||||
Approved revision: | 12914 | ||||
Merged at revision: | 12911 | ||||
Proposed branch: | lp:~khurshid-alam/unity-control-center/uoa-panel | ||||
Merge into: | lp:unity-control-center | ||||
Diff against target: |
1925 lines (+1733/-3) 22 files modified
configure.ac (+43/-1) debian/control (+3/-1) debian/libunity-control-center1.symbols (+3/-0) panels/Makefile.am (+4/-0) panels/online-accounts/Makefile.am (+52/-0) panels/online-accounts/cc-online-accounts-panel.c (+985/-0) panels/online-accounts/cc-online-accounts-panel.h (+65/-0) panels/online-accounts/icons/16x16/Makefile.am (+14/-0) panels/online-accounts/icons/22x22/Makefile.am (+14/-0) panels/online-accounts/icons/24x24/Makefile.am (+14/-0) panels/online-accounts/icons/256x256/Makefile.am (+14/-0) panels/online-accounts/icons/32x32/Makefile.am (+14/-0) panels/online-accounts/icons/48x48/Makefile.am (+14/-0) panels/online-accounts/icons/Makefile.am (+23/-0) panels/online-accounts/online-accounts-module.c (+33/-0) panels/online-accounts/online-accounts.gresource.xml (+6/-0) panels/online-accounts/online-accounts.ui (+270/-0) panels/online-accounts/unity-online-accounts-panel.desktop.in.in (+15/-0) po/POTFILES.in (+4/-1) shell/Makefile.am (+2/-0) shell/list-box-helper.c (+110/-0) shell/list-box-helper.h (+31/-0) |
||||
To merge this branch: | bzr merge lp:~khurshid-alam/unity-control-center/uoa-panel | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeremy Bícha | Approve | ||
Review via email: mp+337618@code.launchpad.net |
Commit message
Import gnome online-accounts panel into unity-control-
Reference: https:/
Reference: https:/
Description of the change
Import gnome online-accounts panel into unity-control-
Reference: https:/
Reference: https:/
PPA: ppa:unity7maint
Community forum thread: https:/
To post a comment you must log in.
Revision history for this message
Jeremy Bícha (jbicha) wrote : | # |
Revision history for this message
Jeremy Bícha (jbicha) wrote : | # |
Thank you! This is a very useful feature! :)
review:
Approve
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 2017-12-07 05:41:33 +0000 | |||
3 | +++ configure.ac 2018-02-13 09:06:22 +0000 | |||
4 | @@ -119,7 +119,7 @@ | |||
5 | 119 | SCHEMAS_REQUIRED_VERSION=3.15.4 | 119 | SCHEMAS_REQUIRED_VERSION=3.15.4 |
6 | 120 | LIBWACOM_REQUIRED_VERSION=0.7 | 120 | LIBWACOM_REQUIRED_VERSION=0.7 |
7 | 121 | CLUTTER_REQUIRED_VERSION=1.11.3 | 121 | CLUTTER_REQUIRED_VERSION=1.11.3 |
9 | 122 | GOA_REQUIRED_VERSION=3.5.90 | 122 | GOA_REQUIRED_VERSION=3.18.0 |
10 | 123 | ACCOUNTSSERVICE_REQUIRED_VERSION=0.6.30 | 123 | ACCOUNTSSERVICE_REQUIRED_VERSION=0.6.30 |
11 | 124 | 124 | ||
12 | 125 | COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED_VERSION | 125 | COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED_VERSION |
13 | @@ -262,6 +262,34 @@ | |||
14 | 262 | esac | 262 | esac |
15 | 263 | AM_CONDITIONAL(BUILD_WACOM, [test x"$have_wacom" = x"yes"]) | 263 | AM_CONDITIONAL(BUILD_WACOM, [test x"$have_wacom" = x"yes"]) |
16 | 264 | 264 | ||
17 | 265 | # Online accounts | ||
18 | 266 | AC_ARG_ENABLE(onlineaccounts, AC_HELP_STRING([--disable-onlineaccounts], [disable online-accounts panel]), | ||
19 | 267 | [case "${enableval}" in | ||
20 | 268 | yes) enable_onlineaccounts=yes ;; | ||
21 | 269 | no) enable_onlineaccounts=no ;; | ||
22 | 270 | *) AC_MSG_ERROR(bad value ${enableval} for --disable-onlineaccounts) ;; | ||
23 | 271 | esac], | ||
24 | 272 | [enable_onlineaccounts=yes]) dnl Enabled by default | ||
25 | 273 | |||
26 | 274 | if test "x$enable_onlineaccounts" = xyes; then | ||
27 | 275 | PKG_CHECK_MODULES(ONLINE_ACCOUNTS_PANEL, $COMMON_MODULES goa-1.0 | ||
28 | 276 | goa-backend-1.0 >= $GOA_REQUIRED_VERSION, | ||
29 | 277 | [have_onlineaccounts=yes], have_onlineaccounts=no) | ||
30 | 278 | if test "x$have_onlineaccounts" = xno ; then | ||
31 | 279 | AC_MSG_ERROR(*** Gnome Online Accounts not found ***) | ||
32 | 280 | fi | ||
33 | 281 | |||
34 | 282 | AC_DEFINE(BUILD_ONLINE_ACCOUNTS, 1, [Define to 1 to build the online-accounts panel]) | ||
35 | 283 | |||
36 | 284 | if test x${have_onlineaccounts} = xyes; then | ||
37 | 285 | AC_DEFINE(HAVE_ONLINE_ACCOUNTS, 1, [Define to 1 if Gnome Online Accounts is available]) | ||
38 | 286 | fi | ||
39 | 287 | fi | ||
40 | 288 | |||
41 | 289 | AM_CONDITIONAL(BUILD_ONLINE_ACCOUNTS, [test x$have_onlineaccounts = xyes]) | ||
42 | 290 | AC_SUBST(ONLINE_ACCOUNTS_CFLAGS) | ||
43 | 291 | AC_SUBST(ONLINE_ACCOUNTS_LIBS) | ||
44 | 292 | |||
45 | 265 | # This is a hard-dependency for the region and user-accounts panels | 293 | # This is a hard-dependency for the region and user-accounts panels |
46 | 266 | PKG_CHECK_MODULES(ISOCODES, iso-codes) | 294 | PKG_CHECK_MODULES(ISOCODES, iso-codes) |
47 | 267 | 295 | ||
48 | @@ -495,6 +523,15 @@ | |||
49 | 495 | panels/wacom/Makefile | 523 | panels/wacom/Makefile |
50 | 496 | panels/wacom/calibrator/Makefile | 524 | panels/wacom/calibrator/Makefile |
51 | 497 | panels/wacom/unity-wacom-panel.desktop.in | 525 | panels/wacom/unity-wacom-panel.desktop.in |
52 | 526 | panels/online-accounts/Makefile | ||
53 | 527 | panels/online-accounts/unity-online-accounts-panel.desktop.in | ||
54 | 528 | panels/online-accounts/icons/Makefile | ||
55 | 529 | panels/online-accounts/icons/16x16/Makefile | ||
56 | 530 | panels/online-accounts/icons/22x22/Makefile | ||
57 | 531 | panels/online-accounts/icons/24x24/Makefile | ||
58 | 532 | panels/online-accounts/icons/32x32/Makefile | ||
59 | 533 | panels/online-accounts/icons/48x48/Makefile | ||
60 | 534 | panels/online-accounts/icons/256x256/Makefile | ||
61 | 498 | po/Makefile.in | 535 | po/Makefile.in |
62 | 499 | shell/appdata/Makefile | 536 | shell/appdata/Makefile |
63 | 500 | shell/Makefile | 537 | shell/Makefile |
64 | @@ -538,4 +575,9 @@ | |||
65 | 538 | else | 575 | else |
66 | 539 | AC_MSG_NOTICE([ Region panel Fcitx support disabled]) | 576 | AC_MSG_NOTICE([ Region panel Fcitx support disabled]) |
67 | 540 | fi | 577 | fi |
68 | 578 | if test "x$have_onlineaccounts" = "xyes"; then | ||
69 | 579 | AC_MSG_NOTICE([** Online-Accounts support (Online-Accounts panel)]) | ||
70 | 580 | else | ||
71 | 581 | AC_MSG_NOTICE([ Online-Accounts support disabled]) | ||
72 | 582 | fi | ||
73 | 541 | AC_MSG_NOTICE([End options]) | 583 | AC_MSG_NOTICE([End options]) |
74 | 542 | 584 | ||
75 | === modified file 'debian/control' | |||
76 | --- debian/control 2017-09-30 22:30:57 +0000 | |||
77 | +++ debian/control 2018-02-13 09:06:22 +0000 | |||
78 | @@ -29,7 +29,8 @@ | |||
79 | 29 | libgnome-desktop-3-dev (>= 3.5.91), | 29 | libgnome-desktop-3-dev (>= 3.5.91), |
80 | 30 | libgnome-menu-3-dev, | 30 | libgnome-menu-3-dev, |
81 | 31 | libgnomekbd-dev, | 31 | libgnomekbd-dev, |
83 | 32 | libgoa-1.0-dev (>= 3.5.90), | 32 | libgoa-1.0-dev (>= 3.18.0), |
84 | 33 | libgoa-backend-1.0-dev (>= 3.18.0), | ||
85 | 33 | libgtk-3-dev (>= 3.10.0), | 34 | libgtk-3-dev (>= 3.10.0), |
86 | 34 | libgtop2-dev, | 35 | libgtop2-dev, |
87 | 35 | libibus-1.0-dev (>= 1.5.0), | 36 | libibus-1.0-dev (>= 1.5.0), |
88 | @@ -73,6 +74,7 @@ | |||
89 | 73 | gnome-desktop3-data, | 74 | gnome-desktop3-data, |
90 | 74 | adwaita-icon-theme, | 75 | adwaita-icon-theme, |
91 | 75 | gnome-menus (>= 2.12.0), | 76 | gnome-menus (>= 2.12.0), |
92 | 77 | gnome-online-accounts, | ||
93 | 76 | unity-settings-daemon, | 78 | unity-settings-daemon, |
94 | 77 | gnome-settings-daemon-schemas (>= 3.16), | 79 | gnome-settings-daemon-schemas (>= 3.16), |
95 | 78 | gsettings-desktop-schemas (>= 3.15.4), | 80 | gsettings-desktop-schemas (>= 3.15.4), |
96 | 79 | 81 | ||
97 | === modified file 'debian/libunity-control-center1.symbols' | |||
98 | --- debian/libunity-control-center1.symbols 2014-06-26 02:58:37 +0000 | |||
99 | +++ debian/libunity-control-center1.symbols 2018-02-13 09:06:22 +0000 | |||
100 | @@ -18,6 +18,9 @@ | |||
101 | 18 | cc_editable_entry_set_text@Base 14.04.0 | 18 | cc_editable_entry_set_text@Base 14.04.0 |
102 | 19 | cc_editable_entry_set_weight@Base 14.04.0 | 19 | cc_editable_entry_set_weight@Base 14.04.0 |
103 | 20 | cc_editable_entry_set_width_chars@Base 14.04.3+14.04.20140225 | 20 | cc_editable_entry_set_width_chars@Base 14.04.3+14.04.20140225 |
104 | 21 | cc_list_box_adjust_scrolling@Base 15.04.0+17.10.20171225 | ||
105 | 22 | cc_list_box_setup_scrolling@Base 15.04.0+17.10.20171225 | ||
106 | 23 | cc_list_box_update_header_func@Base 15.04.0+17.10.20171225 | ||
107 | 21 | cc_panel_get_display_name@Base 14.04.0 | 24 | cc_panel_get_display_name@Base 14.04.0 |
108 | 22 | cc_panel_get_help_uri@Base 14.04.0 | 25 | cc_panel_get_help_uri@Base 14.04.0 |
109 | 23 | cc_panel_get_permission@Base 14.04.0 | 26 | cc_panel_get_permission@Base 14.04.0 |
110 | 24 | 27 | ||
111 | === modified file 'panels/Makefile.am' | |||
112 | --- panels/Makefile.am 2017-12-07 05:41:33 +0000 | |||
113 | +++ panels/Makefile.am 2018-02-13 09:06:22 +0000 | |||
114 | @@ -28,4 +28,8 @@ | |||
115 | 28 | SUBDIRS += network | 28 | SUBDIRS += network |
116 | 29 | endif | 29 | endif |
117 | 30 | 30 | ||
118 | 31 | if BUILD_ONLINE_ACCOUNTS | ||
119 | 32 | SUBDIRS += online-accounts | ||
120 | 33 | endif | ||
121 | 34 | |||
122 | 31 | -include $(top_srcdir)/git.mk | 35 | -include $(top_srcdir)/git.mk |
123 | 32 | 36 | ||
124 | === added directory 'panels/online-accounts' | |||
125 | === added file 'panels/online-accounts/Makefile.am' | |||
126 | --- panels/online-accounts/Makefile.am 1970-01-01 00:00:00 +0000 | |||
127 | +++ panels/online-accounts/Makefile.am 2018-02-13 09:06:22 +0000 | |||
128 | @@ -0,0 +1,52 @@ | |||
129 | 1 | cappletname = online-accounts | ||
130 | 2 | |||
131 | 3 | SUBDIRS = icons | ||
132 | 4 | |||
133 | 5 | uidir = $(pkgdatadir)/ui/online-accounts | ||
134 | 6 | dist_ui_DATA = \ | ||
135 | 7 | online-accounts.ui | ||
136 | 8 | |||
137 | 9 | INCLUDES = \ | ||
138 | 10 | $(PANEL_CFLAGS) \ | ||
139 | 11 | $(ONLINE_ACCOUNTS_PANEL_CFLAGS) \ | ||
140 | 12 | -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ | ||
141 | 13 | -DG_LOG_DOMAIN="\"$(PACKAGE)\"" \ | ||
142 | 14 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ | ||
143 | 15 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ | ||
144 | 16 | $(NULL) | ||
145 | 17 | |||
146 | 18 | ccpanelsdir = $(PANELS_DIR) | ||
147 | 19 | ccpanels_LTLIBRARIES = libonline-accounts.la | ||
148 | 20 | |||
149 | 21 | BUILT_SOURCES = \ | ||
150 | 22 | cc-online-accounts-resources.c \ | ||
151 | 23 | cc-online-accounts-resources.h | ||
152 | 24 | |||
153 | 25 | libonline_accounts_la_SOURCES = \ | ||
154 | 26 | $(BUILT_SOURCES) \ | ||
155 | 27 | online-accounts-module.c \ | ||
156 | 28 | cc-online-accounts-panel.c \ | ||
157 | 29 | cc-online-accounts-panel.h | ||
158 | 30 | |||
159 | 31 | libonline_accounts_la_LIBADD = \ | ||
160 | 32 | $(PANEL_LIBS) \ | ||
161 | 33 | $(ONLINE_ACCOUNTS_PANEL_LIBS) | ||
162 | 34 | |||
163 | 35 | libonline_accounts_la_LDFLAGS = $(PANEL_LDFLAGS) | ||
164 | 36 | |||
165 | 37 | resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/online-accounts.gresource.xml) | ||
166 | 38 | cc-online-accounts-resources.c: online-accounts.gresource.xml $(resource_files) | ||
167 | 39 | $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_online_accounts $< | ||
168 | 40 | cc-online-accounts-resources.h: online-accounts.gresource.xml $(resource_files) | ||
169 | 41 | $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_online_accounts $< | ||
170 | 42 | |||
171 | 43 | @INTLTOOL_DESKTOP_RULE@ | ||
172 | 44 | |||
173 | 45 | desktopdir = $(datadir)/applications | ||
174 | 46 | desktop_in_files = unity-online-accounts-panel.desktop.in | ||
175 | 47 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) | ||
176 | 48 | |||
177 | 49 | CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES) | ||
178 | 50 | EXTRA_DIST = $(resource_files) online-accounts.gresource.xml | ||
179 | 51 | |||
180 | 52 | -include $(top_srcdir)/git.mk | ||
181 | 0 | 53 | ||
182 | === added file 'panels/online-accounts/cc-online-accounts-panel.c' | |||
183 | --- panels/online-accounts/cc-online-accounts-panel.c 1970-01-01 00:00:00 +0000 | |||
184 | +++ panels/online-accounts/cc-online-accounts-panel.c 2018-02-13 09:06:22 +0000 | |||
185 | @@ -0,0 +1,985 @@ | |||
186 | 1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ | ||
187 | 2 | /* | ||
188 | 3 | * Copyright (C) 2011, 2012 Red Hat, Inc. | ||
189 | 4 | * | ||
190 | 5 | * This library is free software; you can redistribute it and/or | ||
191 | 6 | * modify it under the terms of the GNU Lesser General Public | ||
192 | 7 | * License as published by the Free Software Foundation; either | ||
193 | 8 | * version 2 of the License, or (at your option) any later version. | ||
194 | 9 | * | ||
195 | 10 | * This library is distributed in the hope that it will be useful, | ||
196 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
197 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
198 | 13 | * Lesser General Public License for more details. | ||
199 | 14 | * | ||
200 | 15 | * You should have received a copy of the GNU Lesser General | ||
201 | 16 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
202 | 17 | * | ||
203 | 18 | * Author: David Zeuthen <davidz@redhat.com> | ||
204 | 19 | */ | ||
205 | 20 | |||
206 | 21 | #include "config.h" | ||
207 | 22 | |||
208 | 23 | #include <gio/gio.h> | ||
209 | 24 | #include <string.h> | ||
210 | 25 | #include <glib/gi18n.h> | ||
211 | 26 | |||
212 | 27 | #define GOA_API_IS_SUBJECT_TO_CHANGE | ||
213 | 28 | #include <goa/goa.h> | ||
214 | 29 | #define GOA_BACKEND_API_IS_SUBJECT_TO_CHANGE | ||
215 | 30 | #include <goabackend/goabackend.h> | ||
216 | 31 | |||
217 | 32 | #include "cc-online-accounts-panel.h" | ||
218 | 33 | #include "cc-online-accounts-resources.h" | ||
219 | 34 | |||
220 | 35 | #include "shell/list-box-helper.h" | ||
221 | 36 | |||
222 | 37 | struct _CcGoaPanel | ||
223 | 38 | { | ||
224 | 39 | CcPanel parent_instance; | ||
225 | 40 | |||
226 | 41 | GoaClient *client; | ||
227 | 42 | GoaObject *active_object; | ||
228 | 43 | GoaObject *removed_object; | ||
229 | 44 | |||
230 | 45 | GtkWidget *accounts_frame; | ||
231 | 46 | GtkWidget *accounts_listbox; | ||
232 | 47 | GtkWidget *edit_account_dialog; | ||
233 | 48 | GtkWidget *edit_account_headerbar; | ||
234 | 49 | GtkWidget *more_providers_row; | ||
235 | 50 | GtkWidget *new_account_vbox; | ||
236 | 51 | GtkWidget *notification_label; | ||
237 | 52 | GtkWidget *notification_revealer; | ||
238 | 53 | GtkWidget *offline_label; | ||
239 | 54 | GtkWidget *providers_listbox; | ||
240 | 55 | GtkWidget *remove_account_button; | ||
241 | 56 | GtkWidget *stack; | ||
242 | 57 | GtkWidget *accounts_vbox; | ||
243 | 58 | |||
244 | 59 | guint remove_account_timeout_id; | ||
245 | 60 | }; | ||
246 | 61 | |||
247 | 62 | static gboolean on_edit_account_dialog_delete_event (CcGoaPanel *self); | ||
248 | 63 | |||
249 | 64 | static void on_listbox_row_activated (CcGoaPanel *self, | ||
250 | 65 | GtkListBoxRow *activated_row); | ||
251 | 66 | |||
252 | 67 | static void fill_accounts_listbox (CcGoaPanel *self); | ||
253 | 68 | |||
254 | 69 | static void on_account_added (GoaClient *client, | ||
255 | 70 | GoaObject *object, | ||
256 | 71 | gpointer user_data); | ||
257 | 72 | |||
258 | 73 | static void on_account_changed (GoaClient *client, | ||
259 | 74 | GoaObject *object, | ||
260 | 75 | gpointer user_data); | ||
261 | 76 | |||
262 | 77 | static void on_account_removed (GoaClient *client, | ||
263 | 78 | GoaObject *object, | ||
264 | 79 | gpointer user_data); | ||
265 | 80 | |||
266 | 81 | static void select_account_by_id (CcGoaPanel *panel, | ||
267 | 82 | const gchar *account_id); | ||
268 | 83 | |||
269 | 84 | static void get_all_providers_cb (GObject *source, | ||
270 | 85 | GAsyncResult *res, | ||
271 | 86 | gpointer user_data); | ||
272 | 87 | |||
273 | 88 | static void show_page_account (CcGoaPanel *panel, | ||
274 | 89 | GoaObject *object); | ||
275 | 90 | |||
276 | 91 | static void on_remove_button_clicked (CcGoaPanel *self); | ||
277 | 92 | |||
278 | 93 | static void on_notification_closed (GtkButton *button, | ||
279 | 94 | CcGoaPanel *self); | ||
280 | 95 | |||
281 | 96 | static void on_undo_button_clicked (GtkButton *button, | ||
282 | 97 | CcGoaPanel *self); | ||
283 | 98 | |||
284 | 99 | CC_PANEL_REGISTER (CcGoaPanel, cc_goa_panel); | ||
285 | 100 | |||
286 | 101 | enum { | ||
287 | 102 | PROP_0, | ||
288 | 103 | PROP_PARAMETERS | ||
289 | 104 | }; | ||
290 | 105 | |||
291 | 106 | /* ---------------------------------------------------------------------------------------------------- */ | ||
292 | 107 | |||
293 | 108 | static void | ||
294 | 109 | reset_headerbar (CcGoaPanel *self) | ||
295 | 110 | { | ||
296 | 111 | gtk_header_bar_set_title (GTK_HEADER_BAR (self->edit_account_headerbar), NULL); | ||
297 | 112 | gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->edit_account_headerbar), NULL); | ||
298 | 113 | gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->edit_account_headerbar), TRUE); | ||
299 | 114 | |||
300 | 115 | /* Remove any leftover widgets */ | ||
301 | 116 | gtk_container_foreach (GTK_CONTAINER (self->edit_account_headerbar), | ||
302 | 117 | (GtkCallback) gtk_widget_destroy, | ||
303 | 118 | NULL); | ||
304 | 119 | |||
305 | 120 | } | ||
306 | 121 | |||
307 | 122 | /* ---------------------------------------------------------------------------------------------------- */ | ||
308 | 123 | |||
309 | 124 | static void | ||
310 | 125 | add_provider_row (CcGoaPanel *self, | ||
311 | 126 | GoaProvider *provider) | ||
312 | 127 | { | ||
313 | 128 | GIcon *icon; | ||
314 | 129 | GoaProviderFeatures features; | ||
315 | 130 | GtkWidget *image; | ||
316 | 131 | GtkWidget *label; | ||
317 | 132 | GtkWidget *row; | ||
318 | 133 | GtkWidget *row_grid; | ||
319 | 134 | gchar *markup; | ||
320 | 135 | gchar *name; | ||
321 | 136 | |||
322 | 137 | row = gtk_list_box_row_new (); | ||
323 | 138 | |||
324 | 139 | row_grid = gtk_grid_new (); | ||
325 | 140 | gtk_orientable_set_orientation (GTK_ORIENTABLE (row_grid), GTK_ORIENTATION_HORIZONTAL); | ||
326 | 141 | gtk_grid_set_column_spacing (GTK_GRID (row_grid), 6); | ||
327 | 142 | gtk_container_add (GTK_CONTAINER (row), row_grid); | ||
328 | 143 | |||
329 | 144 | if (provider == NULL) | ||
330 | 145 | { | ||
331 | 146 | g_object_set_data (G_OBJECT (row), "goa-provider", NULL); | ||
332 | 147 | icon = g_themed_icon_new_with_default_fallbacks ("goa-account"); | ||
333 | 148 | name = g_strdup (C_("Online Account", "Other")); | ||
334 | 149 | } | ||
335 | 150 | else | ||
336 | 151 | { | ||
337 | 152 | g_object_set_data_full (G_OBJECT (row), "goa-provider", g_object_ref (provider), g_object_unref); | ||
338 | 153 | icon = goa_provider_get_provider_icon (provider, NULL); | ||
339 | 154 | name = goa_provider_get_provider_name (provider, NULL); | ||
340 | 155 | } | ||
341 | 156 | |||
342 | 157 | image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); | ||
343 | 158 | gtk_container_add (GTK_CONTAINER (row_grid), image); | ||
344 | 159 | g_object_set (image, "margin", 6, NULL); | ||
345 | 160 | |||
346 | 161 | markup = g_strdup_printf ("<b>%s</b>", name); | ||
347 | 162 | label = gtk_label_new (NULL); | ||
348 | 163 | gtk_label_set_markup (GTK_LABEL (label), markup); | ||
349 | 164 | gtk_container_add (GTK_CONTAINER (row_grid), label); | ||
350 | 165 | |||
351 | 166 | /* Check if the row should be shown initially */ | ||
352 | 167 | features = goa_provider_get_provider_features (provider); | ||
353 | 168 | |||
354 | 169 | if ((features & GOA_PROVIDER_FEATURE_BRANDED) != 0) | ||
355 | 170 | gtk_widget_show_all (row); | ||
356 | 171 | |||
357 | 172 | gtk_container_add (GTK_CONTAINER (self->providers_listbox), row); | ||
358 | 173 | |||
359 | 174 | g_free (markup); | ||
360 | 175 | g_free (name); | ||
361 | 176 | g_object_unref (icon); | ||
362 | 177 | } | ||
363 | 178 | |||
364 | 179 | static gint | ||
365 | 180 | sort_providers_func (GtkListBoxRow *a, | ||
366 | 181 | GtkListBoxRow *b, | ||
367 | 182 | gpointer user_data) | ||
368 | 183 | { | ||
369 | 184 | GoaProvider *a_provider, *b_provider; | ||
370 | 185 | CcGoaPanel *self; | ||
371 | 186 | gboolean a_branded, b_branded; | ||
372 | 187 | |||
373 | 188 | self = user_data; | ||
374 | 189 | |||
375 | 190 | if (a == GTK_LIST_BOX_ROW (self->more_providers_row)) | ||
376 | 191 | return 1; | ||
377 | 192 | else if (b == GTK_LIST_BOX_ROW (self->more_providers_row)) | ||
378 | 193 | return -1; | ||
379 | 194 | |||
380 | 195 | a_provider = g_object_get_data (G_OBJECT (a), "goa-provider"); | ||
381 | 196 | b_provider = g_object_get_data (G_OBJECT (b), "goa-provider"); | ||
382 | 197 | |||
383 | 198 | a_branded = (goa_provider_get_provider_features (a_provider) & GOA_PROVIDER_FEATURE_BRANDED) != 0; | ||
384 | 199 | b_branded = (goa_provider_get_provider_features (b_provider) & GOA_PROVIDER_FEATURE_BRANDED) != 0; | ||
385 | 200 | |||
386 | 201 | if (a_branded != b_branded) | ||
387 | 202 | { | ||
388 | 203 | if (a_branded) | ||
389 | 204 | return -1; | ||
390 | 205 | else | ||
391 | 206 | return 1; | ||
392 | 207 | } | ||
393 | 208 | |||
394 | 209 | return gtk_list_box_row_get_index (b) - gtk_list_box_row_get_index (a); | ||
395 | 210 | } | ||
396 | 211 | |||
397 | 212 | static void | ||
398 | 213 | show_non_branded_providers (CcGoaPanel *self) | ||
399 | 214 | { | ||
400 | 215 | GList *children, *l; | ||
401 | 216 | |||
402 | 217 | children = gtk_container_get_children (GTK_CONTAINER (self->providers_listbox)); | ||
403 | 218 | |||
404 | 219 | for (l = children; l != NULL; l = l->next) | ||
405 | 220 | { | ||
406 | 221 | GoaProvider *provider = g_object_get_data (l->data, "goa-provider"); | ||
407 | 222 | |||
408 | 223 | if (!provider) | ||
409 | 224 | continue; | ||
410 | 225 | |||
411 | 226 | if ((goa_provider_get_provider_features (provider) & GOA_PROVIDER_FEATURE_BRANDED) == 0) | ||
412 | 227 | gtk_widget_show_all (l->data); | ||
413 | 228 | } | ||
414 | 229 | |||
415 | 230 | gtk_widget_hide (self->more_providers_row); | ||
416 | 231 | |||
417 | 232 | g_list_free (children); | ||
418 | 233 | } | ||
419 | 234 | |||
420 | 235 | static void | ||
421 | 236 | add_account (CcGoaPanel *self, | ||
422 | 237 | GoaProvider *provider, | ||
423 | 238 | GVariant *preseed) | ||
424 | 239 | { | ||
425 | 240 | GoaObject *object; | ||
426 | 241 | GError *error; | ||
427 | 242 | |||
428 | 243 | error = NULL; | ||
429 | 244 | |||
430 | 245 | gtk_container_foreach (GTK_CONTAINER (self->new_account_vbox), | ||
431 | 246 | (GtkCallback) gtk_widget_destroy, | ||
432 | 247 | NULL); | ||
433 | 248 | |||
434 | 249 | reset_headerbar (self); | ||
435 | 250 | |||
436 | 251 | /* Move to the new account page */ | ||
437 | 252 | gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "new-account"); | ||
438 | 253 | |||
439 | 254 | /* Reset the dialog size */ | ||
440 | 255 | gtk_window_resize (GTK_WINDOW (self->edit_account_dialog), 1, 1); | ||
441 | 256 | |||
442 | 257 | /* This spins gtk_dialog_run() */ | ||
443 | 258 | object = goa_provider_add_account (provider, | ||
444 | 259 | self->client, | ||
445 | 260 | GTK_DIALOG (self->edit_account_dialog), | ||
446 | 261 | GTK_BOX (self->new_account_vbox), | ||
447 | 262 | &error); | ||
448 | 263 | |||
449 | 264 | if (preseed) | ||
450 | 265 | goa_provider_set_preseed_data (provider, preseed); | ||
451 | 266 | |||
452 | 267 | if (object == NULL) | ||
453 | 268 | gtk_widget_hide (self->edit_account_dialog); | ||
454 | 269 | else | ||
455 | 270 | show_page_account (self, object); | ||
456 | 271 | } | ||
457 | 272 | |||
458 | 273 | static void | ||
459 | 274 | on_provider_row_activated (CcGoaPanel *self, | ||
460 | 275 | GtkListBoxRow *activated_row) | ||
461 | 276 | { | ||
462 | 277 | GoaProvider *provider; | ||
463 | 278 | |||
464 | 279 | /* Show More row */ | ||
465 | 280 | if (activated_row == GTK_LIST_BOX_ROW (self->more_providers_row)) | ||
466 | 281 | { | ||
467 | 282 | show_non_branded_providers (self); | ||
468 | 283 | return; | ||
469 | 284 | } | ||
470 | 285 | |||
471 | 286 | provider = g_object_get_data (G_OBJECT (activated_row), "goa-provider"); | ||
472 | 287 | |||
473 | 288 | add_account (self, provider, NULL); | ||
474 | 289 | } | ||
475 | 290 | |||
476 | 291 | /* ---------------------------------------------------------------------------------------------------- */ | ||
477 | 292 | |||
478 | 293 | static gint | ||
479 | 294 | sort_func (GtkListBoxRow *a, | ||
480 | 295 | GtkListBoxRow *b, | ||
481 | 296 | gpointer user_data) | ||
482 | 297 | { | ||
483 | 298 | GoaObject *a_obj, *b_obj; | ||
484 | 299 | GoaAccount *a_account, *b_account; | ||
485 | 300 | |||
486 | 301 | a_obj = g_object_get_data (G_OBJECT (a), "goa-object"); | ||
487 | 302 | a_account = goa_object_peek_account (a_obj); | ||
488 | 303 | |||
489 | 304 | b_obj = g_object_get_data (G_OBJECT (b), "goa-object"); | ||
490 | 305 | b_account = goa_object_peek_account (b_obj); | ||
491 | 306 | |||
492 | 307 | return g_strcmp0 (goa_account_get_id (a_account), goa_account_get_id (b_account)); | ||
493 | 308 | } | ||
494 | 309 | |||
495 | 310 | static void | ||
496 | 311 | command_add (CcGoaPanel *panel, | ||
497 | 312 | GVariant *parameters) | ||
498 | 313 | { | ||
499 | 314 | GVariant *v, *preseed = NULL; | ||
500 | 315 | GoaProvider *provider = NULL; | ||
501 | 316 | const gchar *provider_name = NULL; | ||
502 | 317 | |||
503 | 318 | g_assert (panel != NULL); | ||
504 | 319 | g_assert (parameters != NULL); | ||
505 | 320 | |||
506 | 321 | switch (g_variant_n_children (parameters)) | ||
507 | 322 | { | ||
508 | 323 | case 3: | ||
509 | 324 | g_variant_get_child (parameters, 2, "v", &preseed); | ||
510 | 325 | case 2: | ||
511 | 326 | g_variant_get_child (parameters, 1, "v", &v); | ||
512 | 327 | if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING)) | ||
513 | 328 | provider_name = g_variant_get_string (v, NULL); | ||
514 | 329 | else | ||
515 | 330 | g_warning ("Wrong type for the second argument (provider name) GVariant, expected 's' but got '%s'", | ||
516 | 331 | (gchar *)g_variant_get_type (v)); | ||
517 | 332 | g_variant_unref (v); | ||
518 | 333 | break; | ||
519 | 334 | default: | ||
520 | 335 | g_warning ("Unexpected parameters found, ignore request"); | ||
521 | 336 | goto out; | ||
522 | 337 | } | ||
523 | 338 | |||
524 | 339 | if (provider_name != NULL) | ||
525 | 340 | { | ||
526 | 341 | provider = goa_provider_get_for_provider_type (provider_name); | ||
527 | 342 | if (provider == NULL) | ||
528 | 343 | { | ||
529 | 344 | g_warning ("Unable to get a provider for type '%s'", provider_name); | ||
530 | 345 | goto out; | ||
531 | 346 | } | ||
532 | 347 | |||
533 | 348 | add_account (panel, provider, preseed); | ||
534 | 349 | } | ||
535 | 350 | |||
536 | 351 | out: | ||
537 | 352 | g_clear_object (&provider); | ||
538 | 353 | g_clear_pointer (&preseed, g_variant_unref); | ||
539 | 354 | } | ||
540 | 355 | |||
541 | 356 | static void | ||
542 | 357 | cc_goa_panel_set_property (GObject *object, | ||
543 | 358 | guint property_id, | ||
544 | 359 | const GValue *value, | ||
545 | 360 | GParamSpec *pspec) | ||
546 | 361 | { | ||
547 | 362 | switch (property_id) | ||
548 | 363 | { | ||
549 | 364 | case PROP_PARAMETERS: | ||
550 | 365 | { | ||
551 | 366 | GVariant *parameters, *v; | ||
552 | 367 | const gchar *first_arg = NULL; | ||
553 | 368 | |||
554 | 369 | parameters = g_value_get_variant (value); | ||
555 | 370 | if (parameters == NULL) | ||
556 | 371 | return; | ||
557 | 372 | |||
558 | 373 | if (g_variant_n_children (parameters) > 0) | ||
559 | 374 | { | ||
560 | 375 | g_variant_get_child (parameters, 0, "v", &v); | ||
561 | 376 | if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING)) | ||
562 | 377 | first_arg = g_variant_get_string (v, NULL); | ||
563 | 378 | else | ||
564 | 379 | g_warning ("Wrong type for the second argument GVariant, expected 's' but got '%s'", | ||
565 | 380 | (gchar *)g_variant_get_type (v)); | ||
566 | 381 | g_variant_unref (v); | ||
567 | 382 | } | ||
568 | 383 | |||
569 | 384 | if (g_strcmp0 (first_arg, "add") == 0) | ||
570 | 385 | command_add (CC_GOA_PANEL (object), parameters); | ||
571 | 386 | else if (first_arg != NULL) | ||
572 | 387 | select_account_by_id (CC_GOA_PANEL (object), first_arg); | ||
573 | 388 | |||
574 | 389 | return; | ||
575 | 390 | } | ||
576 | 391 | } | ||
577 | 392 | |||
578 | 393 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
579 | 394 | } | ||
580 | 395 | |||
581 | 396 | static void | ||
582 | 397 | cc_goa_panel_dispose (GObject *object) | ||
583 | 398 | { | ||
584 | 399 | CcGoaPanel *panel = CC_GOA_PANEL (object); | ||
585 | 400 | |||
586 | 401 | /* Must be destroyed in dispose, not finalize. */ | ||
587 | 402 | g_clear_pointer (&panel->edit_account_dialog, gtk_widget_destroy); | ||
588 | 403 | |||
589 | 404 | G_OBJECT_CLASS (cc_goa_panel_parent_class)->dispose (object); | ||
590 | 405 | } | ||
591 | 406 | |||
592 | 407 | static void | ||
593 | 408 | cc_goa_panel_finalize (GObject *object) | ||
594 | 409 | { | ||
595 | 410 | CcGoaPanel *panel = CC_GOA_PANEL (object); | ||
596 | 411 | |||
597 | 412 | g_clear_object (&panel->client); | ||
598 | 413 | |||
599 | 414 | G_OBJECT_CLASS (cc_goa_panel_parent_class)->finalize (object); | ||
600 | 415 | } | ||
601 | 416 | |||
602 | 417 | static void | ||
603 | 418 | cc_goa_panel_init (CcGoaPanel *panel) | ||
604 | 419 | { | ||
605 | 420 | GError *error; | ||
606 | 421 | GNetworkMonitor *monitor; | ||
607 | 422 | |||
608 | 423 | g_resources_register (cc_online_accounts_get_resource ()); | ||
609 | 424 | |||
610 | 425 | gtk_widget_init_template (GTK_WIDGET (panel)); | ||
611 | 426 | |||
612 | 427 | gtk_list_box_set_header_func (GTK_LIST_BOX (panel->accounts_listbox), | ||
613 | 428 | cc_list_box_update_header_func, | ||
614 | 429 | NULL, | ||
615 | 430 | NULL); | ||
616 | 431 | gtk_list_box_set_sort_func (GTK_LIST_BOX (panel->accounts_listbox), | ||
617 | 432 | sort_func, | ||
618 | 433 | panel, | ||
619 | 434 | NULL); | ||
620 | 435 | |||
621 | 436 | gtk_list_box_set_header_func (GTK_LIST_BOX (panel->providers_listbox), | ||
622 | 437 | cc_list_box_update_header_func, | ||
623 | 438 | NULL, | ||
624 | 439 | NULL); | ||
625 | 440 | gtk_list_box_set_sort_func (GTK_LIST_BOX (panel->providers_listbox), | ||
626 | 441 | sort_providers_func, | ||
627 | 442 | panel, | ||
628 | 443 | NULL); | ||
629 | 444 | |||
630 | 445 | monitor = g_network_monitor_get_default(); | ||
631 | 446 | |||
632 | 447 | g_object_bind_property (monitor, "network-available", | ||
633 | 448 | panel->offline_label, "visible", | ||
634 | 449 | G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); | ||
635 | 450 | |||
636 | 451 | g_object_bind_property (monitor, "network-available", | ||
637 | 452 | panel->providers_listbox, "sensitive", | ||
638 | 453 | G_BINDING_SYNC_CREATE); | ||
639 | 454 | |||
640 | 455 | /* TODO: probably want to avoid _sync() ... */ | ||
641 | 456 | error = NULL; | ||
642 | 457 | panel->client = goa_client_new_sync (NULL /* GCancellable */, &error); | ||
643 | 458 | if (panel->client == NULL) | ||
644 | 459 | { | ||
645 | 460 | g_warning ("Error getting a GoaClient: %s (%s, %d)", | ||
646 | 461 | error->message, g_quark_to_string (error->domain), error->code); | ||
647 | 462 | gtk_widget_set_sensitive (GTK_WIDGET (panel), FALSE); | ||
648 | 463 | g_error_free (error); | ||
649 | 464 | return; | ||
650 | 465 | } | ||
651 | 466 | |||
652 | 467 | g_signal_connect (panel->client, | ||
653 | 468 | "account-added", | ||
654 | 469 | G_CALLBACK (on_account_added), | ||
655 | 470 | panel); | ||
656 | 471 | |||
657 | 472 | g_signal_connect (panel->client, | ||
658 | 473 | "account-changed", | ||
659 | 474 | G_CALLBACK (on_account_changed), | ||
660 | 475 | panel); | ||
661 | 476 | |||
662 | 477 | g_signal_connect (panel->client, | ||
663 | 478 | "account-removed", | ||
664 | 479 | G_CALLBACK (on_account_removed), | ||
665 | 480 | panel); | ||
666 | 481 | |||
667 | 482 | fill_accounts_listbox (panel); | ||
668 | 483 | goa_provider_get_all (get_all_providers_cb, panel); | ||
669 | 484 | |||
670 | 485 | gtk_widget_show (GTK_WIDGET (panel)); | ||
671 | 486 | } | ||
672 | 487 | |||
673 | 488 | static const char * | ||
674 | 489 | cc_goa_panel_get_help_uri (CcPanel *panel) | ||
675 | 490 | { | ||
676 | 491 | return "help:gnome-help/accounts"; | ||
677 | 492 | } | ||
678 | 493 | |||
679 | 494 | static void | ||
680 | 495 | cc_goa_panel_constructed (GObject *object) | ||
681 | 496 | { | ||
682 | 497 | CcGoaPanel *self = CC_GOA_PANEL (object); | ||
683 | 498 | GtkWindow *parent; | ||
684 | 499 | |||
685 | 500 | /* Setup account editor dialog */ | ||
686 | 501 | parent = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)))); | ||
687 | 502 | |||
688 | 503 | gtk_window_set_transient_for (GTK_WINDOW (self->edit_account_dialog), parent); | ||
689 | 504 | |||
690 | 505 | G_OBJECT_CLASS (cc_goa_panel_parent_class)->constructed (object); | ||
691 | 506 | } | ||
692 | 507 | |||
693 | 508 | static void | ||
694 | 509 | cc_goa_panel_class_init (CcGoaPanelClass *klass) | ||
695 | 510 | { | ||
696 | 511 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); | ||
697 | 512 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
698 | 513 | CcPanelClass *panel_class = CC_PANEL_CLASS (klass); | ||
699 | 514 | |||
700 | 515 | panel_class->get_help_uri = cc_goa_panel_get_help_uri; | ||
701 | 516 | |||
702 | 517 | object_class->set_property = cc_goa_panel_set_property; | ||
703 | 518 | object_class->finalize = cc_goa_panel_finalize; | ||
704 | 519 | object_class->constructed = cc_goa_panel_constructed; | ||
705 | 520 | object_class->dispose = cc_goa_panel_dispose; | ||
706 | 521 | |||
707 | 522 | //g_object_class_override_property (object_class, PROP_PARAMETERS, "parameters"); | ||
708 | 523 | |||
709 | 524 | gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/online-accounts/online-accounts.ui"); | ||
710 | 525 | |||
711 | 526 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_frame); | ||
712 | 527 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_listbox); | ||
713 | 528 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_vbox); | ||
714 | 529 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_dialog); | ||
715 | 530 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_headerbar); | ||
716 | 531 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, more_providers_row); | ||
717 | 532 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, new_account_vbox); | ||
718 | 533 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, notification_label); | ||
719 | 534 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, notification_revealer); | ||
720 | 535 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, offline_label); | ||
721 | 536 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, providers_listbox); | ||
722 | 537 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, remove_account_button); | ||
723 | 538 | gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, stack); | ||
724 | 539 | |||
725 | 540 | gtk_widget_class_bind_template_callback (widget_class, on_edit_account_dialog_delete_event); | ||
726 | 541 | gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated); | ||
727 | 542 | gtk_widget_class_bind_template_callback (widget_class, on_notification_closed); | ||
728 | 543 | gtk_widget_class_bind_template_callback (widget_class, on_provider_row_activated); | ||
729 | 544 | gtk_widget_class_bind_template_callback (widget_class, on_remove_button_clicked); | ||
730 | 545 | gtk_widget_class_bind_template_callback (widget_class, on_undo_button_clicked); | ||
731 | 546 | } | ||
732 | 547 | |||
733 | 548 | /* ---------------------------------------------------------------------------------------------------- */ | ||
734 | 549 | |||
735 | 550 | static void | ||
736 | 551 | show_page_nothing_selected (CcGoaPanel *panel) | ||
737 | 552 | { | ||
738 | 553 | } | ||
739 | 554 | |||
740 | 555 | static void | ||
741 | 556 | show_page_account (CcGoaPanel *panel, | ||
742 | 557 | GoaObject *object) | ||
743 | 558 | { | ||
744 | 559 | GList *children; | ||
745 | 560 | GList *l; | ||
746 | 561 | GoaProvider *provider; | ||
747 | 562 | GoaAccount *account; | ||
748 | 563 | gboolean is_locked; | ||
749 | 564 | const gchar *provider_name; | ||
750 | 565 | const gchar *provider_type; | ||
751 | 566 | gchar *title; | ||
752 | 567 | |||
753 | 568 | provider = NULL; | ||
754 | 569 | |||
755 | 570 | panel->active_object = object; | ||
756 | 571 | reset_headerbar (panel); | ||
757 | 572 | |||
758 | 573 | /* Move to the account editor page */ | ||
759 | 574 | gtk_stack_set_visible_child_name (GTK_STACK (panel->stack), "editor"); | ||
760 | 575 | |||
761 | 576 | /* Out with the old */ | ||
762 | 577 | children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_vbox)); | ||
763 | 578 | for (l = children; l != NULL; l = l->next) | ||
764 | 579 | gtk_container_remove (GTK_CONTAINER (panel->accounts_vbox), GTK_WIDGET (l->data)); | ||
765 | 580 | g_list_free (children); | ||
766 | 581 | |||
767 | 582 | account = goa_object_peek_account (object); | ||
768 | 583 | |||
769 | 584 | is_locked = goa_account_get_is_locked (account); | ||
770 | 585 | gtk_widget_set_visible (panel->remove_account_button, !is_locked); | ||
771 | 586 | |||
772 | 587 | provider_type = goa_account_get_provider_type (account); | ||
773 | 588 | provider = goa_provider_get_for_provider_type (provider_type); | ||
774 | 589 | |||
775 | 590 | if (provider != NULL) | ||
776 | 591 | { | ||
777 | 592 | goa_provider_show_account (provider, | ||
778 | 593 | panel->client, | ||
779 | 594 | object, | ||
780 | 595 | GTK_BOX (panel->accounts_vbox), | ||
781 | 596 | NULL, | ||
782 | 597 | NULL); | ||
783 | 598 | } | ||
784 | 599 | |||
785 | 600 | provider_name = goa_account_get_provider_name (account); | ||
786 | 601 | /* translators: This is the title of the "Show Account" dialog. The | ||
787 | 602 | * %s is the name of the provider. e.g., 'Google'. */ | ||
788 | 603 | title = g_strdup_printf (_("%s Account"), provider_name); | ||
789 | 604 | gtk_header_bar_set_title (GTK_HEADER_BAR (panel->edit_account_headerbar), title); | ||
790 | 605 | g_free (title); | ||
791 | 606 | |||
792 | 607 | /* Reset the dialog size */ | ||
793 | 608 | gtk_window_resize (GTK_WINDOW (panel->edit_account_dialog), 1, 1); | ||
794 | 609 | |||
795 | 610 | gtk_widget_show_all (panel->accounts_vbox); | ||
796 | 611 | gtk_widget_show (panel->edit_account_dialog); | ||
797 | 612 | |||
798 | 613 | g_clear_object (&provider); | ||
799 | 614 | } | ||
800 | 615 | |||
801 | 616 | /* ---------------------------------------------------------------------------------------------------- */ | ||
802 | 617 | |||
803 | 618 | static void | ||
804 | 619 | select_account_by_id (CcGoaPanel *panel, | ||
805 | 620 | const gchar *account_id) | ||
806 | 621 | { | ||
807 | 622 | GList *children, *l; | ||
808 | 623 | |||
809 | 624 | children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_listbox)); | ||
810 | 625 | |||
811 | 626 | for (l = children; l != NULL; l = l->next) | ||
812 | 627 | { | ||
813 | 628 | GoaAccount *account; | ||
814 | 629 | GoaObject *row_object; | ||
815 | 630 | |||
816 | 631 | row_object = g_object_get_data (l->data, "goa-object"); | ||
817 | 632 | account = goa_object_peek_account (row_object); | ||
818 | 633 | |||
819 | 634 | if (g_strcmp0 (goa_account_get_id (account), account_id) == 0) | ||
820 | 635 | { | ||
821 | 636 | show_page_account (panel, row_object); | ||
822 | 637 | break; | ||
823 | 638 | } | ||
824 | 639 | } | ||
825 | 640 | |||
826 | 641 | g_list_free (children); | ||
827 | 642 | } | ||
828 | 643 | |||
829 | 644 | static gboolean | ||
830 | 645 | on_edit_account_dialog_delete_event (CcGoaPanel *self) | ||
831 | 646 | { | ||
832 | 647 | self->active_object = NULL; | ||
833 | 648 | gtk_widget_hide (self->edit_account_dialog); | ||
834 | 649 | return TRUE; | ||
835 | 650 | } | ||
836 | 651 | |||
837 | 652 | static void | ||
838 | 653 | on_listbox_row_activated (CcGoaPanel *self, | ||
839 | 654 | GtkListBoxRow *activated_row) | ||
840 | 655 | { | ||
841 | 656 | GoaObject *object; | ||
842 | 657 | |||
843 | 658 | object = g_object_get_data (G_OBJECT (activated_row), "goa-object"); | ||
844 | 659 | show_page_account (self, object); | ||
845 | 660 | } | ||
846 | 661 | |||
847 | 662 | static void | ||
848 | 663 | fill_accounts_listbox (CcGoaPanel *self) | ||
849 | 664 | { | ||
850 | 665 | GList *accounts, *l; | ||
851 | 666 | |||
852 | 667 | accounts = goa_client_get_accounts (self->client); | ||
853 | 668 | |||
854 | 669 | if (accounts == NULL) | ||
855 | 670 | { | ||
856 | 671 | show_page_nothing_selected (self); | ||
857 | 672 | } | ||
858 | 673 | else | ||
859 | 674 | { | ||
860 | 675 | for (l = accounts; l != NULL; l = l->next) | ||
861 | 676 | on_account_added (self->client, l->data, self); | ||
862 | 677 | } | ||
863 | 678 | |||
864 | 679 | g_list_free_full (accounts, g_object_unref); | ||
865 | 680 | } | ||
866 | 681 | |||
867 | 682 | /* ---------------------------------------------------------------------------------------------------- */ | ||
868 | 683 | |||
869 | 684 | typedef void (*RowForAccountCallback) (CcGoaPanel *self, GtkWidget *row, GList *other_rows); | ||
870 | 685 | |||
871 | 686 | static void | ||
872 | 687 | hide_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows) | ||
873 | 688 | { | ||
874 | 689 | gtk_widget_hide (row); | ||
875 | 690 | gtk_widget_set_visible (self->accounts_frame, other_rows != NULL); | ||
876 | 691 | } | ||
877 | 692 | |||
878 | 693 | static void | ||
879 | 694 | remove_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows) | ||
880 | 695 | { | ||
881 | 696 | gtk_widget_destroy (row); | ||
882 | 697 | gtk_widget_set_visible (self->accounts_frame, other_rows != NULL); | ||
883 | 698 | } | ||
884 | 699 | |||
885 | 700 | static void | ||
886 | 701 | show_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows) | ||
887 | 702 | { | ||
888 | 703 | gtk_widget_show (row); | ||
889 | 704 | gtk_widget_show (self->accounts_frame); | ||
890 | 705 | } | ||
891 | 706 | |||
892 | 707 | static void | ||
893 | 708 | modify_row_for_account (CcGoaPanel *self, | ||
894 | 709 | GoaObject *object, | ||
895 | 710 | RowForAccountCallback callback) | ||
896 | 711 | { | ||
897 | 712 | GList *children, *l; | ||
898 | 713 | |||
899 | 714 | children = gtk_container_get_children (GTK_CONTAINER (self->accounts_listbox)); | ||
900 | 715 | |||
901 | 716 | for (l = children; l != NULL; l = l->next) | ||
902 | 717 | { | ||
903 | 718 | GoaObject *row_object; | ||
904 | 719 | |||
905 | 720 | row_object = g_object_get_data (G_OBJECT (l->data), "goa-object"); | ||
906 | 721 | if (row_object == object) | ||
907 | 722 | { | ||
908 | 723 | GtkWidget *row = GTK_WIDGET (l->data); | ||
909 | 724 | |||
910 | 725 | children = g_list_remove_link (children, l); | ||
911 | 726 | callback (self, row, children); | ||
912 | 727 | g_list_free (l); | ||
913 | 728 | break; | ||
914 | 729 | } | ||
915 | 730 | } | ||
916 | 731 | |||
917 | 732 | g_list_free (children); | ||
918 | 733 | } | ||
919 | 734 | |||
920 | 735 | /* ---------------------------------------------------------------------------------------------------- */ | ||
921 | 736 | |||
922 | 737 | static void | ||
923 | 738 | on_account_added (GoaClient *client, | ||
924 | 739 | GoaObject *object, | ||
925 | 740 | gpointer user_data) | ||
926 | 741 | { | ||
927 | 742 | CcGoaPanel *self = user_data; | ||
928 | 743 | GtkWidget *row, *icon, *label, *box; | ||
929 | 744 | GoaAccount *account; | ||
930 | 745 | GError *error; | ||
931 | 746 | GIcon *gicon; | ||
932 | 747 | gchar* title = NULL; | ||
933 | 748 | |||
934 | 749 | account = goa_object_peek_account (object); | ||
935 | 750 | |||
936 | 751 | /* The main grid */ | ||
937 | 752 | box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); | ||
938 | 753 | gtk_widget_show (box); | ||
939 | 754 | |||
940 | 755 | /* The provider icon */ | ||
941 | 756 | icon = gtk_image_new (); | ||
942 | 757 | |||
943 | 758 | error = NULL; | ||
944 | 759 | gicon = g_icon_new_for_string (goa_account_get_provider_icon (account), &error); | ||
945 | 760 | if (error != NULL) | ||
946 | 761 | { | ||
947 | 762 | g_warning ("Error creating GIcon for account: %s (%s, %d)", | ||
948 | 763 | error->message, | ||
949 | 764 | g_quark_to_string (error->domain), | ||
950 | 765 | error->code); | ||
951 | 766 | |||
952 | 767 | g_clear_error (&error); | ||
953 | 768 | } | ||
954 | 769 | else | ||
955 | 770 | { | ||
956 | 771 | gtk_image_set_from_gicon (GTK_IMAGE (icon), gicon, GTK_ICON_SIZE_DIALOG); | ||
957 | 772 | } | ||
958 | 773 | |||
959 | 774 | g_object_set (icon, "margin", 6, NULL); | ||
960 | 775 | |||
961 | 776 | gtk_container_add (GTK_CONTAINER (box), icon); | ||
962 | 777 | |||
963 | 778 | /* The name of the provider */ | ||
964 | 779 | title = g_strdup_printf ("<b>%s</b>\n<small>%s</small>", | ||
965 | 780 | goa_account_get_provider_name (account), | ||
966 | 781 | goa_account_get_presentation_identity (account)); | ||
967 | 782 | |||
968 | 783 | label = g_object_new (GTK_TYPE_LABEL, | ||
969 | 784 | "ellipsize", PANGO_ELLIPSIZE_END, | ||
970 | 785 | "label", title, | ||
971 | 786 | "xalign", 0.0, | ||
972 | 787 | "use-markup", TRUE, | ||
973 | 788 | "hexpand", TRUE, | ||
974 | 789 | NULL); | ||
975 | 790 | gtk_container_add (GTK_CONTAINER (box), label); | ||
976 | 791 | |||
977 | 792 | /* "Needs attention" icon */ | ||
978 | 793 | icon = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_BUTTON); | ||
979 | 794 | gtk_widget_set_no_show_all (icon, TRUE); | ||
980 | 795 | g_object_set (icon, "margin_end", 30, NULL); | ||
981 | 796 | g_object_bind_property (goa_object_peek_account (object), | ||
982 | 797 | "attention-needed", | ||
983 | 798 | icon, | ||
984 | 799 | "visible", | ||
985 | 800 | G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); | ||
986 | 801 | gtk_container_add (GTK_CONTAINER (box), icon); | ||
987 | 802 | |||
988 | 803 | /* The row */ | ||
989 | 804 | row = gtk_list_box_row_new (); | ||
990 | 805 | g_object_set_data (G_OBJECT (row), "goa-object", object); | ||
991 | 806 | gtk_container_add (GTK_CONTAINER (row), box); | ||
992 | 807 | |||
993 | 808 | /* Add to the listbox */ | ||
994 | 809 | gtk_container_add (GTK_CONTAINER (self->accounts_listbox), row); | ||
995 | 810 | gtk_widget_show_all (row); | ||
996 | 811 | gtk_widget_show (self->accounts_frame); | ||
997 | 812 | |||
998 | 813 | g_clear_pointer (&title, g_free); | ||
999 | 814 | g_clear_object (&gicon); | ||
1000 | 815 | } | ||
1001 | 816 | |||
1002 | 817 | static void | ||
1003 | 818 | on_account_changed (GoaClient *client, | ||
1004 | 819 | GoaObject *object, | ||
1005 | 820 | gpointer user_data) | ||
1006 | 821 | { | ||
1007 | 822 | CcGoaPanel *panel = CC_GOA_PANEL (user_data); | ||
1008 | 823 | |||
1009 | 824 | if (panel->active_object != object) | ||
1010 | 825 | return; | ||
1011 | 826 | |||
1012 | 827 | show_page_account (panel, panel->active_object); | ||
1013 | 828 | } | ||
1014 | 829 | |||
1015 | 830 | static void | ||
1016 | 831 | on_account_removed (GoaClient *client, | ||
1017 | 832 | GoaObject *object, | ||
1018 | 833 | gpointer user_data) | ||
1019 | 834 | { | ||
1020 | 835 | CcGoaPanel *self = user_data; | ||
1021 | 836 | modify_row_for_account (self, object, remove_row_for_account); | ||
1022 | 837 | } | ||
1023 | 838 | |||
1024 | 839 | /* ---------------------------------------------------------------------------------------------------- */ | ||
1025 | 840 | |||
1026 | 841 | static void | ||
1027 | 842 | get_all_providers_cb (GObject *source, | ||
1028 | 843 | GAsyncResult *res, | ||
1029 | 844 | gpointer user_data) | ||
1030 | 845 | { | ||
1031 | 846 | CcGoaPanel *self = user_data; | ||
1032 | 847 | GList *providers; | ||
1033 | 848 | GList *l; | ||
1034 | 849 | |||
1035 | 850 | providers = NULL; | ||
1036 | 851 | if (!goa_provider_get_all_finish (&providers, res, NULL)) | ||
1037 | 852 | return; | ||
1038 | 853 | |||
1039 | 854 | for (l = providers; l != NULL; l = l->next) | ||
1040 | 855 | { | ||
1041 | 856 | GoaProvider *provider; | ||
1042 | 857 | provider = GOA_PROVIDER (l->data); | ||
1043 | 858 | |||
1044 | 859 | add_provider_row (self, provider); | ||
1045 | 860 | } | ||
1046 | 861 | |||
1047 | 862 | g_list_free_full (providers, g_object_unref); | ||
1048 | 863 | } | ||
1049 | 864 | |||
1050 | 865 | |||
1051 | 866 | /* ---------------------------------------------------------------------------------------------------- */ | ||
1052 | 867 | |||
1053 | 868 | static void | ||
1054 | 869 | cancel_notification_timeout (CcGoaPanel *self) | ||
1055 | 870 | { | ||
1056 | 871 | if (self->remove_account_timeout_id == 0) | ||
1057 | 872 | return; | ||
1058 | 873 | |||
1059 | 874 | g_source_remove (self->remove_account_timeout_id); | ||
1060 | 875 | |||
1061 | 876 | self->remove_account_timeout_id = 0; | ||
1062 | 877 | } | ||
1063 | 878 | |||
1064 | 879 | static void | ||
1065 | 880 | remove_account_cb (GoaAccount *account, | ||
1066 | 881 | GAsyncResult *res, | ||
1067 | 882 | gpointer user_data) | ||
1068 | 883 | { | ||
1069 | 884 | CcGoaPanel *panel = CC_GOA_PANEL (user_data); | ||
1070 | 885 | GError *error; | ||
1071 | 886 | |||
1072 | 887 | error = NULL; | ||
1073 | 888 | if (!goa_account_call_remove_finish (account, res, &error)) | ||
1074 | 889 | { | ||
1075 | 890 | GtkWidget *dialog; | ||
1076 | 891 | dialog = gtk_message_dialog_new (GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)))), | ||
1077 | 892 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
1078 | 893 | GTK_MESSAGE_ERROR, | ||
1079 | 894 | GTK_BUTTONS_CLOSE, | ||
1080 | 895 | _("Error removing account")); | ||
1081 | 896 | gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), | ||
1082 | 897 | "%s", | ||
1083 | 898 | error->message); | ||
1084 | 899 | gtk_widget_show_all (dialog); | ||
1085 | 900 | gtk_dialog_run (GTK_DIALOG (dialog)); | ||
1086 | 901 | gtk_widget_destroy (dialog); | ||
1087 | 902 | g_error_free (error); | ||
1088 | 903 | } | ||
1089 | 904 | g_object_unref (panel); | ||
1090 | 905 | } | ||
1091 | 906 | |||
1092 | 907 | static void | ||
1093 | 908 | on_notification_closed (GtkButton *button, | ||
1094 | 909 | CcGoaPanel *self) | ||
1095 | 910 | { | ||
1096 | 911 | goa_account_call_remove (goa_object_peek_account (self->removed_object), | ||
1097 | 912 | NULL, /* GCancellable */ | ||
1098 | 913 | (GAsyncReadyCallback) remove_account_cb, | ||
1099 | 914 | g_object_ref (self)); | ||
1100 | 915 | |||
1101 | 916 | gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification_revealer), FALSE); | ||
1102 | 917 | |||
1103 | 918 | cancel_notification_timeout (self); | ||
1104 | 919 | self->removed_object = NULL; | ||
1105 | 920 | } | ||
1106 | 921 | |||
1107 | 922 | static void | ||
1108 | 923 | on_undo_button_clicked (GtkButton *button, | ||
1109 | 924 | CcGoaPanel *self) | ||
1110 | 925 | { | ||
1111 | 926 | /* Simply show the account row and hide the notification */ | ||
1112 | 927 | modify_row_for_account (self, self->removed_object, show_row_for_account); | ||
1113 | 928 | gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification_revealer), FALSE); | ||
1114 | 929 | |||
1115 | 930 | cancel_notification_timeout (self); | ||
1116 | 931 | self->removed_object = NULL; | ||
1117 | 932 | } | ||
1118 | 933 | |||
1119 | 934 | static gboolean | ||
1120 | 935 | on_remove_account_timeout (gpointer user_data) | ||
1121 | 936 | { | ||
1122 | 937 | on_notification_closed (NULL, user_data); | ||
1123 | 938 | return G_SOURCE_REMOVE; | ||
1124 | 939 | } | ||
1125 | 940 | |||
1126 | 941 | static void | ||
1127 | 942 | on_remove_button_clicked (CcGoaPanel *panel) | ||
1128 | 943 | { | ||
1129 | 944 | GoaAccount *account; | ||
1130 | 945 | gchar *label; | ||
1131 | 946 | |||
1132 | 947 | if (panel->active_object == NULL) | ||
1133 | 948 | return; | ||
1134 | 949 | |||
1135 | 950 | if (panel->removed_object != NULL) | ||
1136 | 951 | on_notification_closed (NULL, panel); | ||
1137 | 952 | |||
1138 | 953 | panel->removed_object = panel->active_object; | ||
1139 | 954 | panel->active_object = NULL; | ||
1140 | 955 | |||
1141 | 956 | account = goa_object_peek_account (panel->removed_object); | ||
1142 | 957 | /* Translators: The %s is the username (eg., debarshi.ray@gmail.com | ||
1143 | 958 | * or rishi). | ||
1144 | 959 | */ | ||
1145 | 960 | label = g_strdup_printf (_("<b>%s</b> removed"), goa_account_get_presentation_identity (account)); | ||
1146 | 961 | gtk_label_set_markup (GTK_LABEL (panel->notification_label), label); | ||
1147 | 962 | gtk_revealer_set_reveal_child (GTK_REVEALER (panel->notification_revealer), TRUE); | ||
1148 | 963 | |||
1149 | 964 | modify_row_for_account (panel, panel->removed_object, hide_row_for_account); | ||
1150 | 965 | gtk_widget_hide (panel->edit_account_dialog); | ||
1151 | 966 | |||
1152 | 967 | panel->remove_account_timeout_id = g_timeout_add_seconds (10, on_remove_account_timeout, panel); | ||
1153 | 968 | |||
1154 | 969 | g_free (label); | ||
1155 | 970 | } | ||
1156 | 971 | |||
1157 | 972 | |||
1158 | 973 | /* ---------------------------------------------------------------------------------------------------- */ | ||
1159 | 974 | |||
1160 | 975 | void | ||
1161 | 976 | cc_goa_panel_register (GIOModule *module) | ||
1162 | 977 | { | ||
1163 | 978 | textdomain (GETTEXT_PACKAGE); | ||
1164 | 979 | bindtextdomain (GETTEXT_PACKAGE, "/usr/share/locale"); | ||
1165 | 980 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); | ||
1166 | 981 | cc_goa_panel_register_type (G_TYPE_MODULE (module)); | ||
1167 | 982 | g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT, | ||
1168 | 983 | CC_TYPE_GOA_PANEL, | ||
1169 | 984 | "online-accounts", 0); | ||
1170 | 985 | } | ||
1171 | 0 | 986 | ||
1172 | === added file 'panels/online-accounts/cc-online-accounts-panel.h' | |||
1173 | --- panels/online-accounts/cc-online-accounts-panel.h 1970-01-01 00:00:00 +0000 | |||
1174 | +++ panels/online-accounts/cc-online-accounts-panel.h 2018-02-13 09:06:22 +0000 | |||
1175 | @@ -0,0 +1,65 @@ | |||
1176 | 1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ | ||
1177 | 2 | /* | ||
1178 | 3 | * Copyright (C) 2011 Red Hat, Inc. | ||
1179 | 4 | * | ||
1180 | 5 | * This library is free software; you can redistribute it and/or | ||
1181 | 6 | * modify it under the terms of the GNU Lesser General Public | ||
1182 | 7 | * License as published by the Free Software Foundation; either | ||
1183 | 8 | * version 2 of the License, or (at your option) any later version. | ||
1184 | 9 | * | ||
1185 | 10 | * This library is distributed in the hope that it will be useful, | ||
1186 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1187 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1188 | 13 | * Lesser General Public License for more details. | ||
1189 | 14 | * | ||
1190 | 15 | * You should have received a copy of the GNU Lesser General | ||
1191 | 16 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
1192 | 17 | * | ||
1193 | 18 | * Author: David Zeuthen <davidz@redhat.com> | ||
1194 | 19 | */ | ||
1195 | 20 | |||
1196 | 21 | #ifndef __GOA_PANEL_H__ | ||
1197 | 22 | #define __GOA_PANEL_H__ | ||
1198 | 23 | |||
1199 | 24 | #include <shell/cc-panel.h> | ||
1200 | 25 | |||
1201 | 26 | G_BEGIN_DECLS | ||
1202 | 27 | |||
1203 | 28 | #define CC_TYPE_GOA_PANEL (cc_goa_panel_get_type ()) | ||
1204 | 29 | |||
1205 | 30 | #define CC_GOA_PANEL(obj) \ | ||
1206 | 31 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | ||
1207 | 32 | CC_TYPE_GOA_PANEL, CcGoaPanel)) | ||
1208 | 33 | |||
1209 | 34 | #define CC_GOA_PANEL_CLASS(klass) \ | ||
1210 | 35 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ | ||
1211 | 36 | CC_TYPE_GOA_PANEL, CcGoaPanelClass)) | ||
1212 | 37 | |||
1213 | 38 | #define CC_IS_GOA_PANEL(obj) \ | ||
1214 | 39 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ | ||
1215 | 40 | CC_TYPE_GOA_PANEL)) | ||
1216 | 41 | |||
1217 | 42 | #define CC_IS_GOA_PANEL_CLASS(klass) \ | ||
1218 | 43 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ | ||
1219 | 44 | CC_TYPE_GOA_PANEL)) | ||
1220 | 45 | |||
1221 | 46 | #define CC_GOA_PANEL_GET_CLASS(obj) \ | ||
1222 | 47 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | ||
1223 | 48 | CC_TYPE_GOA_PANEL, CcGoaPanelClass)) | ||
1224 | 49 | |||
1225 | 50 | typedef struct _CcGoaPanel CcGoaPanel; | ||
1226 | 51 | typedef struct _CcGoaPanelClass CcGoaPanelClass; | ||
1227 | 52 | typedef struct _CcGoaPanelPrivate CcGoaPanelPrivate; | ||
1228 | 53 | |||
1229 | 54 | struct _CcGoaPanelClass | ||
1230 | 55 | { | ||
1231 | 56 | CcPanelClass parent_class; | ||
1232 | 57 | }; | ||
1233 | 58 | |||
1234 | 59 | GType cc_goa_panel_get_type (void) G_GNUC_CONST; | ||
1235 | 60 | |||
1236 | 61 | void cc_goa_panel_register (GIOModule *module); | ||
1237 | 62 | |||
1238 | 63 | G_END_DECLS | ||
1239 | 64 | |||
1240 | 65 | #endif /* __GOA_PANEL_H__ */ | ||
1241 | 0 | 66 | ||
1242 | === added directory 'panels/online-accounts/icons' | |||
1243 | === added directory 'panels/online-accounts/icons/16x16' | |||
1244 | === added file 'panels/online-accounts/icons/16x16/Makefile.am' | |||
1245 | --- panels/online-accounts/icons/16x16/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1246 | +++ panels/online-accounts/icons/16x16/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1247 | @@ -0,0 +1,14 @@ | |||
1248 | 1 | NULL = | ||
1249 | 2 | |||
1250 | 3 | icondir = $(datadir)/icons/hicolor/16x16/apps | ||
1251 | 4 | icon_DATA = \ | ||
1252 | 5 | unity-online-accounts.png \ | ||
1253 | 6 | $(NULL) | ||
1254 | 7 | |||
1255 | 8 | EXTRA_DIST = \ | ||
1256 | 9 | $(icon_DATA) | ||
1257 | 10 | |||
1258 | 11 | clean-local : | ||
1259 | 12 | rm -f *~ | ||
1260 | 13 | |||
1261 | 14 | -include $(top_srcdir)/git.mk | ||
1262 | 0 | 15 | ||
1263 | === added file 'panels/online-accounts/icons/16x16/unity-online-accounts.png' | |||
1264 | 1 | Binary files panels/online-accounts/icons/16x16/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/16x16/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/16x16/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/16x16/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1265 | === added directory 'panels/online-accounts/icons/22x22' | |||
1266 | === added file 'panels/online-accounts/icons/22x22/Makefile.am' | |||
1267 | --- panels/online-accounts/icons/22x22/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1268 | +++ panels/online-accounts/icons/22x22/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1269 | @@ -0,0 +1,14 @@ | |||
1270 | 1 | NULL = | ||
1271 | 2 | |||
1272 | 3 | icondir = $(datadir)/icons/hicolor/22x22/apps | ||
1273 | 4 | icon_DATA = \ | ||
1274 | 5 | unity-online-accounts.png \ | ||
1275 | 6 | $(NULL) | ||
1276 | 7 | |||
1277 | 8 | EXTRA_DIST = \ | ||
1278 | 9 | $(icon_DATA) | ||
1279 | 10 | |||
1280 | 11 | clean-local : | ||
1281 | 12 | rm -f *~ | ||
1282 | 13 | |||
1283 | 14 | -include $(top_srcdir)/git.mk | ||
1284 | 0 | 15 | ||
1285 | === added file 'panels/online-accounts/icons/22x22/unity-online-accounts.png' | |||
1286 | 1 | Binary files panels/online-accounts/icons/22x22/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/22x22/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/22x22/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/22x22/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1287 | === added directory 'panels/online-accounts/icons/24x24' | |||
1288 | === added file 'panels/online-accounts/icons/24x24/Makefile.am' | |||
1289 | --- panels/online-accounts/icons/24x24/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1290 | +++ panels/online-accounts/icons/24x24/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1291 | @@ -0,0 +1,14 @@ | |||
1292 | 1 | NULL = | ||
1293 | 2 | |||
1294 | 3 | icondir = $(datadir)/icons/hicolor/24x24/apps | ||
1295 | 4 | icon_DATA = \ | ||
1296 | 5 | unity-online-accounts.png \ | ||
1297 | 6 | $(NULL) | ||
1298 | 7 | |||
1299 | 8 | EXTRA_DIST = \ | ||
1300 | 9 | $(icon_DATA) | ||
1301 | 10 | |||
1302 | 11 | clean-local : | ||
1303 | 12 | rm -f *~ | ||
1304 | 13 | |||
1305 | 14 | -include $(top_srcdir)/git.mk | ||
1306 | 0 | 15 | ||
1307 | === added file 'panels/online-accounts/icons/24x24/unity-online-accounts.png' | |||
1308 | 1 | Binary files panels/online-accounts/icons/24x24/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/24x24/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/24x24/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/24x24/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1309 | === added directory 'panels/online-accounts/icons/256x256' | |||
1310 | === added file 'panels/online-accounts/icons/256x256/Makefile.am' | |||
1311 | --- panels/online-accounts/icons/256x256/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1312 | +++ panels/online-accounts/icons/256x256/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1313 | @@ -0,0 +1,14 @@ | |||
1314 | 1 | NULL = | ||
1315 | 2 | |||
1316 | 3 | icondir = $(datadir)/icons/hicolor/256x256/apps | ||
1317 | 4 | icon_DATA = \ | ||
1318 | 5 | unity-online-accounts.png \ | ||
1319 | 6 | $(NULL) | ||
1320 | 7 | |||
1321 | 8 | EXTRA_DIST = \ | ||
1322 | 9 | $(icon_DATA) | ||
1323 | 10 | |||
1324 | 11 | clean-local : | ||
1325 | 12 | rm -f *~ | ||
1326 | 13 | |||
1327 | 14 | -include $(top_srcdir)/git.mk | ||
1328 | 0 | 15 | ||
1329 | === added file 'panels/online-accounts/icons/256x256/unity-online-accounts.png' | |||
1330 | 1 | Binary files panels/online-accounts/icons/256x256/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/256x256/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/256x256/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/256x256/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1331 | === added directory 'panels/online-accounts/icons/32x32' | |||
1332 | === added file 'panels/online-accounts/icons/32x32/Makefile.am' | |||
1333 | --- panels/online-accounts/icons/32x32/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1334 | +++ panels/online-accounts/icons/32x32/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1335 | @@ -0,0 +1,14 @@ | |||
1336 | 1 | NULL = | ||
1337 | 2 | |||
1338 | 3 | icondir = $(datadir)/icons/hicolor/32x32/apps | ||
1339 | 4 | icon_DATA = \ | ||
1340 | 5 | unity-online-accounts.png \ | ||
1341 | 6 | $(NULL) | ||
1342 | 7 | |||
1343 | 8 | EXTRA_DIST = \ | ||
1344 | 9 | $(icon_DATA) | ||
1345 | 10 | |||
1346 | 11 | clean-local : | ||
1347 | 12 | rm -f *~ | ||
1348 | 13 | |||
1349 | 14 | -include $(top_srcdir)/git.mk | ||
1350 | 0 | 15 | ||
1351 | === added file 'panels/online-accounts/icons/32x32/unity-online-accounts.png' | |||
1352 | 1 | Binary files panels/online-accounts/icons/32x32/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/32x32/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/32x32/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/32x32/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1353 | === added directory 'panels/online-accounts/icons/48x48' | |||
1354 | === added file 'panels/online-accounts/icons/48x48/Makefile.am' | |||
1355 | --- panels/online-accounts/icons/48x48/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1356 | +++ panels/online-accounts/icons/48x48/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1357 | @@ -0,0 +1,14 @@ | |||
1358 | 1 | NULL = | ||
1359 | 2 | |||
1360 | 3 | icondir = $(datadir)/icons/hicolor/48x48/apps | ||
1361 | 4 | icon_DATA = \ | ||
1362 | 5 | unity-online-accounts.png \ | ||
1363 | 6 | $(NULL) | ||
1364 | 7 | |||
1365 | 8 | EXTRA_DIST = \ | ||
1366 | 9 | $(icon_DATA) | ||
1367 | 10 | |||
1368 | 11 | clean-local : | ||
1369 | 12 | rm -f *~ | ||
1370 | 13 | |||
1371 | 14 | -include $(top_srcdir)/git.mk | ||
1372 | 0 | 15 | ||
1373 | === added file 'panels/online-accounts/icons/48x48/unity-online-accounts.png' | |||
1374 | 1 | Binary files panels/online-accounts/icons/48x48/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/48x48/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ | 16 | Binary files panels/online-accounts/icons/48x48/unity-online-accounts.png 1970-01-01 00:00:00 +0000 and panels/online-accounts/icons/48x48/unity-online-accounts.png 2018-02-13 09:06:22 +0000 differ |
1375 | === added file 'panels/online-accounts/icons/Makefile.am' | |||
1376 | --- panels/online-accounts/icons/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1377 | +++ panels/online-accounts/icons/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1378 | @@ -0,0 +1,23 @@ | |||
1379 | 1 | |||
1380 | 2 | SUBDIRS = 16x16 22x22 24x24 32x32 48x48 256x256 | ||
1381 | 3 | |||
1382 | 4 | gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor | ||
1383 | 5 | |||
1384 | 6 | if MAINTAINER_MODE | ||
1385 | 7 | |||
1386 | 8 | install-data-hook: | ||
1387 | 9 | @-if test -z "$(DESTDIR)"; then \ | ||
1388 | 10 | echo "Updating Gtk icon cache."; \ | ||
1389 | 11 | $(gtk_update_icon_cache); \ | ||
1390 | 12 | else \ | ||
1391 | 13 | echo "*** Icon cache not updated. After install, run this:"; \ | ||
1392 | 14 | echo "*** $(gtk_update_icon_cache)"; \ | ||
1393 | 15 | fi | ||
1394 | 16 | |||
1395 | 17 | endif | ||
1396 | 18 | |||
1397 | 19 | clean-local : | ||
1398 | 20 | rm -f *~ | ||
1399 | 21 | |||
1400 | 22 | |||
1401 | 23 | -include $(top_srcdir)/git.mk | ||
1402 | 0 | 24 | ||
1403 | === added file 'panels/online-accounts/online-accounts-module.c' | |||
1404 | --- panels/online-accounts/online-accounts-module.c 1970-01-01 00:00:00 +0000 | |||
1405 | +++ panels/online-accounts/online-accounts-module.c 2018-02-13 09:06:22 +0000 | |||
1406 | @@ -0,0 +1,33 @@ | |||
1407 | 1 | /* | ||
1408 | 2 | * Copyright (C) 2011 Red Hat, Inc | ||
1409 | 3 | * | ||
1410 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1411 | 5 | * it under the terms of the GNU General Public License as published by | ||
1412 | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
1413 | 7 | * (at your option) any later version. | ||
1414 | 8 | * | ||
1415 | 9 | * This program is distributed in the hope that it will be useful, | ||
1416 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1417 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1418 | 12 | * GNU General Public License for more details. | ||
1419 | 13 | * | ||
1420 | 14 | * You should have received a copy of the GNU General Public License | ||
1421 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
1422 | 16 | * | ||
1423 | 17 | */ | ||
1424 | 18 | |||
1425 | 19 | #include <config.h> | ||
1426 | 20 | #include "cc-online-accounts-panel.h" | ||
1427 | 21 | #include <glib/gi18n.h> | ||
1428 | 22 | |||
1429 | 23 | void | ||
1430 | 24 | g_io_module_load (GIOModule *module) | ||
1431 | 25 | { | ||
1432 | 26 | /* register the panel */ | ||
1433 | 27 | cc_goa_panel_register (module); | ||
1434 | 28 | } | ||
1435 | 29 | |||
1436 | 30 | void | ||
1437 | 31 | g_io_module_unload (GIOModule *module) | ||
1438 | 32 | { | ||
1439 | 33 | } | ||
1440 | 0 | 34 | ||
1441 | === added file 'panels/online-accounts/online-accounts.gresource.xml' | |||
1442 | --- panels/online-accounts/online-accounts.gresource.xml 1970-01-01 00:00:00 +0000 | |||
1443 | +++ panels/online-accounts/online-accounts.gresource.xml 2018-02-13 09:06:22 +0000 | |||
1444 | @@ -0,0 +1,6 @@ | |||
1445 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1446 | 2 | <gresources> | ||
1447 | 3 | <gresource prefix="/org/gnome/control-center/online-accounts"> | ||
1448 | 4 | <file preprocess="xml-stripblanks">online-accounts.ui</file> | ||
1449 | 5 | </gresource> | ||
1450 | 6 | </gresources> | ||
1451 | 0 | 7 | ||
1452 | === added file 'panels/online-accounts/online-accounts.ui' | |||
1453 | --- panels/online-accounts/online-accounts.ui 1970-01-01 00:00:00 +0000 | |||
1454 | +++ panels/online-accounts/online-accounts.ui 2018-02-13 09:06:22 +0000 | |||
1455 | @@ -0,0 +1,270 @@ | |||
1456 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1457 | 2 | <interface> | ||
1458 | 3 | <!-- interface-requires gtk+ 3.0 --> | ||
1459 | 4 | <template class="CcGoaPanel" parent="CcPanel"> | ||
1460 | 5 | <property name="visible">True</property> | ||
1461 | 6 | <property name="can_focus">False</property> | ||
1462 | 7 | <child> | ||
1463 | 8 | <object class="GtkOverlay"> | ||
1464 | 9 | <property name="visible">True</property> | ||
1465 | 10 | <property name="can_focus">False</property> | ||
1466 | 11 | <child type="overlay"> | ||
1467 | 12 | <object class="GtkRevealer" id="notification_revealer"> | ||
1468 | 13 | <property name="visible">True</property> | ||
1469 | 14 | <property name="can_focus">False</property> | ||
1470 | 15 | <property name="halign">center</property> | ||
1471 | 16 | <property name="valign">start</property> | ||
1472 | 17 | <property name="transition_type">slide-down</property> | ||
1473 | 18 | <child> | ||
1474 | 19 | <object class="GtkFrame"> | ||
1475 | 20 | <property name="visible">True</property> | ||
1476 | 21 | <property name="can_focus">False</property> | ||
1477 | 22 | <child> | ||
1478 | 23 | <object class="GtkBox"> | ||
1479 | 24 | <property name="visible">True</property> | ||
1480 | 25 | <property name="can_focus">False</property> | ||
1481 | 26 | <property name="spacing">12</property> | ||
1482 | 27 | <child> | ||
1483 | 28 | <object class="GtkLabel" id="notification_label"> | ||
1484 | 29 | <property name="visible">True</property> | ||
1485 | 30 | <property name="can_focus">False</property> | ||
1486 | 31 | <property name="use_markup">True</property> | ||
1487 | 32 | </object> | ||
1488 | 33 | </child> | ||
1489 | 34 | <child> | ||
1490 | 35 | <object class="GtkButton" id="undo_button"> | ||
1491 | 36 | <property name="visible">True</property> | ||
1492 | 37 | <property name="can_focus">True</property> | ||
1493 | 38 | <property name="label" translatable="yes">Undo</property> | ||
1494 | 39 | <signal name="clicked" handler="on_undo_button_clicked" object="CcGoaPanel" swapped="no" /> | ||
1495 | 40 | </object> | ||
1496 | 41 | </child> | ||
1497 | 42 | <child> | ||
1498 | 43 | <object class="GtkButton"> | ||
1499 | 44 | <property name="visible">True</property> | ||
1500 | 45 | <property name="can_focus">True</property> | ||
1501 | 46 | <property name="relief">none</property> | ||
1502 | 47 | <signal name="clicked" handler="on_notification_closed" object="CcGoaPanel" swapped="no" /> | ||
1503 | 48 | <child> | ||
1504 | 49 | <object class="GtkImage"> | ||
1505 | 50 | <property name="visible">True</property> | ||
1506 | 51 | <property name="can_focus">False</property> | ||
1507 | 52 | <property name="icon-name">window-close-symbolic</property> | ||
1508 | 53 | </object> | ||
1509 | 54 | </child> | ||
1510 | 55 | </object> | ||
1511 | 56 | </child> | ||
1512 | 57 | </object> | ||
1513 | 58 | </child> | ||
1514 | 59 | <style> | ||
1515 | 60 | <class name="app-notification" /> | ||
1516 | 61 | </style> | ||
1517 | 62 | </object> | ||
1518 | 63 | </child> | ||
1519 | 64 | </object> | ||
1520 | 65 | </child> | ||
1521 | 66 | <child> | ||
1522 | 67 | <object class="GtkScrolledWindow"> | ||
1523 | 68 | <property name="visible">True</property> | ||
1524 | 69 | <property name="can_focus">True</property> | ||
1525 | 70 | <property name="hscrollbar_policy">never</property> | ||
1526 | 71 | <property name="min_content_height">500</property> | ||
1527 | 72 | <child> | ||
1528 | 73 | <object class="GtkGrid"> | ||
1529 | 74 | <property name="visible">True</property> | ||
1530 | 75 | <property name="can_focus">False</property> | ||
1531 | 76 | <property name="row-spacing">18</property> | ||
1532 | 77 | <property name="column-spacing">18</property> | ||
1533 | 78 | <property name="orientation">vertical</property> | ||
1534 | 79 | <property name="margin_start">32</property> | ||
1535 | 80 | <property name="margin_end">32</property> | ||
1536 | 81 | <property name="margin_top">32</property> | ||
1537 | 82 | <property name="margin_bottom">22</property> | ||
1538 | 83 | <property name="hexpand">True</property> | ||
1539 | 84 | <property name="width-request">300</property> | ||
1540 | 85 | |||
1541 | 86 | <!-- | ||
1542 | 87 | Stub boxes to pull the widgets to the middle, and yet allow them to | ||
1543 | 88 | grow and cover a third of the available space | ||
1544 | 89 | --> | ||
1545 | 90 | <child> | ||
1546 | 91 | <object class="GtkBox"> | ||
1547 | 92 | <property name="visible">True</property> | ||
1548 | 93 | <property name="hexpand">True</property> | ||
1549 | 94 | </object> | ||
1550 | 95 | <packing> | ||
1551 | 96 | <property name="top-attach">0</property> | ||
1552 | 97 | <property name="left-attach">0</property> | ||
1553 | 98 | </packing> | ||
1554 | 99 | </child> | ||
1555 | 100 | |||
1556 | 101 | <child> | ||
1557 | 102 | <object class="GtkBox"> | ||
1558 | 103 | <property name="visible">True</property> | ||
1559 | 104 | <property name="hexpand">True</property> | ||
1560 | 105 | </object> | ||
1561 | 106 | <packing> | ||
1562 | 107 | <property name="top-attach">0</property> | ||
1563 | 108 | <property name="left-attach">2</property> | ||
1564 | 109 | </packing> | ||
1565 | 110 | </child> | ||
1566 | 111 | |||
1567 | 112 | <child> | ||
1568 | 113 | <object class="GtkBox"> | ||
1569 | 114 | <property name="visible">True</property> | ||
1570 | 115 | <property name="can_focus">False</property> | ||
1571 | 116 | <property name="spacing">12</property> | ||
1572 | 117 | <property name="orientation">vertical</property> | ||
1573 | 118 | <property name="hexpand">True</property> | ||
1574 | 119 | <property name="width-request">300</property> | ||
1575 | 120 | <child> | ||
1576 | 121 | <object class="GtkLabel" id="offline_label"> | ||
1577 | 122 | <property name="visible">True</property> | ||
1578 | 123 | <property name="can_focus">False</property> | ||
1579 | 124 | <property name="wrap">True</property> | ||
1580 | 125 | <property name="label" translatable="yes">No internet connection — connect to set up new online accounts</property> | ||
1581 | 126 | </object> | ||
1582 | 127 | </child> | ||
1583 | 128 | <child> | ||
1584 | 129 | <object class="GtkFrame" id="accounts_frame"> | ||
1585 | 130 | <property name="can_focus">False</property> | ||
1586 | 131 | <child> | ||
1587 | 132 | <object class="GtkListBox" id="accounts_listbox"> | ||
1588 | 133 | <property name="visible">True</property> | ||
1589 | 134 | <property name="can_focus">True</property> | ||
1590 | 135 | <property name="selection_mode">none</property> | ||
1591 | 136 | <signal name="row-activated" handler="on_listbox_row_activated" object="CcGoaPanel" swapped="yes" /> | ||
1592 | 137 | </object> | ||
1593 | 138 | </child> | ||
1594 | 139 | </object> | ||
1595 | 140 | </child> | ||
1596 | 141 | <child> | ||
1597 | 142 | <object class="GtkLabel"> | ||
1598 | 143 | <property name="visible">True</property> | ||
1599 | 144 | <property name="can_focus">False</property> | ||
1600 | 145 | <property name="margin-top">24</property> | ||
1601 | 146 | <property name="xalign">0</property> | ||
1602 | 147 | <property name="label" translatable="yes">Add an account</property> | ||
1603 | 148 | <attributes> | ||
1604 | 149 | <attribute name="weight" value="bold" /> | ||
1605 | 150 | </attributes> | ||
1606 | 151 | </object> | ||
1607 | 152 | </child> | ||
1608 | 153 | <child> | ||
1609 | 154 | <object class="GtkFrame"> | ||
1610 | 155 | <property name="visible">True</property> | ||
1611 | 156 | <property name="can_focus">False</property> | ||
1612 | 157 | <child> | ||
1613 | 158 | <object class="GtkListBox" id="providers_listbox"> | ||
1614 | 159 | <property name="visible">True</property> | ||
1615 | 160 | <property name="can_focus">True</property> | ||
1616 | 161 | <property name="selection_mode">none</property> | ||
1617 | 162 | <signal name="row-activated" handler="on_provider_row_activated" object="CcGoaPanel" swapped="yes" /> | ||
1618 | 163 | <child> | ||
1619 | 164 | <object class="GtkListBoxRow" id="more_providers_row"> | ||
1620 | 165 | <property name="visible">True</property> | ||
1621 | 166 | <property name="can_focus">True</property> | ||
1622 | 167 | <child> | ||
1623 | 168 | <object class="GtkImage"> | ||
1624 | 169 | <property name="visible">True</property> | ||
1625 | 170 | <property name="can_focus">False</property> | ||
1626 | 171 | <property name="hexpand">True</property> | ||
1627 | 172 | <property name="margin">22</property> | ||
1628 | 173 | <property name="icon-name">view-more-symbolic</property> | ||
1629 | 174 | </object> | ||
1630 | 175 | </child> | ||
1631 | 176 | </object> | ||
1632 | 177 | </child> | ||
1633 | 178 | </object> | ||
1634 | 179 | </child> | ||
1635 | 180 | </object> | ||
1636 | 181 | </child> | ||
1637 | 182 | </object> | ||
1638 | 183 | <packing> | ||
1639 | 184 | <property name="top-attach">0</property> | ||
1640 | 185 | <property name="left-attach">1</property> | ||
1641 | 186 | </packing> | ||
1642 | 187 | </child> | ||
1643 | 188 | </object> | ||
1644 | 189 | </child> | ||
1645 | 190 | </object> | ||
1646 | 191 | </child> | ||
1647 | 192 | </object> | ||
1648 | 193 | </child> | ||
1649 | 194 | </template> | ||
1650 | 195 | <object class="GtkDialog" id="edit_account_dialog"> | ||
1651 | 196 | <property name="can_focus">False</property> | ||
1652 | 197 | <property name="type_hint">dialog</property> | ||
1653 | 198 | <property name="use_header_bar">1</property> | ||
1654 | 199 | <property name="resizable">True</property> | ||
1655 | 200 | <property name="modal">True</property> | ||
1656 | 201 | <signal name="delete-event" handler="on_edit_account_dialog_delete_event" object="CcGoaPanel" swapped="yes" /> | ||
1657 | 202 | <child type="titlebar"> | ||
1658 | 203 | <object class="GtkHeaderBar" id="edit_account_headerbar"> | ||
1659 | 204 | <property name="visible">True</property> | ||
1660 | 205 | <property name="can_focus">False</property> | ||
1661 | 206 | <property name="show_close_button">False</property> | ||
1662 | 207 | </object> | ||
1663 | 208 | </child> | ||
1664 | 209 | <child internal-child="vbox"> | ||
1665 | 210 | <object class="GtkBox"> | ||
1666 | 211 | <property name="can_focus">False</property> | ||
1667 | 212 | <property name="orientation">vertical</property> | ||
1668 | 213 | <property name="border_width">0</property> | ||
1669 | 214 | <child> | ||
1670 | 215 | <object class="GtkStack" id="stack"> | ||
1671 | 216 | <property name="visible">True</property> | ||
1672 | 217 | <property name="can_focus">False</property> | ||
1673 | 218 | <property name="transition_type">crossfade</property> | ||
1674 | 219 | <property name="homogeneous">False</property> | ||
1675 | 220 | <child> | ||
1676 | 221 | <object class="GtkBox" id="new_account_vbox"> | ||
1677 | 222 | <property name="visible">True</property> | ||
1678 | 223 | <property name="can_focus">False</property> | ||
1679 | 224 | </object> | ||
1680 | 225 | <packing> | ||
1681 | 226 | <property name="name">new-account</property> | ||
1682 | 227 | </packing> | ||
1683 | 228 | </child> | ||
1684 | 229 | <child> | ||
1685 | 230 | <object class="GtkBox"> | ||
1686 | 231 | <property name="visible">True</property> | ||
1687 | 232 | <property name="can_focus">False</property> | ||
1688 | 233 | <property name="margin">24</property> | ||
1689 | 234 | <property name="spacing">24</property> | ||
1690 | 235 | <property name="orientation">vertical</property> | ||
1691 | 236 | <child> | ||
1692 | 237 | <object class="GtkBox" id="accounts_vbox"> | ||
1693 | 238 | <property name="visible">True</property> | ||
1694 | 239 | <property name="can_focus">False</property> | ||
1695 | 240 | <property name="vexpand">True</property> | ||
1696 | 241 | <property name="orientation">vertical</property> | ||
1697 | 242 | <property name="margin-start">18</property> | ||
1698 | 243 | <property name="margin-end">18</property> | ||
1699 | 244 | <property name="spacing">18</property> | ||
1700 | 245 | </object> | ||
1701 | 246 | </child> | ||
1702 | 247 | <child> | ||
1703 | 248 | <object class="GtkButton" id="remove_account_button"> | ||
1704 | 249 | <property name="visible">True</property> | ||
1705 | 250 | <property name="can_focus">True</property> | ||
1706 | 251 | <property name="valign">end</property> | ||
1707 | 252 | <property name="halign">end</property> | ||
1708 | 253 | <property name="label" translatable="yes">Remove Account</property> | ||
1709 | 254 | <signal name="clicked" handler="on_remove_button_clicked" object="CcGoaPanel" swapped="yes" /> | ||
1710 | 255 | <style> | ||
1711 | 256 | <class name="destructive-action" /> | ||
1712 | 257 | </style> | ||
1713 | 258 | </object> | ||
1714 | 259 | </child> | ||
1715 | 260 | </object> | ||
1716 | 261 | <packing> | ||
1717 | 262 | <property name="name">editor</property> | ||
1718 | 263 | </packing> | ||
1719 | 264 | </child> | ||
1720 | 265 | </object> | ||
1721 | 266 | </child> | ||
1722 | 267 | </object> | ||
1723 | 268 | </child> | ||
1724 | 269 | </object> | ||
1725 | 270 | </interface> | ||
1726 | 0 | 271 | ||
1727 | === added file 'panels/online-accounts/unity-online-accounts-panel.desktop.in.in' | |||
1728 | --- panels/online-accounts/unity-online-accounts-panel.desktop.in.in 1970-01-01 00:00:00 +0000 | |||
1729 | +++ panels/online-accounts/unity-online-accounts-panel.desktop.in.in 2018-02-13 09:06:22 +0000 | |||
1730 | @@ -0,0 +1,15 @@ | |||
1731 | 1 | [Desktop Entry] | ||
1732 | 2 | Exec=unity-control-center online-accounts | ||
1733 | 3 | Icon=unity-online-accounts | ||
1734 | 4 | Terminal=false | ||
1735 | 5 | Type=Application | ||
1736 | 6 | NoDisplay=false | ||
1737 | 7 | StartupNotify=true | ||
1738 | 8 | Categories=GNOME;GTK;Settings;DesktopSettings;X-Unity-Settings-Panel;X-GNOME-PersonalSettings;OnlineAccounts; | ||
1739 | 9 | OnlyShowIn=Unity; | ||
1740 | 10 | X-Unity-Settings-Panel=online-accounts | ||
1741 | 11 | # Translators: those are keywords for the online-accounts control-center panel | ||
1742 | 12 | Keywords=Google;Facebook;Twitter;Yahoo;Web;Online;Chat;Calendar;Mail;Contact;ownCloud;Kerberos;IMAP;SMTP;Pocket;ReadItLater; | ||
1743 | 13 | Name=Online Accounts | ||
1744 | 14 | Comment=Connect your online accounts | ||
1745 | 15 | X-Ubuntu-Gettext-Domain=unity-control-center | ||
1746 | 0 | 16 | ||
1747 | === modified file 'po/POTFILES.in' | |||
1748 | --- po/POTFILES.in 2017-12-07 05:45:44 +0000 | |||
1749 | +++ po/POTFILES.in 2018-02-13 09:06:22 +0000 | |||
1750 | @@ -92,7 +92,10 @@ | |||
1751 | 92 | panels/screen-sharing/vino-message-box.c | 92 | panels/screen-sharing/vino-message-box.c |
1752 | 93 | panels/screen-sharing/cc-screen-sharing-panel.c | 93 | panels/screen-sharing/cc-screen-sharing-panel.c |
1753 | 94 | panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in | 94 | panels/screen-sharing/unity-screen-sharing-panel.desktop.in.in |
1755 | 95 | [type: gettext/glade]panels/screen-sharing/cc-screen-sharing-panel.ui | 95 | [type: gettext/glade]panels/screen-sharing/screen-sharing-panel.ui |
1756 | 96 | panels/online-accounts/cc-online-accounts-panel.c | ||
1757 | 97 | panels/online-accounts/unity-online-accounts-panel.desktop.in.in | ||
1758 | 98 | [type: gettext/glade]panels/online-accounts/online-accounts.ui | ||
1759 | 96 | panels/sound/cc-sound-panel.c | 99 | panels/sound/cc-sound-panel.c |
1760 | 97 | panels/sound/gvc-balance-bar.c | 100 | panels/sound/gvc-balance-bar.c |
1761 | 98 | panels/sound/gvc-channel-bar.c | 101 | panels/sound/gvc-channel-bar.c |
1762 | 99 | 102 | ||
1763 | === modified file 'shell/Makefile.am' | |||
1764 | --- shell/Makefile.am 2017-04-06 13:23:05 +0000 | |||
1765 | +++ shell/Makefile.am 2018-02-13 09:06:22 +0000 | |||
1766 | @@ -54,6 +54,8 @@ | |||
1767 | 54 | cc-shell.h \ | 54 | cc-shell.h \ |
1768 | 55 | cc-editable-entry.c \ | 55 | cc-editable-entry.c \ |
1769 | 56 | cc-editable-entry.h \ | 56 | cc-editable-entry.h \ |
1770 | 57 | list-box-helper.h \ | ||
1771 | 58 | list-box-helper.c \ | ||
1772 | 57 | $(NULL) | 59 | $(NULL) |
1773 | 58 | 60 | ||
1774 | 59 | libunity_control_center_la_LDFLAGS = \ | 61 | libunity_control_center_la_LDFLAGS = \ |
1775 | 60 | 62 | ||
1776 | === added file 'shell/list-box-helper.c' | |||
1777 | --- shell/list-box-helper.c 1970-01-01 00:00:00 +0000 | |||
1778 | +++ shell/list-box-helper.c 2018-02-13 09:06:22 +0000 | |||
1779 | @@ -0,0 +1,110 @@ | |||
1780 | 1 | /* | ||
1781 | 2 | * Copyright (C) 2014 Red Hat, Inc | ||
1782 | 3 | * | ||
1783 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1784 | 5 | * it under the terms of the GNU General Public License as published by | ||
1785 | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
1786 | 7 | * (at your option) any later version. | ||
1787 | 8 | * | ||
1788 | 9 | * This program is distributed in the hope that it will be useful, | ||
1789 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1790 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1791 | 12 | * GNU General Public License for more details. | ||
1792 | 13 | * | ||
1793 | 14 | * You should have received a copy of the GNU General Public License | ||
1794 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
1795 | 16 | * | ||
1796 | 17 | */ | ||
1797 | 18 | |||
1798 | 19 | #include "list-box-helper.h" | ||
1799 | 20 | |||
1800 | 21 | #define MAX_ROWS_VISIBLE 5 | ||
1801 | 22 | |||
1802 | 23 | void | ||
1803 | 24 | cc_list_box_update_header_func (GtkListBoxRow *row, | ||
1804 | 25 | GtkListBoxRow *before, | ||
1805 | 26 | gpointer user_data) | ||
1806 | 27 | { | ||
1807 | 28 | GtkWidget *current; | ||
1808 | 29 | |||
1809 | 30 | if (before == NULL) | ||
1810 | 31 | { | ||
1811 | 32 | gtk_list_box_row_set_header (row, NULL); | ||
1812 | 33 | return; | ||
1813 | 34 | } | ||
1814 | 35 | |||
1815 | 36 | current = gtk_list_box_row_get_header (row); | ||
1816 | 37 | if (current == NULL) | ||
1817 | 38 | { | ||
1818 | 39 | current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); | ||
1819 | 40 | gtk_widget_show (current); | ||
1820 | 41 | gtk_list_box_row_set_header (row, current); | ||
1821 | 42 | } | ||
1822 | 43 | } | ||
1823 | 44 | |||
1824 | 45 | void | ||
1825 | 46 | cc_list_box_adjust_scrolling (GtkListBox *listbox) | ||
1826 | 47 | { | ||
1827 | 48 | GtkWidget *scrolled_window; | ||
1828 | 49 | GList *children; | ||
1829 | 50 | guint n_rows, num_max_rows; | ||
1830 | 51 | |||
1831 | 52 | scrolled_window = g_object_get_data (G_OBJECT (listbox), "cc-scrolling-scrolled-window"); | ||
1832 | 53 | if (!scrolled_window) | ||
1833 | 54 | return; | ||
1834 | 55 | |||
1835 | 56 | children = gtk_container_get_children (GTK_CONTAINER (listbox)); | ||
1836 | 57 | n_rows = g_list_length (children); | ||
1837 | 58 | |||
1838 | 59 | num_max_rows = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (listbox), "cc-max-rows-visible")); | ||
1839 | 60 | |||
1840 | 61 | if (n_rows >= num_max_rows) | ||
1841 | 62 | { | ||
1842 | 63 | gint total_row_height = 0; | ||
1843 | 64 | GList *l; | ||
1844 | 65 | guint i; | ||
1845 | 66 | |||
1846 | 67 | for (l = children, i = 0; l != NULL && i < num_max_rows; l = l->next, i++) { | ||
1847 | 68 | gint row_height; | ||
1848 | 69 | gtk_widget_get_preferred_height (GTK_WIDGET (l->data), &row_height, NULL); | ||
1849 | 70 | total_row_height += row_height; | ||
1850 | 71 | } | ||
1851 | 72 | |||
1852 | 73 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_window), total_row_height); | ||
1853 | 74 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), | ||
1854 | 75 | GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | ||
1855 | 76 | } | ||
1856 | 77 | else | ||
1857 | 78 | { | ||
1858 | 79 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_window), -1); | ||
1859 | 80 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), | ||
1860 | 81 | GTK_POLICY_NEVER, GTK_POLICY_NEVER); | ||
1861 | 82 | } | ||
1862 | 83 | |||
1863 | 84 | g_list_free (children); | ||
1864 | 85 | } | ||
1865 | 86 | |||
1866 | 87 | void | ||
1867 | 88 | cc_list_box_setup_scrolling (GtkListBox *listbox, | ||
1868 | 89 | guint num_max_rows) | ||
1869 | 90 | { | ||
1870 | 91 | GtkWidget *parent; | ||
1871 | 92 | GtkWidget *scrolled_window; | ||
1872 | 93 | |||
1873 | 94 | parent = gtk_widget_get_parent (GTK_WIDGET (listbox)); | ||
1874 | 95 | scrolled_window = gtk_scrolled_window_new (NULL, NULL); | ||
1875 | 96 | gtk_widget_show (scrolled_window); | ||
1876 | 97 | |||
1877 | 98 | g_object_ref (listbox); | ||
1878 | 99 | gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (listbox)); | ||
1879 | 100 | gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (listbox)); | ||
1880 | 101 | g_object_unref (listbox); | ||
1881 | 102 | |||
1882 | 103 | gtk_container_add (GTK_CONTAINER (parent), scrolled_window); | ||
1883 | 104 | |||
1884 | 105 | if (num_max_rows == 0) | ||
1885 | 106 | num_max_rows = MAX_ROWS_VISIBLE; | ||
1886 | 107 | |||
1887 | 108 | g_object_set_data (G_OBJECT (listbox), "cc-scrolling-scrolled-window", scrolled_window); | ||
1888 | 109 | g_object_set_data (G_OBJECT (listbox), "cc-max-rows-visible", GUINT_TO_POINTER (num_max_rows)); | ||
1889 | 110 | } | ||
1890 | 0 | 111 | ||
1891 | === added file 'shell/list-box-helper.h' | |||
1892 | --- shell/list-box-helper.h 1970-01-01 00:00:00 +0000 | |||
1893 | +++ shell/list-box-helper.h 2018-02-13 09:06:22 +0000 | |||
1894 | @@ -0,0 +1,31 @@ | |||
1895 | 1 | /* | ||
1896 | 2 | * Copyright (C) 2014 Red Hat, Inc | ||
1897 | 3 | * | ||
1898 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1899 | 5 | * it under the terms of the GNU General Public License as published by | ||
1900 | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
1901 | 7 | * (at your option) any later version. | ||
1902 | 8 | * | ||
1903 | 9 | * This program is distributed in the hope that it will be useful, | ||
1904 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1905 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1906 | 12 | * GNU General Public License for more details. | ||
1907 | 13 | * | ||
1908 | 14 | * You should have received a copy of the GNU General Public License | ||
1909 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
1910 | 16 | * | ||
1911 | 17 | */ | ||
1912 | 18 | |||
1913 | 19 | #include <gtk/gtk.h> | ||
1914 | 20 | |||
1915 | 21 | void | ||
1916 | 22 | cc_list_box_update_header_func (GtkListBoxRow *row, | ||
1917 | 23 | GtkListBoxRow *before, | ||
1918 | 24 | gpointer user_data); | ||
1919 | 25 | |||
1920 | 26 | void | ||
1921 | 27 | cc_list_box_adjust_scrolling (GtkListBox *listbox); | ||
1922 | 28 | |||
1923 | 29 | void | ||
1924 | 30 | cc_list_box_setup_scrolling (GtkListBox *listbox, | ||
1925 | 31 | guint num_rows); |
https:/ /bileto. ubuntu. com/#/ticket/ 3158
This will be part of the gnome-desktop3 transition which is currently held up by a few things (glib needs to migrate, libglvnd needs to be promoted to main, and I'm having trouble with Unity FTBFS) /people. canonical. com/~ubuntu- archive/ transitions/ html/gnome- desktop3. html
https:/