[gnome-photos/wip/abono/sidebar: 622/635] preview-view: Move nav buttons to the new overlay



commit b7b981cd8500b710384629b6c215ff9801a72489
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 |   48 ++++++--------------------------------------
 src/photos-preview-view.h |    2 +-
 3 files changed, 9 insertions(+), 43 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 216ffb9..5923da9 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -739,7 +739,7 @@ photos_embed_init (PhotosEmbed *self)
   self->search = photos_view_container_new (PHOTOS_WINDOW_MODE_SEARCH, _("Search"));
   gtk_stack_add_named (GTK_STACK (self->stack), self->search, "search");
 
-  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");
 
   /* TODO: SearchBar.Dropdown, …
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 20e1ba1..8be45a3 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -55,7 +55,6 @@ struct _PhotosPreviewView
   GAction *zoom_out_action;
   GCancellable *cancellable;
   GeglNode *node;
-  GtkWidget *overlay;
   GtkWidget *palette;
   GtkWidget *revealer;
   GtkWidget *stack;
@@ -71,12 +70,6 @@ struct _PhotosPreviewView
   gdouble zoom_best_fit;
 };
 
-enum
-{
-  PROP_0,
-  PROP_OVERLAY
-};
-
 
 G_DEFINE_TYPE (PhotosPreviewView, photos_preview_view, GTK_TYPE_BIN);
 
@@ -1217,10 +1210,6 @@ photos_preview_view_constructed (GObject *object)
                             G_CALLBACK (photos_preview_view_gesture_zoom_scale_changed),
                             self);
 
-  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));
 
   g_object_unref (gesture_zoom);
@@ -1228,24 +1217,6 @@ photos_preview_view_constructed (GObject *object)
 
 
 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;
@@ -1278,6 +1249,10 @@ photos_preview_view_init (PhotosPreviewView *self)
   overlay = gtk_overlay_new ();
   gtk_container_add (GTK_CONTAINER (grid), 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);
@@ -1378,6 +1353,7 @@ photos_preview_view_init (PhotosPreviewView *self)
 
   self->event_x_last = -1.0;
   self->event_y_last = -1.0;
+  gtk_widget_show_all (GTK_WIDGET (self));
 }
 
 
@@ -1386,25 +1362,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 3f217b2..e5887c0 100644
--- a/src/photos-preview-view.h
+++ b/src/photos-preview-view.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 #define PHOTOS_TYPE_PREVIEW_VIEW (photos_preview_view_get_type ())
 G_DECLARE_FINAL_TYPE (PhotosPreviewView, photos_preview_view, PHOTOS, PREVIEW_VIEW, GtkBin);
 
-GtkWidget             *photos_preview_view_new                    (GtkOverlay *overlay);
+GtkWidget             *photos_preview_view_new                    (void);
 
 void                   photos_preview_view_set_mode               (PhotosPreviewView *self,
                                                                    PhotosWindowMode old_mode);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]