[gnome-photos/wip/rishi/imageview: 5/7] Use Image Container
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/imageview: 5/7] Use Image Container
- Date: Wed, 3 Feb 2016 13:40:55 +0000 (UTC)
commit bbefb64095909cb5221a4c41087606b832cacf3c
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Feb 2 10:37:29 2016 +0100
Use Image Container
src/photos-preview-view.c | 38 +++++++++-----------------------------
1 files changed, 9 insertions(+), 29 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index dd6e43a..d538ce9 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -30,6 +30,7 @@
#include <glib/gi18n.h>
#include "photos-base-item.h"
+#include "photos-image-container.h"
#include "photos-image-view.h"
#include "photos-item-manager.h"
#include "photos-edit-palette.h"
@@ -226,17 +227,11 @@ photos_preview_view_navigate_previous (PhotosPreviewView *self)
static GtkWidget *
photos_preview_view_create_view_with_container (PhotosPreviewView *self)
{
- GtkStyleContext *context;
- GtkWidget *sw;
GtkWidget *view;
+ GtkWidget *view_container;
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- context = gtk_widget_get_style_context (sw);
- gtk_style_context_add_class (context, "documents-scrolledwin");
-
- view = photos_image_view_new ();
- gtk_container_add (GTK_CONTAINER (sw), view);
+ view_container = photos_image_container_new ();
+ view = photos_image_container_get_view (PHOTOS_IMAGE_CONTAINER (view_container));
g_signal_connect_swapped (view, "button-press-event", G_CALLBACK (photos_preview_view_button_press_event),
self);
g_signal_connect_swapped (view,
"button-release-event",
@@ -247,21 +242,9 @@ photos_preview_view_create_view_with_container (PhotosPreviewView *self)
g_signal_connect_swapped (view, "draw-overlay", G_CALLBACK (photos_preview_view_draw_overlay), self);
/* It has to be visible to become the visible child of self->stack. */
- gtk_widget_show_all (sw);
-
- return sw;
-}
-
+ gtk_widget_show_all (view_container);
-static GtkWidget *
-photos_preview_view_get_view_from_view_container (GtkWidget *view_container)
-{
- GtkWidget *view;
- GtkWidget *viewport;
-
- viewport = gtk_bin_get_child (GTK_BIN (view_container));
- view = gtk_bin_get_child (GTK_BIN (viewport));
- return view;
+ return view_container;
}
@@ -282,7 +265,7 @@ photos_preview_view_process (GObject *source_object, GAsyncResult *res, gpointer
}
view_container = gtk_stack_get_visible_child (GTK_STACK (self->stack));
- view = photos_preview_view_get_view_from_view_container (view_container);
+ view = photos_image_container_get_view (PHOTOS_IMAGE_CONTAINER (view_container));
gtk_widget_queue_draw (view);
}
@@ -442,7 +425,7 @@ photos_preview_view_tool_changed (PhotosPreviewView *self, PhotosTool *tool)
}
view_container = gtk_stack_get_visible_child (GTK_STACK (self->stack));
- view = photos_preview_view_get_view_from_view_container (view_container);
+ view = photos_image_container_get_view (PHOTOS_IMAGE_CONTAINER (view_container));
if (tool != NULL)
{
@@ -712,10 +695,7 @@ photos_preview_view_set_node (PhotosPreviewView *self, GeglNode *node)
}
else
{
- GtkWidget *view;
-
self->node = g_object_ref (node);
- view = photos_preview_view_get_view_from_view_container (view_container);
- photos_image_view_set_node (PHOTOS_IMAGE_VIEW (view), self->node);
+ photos_image_container_set_node (PHOTOS_IMAGE_CONTAINER (view_container), self->node);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]