[gnome-photos] embed, spinner-box: Overlay the spinner
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] embed, spinner-box: Overlay the spinner
- Date: Fri, 26 Sep 2014 16:06:19 +0000 (UTC)
commit b1f68f60673e9e4cc234878c6901b88addfe38f7
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Sep 26 14:05:47 2014 +0200
embed, spinner-box: Overlay the spinner
... instead of using a separate view with an opaque background.
Fixes: https://bugzilla.gnome.org/737425
src/photos-embed.c | 52 ++-------------------------------------------
src/photos-spinner-box.c | 19 ++++++++--------
src/photos-spinner-box.h | 6 ++--
3 files changed, 15 insertions(+), 62 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 62b1441..2a013be 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -266,7 +266,6 @@ photos_embed_load_show_timeout (gpointer user_data)
PhotosEmbedPrivate *priv = self->priv;
priv->load_show_id = 0;
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "spinner");
photos_spinner_box_start (PHOTOS_SPINNER_BOX (priv->spinner_box));
g_object_unref (self);
return G_SOURCE_REMOVE;
@@ -347,45 +346,6 @@ photos_embed_active_changed (PhotosBaseManager *manager, GObject *object, gpoint
static void
-photos_embed_restore_last_page (PhotosEmbed *self)
-{
- PhotosEmbedPrivate *priv = self->priv;
- PhotosWindowMode mode;
- const gchar *page;
-
- mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr);
- switch (mode)
- {
- case PHOTOS_WINDOW_MODE_COLLECTIONS:
- page = "collections";
- break;
-
- case PHOTOS_WINDOW_MODE_FAVORITES:
- page = "favorites";
- break;
-
- case PHOTOS_WINDOW_MODE_OVERVIEW:
- page = "overview";
- break;
-
- case PHOTOS_WINDOW_MODE_PREVIEW:
- page = "preview";
- break;
-
- case PHOTOS_WINDOW_MODE_SEARCH:
- page = "search";
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), page);
-}
-
-
-static void
photos_embed_fullscreen_changed (PhotosModeController *mode_cntrlr, gboolean fullscreen, gpointer user_data)
{
}
@@ -472,15 +432,9 @@ photos_embed_query_status_changed (PhotosEmbed *self, gboolean querying)
PhotosEmbedPrivate *priv = self->priv;
if (querying)
- {
- photos_spinner_box_start (PHOTOS_SPINNER_BOX (priv->spinner_box));
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "spinner");
- }
+ photos_spinner_box_start (PHOTOS_SPINNER_BOX (priv->spinner_box));
else
- {
- photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
- photos_embed_restore_last_page (self);
- }
+ photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
}
@@ -693,7 +647,7 @@ photos_embed_init (PhotosEmbed *self)
gtk_stack_add_named (GTK_STACK (priv->stack), priv->preview, "preview");
priv->spinner_box = photos_spinner_box_new ();
- gtk_stack_add_named (GTK_STACK (priv->stack), priv->spinner_box, "spinner");
+ gtk_overlay_add_overlay (GTK_OVERLAY (priv->stack_overlay), priv->spinner_box);
/* TODO: SearchBar.Dropdown, …
*/
diff --git a/src/photos-spinner-box.c b/src/photos-spinner-box.c
index 1497db6..31a5a76 100644
--- a/src/photos-spinner-box.c
+++ b/src/photos-spinner-box.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -37,7 +37,7 @@ struct _PhotosSpinnerBoxPrivate
};
-G_DEFINE_TYPE_WITH_PRIVATE (PhotosSpinnerBox, photos_spinner_box, GTK_TYPE_GRID);
+G_DEFINE_TYPE_WITH_PRIVATE (PhotosSpinnerBox, photos_spinner_box, GTK_TYPE_REVEALER);
static void
@@ -48,13 +48,6 @@ photos_spinner_box_constructed (GObject *object)
G_OBJECT_CLASS (photos_spinner_box_parent_class)->constructed (object);
- gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE);
- gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
- gtk_widget_set_vexpand (GTK_WIDGET (self), TRUE);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (self), 24);
-
priv->spinner = gtk_spinner_new ();
gtk_widget_set_size_request (priv->spinner, 128, 128);
gtk_widget_set_halign (priv->spinner, GTK_ALIGN_CENTER);
@@ -84,13 +77,18 @@ photos_spinner_box_class_init (PhotosSpinnerBoxClass *class)
GtkWidget *
photos_spinner_box_new (void)
{
- return g_object_new (PHOTOS_TYPE_SPINNER_BOX, NULL);
+ return g_object_new (PHOTOS_TYPE_SPINNER_BOX,
+ "halign", GTK_ALIGN_CENTER,
+ "transition-type", GTK_REVEALER_TRANSITION_TYPE_CROSSFADE,
+ "valign", GTK_ALIGN_CENTER,
+ NULL);
}
void
photos_spinner_box_start (PhotosSpinnerBox *self)
{
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE);
gtk_spinner_start (GTK_SPINNER (self->priv->spinner));
}
@@ -98,5 +96,6 @@ photos_spinner_box_start (PhotosSpinnerBox *self)
void
photos_spinner_box_stop (PhotosSpinnerBox *self)
{
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
}
diff --git a/src/photos-spinner-box.h b/src/photos-spinner-box.h
index 07b5760..481e437 100644
--- a/src/photos-spinner-box.h
+++ b/src/photos-spinner-box.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -57,13 +57,13 @@ typedef struct _PhotosSpinnerBoxPrivate PhotosSpinnerBoxPrivate;
struct _PhotosSpinnerBox
{
- GtkGrid parent_instance;
+ GtkRevealer parent_instance;
PhotosSpinnerBoxPrivate *priv;
};
struct _PhotosSpinnerBoxClass
{
- GtkGridClass parent_class;
+ GtkRevealerClass parent_class;
};
GType photos_spinner_box_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]