Merge lp:~amigadave/gnome-control-center-signon/remove-scrolling-transition into lp:gnome-control-center-signon
- remove-scrolling-transition
- Merge into trunk
Proposed by
David King
Status: | Merged |
---|---|
Approved by: | Alberto Mardegan |
Approved revision: | 95 |
Merged at revision: | 95 |
Proposed branch: | lp:~amigadave/gnome-control-center-signon/remove-scrolling-transition |
Merge into: | lp:gnome-control-center-signon |
Diff against target: |
940 lines (+15/-734) 8 files modified
Makefile.am (+0/-9) configure.ac (+1/-3) src/cc-credentials-application.vala (+0/-5) src/cc-credentials-preferences.vala (+14/-67) src/cc-notebook.c (+0/-566) src/cc-notebook.deps (+0/-1) src/cc-notebook.h (+0/-70) src/cc-notebook.vapi (+0/-13) |
To merge this branch: | bzr merge lp:~amigadave/gnome-control-center-signon/remove-scrolling-transition |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Mardegan (community) | Approve | ||
jenkins (community) | continuous-integration | Needs Fixing | |
Review via email: mp+122262@code.launchpad.net |
Commit message
Description of the change
Revert the scrolling transition changes
To post a comment you must log in.
- 95. By David King
-
Remove scrolling transition
Revision history for this message
jenkins (martin-mrazik+qa) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2012-08-22 11:53:56 +0000 |
3 | +++ Makefile.am 2012-08-31 12:46:18 +0000 |
4 | @@ -48,7 +48,6 @@ |
5 | |
6 | common_cppflags = \ |
7 | $(CREDENTIALS_PANEL_CFLAGS) \ |
8 | - -I$(srcdir)/src \ |
9 | -include $(top_builddir)/config.h \ |
10 | -DG_LOG_DOMAIN=\"\$(cappletname)-cc-panel\" \ |
11 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
12 | @@ -65,7 +64,6 @@ |
13 | --pkg AccountPlugin \ |
14 | --pkg accounts \ |
15 | --pkg assertions \ |
16 | - --pkg cc-notebook \ |
17 | --pkg posix \ |
18 | --pkg signon \ |
19 | --pkg gtk+-3.0 \ |
20 | @@ -82,12 +80,8 @@ |
21 | src/cc-credentials-preferences.vala \ |
22 | src/cc-credentials-providers-model.vala \ |
23 | src/cc-credentials-providers-page.vala \ |
24 | - src/cc-notebook.c \ |
25 | src/cc-webcredentials-indicator.vala |
26 | |
27 | -common_headers = \ |
28 | - src/cc-notebook.h |
29 | - |
30 | libcredentials_la_SOURCES = \ |
31 | $(common_vala_sources) \ |
32 | src/cc-credentials-panel.c |
33 | @@ -420,7 +414,6 @@ |
34 | dist-hook |
35 | |
36 | dist_noinst_DATA = \ |
37 | - $(common_headers) \ |
38 | $(gtkdoc_srcdir)/account-plugin-docs.xml \ |
39 | $(gtkdoc_srcdir)/account-plugin-sections.txt \ |
40 | $(gtkdoc_srcdir)/version.xml.in \ |
41 | @@ -433,8 +426,6 @@ |
42 | src/accounts.deps \ |
43 | src/accounts.vapi \ |
44 | src/assertions.vapi \ |
45 | - src/cc-notebook.vapi \ |
46 | - src/cc-notebook.deps \ |
47 | src/signon.vapi \ |
48 | src/gtk+-3.0.vapi \ |
49 | src/gtk+-3.0.deps |
50 | |
51 | === modified file 'configure.ac' |
52 | --- configure.ac 2012-08-23 13:30:43 +0000 |
53 | +++ configure.ac 2012-08-31 12:46:18 +0000 |
54 | @@ -46,7 +46,6 @@ |
55 | GLIB_REQUIRED="glib-2.0 gio-2.0 gio-unix-2.0 >= 2.29.5" |
56 | GTK_REQUIRED="gtk+-3.0 >= 3.0.0" |
57 | GNOME_CONTROL_CENTER_REQUIRED="libgnome-control-center" |
58 | -CLUTTER_REQUIRED="clutter-1.0 >= 1.11.10 clutter-gtk-1.0 >= 1.3.2" |
59 | # Unfortunately we need this in order to store the cookies (D-Bus signature |
60 | # a{ss}) into a GValue |
61 | DBUS_GLIB_REQUIRED="dbus-glib-1" |
62 | @@ -56,8 +55,7 @@ |
63 | $LIBSIGNON_GLIB_REQUIRED |
64 | $GLIB_REQUIRED |
65 | $GTK_REQUIRED |
66 | - $GNOME_CONTROL_CENTER_REQUIRED |
67 | - $CLUTTER_REQUIRED]) |
68 | + $GNOME_CONTROL_CENTER_REQUIRED]) |
69 | |
70 | # libaccount-plugin variables. |
71 | AC_SUBST([LIBACCOUNT_PLUGIN_SO_VERSION], [0:0:0]) |
72 | |
73 | === modified file 'src/cc-credentials-application.vala' |
74 | --- src/cc-credentials-application.vala 2012-08-22 10:01:12 +0000 |
75 | +++ src/cc-credentials-application.vala 2012-08-31 12:46:18 +0000 |
76 | @@ -87,11 +87,6 @@ |
77 | unowned string[] arguments = args; |
78 | if (arguments.length <= 1) |
79 | { |
80 | - var result = GtkClutter.init (ref arguments); |
81 | - if (result != Clutter.InitError.SUCCESS) |
82 | - { |
83 | - error ("Clutter failed to initalize"); |
84 | - } |
85 | activate (); |
86 | exit_status = 0; |
87 | } |
88 | |
89 | === modified file 'src/cc-credentials-preferences.vala' |
90 | --- src/cc-credentials-preferences.vala 2012-08-22 13:12:49 +0000 |
91 | +++ src/cc-credentials-preferences.vala 2012-08-31 12:46:18 +0000 |
92 | @@ -23,14 +23,9 @@ |
93 | */ |
94 | public class Cc.Credentials.Preferences : Gtk.Notebook |
95 | { |
96 | - private AccountsPage accounts_page; |
97 | private AuthorizationPage authorization_page; |
98 | private Ag.Manager accounts_manager; |
99 | - private Cc.Notebook scroller; |
100 | - private Gtk.Spinner placeholder; |
101 | - private Gtk.Widget account_options_widget; |
102 | private LoginCapture login_capture; |
103 | - private int next_page_num; |
104 | |
105 | /* This must be a construct property so that is is called before the |
106 | * construct block. |
107 | @@ -95,6 +90,8 @@ |
108 | warning ("Error launching update-accounts tool: %s", e.message); |
109 | } |
110 | |
111 | + AccountsPage accounts_page; |
112 | + |
113 | if (account_details_id != 0) |
114 | { |
115 | accounts_page = new AccountsPage.with_account_details (account_details_id); |
116 | @@ -113,30 +110,14 @@ |
117 | accounts_page.account_options_request.connect (on_accounts_page_account_options_request); |
118 | accounts_page.account_edit_options_request.connect (on_accounts_page_account_edit_options_request); |
119 | |
120 | - /* The embedded scrolling clutter stage contains the accounts page and |
121 | - * a placeholder page. This scroller is in turn contained within a |
122 | - * notebook, with the real page to transition to as the second item in |
123 | - * said notebook. This is a little convoluted as it is not possible to |
124 | - * embed a non-native X11 window inside a GtkClutter.Embed, and the |
125 | - * GtkSocket used for the signon-ui output breaks this rule. |
126 | - */ |
127 | - scroller = new Cc.Notebook (); |
128 | - scroller.show (); |
129 | - this.append_page (scroller); |
130 | - |
131 | - scroller.add_page (accounts_page); |
132 | - |
133 | - placeholder = new Gtk.Spinner (); |
134 | - placeholder.start (); |
135 | - placeholder.show (); |
136 | - scroller.add_page (placeholder); |
137 | + this.append_page (accounts_page); |
138 | |
139 | authorization_page = new AuthorizationPage (); |
140 | authorization_page.cancelled.connect (on_authorization_page_cancelled); |
141 | |
142 | this.append_page (authorization_page); |
143 | |
144 | - scroller.select_page (accounts_page, false); |
145 | + set_current_page (PreferencesPage.ACCOUNTS); |
146 | |
147 | set_size_request (-1, 400); |
148 | |
149 | @@ -148,37 +129,6 @@ |
150 | } |
151 | |
152 | /** |
153 | - * Switch the notebook to the scroller, and scroll the stage to the |
154 | - * accounts page. |
155 | - */ |
156 | - private void switch_to_accounts_page () |
157 | - { |
158 | - this.set_current_page (PreferencesPage.ACCOUNTS); |
159 | - scroller.select_page (accounts_page, true); |
160 | - } |
161 | - |
162 | - /** |
163 | - * Scroll the stage to the placeholder, and switch the notebook to the |
164 | - * requested widget after a delay. |
165 | - */ |
166 | - private void switch_to_other_page (PreferencesPage page_num) |
167 | - { |
168 | - scroller.select_page (placeholder, true); |
169 | - next_page_num = page_num; |
170 | - // Scrolling transition should have finished. |
171 | - Timeout.add (400, switch_notebook_timeout); |
172 | - } |
173 | - |
174 | - /** |
175 | - * Timeout to switch the notebook page, see switch_to_other_page(). |
176 | - */ |
177 | - private bool switch_notebook_timeout () |
178 | - { |
179 | - this.set_current_page (next_page_num); |
180 | - return false; |
181 | - } |
182 | - |
183 | - /** |
184 | * Handle the new-account-request signal from LoginCapture, switching |
185 | * notebook page to the new account view. |
186 | * |
187 | @@ -196,7 +146,7 @@ |
188 | var account = accounts_manager.create_account (provider_name); |
189 | authorization_page.account = account; |
190 | authorization_page.set_login_data (username, password, cookies); |
191 | - switch_to_other_page (PreferencesPage.AUTHORIZATION); |
192 | + set_current_page (PreferencesPage.AUTHORIZATION); |
193 | } |
194 | |
195 | /** |
196 | @@ -210,7 +160,7 @@ |
197 | { |
198 | var account = accounts_manager.create_account (provider_name); |
199 | authorization_page.account = account; |
200 | - switch_to_other_page (PreferencesPage.AUTHORIZATION); |
201 | + set_current_page (PreferencesPage.AUTHORIZATION); |
202 | } |
203 | |
204 | /** |
205 | @@ -223,7 +173,7 @@ |
206 | private void on_accounts_page_reauthenticate_account_request (Ag.Account account) |
207 | { |
208 | authorization_page.reauthenticate_account (account); |
209 | - switch_to_other_page (PreferencesPage.AUTHORIZATION); |
210 | + set_current_page (PreferencesPage.AUTHORIZATION); |
211 | } |
212 | |
213 | /** |
214 | @@ -232,7 +182,7 @@ |
215 | */ |
216 | private void on_authorization_page_cancelled () |
217 | { |
218 | - switch_to_accounts_page (); |
219 | + set_current_page (PreferencesPage.ACCOUNTS); |
220 | } |
221 | |
222 | /** |
223 | @@ -246,12 +196,10 @@ |
224 | { |
225 | assert (application_row.plugin_widget != null); |
226 | |
227 | - var widget = application_row.plugin_widget; |
228 | - account_options_widget = widget; |
229 | - this.append_page (account_options_widget); |
230 | + this.append_page (application_row.plugin_widget); |
231 | application_row.plugin.finished.connect (on_account_application_options_finished); |
232 | |
233 | - switch_to_other_page (PreferencesPage.ACCOUNT_OPTIONS); |
234 | + set_current_page (PreferencesPage.ACCOUNT_OPTIONS); |
235 | } |
236 | |
237 | /** |
238 | @@ -269,8 +217,8 @@ |
239 | plugin_err.message); |
240 | } |
241 | |
242 | - switch_to_accounts_page (); |
243 | this.remove_page (PreferencesPage.ACCOUNT_OPTIONS); |
244 | + set_current_page (PreferencesPage.ACCOUNTS); |
245 | } |
246 | |
247 | /** |
248 | @@ -291,11 +239,10 @@ |
249 | } |
250 | |
251 | widget.show (); |
252 | - account_options_widget = widget; |
253 | - this.append_page (account_options_widget); |
254 | + this.append_page (widget); |
255 | plugin.finished.connect (on_account_edit_options_finished); |
256 | |
257 | - switch_to_other_page (PreferencesPage.ACCOUNT_OPTIONS); |
258 | + set_current_page (PreferencesPage.ACCOUNT_OPTIONS); |
259 | } |
260 | |
261 | /** |
262 | @@ -313,7 +260,7 @@ |
263 | plugin_err.message); |
264 | } |
265 | |
266 | - switch_to_accounts_page (); |
267 | this.remove_page (PreferencesPage.ACCOUNT_OPTIONS); |
268 | + set_current_page (PreferencesPage.ACCOUNTS); |
269 | } |
270 | } |
271 | |
272 | === removed file 'src/cc-notebook.c' |
273 | --- src/cc-notebook.c 2012-08-22 10:01:12 +0000 |
274 | +++ src/cc-notebook.c 1970-01-01 00:00:00 +0000 |
275 | @@ -1,566 +0,0 @@ |
276 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
277 | - * |
278 | - * Copyright © 2012 Red Hat, Inc. |
279 | - * |
280 | - * This library is free software; you can redistribute it and/or |
281 | - * modify it under the terms of the GNU Lesser General Public |
282 | - * License as published by the Free Software Foundation; either |
283 | - * version 2 of the License, or (at your option) any later version. |
284 | - * |
285 | - * This library is distributed in the hope that it will be useful, |
286 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
287 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
288 | - * Lesser General Public License for more details. |
289 | - * |
290 | - * You should have received a copy of the GNU Lesser General Public |
291 | - * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
292 | - * |
293 | - * Written by: |
294 | - * Bastien Nocera <hadess@hadess.net> |
295 | - * Emmanuele Bassi <ebassi@linux.intel.com> |
296 | - */ |
297 | - |
298 | -#include "config.h" |
299 | - |
300 | -#include <glib.h> |
301 | -#include <glib/gi18n.h> |
302 | -#include <gtk/gtk.h> |
303 | - |
304 | -#include "cc-notebook.h" |
305 | - |
306 | -#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TYPE_NOTEBOOK, CcNotebookPrivate)) |
307 | - |
308 | -/* |
309 | - * Structure: |
310 | - * |
311 | - * Notebook |
312 | - * +---- GtkClutterEmbed |
313 | - * +---- ClutterStage |
314 | - * +---- ClutterScrollActor:scroll |
315 | - * +---- ClutterActor:bin |
316 | - * +---- ClutterActor:frame<ClutterBinLayout> |
317 | - * +---- GtkClutterActor:embed<GtkWidget> |
318 | - * |
319 | - * the frame element is needed to make the GtkClutterActor contents fill the allocation |
320 | - */ |
321 | - |
322 | -struct _CcNotebookPrivate |
323 | -{ |
324 | - GtkWidget *embed; |
325 | - |
326 | - ClutterActor *stage; |
327 | - ClutterActor *scroll; |
328 | - ClutterActor *bin; |
329 | - |
330 | - int last_width; |
331 | - |
332 | - GtkWidget *selected_page; |
333 | - GList *pages; /* GList of GtkWidgets */ |
334 | - GList *removed_pages; /* GList of RemoveData, see setup_delayed_remove() */ |
335 | -}; |
336 | - |
337 | -enum |
338 | -{ |
339 | - PROP_0, |
340 | - PROP_CURRENT_PAGE, |
341 | - LAST_PROP |
342 | -}; |
343 | - |
344 | -static GParamSpec *obj_props[LAST_PROP] = { NULL, }; |
345 | - |
346 | -static void |
347 | -cc_notebook_buildable_add_child (GtkBuildable *buildable, |
348 | - GtkBuilder *builder, |
349 | - GObject *child, |
350 | - const gchar *type); |
351 | - |
352 | -static void |
353 | -cc_notebook_buildable_init (GtkBuildableIface *iface); |
354 | - |
355 | -G_DEFINE_TYPE_WITH_CODE (CcNotebook, cc_notebook, GTK_TYPE_BOX, |
356 | - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, |
357 | - cc_notebook_buildable_init)) |
358 | - |
359 | -static void |
360 | -cc_notebook_get_property (GObject *gobject, |
361 | - guint prop_id, |
362 | - GValue *value, |
363 | - GParamSpec *pspec) |
364 | -{ |
365 | - CcNotebookPrivate *priv = CC_NOTEBOOK (gobject)->priv; |
366 | - |
367 | - switch (prop_id) { |
368 | - case PROP_CURRENT_PAGE: |
369 | - g_value_set_pointer (value, priv->selected_page); |
370 | - break; |
371 | - |
372 | - default: |
373 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
374 | - } |
375 | -} |
376 | - |
377 | -static void |
378 | -cc_notebook_set_property (GObject *gobject, |
379 | - guint prop_id, |
380 | - const GValue *value, |
381 | - GParamSpec *pspec) |
382 | -{ |
383 | - CcNotebook *self = CC_NOTEBOOK (gobject); |
384 | - |
385 | - switch (prop_id) { |
386 | - case PROP_CURRENT_PAGE: |
387 | - cc_notebook_select_page (self, g_value_get_pointer (value), TRUE); |
388 | - break; |
389 | - |
390 | - default: |
391 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
392 | - } |
393 | -} |
394 | - |
395 | -static void |
396 | -cc_notebook_finalize (GObject *gobject) |
397 | -{ |
398 | - CcNotebook *self = CC_NOTEBOOK (gobject); |
399 | - |
400 | - g_list_free_full (self->priv->removed_pages, (GDestroyNotify) g_free); |
401 | - self->priv->removed_pages = NULL; |
402 | - |
403 | - g_list_free (self->priv->pages); |
404 | - self->priv->pages = NULL; |
405 | - |
406 | - G_OBJECT_CLASS (cc_notebook_parent_class)->finalize (gobject); |
407 | -} |
408 | - |
409 | -static GtkSizeRequestMode |
410 | -cc_notebook_get_request_mode (GtkWidget *widget) |
411 | -{ |
412 | - CcNotebook *notebook; |
413 | - GtkWidget *target; |
414 | - |
415 | - notebook = CC_NOTEBOOK (widget); |
416 | - |
417 | - target = notebook->priv->selected_page ? notebook->priv->selected_page : notebook->priv->embed; |
418 | - |
419 | - return gtk_widget_get_request_mode (target); |
420 | -} |
421 | - |
422 | -static void |
423 | -cc_notebook_get_preferred_height (GtkWidget *widget, |
424 | - gint *minimum_height, |
425 | - gint *natural_height) |
426 | -{ |
427 | - CcNotebook *notebook; |
428 | - GList *l; |
429 | - |
430 | - notebook = CC_NOTEBOOK (widget); |
431 | - |
432 | - if (notebook->priv->selected_page == NULL) { |
433 | - gtk_widget_get_preferred_height (notebook->priv->embed, minimum_height, natural_height); |
434 | - return; |
435 | - } |
436 | - |
437 | - *minimum_height = 0; |
438 | - *natural_height = 0; |
439 | - for (l = notebook->priv->pages; l != NULL; l = l->next) { |
440 | - GtkWidget *page = l->data; |
441 | - int page_min, page_nat; |
442 | - |
443 | - gtk_widget_get_preferred_height (page, &page_min, &page_nat); |
444 | - *minimum_height = MAX(page_min, *minimum_height); |
445 | - *natural_height = MAX(page_nat, *natural_height); |
446 | - } |
447 | -} |
448 | - |
449 | -static void |
450 | -cc_notebook_get_preferred_width_for_height (GtkWidget *widget, |
451 | - gint height, |
452 | - gint *minimum_width, |
453 | - gint *natural_width) |
454 | -{ |
455 | - CcNotebook *notebook; |
456 | - GList *l; |
457 | - |
458 | - notebook = CC_NOTEBOOK (widget); |
459 | - |
460 | - if (notebook->priv->selected_page == NULL) { |
461 | - gtk_widget_get_preferred_width_for_height (notebook->priv->embed, height, minimum_width, natural_width); |
462 | - return; |
463 | - } |
464 | - |
465 | - *minimum_width = 0; |
466 | - *natural_width = 0; |
467 | - for (l = notebook->priv->pages; l != NULL; l = l->next) { |
468 | - GtkWidget *page = l->data; |
469 | - int page_min, page_nat; |
470 | - |
471 | - gtk_widget_get_preferred_width_for_height (page, height, &page_min, &page_nat); |
472 | - *minimum_width = MAX(page_min, *minimum_width); |
473 | - *natural_width = MAX(page_nat, *natural_width); |
474 | - } |
475 | -} |
476 | - |
477 | -static void |
478 | -cc_notebook_get_preferred_width (GtkWidget *widget, |
479 | - gint *minimum_width, |
480 | - gint *natural_width) |
481 | -{ |
482 | - CcNotebook *notebook; |
483 | - GList *l; |
484 | - |
485 | - notebook = CC_NOTEBOOK (widget); |
486 | - |
487 | - if (notebook->priv->selected_page == NULL) { |
488 | - gtk_widget_get_preferred_width (notebook->priv->embed, minimum_width, natural_width); |
489 | - return; |
490 | - } |
491 | - |
492 | - *minimum_width = 0; |
493 | - *natural_width = 0; |
494 | - for (l = notebook->priv->pages; l != NULL; l = l->next) { |
495 | - GtkWidget *page = l->data; |
496 | - int page_min, page_nat; |
497 | - |
498 | - gtk_widget_get_preferred_width (page, &page_min, &page_nat); |
499 | - *minimum_width = MAX(page_min, *minimum_width); |
500 | - *natural_width = MAX(page_nat, *natural_width); |
501 | - } |
502 | -} |
503 | - |
504 | -static void |
505 | -cc_notebook_get_preferred_height_for_width (GtkWidget *widget, |
506 | - gint width, |
507 | - gint *minimum_height, |
508 | - gint *natural_height) |
509 | -{ |
510 | - CcNotebook *notebook; |
511 | - GList *l; |
512 | - |
513 | - notebook = CC_NOTEBOOK (widget); |
514 | - |
515 | - if (notebook->priv->selected_page == NULL) { |
516 | - gtk_widget_get_preferred_height_for_width (notebook->priv->embed, width, minimum_height, natural_height); |
517 | - return; |
518 | - } |
519 | - |
520 | - *minimum_height = 0; |
521 | - *natural_height = 0; |
522 | - for (l = notebook->priv->pages; l != NULL; l = l->next) { |
523 | - GtkWidget *page = l->data; |
524 | - int page_min, page_nat; |
525 | - |
526 | - gtk_widget_get_preferred_height_for_width (page, width, &page_min, &page_nat); |
527 | - *minimum_height = MAX(page_min, *minimum_height); |
528 | - *natural_height = MAX(page_nat, *natural_height); |
529 | - } |
530 | -} |
531 | - |
532 | -static gboolean |
533 | -cc_notebook_focus (GtkWidget *widget, |
534 | - GtkDirectionType direction) |
535 | -{ |
536 | - CcNotebook *notebook; |
537 | - GtkWidget *child; |
538 | - |
539 | - notebook = CC_NOTEBOOK (widget); |
540 | - child = notebook->priv->selected_page; |
541 | - |
542 | - if (child == NULL) |
543 | - return FALSE; |
544 | - |
545 | - /* HACK: the default GtkContainer implementation is fine by us |
546 | - * and there's no way to get to it without excessive copy/paste */ |
547 | - return GTK_WIDGET_GET_CLASS (child)->focus (child, direction); |
548 | -} |
549 | - |
550 | -static void |
551 | -cc_notebook_class_init (CcNotebookClass *klass) |
552 | -{ |
553 | - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
554 | - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); |
555 | - |
556 | - g_type_class_add_private (klass, sizeof (CcNotebookPrivate)); |
557 | - |
558 | - obj_props[PROP_CURRENT_PAGE] = |
559 | - g_param_spec_pointer (g_intern_static_string ("current-page"), |
560 | - "Current Page", |
561 | - "The currently selected page widget", |
562 | - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
563 | - |
564 | - gobject_class->get_property = cc_notebook_get_property; |
565 | - gobject_class->set_property = cc_notebook_set_property; |
566 | - gobject_class->finalize = cc_notebook_finalize; |
567 | - g_object_class_install_properties (gobject_class, LAST_PROP, obj_props); |
568 | - |
569 | - widget_class->get_request_mode = cc_notebook_get_request_mode; |
570 | - widget_class->get_preferred_height = cc_notebook_get_preferred_height; |
571 | - widget_class->get_preferred_width_for_height = cc_notebook_get_preferred_width_for_height; |
572 | - widget_class->get_preferred_width = cc_notebook_get_preferred_width; |
573 | - widget_class->get_preferred_height_for_width = cc_notebook_get_preferred_height_for_width; |
574 | - widget_class->focus = cc_notebook_focus; |
575 | -} |
576 | - |
577 | -static void |
578 | -on_embed_size_allocate (GtkWidget *embed, |
579 | - GtkAllocation *allocation, |
580 | - CcNotebook *self) |
581 | -{ |
582 | - ClutterActorIter iter; |
583 | - ClutterActor *child; |
584 | - ClutterActor *frame; |
585 | - float page_w, page_h; |
586 | - float offset = 0.f; |
587 | - ClutterPoint pos; |
588 | - |
589 | - if (self->priv->selected_page == NULL) |
590 | - return; |
591 | - |
592 | - self->priv->last_width = allocation->width; |
593 | - |
594 | - page_w = allocation->width; |
595 | - page_h = allocation->height; |
596 | - |
597 | - clutter_actor_iter_init (&iter, self->priv->bin); |
598 | - while (clutter_actor_iter_next (&iter, &child)) { |
599 | - clutter_actor_set_x (child, offset); |
600 | - clutter_actor_set_size (child, page_w, page_h); |
601 | - |
602 | - offset += page_w; |
603 | - } |
604 | - |
605 | - /* This stops the non-animated scrolling from happening |
606 | - * if we're still scrolling there */ |
607 | - if (clutter_actor_get_transition (self->priv->scroll, "scroll-to") != NULL) |
608 | - return; |
609 | - |
610 | - frame = g_object_get_data (G_OBJECT (self->priv->selected_page), |
611 | - "cc-notebook-frame"); |
612 | - |
613 | - pos.y = 0; |
614 | - pos.x = clutter_actor_get_x (frame); |
615 | - g_debug ("Scrolling to (%lf,%lf) in allocation", pos.x, pos.y); |
616 | - clutter_scroll_actor_scroll_to_point (CLUTTER_SCROLL_ACTOR (self->priv->scroll), &pos); |
617 | -} |
618 | - |
619 | -static void |
620 | -cc_notebook_init (CcNotebook *self) |
621 | -{ |
622 | - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_NOTEBOOK, CcNotebookPrivate); |
623 | - |
624 | - gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE); |
625 | - |
626 | - self->priv->embed = gtk_clutter_embed_new (); |
627 | - gtk_widget_push_composite_child (); |
628 | - gtk_container_add (GTK_CONTAINER (self), self->priv->embed); |
629 | - gtk_widget_pop_composite_child (); |
630 | - g_signal_connect (self->priv->embed, "size-allocate", G_CALLBACK (on_embed_size_allocate), self); |
631 | - gtk_widget_show (self->priv->embed); |
632 | - |
633 | - self->priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (self->priv->embed)); |
634 | - |
635 | - self->priv->scroll = clutter_scroll_actor_new (); |
636 | - clutter_scroll_actor_set_scroll_mode (CLUTTER_SCROLL_ACTOR (self->priv->scroll), |
637 | - CLUTTER_SCROLL_HORIZONTALLY); |
638 | - clutter_actor_add_constraint (self->priv->scroll, clutter_bind_constraint_new (self->priv->stage, CLUTTER_BIND_SIZE, 0.f)); |
639 | - clutter_actor_add_child (self->priv->stage, self->priv->scroll); |
640 | - |
641 | - self->priv->bin = clutter_actor_new (); |
642 | - clutter_actor_add_child (self->priv->scroll, self->priv->bin); |
643 | - |
644 | - self->priv->selected_page = NULL; |
645 | - gtk_widget_set_name (GTK_WIDGET (self), "GtkBox"); |
646 | -} |
647 | - |
648 | -GtkWidget * |
649 | -cc_notebook_new (void) |
650 | -{ |
651 | - return g_object_new (CC_TYPE_NOTEBOOK, NULL); |
652 | -} |
653 | - |
654 | -static void |
655 | -_cc_notebook_select_page (CcNotebook *self, |
656 | - GtkWidget *widget, |
657 | - int index, |
658 | - gboolean animate) |
659 | -{ |
660 | - ClutterPoint pos; |
661 | - |
662 | - g_return_if_fail (CC_IS_NOTEBOOK (self)); |
663 | - g_return_if_fail (GTK_IS_WIDGET (widget)); |
664 | - |
665 | - pos.y = 0; |
666 | - pos.x = self->priv->last_width * index; |
667 | - |
668 | - if (clutter_actor_get_transition (self->priv->scroll, "scroll-to") != NULL) { |
669 | - g_debug ("Cancelling previous scroll animation"); |
670 | - clutter_actor_remove_transition (self->priv->scroll, "scroll-to"); |
671 | - } |
672 | - |
673 | - clutter_actor_save_easing_state (self->priv->scroll); |
674 | - if (animate) |
675 | - clutter_actor_set_easing_duration (self->priv->scroll, 350); |
676 | - else |
677 | - clutter_actor_set_easing_duration (self->priv->scroll, 0); |
678 | - |
679 | - g_debug ("Scrolling to (%lf,%lf) %s animation in page selection", pos.x, pos.y, |
680 | - animate ? "with" : "without"); |
681 | - clutter_scroll_actor_scroll_to_point (CLUTTER_SCROLL_ACTOR (self->priv->scroll), &pos); |
682 | - |
683 | - clutter_actor_restore_easing_state (self->priv->scroll); |
684 | - |
685 | - /* Remember the last selected page */ |
686 | - self->priv->selected_page = widget; |
687 | - |
688 | - g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURRENT_PAGE]); |
689 | -} |
690 | - |
691 | -void |
692 | -cc_notebook_select_page (CcNotebook *self, |
693 | - GtkWidget *widget, |
694 | - gboolean animate) |
695 | -{ |
696 | - int i, n_children; |
697 | - GList *children, *l; |
698 | - ClutterActor *frame; |
699 | - gboolean found; |
700 | - |
701 | - if (widget == self->priv->selected_page) |
702 | - return; |
703 | - |
704 | - found = FALSE; |
705 | - frame = g_object_get_data (G_OBJECT (widget), "cc-notebook-frame"); |
706 | - |
707 | - n_children = clutter_actor_get_n_children (self->priv->bin); |
708 | - children = clutter_actor_get_children (self->priv->bin); |
709 | - for (i = 0, l = children; i < n_children; i++, l = l->next) { |
710 | - if (frame == l->data) { |
711 | - _cc_notebook_select_page (self, widget, i, animate); |
712 | - found = TRUE; |
713 | - break; |
714 | - } |
715 | - } |
716 | - g_list_free (children); |
717 | - if (found == FALSE) |
718 | - g_warning ("Could not find widget '%p' in CcNotebook '%p'", widget, self); |
719 | -} |
720 | - |
721 | -void |
722 | -cc_notebook_add_page (CcNotebook *self, |
723 | - GtkWidget *widget) |
724 | -{ |
725 | - ClutterActor *frame; |
726 | - ClutterActor *embed; |
727 | - int res; |
728 | - |
729 | - g_return_if_fail (CC_IS_NOTEBOOK (self)); |
730 | - g_return_if_fail (GTK_IS_WIDGET (widget)); |
731 | - |
732 | - frame = clutter_actor_new (); |
733 | - clutter_actor_set_layout_manager (frame, clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL, |
734 | - CLUTTER_BIN_ALIGNMENT_FILL)); |
735 | - |
736 | - embed = gtk_clutter_actor_new_with_contents (widget); |
737 | - g_object_set_data (G_OBJECT (widget), "cc-notebook-frame", frame); |
738 | - clutter_actor_add_child (frame, embed); |
739 | - gtk_widget_show (widget); |
740 | - |
741 | - res = clutter_actor_get_n_children (self->priv->bin); |
742 | - clutter_actor_insert_child_at_index (self->priv->bin, frame, res); |
743 | - |
744 | - self->priv->pages = g_list_prepend (self->priv->pages, widget); |
745 | - |
746 | - if (self->priv->selected_page == NULL) |
747 | - _cc_notebook_select_page (self, widget, res, FALSE); |
748 | - |
749 | - gtk_widget_queue_resize (GTK_WIDGET (self)); |
750 | -} |
751 | - |
752 | -typedef struct { |
753 | - CcNotebook *notebook; |
754 | - ClutterActor *frame; |
755 | -} RemoveData; |
756 | - |
757 | -static void |
758 | -remove_on_complete (ClutterTimeline *timeline, |
759 | - RemoveData *data) |
760 | -{ |
761 | - g_signal_handlers_disconnect_by_func (timeline, remove_on_complete, data); |
762 | - data->notebook->priv->removed_pages = g_list_remove (data->notebook->priv->removed_pages, data); |
763 | - clutter_actor_destroy (data->frame); |
764 | - g_free (data); |
765 | -} |
766 | - |
767 | -static gboolean |
768 | -setup_delayed_remove (CcNotebook *self, |
769 | - ClutterActor *frame) |
770 | -{ |
771 | - ClutterTransition *transition; |
772 | - RemoveData *data; |
773 | - |
774 | - transition = clutter_actor_get_transition (self->priv->scroll, "scroll-to"); |
775 | - if (transition == NULL) |
776 | - return FALSE; |
777 | - |
778 | - data = g_new0 (RemoveData, 1); |
779 | - data->notebook = self; |
780 | - data->frame = frame; |
781 | - |
782 | - self->priv->removed_pages = g_list_prepend (self->priv->removed_pages, data); |
783 | - g_signal_connect (transition, "completed", |
784 | - G_CALLBACK (remove_on_complete), data); |
785 | - |
786 | - return TRUE; |
787 | -} |
788 | - |
789 | -void |
790 | -cc_notebook_remove_page (CcNotebook *self, |
791 | - GtkWidget *widget) |
792 | -{ |
793 | - ClutterActorIter iter; |
794 | - ClutterActor *child, *frame; |
795 | - int index; |
796 | - |
797 | - g_return_if_fail (CC_IS_NOTEBOOK (self)); |
798 | - g_return_if_fail (GTK_IS_WIDGET (widget)); |
799 | - g_return_if_fail (widget != self->priv->selected_page); |
800 | - |
801 | - frame = g_object_get_data (G_OBJECT (widget), "cc-notebook-frame"); |
802 | - |
803 | - index = 0; |
804 | - clutter_actor_iter_init (&iter, self->priv->bin); |
805 | - while (clutter_actor_iter_next (&iter, &child)) { |
806 | - if (frame == child) { |
807 | - if (setup_delayed_remove (self, frame) == FALSE) |
808 | - clutter_actor_iter_remove (&iter); |
809 | - break; |
810 | - } |
811 | - |
812 | - index++; |
813 | - } |
814 | - |
815 | - self->priv->pages = g_list_remove (self->priv->pages, widget); |
816 | - gtk_widget_queue_resize (GTK_WIDGET (self)); |
817 | -} |
818 | - |
819 | -GtkWidget * |
820 | -cc_notebook_get_selected_page (CcNotebook *self) |
821 | -{ |
822 | - g_return_val_if_fail (CC_IS_NOTEBOOK (self), NULL); |
823 | - |
824 | - return self->priv->selected_page; |
825 | -} |
826 | - |
827 | -static void |
828 | -cc_notebook_buildable_add_child (GtkBuildable *buildable, |
829 | - GtkBuilder *builder, |
830 | - GObject *child, |
831 | - const gchar *type) |
832 | -{ |
833 | - CcNotebook *notebook = CC_NOTEBOOK (buildable); |
834 | - cc_notebook_add_page (notebook, GTK_WIDGET (child)); |
835 | -} |
836 | - |
837 | -static void |
838 | -cc_notebook_buildable_init (GtkBuildableIface *iface) |
839 | -{ |
840 | - iface->add_child = cc_notebook_buildable_add_child; |
841 | -} |
842 | |
843 | === removed file 'src/cc-notebook.deps' |
844 | --- src/cc-notebook.deps 2012-08-22 10:01:12 +0000 |
845 | +++ src/cc-notebook.deps 1970-01-01 00:00:00 +0000 |
846 | @@ -1,1 +0,0 @@ |
847 | -clutter-gtk-1.0 |
848 | |
849 | === removed file 'src/cc-notebook.h' |
850 | --- src/cc-notebook.h 2012-08-22 10:01:12 +0000 |
851 | +++ src/cc-notebook.h 1970-01-01 00:00:00 +0000 |
852 | @@ -1,70 +0,0 @@ |
853 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
854 | - * |
855 | - * Copyright © 2012 Red Hat, Inc. |
856 | - * |
857 | - * This library is free software; you can redistribute it and/or |
858 | - * modify it under the terms of the GNU Lesser General Public |
859 | - * License as published by the Free Software Foundation; either |
860 | - * version 2 of the License, or (at your option) any later version. |
861 | - * |
862 | - * This library is distributed in the hope that it will be useful, |
863 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
864 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
865 | - * Lesser General Public License for more details. |
866 | - * |
867 | - * You should have received a copy of the GNU Lesser General Public |
868 | - * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
869 | - * |
870 | - * Written by: |
871 | - * Bastien Nocera <hadess@hadess.net> |
872 | - */ |
873 | - |
874 | -#ifndef _CC_NOTEBOOK_H_ |
875 | -#define _CC_NOTEBOOK_H_ |
876 | - |
877 | -#include <gtk/gtk.h> |
878 | -#include <clutter-gtk/clutter-gtk.h> |
879 | - |
880 | -G_BEGIN_DECLS |
881 | - |
882 | -#define CC_TYPE_NOTEBOOK (cc_notebook_get_type ()) |
883 | -#define CC_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_NOTEBOOK, CcNotebook)) |
884 | -#define CC_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_NOTEBOOK)) |
885 | -#define CC_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_NOTEBOOK, CcNotebookClass)) |
886 | -#define CC_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_NOTEBOOK)) |
887 | -#define CC_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_NOTEBOOK, CcNotebookClass)) |
888 | - |
889 | -typedef struct _CcNotebook CcNotebook; |
890 | -typedef struct _CcNotebookPrivate CcNotebookPrivate; |
891 | -typedef struct _CcNotebookClass CcNotebookClass; |
892 | - |
893 | -struct _CcNotebook |
894 | -{ |
895 | - GtkBox parent_class; |
896 | - |
897 | - CcNotebookPrivate *priv; |
898 | -}; |
899 | - |
900 | -struct _CcNotebookClass |
901 | -{ |
902 | - GtkBoxClass parent_class; |
903 | -}; |
904 | - |
905 | -GType cc_notebook_get_type (void) G_GNUC_CONST; |
906 | - |
907 | -GtkWidget * cc_notebook_new (void); |
908 | - |
909 | -void cc_notebook_add_page (CcNotebook *self, |
910 | - GtkWidget *widget); |
911 | -void cc_notebook_remove_page (CcNotebook *self, |
912 | - GtkWidget *widget); |
913 | - |
914 | -void cc_notebook_select_page (CcNotebook *self, |
915 | - GtkWidget *widget, |
916 | - gboolean animate); |
917 | - |
918 | -GtkWidget * cc_notebook_get_selected_page (CcNotebook *self); |
919 | - |
920 | -G_END_DECLS |
921 | - |
922 | -#endif /* _CC_NOTEBOOK_H_ */ |
923 | |
924 | === removed file 'src/cc-notebook.vapi' |
925 | --- src/cc-notebook.vapi 2012-08-22 11:53:56 +0000 |
926 | +++ src/cc-notebook.vapi 1970-01-01 00:00:00 +0000 |
927 | @@ -1,13 +0,0 @@ |
928 | -[CCode (cprefix = "Cc", lower_case_cprefix = "cc_")] |
929 | -namespace Cc { |
930 | - [CCode (cheader_filename = "cc-notebook.h", type_id = "cc_notebook_get_type ()")] |
931 | - public class Notebook : Gtk.Box { |
932 | - public Notebook (); |
933 | - public void add_page (Gtk.Widget widget); |
934 | - public void remove_page (Gtk.Widget widget); |
935 | - public void select_page (Gtk.Widget widget, bool animate); |
936 | - public Gtk.Widget get_selected_page (); |
937 | - [NoAccessorMethod] |
938 | - public Gtk.Widget current_page { get; set; } |
939 | - } |
940 | -} |
FAILED: Continuous integration, rev:95 s-jenkins: 8080/job/ online- accounts- gnome-control- center- ci/34/ s-jenkins: 8080/job/ online- accounts- gnome-control- center- ci/./label= precise- clean-i386/ 34/console
http://
Executed test runs:
FAILURE: http://