[gnome-photos/wip/abono/sidebar: 6/13] preview-view: Move nav buttons to the new overlay
- From: Alessandro Bono <abono src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/abono/sidebar: 6/13] preview-view: Move nav buttons to the new overlay
- Date: Fri, 11 Nov 2016 12:13:31 +0000 (UTC)
commit 0f0d95611b37da19b37a086d11325944c7fe5af0
Author: Alessandro Bono <abono gnome org>
Date: Thu Sep 15 23:47:43 2016 +0200
preview-view: Move nav buttons to the new overlay
https://bugzilla.gnome.org/show_bug.cgi?id=771704
src/photos-embed.c | 2 +-
src/photos-preview-view.c | 60 ++++++---------------------------------------
src/photos-preview-view.h | 2 +-
3 files changed, 10 insertions(+), 54 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 7fe4ca0..59b7c14 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -690,7 +690,7 @@ photos_embed_init (PhotosEmbed *self)
g_signal_connect_object (model, "row-inserted", G_CALLBACK (photos_embed_row_changed), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (model, "row-deleted", G_CALLBACK (photos_embed_row_changed), self,
G_CONNECT_SWAPPED);
- self->preview = photos_preview_view_new (GTK_OVERLAY (self->stack_overlay));
+ self->preview = photos_preview_view_new ();
gtk_stack_add_named (GTK_STACK (self->stack), self->preview, "preview");
self->spinner_box = photos_spinner_box_new ();
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index be01519..c8d4818 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -48,7 +48,6 @@ struct _PhotosPreviewView
GAction *draw;
GCancellable *cancellable;
GeglNode *node;
- GtkWidget *overlay;
GtkWidget *palette;
GtkWidget *revealer;
GtkWidget *stack;
@@ -63,12 +62,6 @@ struct _PhotosPreviewViewClass
GtkGridClass parent_class;
};
-enum
-{
- PROP_0,
- PROP_OVERLAY
-};
-
G_DEFINE_TYPE (PhotosPreviewView, photos_preview_view, GTK_TYPE_GRID);
@@ -646,39 +639,6 @@ photos_preview_view_finalize (GObject *object)
static void
-photos_preview_view_constructed (GObject *object)
-{
- PhotosPreviewView *self = PHOTOS_PREVIEW_VIEW (object);
-
- G_OBJECT_CLASS (photos_preview_view_parent_class)->constructed (object);
-
- self->nav_buttons = photos_preview_nav_buttons_new (self, GTK_OVERLAY (self->overlay));
- g_signal_connect_swapped (self->nav_buttons, "load-next", G_CALLBACK (photos_preview_view_navigate_next),
self);
- g_signal_connect_swapped (self->nav_buttons, "load-previous", G_CALLBACK
(photos_preview_view_navigate_previous), self);
-
- gtk_widget_show_all (GTK_WIDGET (self));
-}
-
-
-static void
-photos_preview_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- PhotosPreviewView *self = PHOTOS_PREVIEW_VIEW (object);
-
- switch (prop_id)
- {
- case PROP_OVERLAY:
- self->overlay = GTK_WIDGET (g_value_dup_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
photos_preview_view_init (PhotosPreviewView *self)
{
GAction *action;
@@ -707,6 +667,10 @@ photos_preview_view_init (PhotosPreviewView *self)
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (self), overlay);
+ self->nav_buttons = photos_preview_nav_buttons_new (self, GTK_OVERLAY (overlay));
+ g_signal_connect_swapped (self->nav_buttons, "load-next", G_CALLBACK (photos_preview_view_navigate_next),
self);
+ g_signal_connect_swapped (self->nav_buttons, "load-previous", G_CALLBACK
(photos_preview_view_navigate_previous), self);
+
self->stack = gtk_stack_new ();
gtk_widget_set_hexpand (self->stack, TRUE);
gtk_widget_set_vexpand (self->stack, TRUE);
@@ -763,6 +727,8 @@ photos_preview_view_init (PhotosPreviewView *self)
action = g_action_map_lookup_action (G_ACTION_MAP (app), "sharpen-current");
g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_sharpen), self,
G_CONNECT_SWAPPED);
+
+ gtk_widget_show_all (GTK_WIDGET (self));
}
@@ -771,25 +737,15 @@ photos_preview_view_class_init (PhotosPreviewViewClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->constructed = photos_preview_view_constructed;
object_class->dispose = photos_preview_view_dispose;
object_class->finalize = photos_preview_view_finalize;
- object_class->set_property = photos_preview_view_set_property;
-
- g_object_class_install_property (object_class,
- PROP_OVERLAY,
- g_param_spec_object ("overlay",
- "GtkOverlay object",
- "The stack overlay widget",
- GTK_TYPE_OVERLAY,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
}
GtkWidget *
-photos_preview_view_new (GtkOverlay *overlay)
+photos_preview_view_new (void)
{
- return g_object_new (PHOTOS_TYPE_PREVIEW_VIEW, "overlay", overlay, NULL);
+ return g_object_new (PHOTOS_TYPE_PREVIEW_VIEW, NULL);
}
diff --git a/src/photos-preview-view.h b/src/photos-preview-view.h
index 526f2c3..7066d20 100644
--- a/src/photos-preview-view.h
+++ b/src/photos-preview-view.h
@@ -45,7 +45,7 @@ typedef struct _PhotosPreviewViewClass PhotosPreviewViewClass;
GType photos_preview_view_get_type (void) G_GNUC_CONST;
-GtkWidget *photos_preview_view_new (GtkOverlay *overlay);
+GtkWidget *photos_preview_view_new (void);
void photos_preview_view_set_model (PhotosPreviewView *self,
GtkTreeModel *model,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]