[gnome-photos/wip/baedert/gtkimageview: 1/2] image-view: Inherit from GtkImageView
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/baedert/gtkimageview: 1/2] image-view: Inherit from GtkImageView
- Date: Thu, 24 Mar 2016 18:38:22 +0000 (UTC)
commit bee4e592f4113c410f0dc174c3a49a9d5a9a7a17
Author: Timm Bäder <mail baedert org>
Date: Thu Mar 24 19:26:17 2016 +0100
image-view: Inherit from GtkImageView
src/photos-image-view.c | 12 ++++++++----
src/photos-preview-view.c | 11 ++---------
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/photos-image-view.c b/src/photos-image-view.c
index 59bdbd6..f7a1477 100644
--- a/src/photos-image-view.c
+++ b/src/photos-image-view.c
@@ -31,7 +31,7 @@
struct _PhotosImageView
{
- GtkDrawingArea parent_instance;
+ GtkImageView parent_instance;
GeglNode *node;
gfloat x;
gfloat x_scaled;
@@ -43,7 +43,7 @@ struct _PhotosImageView
struct _PhotosImageViewClass
{
- GtkDrawingAreaClass parent_class;
+ GtkImageViewClass parent_class;
/* signals */
void (*draw_background) (PhotosImageView *self, cairo_t *cr, GdkRectangle *rect);
@@ -69,7 +69,7 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (PhotosImageView, photos_image_view, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (PhotosImageView, photos_image_view, GTK_TYPE_IMAGE_VIEW);
static void
@@ -376,7 +376,11 @@ photos_image_view_class_init (PhotosImageViewClass *class)
GtkWidget *
photos_image_view_new (void)
{
- return g_object_new (PHOTOS_TYPE_IMAGE_VIEW, NULL);
+ return g_object_new (PHOTOS_TYPE_IMAGE_VIEW,
+ "fit-allocation", TRUE,
+ "zoomable", FALSE,
+ "rotatable", FALSE,
+ NULL);
}
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 1afc1a7..c2cfd96 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -259,10 +259,8 @@ 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));
+ view = gtk_bin_get_child (GTK_BIN (view_container));
return view;
}
@@ -378,12 +376,7 @@ photos_preview_view_denoise (PhotosPreviewView *self, GVariant *parameter)
static void
photos_preview_view_draw (PhotosPreviewView *self)
{
- GtkWidget *view;
- GtkWidget *view_container;
-
- view_container = gtk_stack_get_visible_child (GTK_STACK (self->stack));
- view = photos_preview_view_get_view_from_view_container (view_container);
- gtk_widget_queue_draw (view);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]