[gnome-photos] Don't use Clutter and ClutterGTK
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] Don't use Clutter and ClutterGTK
- Date: Sat, 23 Mar 2013 17:28:34 +0000 (UTC)
commit f18369841e0ac49b674e02c87f3c0e49e8ca56c6
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Mar 14 18:35:20 2013 +0100
Don't use Clutter and ClutterGTK
Take this opportunity to use GEGL for image handling. I am not 100%
sure about this, so this is still a bit of an experiment.
Original patch from Cosimo Cecchi for gnome-documents.
configure.ac | 6 +-
src/Makefile.am | 10 +-
src/photos-application.c | 10 +-
src/photos-base-item.c | 55 ++++--
src/photos-base-item.h | 6 +-
src/photos-embed-widget.c | 81 ---------
src/photos-embed-widget.h | 75 --------
src/photos-embed.c | 345 ++++++++++++-----------------------
src/photos-embed.h | 8 +-
src/photos-empty-results-box.c | 36 ++---
src/photos-empty-results-box.h | 10 +-
src/photos-error-box.c | 74 ++-------
src/photos-error-box.h | 14 +-
src/photos-indexing-notification.c | 4 +-
src/photos-main-toolbar.c | 73 +++-----
src/photos-main-toolbar.h | 12 +-
src/photos-notification-manager.c | 56 ++----
src/photos-notification-manager.h | 10 +-
src/photos-selection-toolbar.c | 132 +++-----------
src/photos-selection-toolbar.h | 11 +-
src/photos-spinner-box.c | 84 +++-------
src/photos-spinner-box.h | 14 +-
src/photos-utils.c | 8 -
src/photos-utils.h | 2 -
24 files changed, 329 insertions(+), 807 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d00c8d9..4dec73a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,8 +24,6 @@ AC_SUBST(LIBM)
GLIB_GSETTINGS
-CLUTTER_GTK_MIN_VERSION=1.3.2
-CLUTTER_MIN_VERSION=1.11
EXEMPI_MIN_VERSION=1.99.5
GLIB_MIN_VERSION=2.35.1
LIBEXIF_MIN_VERSION=0.6.14
@@ -76,9 +74,9 @@ if test x$have_zlib = xno; then
fi
PKG_CHECK_MODULES(CAIRO, [cairo])
-PKG_CHECK_MODULES(CLUTTER, [clutter-1.0 >= $CLUTTER_MIN_VERSION])
-PKG_CHECK_MODULES(CLUTTER_GTK, [clutter-gtk-1.0 >= $CLUTTER_GTK_MIN_VERSION])
PKG_CHECK_MODULES(EXEMPI, [exempi-2.0 >= $EXEMPI_MIN_VERSION])
+PKG_CHECK_MODULES(GEGL, [gegl-0.2])
+PKG_CHECK_MODULES(GEGL_GTK, [gegl-gtk3-0.1])
PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= $GLIB_MIN_VERSION])
PKG_CHECK_MODULES(GIO, [gio-2.0])
diff --git a/src/Makefile.am b/src/Makefile.am
index f906ed7..9a76554 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,8 +60,6 @@ gnome_photos_SOURCES = \
photos-collection-manager.h \
photos-embed.c \
photos-embed.h \
- photos-embed-widget.c \
- photos-embed-widget.h \
photos-empty-results-box.c \
photos-empty-results-box.h \
photos-error-box.c \
@@ -159,10 +157,10 @@ AM_CPPFLAGS = \
-DPACKAGE_ICONS_DIR=\""${pkgdatadir}/icons"\" \
-DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
$(CAIRO_CFLAGS) \
- $(CLUTTER_CFLAGS) \
- $(CLUTTER_GTK_CFLAGS) \
$(EXEMPI_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GEGL_GTK_CFLAGS) \
$(GIO_CFLAGS) \
$(GLIB_CFLAGS) \
$(GNOME_DESKTOP_CFLAGS) \
@@ -180,10 +178,10 @@ gnome_photos_LDFLAGS =
gnome_photos_LDADD = \
$(CAIRO_LIBS) \
- $(CLUTTER_LIBS) \
- $(CLUTTER_GTK_LIBS) \
$(EXEMPI_LIBS) \
$(GDK_PIXBUF_LIBS) \
+ $(GEGL_CFLAGS) \
+ $(GEGL_GTK_LIBS) \
$(GIO_LIBS) \
$(GLIB_LIBS) \
$(GNOME_DESKTOP_LIBS) \
diff --git a/src/photos-application.c b/src/photos-application.c
index 84a26da..9e01c36 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#include "config.h"
-#include <clutter-gtk/clutter-gtk.h>
+#include <gegl.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -104,11 +104,7 @@ photos_application_startup (GApplication *application)
G_APPLICATION_CLASS (photos_application_parent_class)
->startup (application);
- if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
- {
- g_warning ("Unable to initialize Clutter");
- return;
- }
+ gegl_init (NULL, NULL);
priv->resource = photos_get_resource ();
g_resources_register (priv->resource);
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index ee0bfe7..bc792bd 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -41,6 +41,9 @@ struct _PhotosBaseItemPrivate
{
GdkPixbuf *icon;
GdkPixbuf *pristine_icon;
+ GeglNode *graph;
+ GeglNode *node;
+ GMutex mutex;
TrackerSparqlCursor *cursor;
gboolean collection;
gboolean failed_thumbnailing;
@@ -192,25 +195,35 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
}
-static GdkPixbuf *
+static GeglNode *
photos_base_item_default_load (PhotosBaseItem *self, GCancellable *cancellable, GError **error)
{
PhotosBaseItemPrivate *priv = self->priv;
- GdkPixbuf *pixbuf = NULL;
+ GeglNode *ret_val = NULL;
GFile *file = NULL;
- GFileInputStream *stream = NULL;
+ gchar *path = NULL;
- file = g_file_new_for_uri (priv->uri);
- stream = g_file_read (file, cancellable, error);
- if (stream == NULL)
- goto out;
+ if (priv->graph == NULL)
+ {
+ file = g_file_new_for_uri (priv->uri);
+ path = g_file_get_path (file);
+ if (path == NULL)
+ goto out;
+
+ priv->graph = gegl_node_new ();
+ priv->node = gegl_node_new_child (priv->graph,
+ "operation", "gegl:load",
+ "path", path,
+ NULL);
+ }
- pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (stream), cancellable, error);
+ gegl_node_process (priv->node);
+ ret_val = g_object_ref (priv->node);
out:
- g_clear_object (&stream);
+ g_free (path);
g_clear_object (&file);
- return pixbuf;
+ return ret_val;
}
@@ -406,14 +419,19 @@ static void
photos_base_item_load_in_thread_func (GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
{
PhotosBaseItem *self = PHOTOS_BASE_ITEM (object);
- GdkPixbuf *pixbuf;
+ PhotosBaseItemPrivate *priv = self->priv;
+ GeglNode *node;
GError *error = NULL;
- pixbuf = PHOTOS_BASE_ITEM_GET_CLASS (self)->load (self, cancellable, &error);
+ g_mutex_lock (&priv->mutex);
+
+ node = PHOTOS_BASE_ITEM_GET_CLASS (self)->load (self, cancellable, &error);
if (error != NULL)
g_simple_async_result_take_error (simple, error);
- g_simple_async_result_set_op_res_gpointer (simple, (gpointer) pixbuf, g_object_unref);
+ g_simple_async_result_set_op_res_gpointer (simple, (gpointer) node, g_object_unref);
+
+ g_mutex_unlock (&priv->mutex);
}
@@ -572,6 +590,7 @@ photos_base_item_dispose (GObject *object)
PhotosBaseItem *self = PHOTOS_BASE_ITEM (object);
PhotosBaseItemPrivate *priv = self->priv;
+ g_clear_object (&priv->graph);
g_clear_object (&priv->icon);
g_clear_object (&priv->pristine_icon);
g_clear_object (&priv->cursor);
@@ -597,6 +616,8 @@ photos_base_item_finalize (GObject *object)
g_free (priv->type_description);
g_free (priv->uri);
+ g_mutex_clear (&priv->mutex);
+
G_OBJECT_CLASS (photos_base_item_parent_class)->finalize (object);
}
@@ -653,6 +674,8 @@ photos_base_item_init (PhotosBaseItem *self)
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_BASE_ITEM, PhotosBaseItemPrivate);
priv = self->priv;
+
+ g_mutex_init (&priv->mutex);
}
@@ -854,11 +877,11 @@ photos_base_item_load_async (PhotosBaseItem *self,
}
-GdkPixbuf *
+GeglNode *
photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
- GdkPixbuf *ret_val = NULL;
+ GeglNode *ret_val = NULL;
g_return_val_if_fail (g_simple_async_result_is_valid (res, G_OBJECT (self), photos_base_item_load_async),
NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -866,7 +889,7 @@ photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError **
if (g_simple_async_result_propagate_error (simple, error))
goto out;
- ret_val = GDK_PIXBUF (g_simple_async_result_get_op_res_gpointer (simple));
+ ret_val = GEGL_NODE (g_simple_async_result_get_op_res_gpointer (simple));
g_object_ref (ret_val);
out:
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 51484f2..ad2a3b3 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -25,7 +25,7 @@
#ifndef PHOTOS_BASE_ITEM_H
#define PHOTOS_BASE_ITEM_H
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -68,7 +68,7 @@ struct _PhotosBaseItemClass
{
GObjectClass parent_class;
- GdkPixbuf *(*load) (PhotosBaseItem *self, GCancellable *cancellable, GError **error);
+ GeglNode *(*load) (PhotosBaseItem *self, GCancellable *cancellable, GError **error);
void (*set_favorite) (PhotosBaseItem *self, gboolean favorite);
void (*update_type_description) (PhotosBaseItem *self);
@@ -113,7 +113,7 @@ void photos_base_item_load_async (PhotosBaseItem *self,
GAsyncReadyCallback callback,
gpointer user_data);
-GdkPixbuf *photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError
**error);
+GeglNode *photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError
**error);
void photos_base_item_open (PhotosBaseItem *self,
GdkScreen *screen,
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 301f05b..ffc0b9d 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,9 +25,9 @@
#include "config.h"
-#include <clutter/clutter.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtk.h>
+#include <gegl.h>
+#include <gegl-gtk.h>
#include "photos-embed.h"
#include "photos-empty-results-box.h"
@@ -47,72 +47,35 @@
struct _PhotosEmbedPrivate
{
- ClutterActor *background;
- ClutterActor *contents_actor;
- ClutterActor *error_box;
- ClutterActor *favorites_actor;
- ClutterActor *image_actor;
- ClutterActor *image_container;
- ClutterActor *no_results;
- ClutterActor *ntfctn_mngr;
- ClutterActor *overview_actor;
- ClutterActor *spinner_box;
- ClutterActor *view_actor;
- ClutterLayoutManager *contents_layout;
- ClutterLayoutManager *view_layout;
GCancellable *loader_cancellable;
+ GtkWidget *error_box;
GtkWidget *favorites;
GtkWidget *indexing_ntfctn;
+ GtkWidget *no_results;
+ GtkWidget *notebook;
+ GtkWidget *notebook_overlay;
+ GtkWidget *ntfctn_mngr;
GtkWidget *overview;
+ GtkWidget *preview;
+ GtkWidget *selection_toolbar;
+ GtkWidget *spinner_box;
+ GtkWidget *toolbar;
PhotosBaseManager *item_mngr;
- PhotosMainToolbar *toolbar;
- PhotosSelectionToolbar *selection_toolbar;
PhotosModeController *mode_cntrlr;
PhotosOffsetController *offset_cntrlr;
PhotosTrackerChangeMonitor *monitor;
PhotosTrackerController *trk_ovrvw_cntrlr;
+ gint error_page;
+ gint favorites_page;
+ gint no_results_page;
gint preview_page;
- gint view_page;
+ gint overview_page;
+ gint spinner_page;
gulong no_results_change_id;
};
-G_DEFINE_TYPE (PhotosEmbed, photos_embed, PHOTOS_TYPE_EMBED_WIDGET);
-
-
-static void
-photos_embed_scale_image (PhotosEmbed *self)
-{
- PhotosEmbedPrivate *priv = self->priv;
- ClutterContent *content;
- gfloat height_a;
- gfloat height_c;
- gfloat width_a;
- gfloat width_c;
-
- content = clutter_actor_get_content (priv->image_actor);
- if (content == NULL)
- return;
-
- if (!clutter_content_get_preferred_size (content, &width_c, &height_c))
- return;
-
- clutter_actor_get_size (priv->image_container, &width_a, &height_a);
- if (width_c < width_a && height_c < height_a)
- {
- clutter_actor_set_content_gravity (priv->image_actor, CLUTTER_CONTENT_GRAVITY_CENTER);
- clutter_actor_set_size (priv->image_actor, width_c, height_c);
- clutter_actor_set_x_expand (priv->image_actor, FALSE);
- clutter_actor_set_y_expand (priv->image_actor, FALSE);
- }
- else
- {
- clutter_actor_set_content_gravity (priv->image_actor, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
- clutter_actor_set_size (priv->image_actor, -1.0, -1.0);
- clutter_actor_set_x_expand (priv->image_actor, TRUE);
- clutter_actor_set_y_expand (priv->image_actor, TRUE);
- }
-}
+G_DEFINE_TYPE (PhotosEmbed, photos_embed, GTK_TYPE_BOX);
static void
@@ -120,41 +83,19 @@ photos_embed_item_load (GObject *source_object, GAsyncResult *res, gpointer user
{
PhotosEmbed *self = PHOTOS_EMBED (user_data);
PhotosEmbedPrivate *priv = self->priv;
- ClutterContent *image;
- CoglPixelFormat pixel_format;
- GdkPixbuf *pixbuf;
+ GeglNode *node;
PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object);
- gboolean has_alpha;
- gint height;
- gint row_stride;
- gint width;
- guchar *pixels;
g_clear_object (&priv->loader_cancellable);
- pixbuf = photos_base_item_load_finish (item, res, NULL);
- if (pixbuf == NULL)
+ node = photos_base_item_load_finish (item, res, NULL);
+ if (node == NULL)
return;
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
- pixel_format = (has_alpha) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- row_stride = gdk_pixbuf_get_rowstride (pixbuf);
-
- image = clutter_image_new ();
- clutter_image_set_data (CLUTTER_IMAGE (image), pixels, pixel_format, width, height, row_stride, NULL);
- g_object_unref (pixbuf);
-
- clutter_actor_set_content (priv->image_actor, image);
- g_object_unref (image);
-
- photos_embed_scale_image (self);
+ gegl_gtk_view_set_node (GEGL_GTK_VIEW (priv->preview), node);
/* TODO: set toolbar model */
- photos_spinner_box_move_out (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_PREVIEW);
photos_mode_controller_set_can_fullscreen (priv->mode_cntrlr, TRUE);
}
@@ -170,8 +111,8 @@ photos_embed_active_changed (PhotosBaseManager *manager, GObject *object, gpoint
/* TODO: CollectionManager */
- photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_PREVIEW);
- photos_spinner_box_move_in_delayed (PHOTOS_SPINNER_BOX (priv->spinner_box), 400);
+ photos_spinner_box_start_delayed (PHOTOS_SPINNER_BOX (priv->spinner_box), 400);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->spinner_page);
priv->loader_cancellable = g_cancellable_new ();
photos_base_item_load_async (PHOTOS_BASE_ITEM (object),
@@ -182,6 +123,37 @@ photos_embed_active_changed (PhotosBaseManager *manager, GObject *object, gpoint
static void
+photos_embed_restore_last_page (PhotosEmbed *self)
+{
+ PhotosEmbedPrivate *priv = self->priv;
+ PhotosWindowMode mode;
+ gint page;
+
+ mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr);
+ switch (mode)
+ {
+ case PHOTOS_WINDOW_MODE_FAVORITES:
+ page = priv->overview_page;
+ break;
+
+ case PHOTOS_WINDOW_MODE_OVERVIEW:
+ page = priv->favorites_page;
+ break;
+
+ case PHOTOS_WINDOW_MODE_PREVIEW:
+ page = priv->preview_page;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page);
+}
+
+
+static void
photos_embed_hide_no_results_page (PhotosEmbed *self)
{
PhotosEmbedPrivate *priv = self->priv;
@@ -192,8 +164,7 @@ photos_embed_hide_no_results_page (PhotosEmbed *self)
priv->no_results_change_id = 0;
}
- clutter_actor_set_child_below_sibling (priv->view_actor, priv->no_results, NULL);
- clutter_actor_hide (priv->no_results);
+ photos_embed_restore_last_page (self);
}
@@ -215,8 +186,7 @@ photos_embed_count_changed (PhotosEmbed *self, gint count)
"changes-pending",
G_CALLBACK (photos_embed_changes_pending),
self);
- clutter_actor_show (priv->no_results);
- clutter_actor_set_child_above_sibling (priv->view_actor, priv->no_results, NULL);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->no_results_page);
}
else
photos_embed_hide_no_results_page (self);
@@ -242,11 +212,8 @@ photos_embed_prepare_for_favorites (PhotosEmbed *self)
g_clear_object (&priv->loader_cancellable);
}
- photos_spinner_box_move_out (PHOTOS_SPINNER_BOX (priv->spinner_box));
- photos_error_box_move_out (PHOTOS_ERROR_BOX (priv->error_box));
-
- clutter_actor_show (priv->favorites_actor);
- clutter_actor_set_child_below_sibling (priv->view_actor, priv->favorites_actor, priv->ntfctn_mngr);
+ photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->favorites_page);
}
@@ -263,11 +230,8 @@ photos_embed_prepare_for_overview (PhotosEmbed *self)
g_clear_object (&priv->loader_cancellable);
}
- photos_spinner_box_move_out (PHOTOS_SPINNER_BOX (priv->spinner_box));
- photos_error_box_move_out (PHOTOS_ERROR_BOX (priv->error_box));
-
- clutter_actor_show (priv->overview_actor);
- clutter_actor_set_child_below_sibling (priv->view_actor, priv->overview_actor, priv->ntfctn_mngr);
+ photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->overview_page);
}
@@ -280,8 +244,24 @@ photos_embed_prepare_for_preview (PhotosEmbed *self)
* ErrorHandler
*/
- clutter_actor_show (priv->image_container);
- clutter_actor_set_child_below_sibling (priv->view_actor, priv->image_container, priv->ntfctn_mngr);
+ photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->preview_page);
+}
+
+
+static void
+photos_embed_preview_draw_background (PhotosEmbed *self, cairo_t *cr, GdkRectangle *rect)
+{
+ PhotosEmbedPrivate *priv = self->priv;
+ GtkStyleContext *context;
+ GtkStateFlags flags;
+
+ context = gtk_widget_get_style_context (priv->preview);
+ flags = gtk_widget_get_state_flags (priv->preview);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, flags);
+ gtk_render_background (context, cr, 0, 0, rect->width, rect->height);
+ gtk_style_context_restore (context);
}
@@ -291,7 +271,7 @@ photos_embed_set_error (PhotosEmbed *self, const gchar *primary, const gchar *se
PhotosEmbedPrivate *priv = self->priv;
photos_error_box_update (PHOTOS_ERROR_BOX (priv->error_box), primary, secondary);
- photos_error_box_move_in (PHOTOS_ERROR_BOX (priv->error_box));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->error_page);
}
@@ -310,11 +290,14 @@ photos_embed_query_status_changed (PhotosTrackerController *trk_cntrlr, gboolean
if (querying)
{
- photos_error_box_move_out (PHOTOS_ERROR_BOX (priv->error_box));
- photos_spinner_box_move_in (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ photos_spinner_box_start (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), priv->spinner_page);
}
else
- photos_spinner_box_move_out (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ {
+ photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
+ photos_embed_restore_last_page (self);
+ }
}
static void
@@ -326,10 +309,6 @@ photos_embed_window_mode_changed (PhotosModeController *mode_cntrlr,
PhotosEmbed *self = PHOTOS_EMBED (user_data);
PhotosEmbedPrivate *priv = self->priv;
- clutter_actor_hide (priv->favorites_actor);
- clutter_actor_hide (priv->image_container);
- clutter_actor_hide (priv->overview_actor);
-
if (mode == PHOTOS_WINDOW_MODE_FAVORITES)
photos_embed_prepare_for_favorites (self);
else if (mode == PHOTOS_WINDOW_MODE_OVERVIEW)
@@ -363,158 +342,70 @@ photos_embed_dispose (GObject *object)
G_OBJECT_CLASS (photos_embed_parent_class)->dispose (object);
}
-static gboolean
-on_image_background_draw (ClutterCanvas *canvas,
- cairo_t *cr,
- gint width,
- gint height,
- gpointer user_data)
-{
- PhotosEmbed *self = PHOTOS_EMBED (user_data);
- GtkStyleContext *context;
- GtkStateFlags flags;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
- flags = gtk_widget_get_state_flags (GTK_WIDGET (self));
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, flags);
- gtk_render_background (context, cr, 0, 0, width, height);
- gtk_style_context_restore (context);
-
- return TRUE;
-}
-
-static void
-photos_embed_image_container_allocation_changed (ClutterActor *actor,
- const ClutterActorBox *allocation,
- ClutterAllocationFlags flags,
- gpointer user_data)
-{
- PhotosEmbed *self = PHOTOS_EMBED (user_data);
- ClutterContent *content;
-
- content = clutter_actor_get_content (actor);
- clutter_canvas_set_size (CLUTTER_CANVAS (content),
- allocation->x2 - allocation->x1,
- allocation->y2 - allocation->y1);
-
- photos_embed_scale_image (self);
-}
-
-
static void
photos_embed_init (PhotosEmbed *self)
{
PhotosEmbedPrivate *priv;
- ClutterActor *actor;
- ClutterActor *stage;
- ClutterActor *toolbar_actor;
- ClutterLayoutManager *image_layout;
- ClutterLayoutManager *overlay_layout;
- ClutterConstraint *constraint;
- ClutterContent *image_background;
gboolean querying;
GtkStyleContext *context;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_EMBED, PhotosEmbedPrivate);
priv = self->priv;
- gtk_clutter_embed_set_use_layout_size (GTK_CLUTTER_EMBED (self), TRUE);
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_add_class (context, "content-view");
-
- overlay_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
- actor = clutter_actor_new ();
- clutter_actor_set_layout_manager (actor, overlay_layout);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
+ gtk_widget_show (GTK_WIDGET (self));
- stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (self));
- constraint = clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0);
- clutter_actor_add_constraint (actor, constraint);
- clutter_actor_add_child (stage, actor);
+ priv->notebook_overlay = gtk_overlay_new ();
+ gtk_widget_show (priv->notebook_overlay);
+ gtk_box_pack_end (GTK_BOX (self), priv->notebook_overlay, TRUE, TRUE, 0);
- priv->contents_layout = clutter_box_layout_new ();
- clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (priv->contents_layout),
CLUTTER_ORIENTATION_VERTICAL);
- priv->contents_actor = clutter_actor_new ();
- clutter_actor_set_layout_manager (priv->contents_actor, priv->contents_layout);
- clutter_actor_set_x_expand (priv->contents_actor, TRUE);
- clutter_actor_set_y_expand (priv->contents_actor, TRUE);
- clutter_actor_add_child (actor, priv->contents_actor);
+ priv->notebook = gtk_notebook_new ();
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
+ gtk_widget_show (priv->notebook);
+ gtk_container_add (GTK_CONTAINER (priv->notebook_overlay), priv->notebook);
priv->toolbar = photos_main_toolbar_new ();
- toolbar_actor = photos_main_toolbar_get_actor (priv->toolbar);
- clutter_actor_set_x_expand (toolbar_actor, TRUE);
- clutter_actor_add_child (priv->contents_actor, toolbar_actor);
-
- priv->view_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
- priv->view_actor = clutter_actor_new ();
- clutter_actor_set_layout_manager (priv->view_actor, priv->view_layout);
- clutter_actor_set_x_expand (priv->view_actor, TRUE);
- clutter_actor_set_y_expand (priv->view_actor, TRUE);
- clutter_actor_add_child (priv->contents_actor, priv->view_actor);
+ gtk_box_pack_start (GTK_BOX (self), priv->toolbar, FALSE, FALSE, 0);
priv->ntfctn_mngr = g_object_ref_sink (photos_notification_manager_new ());
- clutter_actor_add_child (priv->view_actor, priv->ntfctn_mngr);
+ gtk_overlay_add_overlay (GTK_OVERLAY (priv->notebook_overlay), priv->ntfctn_mngr);
priv->indexing_ntfctn = g_object_ref_sink (photos_indexing_notification_new ());
priv->overview = photos_view_container_new (PHOTOS_WINDOW_MODE_OVERVIEW);
- priv->overview_actor = gtk_clutter_actor_new_with_contents (priv->overview);
- clutter_actor_set_x_expand (priv->overview_actor, TRUE);
- clutter_actor_set_y_expand (priv->overview_actor, TRUE);
- clutter_actor_insert_child_below (priv->view_actor, priv->overview_actor, NULL);
+ priv->overview_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->overview, NULL);
priv->favorites = photos_view_container_new (PHOTOS_WINDOW_MODE_FAVORITES);
- priv->favorites_actor = gtk_clutter_actor_new_with_contents (priv->favorites);
- clutter_actor_set_x_expand (priv->favorites_actor, TRUE);
- clutter_actor_set_y_expand (priv->favorites_actor, TRUE);
- clutter_actor_insert_child_below (priv->view_actor, priv->favorites_actor, NULL);
-
- priv->image_container = clutter_actor_new ();
- clutter_actor_set_x_expand (priv->image_container, TRUE);
- clutter_actor_set_y_expand (priv->image_container, TRUE);
- image_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
- clutter_actor_set_layout_manager (priv->image_container, image_layout);
- clutter_actor_insert_child_below (priv->view_actor, priv->image_container, NULL);
-
- image_background = clutter_canvas_new ();
- clutter_actor_set_content (priv->image_container, image_background);
- g_signal_connect (priv->image_container, "allocation-changed",
- G_CALLBACK (photos_embed_image_container_allocation_changed), self);
- g_signal_connect (image_background, "draw",
- G_CALLBACK (on_image_background_draw), self);
- g_signal_connect_swapped (self, "state-flags-changed",
- G_CALLBACK (clutter_content_invalidate), image_background);
- g_object_unref (image_background);
-
- priv->image_actor = clutter_actor_new ();
- clutter_actor_set_content_scaling_filters (priv->image_actor,
- CLUTTER_SCALING_FILTER_TRILINEAR,
- CLUTTER_SCALING_FILTER_TRILINEAR);
- clutter_actor_add_child (priv->image_container, priv->image_actor);
+ priv->favorites_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->favorites, NULL);
+
+ priv->preview = GTK_WIDGET (gegl_gtk_view_new ());
+ context = gtk_widget_get_style_context (priv->preview);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+ gtk_style_context_add_class (context, "content-view");
+ gegl_gtk_view_set_autoscale_policy (GEGL_GTK_VIEW (priv->preview), GEGL_GTK_VIEW_AUTOSCALE_DISABLED);
+ g_signal_connect_swapped (priv->preview,
+ "draw-background",
+ G_CALLBACK (photos_embed_preview_draw_background),
+ self);
+ gtk_widget_show (priv->preview);
+ priv->preview_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->preview, NULL);
priv->spinner_box = photos_spinner_box_new ();
- clutter_actor_insert_child_below (priv->view_actor, priv->spinner_box, NULL);
+ priv->spinner_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->spinner_box, NULL);
priv->error_box = photos_error_box_new ();
- clutter_actor_insert_child_below (priv->view_actor, priv->error_box, NULL);
+ priv->error_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->error_box, NULL);
priv->no_results = photos_empty_results_box_new ();
- clutter_actor_insert_child_below (priv->view_actor, priv->no_results, NULL);
-
- priv->background = clutter_actor_new ();
- clutter_actor_set_background_color (priv->background, CLUTTER_COLOR_Black);
- clutter_actor_set_x_expand (priv->background, TRUE);
- clutter_actor_set_y_expand (priv->background, TRUE);
- clutter_actor_insert_child_below (priv->view_actor, priv->background, NULL);
+ priv->no_results_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->no_results, NULL);
/* TODO: SearchBar.Dropdown,
* ...
*/
- priv->selection_toolbar = photos_selection_toolbar_new (actor);
- toolbar_actor = photos_selection_toolbar_get_actor (priv->selection_toolbar);
- clutter_actor_add_child (actor, toolbar_actor);
+ priv->selection_toolbar = photos_selection_toolbar_new ();
+ gtk_overlay_add_overlay (GTK_OVERLAY (priv->notebook_overlay), priv->selection_toolbar);
priv->mode_cntrlr = photos_mode_controller_new ();
g_signal_connect (priv->mode_cntrlr,
diff --git a/src/photos-embed.h b/src/photos-embed.h
index 54f85c2..9f4c813 100644
--- a/src/photos-embed.h
+++ b/src/photos-embed.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_EMBED_H
#define PHOTOS_EMBED_H
-#include "photos-embed-widget.h"
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,13 +57,13 @@ typedef struct _PhotosEmbedPrivate PhotosEmbedPrivate;
struct _PhotosEmbed
{
- PhotosEmbedWidget parent_instance;
+ GtkBox parent_instance;
PhotosEmbedPrivate *priv;
};
struct _PhotosEmbedClass
{
- PhotosEmbedWidgetClass parent_class;
+ GtkBoxClass parent_class;
};
GType photos_embed_get_type (void) G_GNUC_CONST;
diff --git a/src/photos-empty-results-box.c b/src/photos-empty-results-box.c
index a8a32b6..18098ff 100644
--- a/src/photos-empty-results-box.c
+++ b/src/photos-empty-results-box.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,13 +25,12 @@
#include "config.h"
-#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "photos-empty-results-box.h"
-G_DEFINE_TYPE (PhotosEmptyResultsBox, photos_empty_results_box, GTK_CLUTTER_TYPE_ACTOR);
+G_DEFINE_TYPE (PhotosEmptyResultsBox, photos_empty_results_box, GTK_TYPE_GRID);
static void
@@ -39,33 +38,30 @@ photos_empty_results_box_constructed (GObject *object)
{
PhotosEmptyResultsBox *self = PHOTOS_EMPTY_RESULTS_BOX (object);
GtkStyleContext *context;
- GtkWidget *bin;
GtkWidget *image;
GtkWidget *labels_grid;
GtkWidget *title_label;
- GtkWidget *widget;
gchar *label;
G_OBJECT_CLASS (photos_empty_results_box_parent_class)->constructed (object);
- widget = gtk_grid_new ();
- gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (widget, TRUE);
- gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_vexpand (widget, TRUE);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_HORIZONTAL);
- gtk_grid_set_column_spacing (GTK_GRID (widget), 12);
- context = gtk_widget_get_style_context (widget);
+ 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_HORIZONTAL);
+ gtk_grid_set_column_spacing (GTK_GRID (self), 12);
+ context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, "dim-label");
image = gtk_image_new_from_icon_name ("emblem-photos-symbolic", GTK_ICON_SIZE_INVALID);
gtk_image_set_pixel_size (GTK_IMAGE (image), 64);
- gtk_container_add (GTK_CONTAINER (widget), image);
+ gtk_container_add (GTK_CONTAINER (self), image);
labels_grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (labels_grid), GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (labels_grid), 12);
- gtk_container_add (GTK_CONTAINER (widget), labels_grid);
+ gtk_container_add (GTK_CONTAINER (self), labels_grid);
label = g_strconcat ("<b><span size=\"large\">", _("No Photos Found"), "</span></b>", NULL);
title_label = gtk_label_new (label);
@@ -78,19 +74,13 @@ photos_empty_results_box_constructed (GObject *object)
/* TODO: Check PhotosSourceManager for online sources */
gtk_widget_set_valign (title_label, GTK_ALIGN_CENTER);
- gtk_widget_show_all (widget);
-
- bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (self));
- gtk_container_add (GTK_CONTAINER (bin), widget);
+ gtk_widget_show_all (GTK_WIDGET (self));
}
static void
photos_empty_results_box_init (PhotosEmptyResultsBox *self)
{
- clutter_actor_set_opacity (CLUTTER_ACTOR (self), 255);
- clutter_actor_set_x_expand (CLUTTER_ACTOR (self), TRUE);
- clutter_actor_set_y_expand (CLUTTER_ACTOR (self), TRUE);
}
@@ -103,7 +93,7 @@ photos_empty_results_box_class_init (PhotosEmptyResultsBoxClass *class)
}
-ClutterActor *
+GtkWidget *
photos_empty_results_box_new (void)
{
return g_object_new (PHOTOS_TYPE_EMPTY_RESULTS_BOX, NULL);
diff --git a/src/photos-empty-results-box.h b/src/photos-empty-results-box.h
index 5338d4e..a96a76c 100644
--- a/src/photos-empty-results-box.h
+++ b/src/photos-empty-results-box.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_EMPTY_RESULTS_BOX_H
#define PHOTOS_EMPTY_RESULTS_BOX_H
-#include <clutter-gtk/clutter-gtk.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,18 +57,18 @@ typedef struct _PhotosEmptyResultsBoxPrivate PhotosEmptyResultsBoxPrivate;
struct _PhotosEmptyResultsBox
{
- GtkClutterActor parent_instance;
+ GtkGrid parent_instance;
PhotosEmptyResultsBoxPrivate *priv;
};
struct _PhotosEmptyResultsBoxClass
{
- GtkClutterActorClass parent_class;
+ GtkGridClass parent_class;
};
GType photos_empty_results_box_get_type (void) G_GNUC_CONST;
-ClutterActor *photos_empty_results_box_new (void);
+GtkWidget *photos_empty_results_box_new (void);
G_END_DECLS
diff --git a/src/photos-error-box.c b/src/photos-error-box.c
index c835e5e..30bfd41 100644
--- a/src/photos-error-box.c
+++ b/src/photos-error-box.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,9 +25,7 @@
#include "config.h"
-#include <clutter/clutter.h>
#include <glib.h>
-#include <gtk/gtk.h>
#include "photos-error-box.h"
@@ -40,20 +38,7 @@ struct _PhotosErrorBoxPrivate
};
-G_DEFINE_TYPE (PhotosErrorBox, photos_error_box, GTK_CLUTTER_TYPE_ACTOR);
-
-
-static void
-photos_error_box_move_out_completed (PhotosErrorBox *self)
-{
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
- if (parent == NULL)
- return;
-
- clutter_actor_set_child_below_sibling (parent, CLUTTER_ACTOR (self), NULL);
-}
+G_DEFINE_TYPE (PhotosErrorBox, photos_error_box, GTK_TYPE_GRID);
static void
@@ -61,41 +46,35 @@ photos_error_box_constructed (GObject *object)
{
PhotosErrorBox *self = PHOTOS_ERROR_BOX (object);
PhotosErrorBoxPrivate *priv = self->priv;
- GtkWidget *bin;
- GtkWidget *widget;
G_OBJECT_CLASS (photos_error_box_parent_class)->constructed (object);
- widget = gtk_grid_new ();
- gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (widget, TRUE);
- gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_vexpand (widget, TRUE);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (widget), 12);
+ 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), 12);
priv->image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_INVALID);
gtk_image_set_pixel_size (GTK_IMAGE (priv->image), 128);
gtk_widget_set_halign (priv->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (priv->image, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (widget), priv->image);
+ gtk_container_add (GTK_CONTAINER (self), priv->image);
priv->primary_label = gtk_label_new (NULL);
gtk_label_set_use_markup (GTK_LABEL (priv->primary_label), TRUE);
gtk_widget_set_halign (priv->primary_label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (priv->primary_label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (widget), priv->primary_label);
+ gtk_container_add (GTK_CONTAINER (self), priv->primary_label);
priv->secondary_label = gtk_label_new (NULL);
gtk_label_set_use_markup (GTK_LABEL (priv->secondary_label), TRUE);
gtk_widget_set_halign (priv->secondary_label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (priv->secondary_label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (widget), priv->secondary_label);
-
- gtk_widget_show_all (widget);
+ gtk_container_add (GTK_CONTAINER (self), priv->secondary_label);
- bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (self));
- gtk_container_add (GTK_CONTAINER (bin), widget);
+ gtk_widget_show_all (GTK_WIDGET (self));
}
@@ -113,9 +92,6 @@ static void
photos_error_box_init (PhotosErrorBox *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_ERROR_BOX, PhotosErrorBoxPrivate);
-
- clutter_actor_set_x_expand (CLUTTER_ACTOR (self), TRUE);
- clutter_actor_set_y_expand (CLUTTER_ACTOR (self), TRUE);
}
@@ -131,7 +107,7 @@ photos_error_box_class_init (PhotosErrorBoxClass *class)
}
-ClutterActor *
+GtkWidget *
photos_error_box_new (void)
{
return g_object_new (PHOTOS_TYPE_ERROR_BOX, NULL);
@@ -139,30 +115,6 @@ photos_error_box_new (void)
void
-photos_error_box_move_in (PhotosErrorBox *self)
-{
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
- if (parent == NULL)
- return;
-
- clutter_actor_set_child_above_sibling (parent, CLUTTER_ACTOR (self), NULL);
- clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 255, NULL);
-}
-
-
-void
-photos_error_box_move_out (PhotosErrorBox *self)
-{
- ClutterAnimation *animation;
-
- animation = clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 0, NULL);
- g_signal_connect_swapped (animation, "completed", G_CALLBACK (photos_error_box_move_out_completed), self);
-}
-
-
-void
photos_error_box_update (PhotosErrorBox *self, const gchar *primary, const gchar *secondary)
{
PhotosErrorBoxPrivate *priv = self->priv;
diff --git a/src/photos-error-box.h b/src/photos-error-box.h
index a61e2c3..38d7be1 100644
--- a/src/photos-error-box.h
+++ b/src/photos-error-box.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_ERROR_BOX_H
#define PHOTOS_ERROR_BOX_H
-#include <clutter-gtk/clutter-gtk.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,22 +57,18 @@ typedef struct _PhotosErrorBoxPrivate PhotosErrorBoxPrivate;
struct _PhotosErrorBox
{
- GtkClutterActor parent_instance;
+ GtkGrid parent_instance;
PhotosErrorBoxPrivate *priv;
};
struct _PhotosErrorBoxClass
{
- GtkClutterActorClass parent_class;
+ GtkGridClass parent_class;
};
GType photos_error_box_get_type (void) G_GNUC_CONST;
-ClutterActor *photos_error_box_new (void);
-
-void photos_error_box_move_in (PhotosErrorBox *self);
-
-void photos_error_box_move_out (PhotosErrorBox *self);
+GtkWidget *photos_error_box_new (void);
void photos_error_box_update (PhotosErrorBox *self,
const gchar *primary,
diff --git a/src/photos-indexing-notification.c b/src/photos-indexing-notification.c
index e3e196e..3296571 100644
--- a/src/photos-indexing-notification.c
+++ b/src/photos-indexing-notification.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -35,7 +35,7 @@
struct _PhotosIndexingNotificationPrivate
{
- ClutterActor *ntfctn_mngr;
+ GtkWidget *ntfctn_mngr;
GtkWidget *spinner;
TrackerMinerManager *manager;
gboolean manually_closed;
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index 6ec706e..5371b92 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,6 @@
#include "config.h"
-#include <clutter-gtk/clutter-gtk.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -41,11 +40,8 @@
struct _PhotosMainToolbarPrivate
{
- ClutterActor *actor;
- ClutterLayoutManager *layout;
GtkWidget *coll_back_button;
GtkWidget *toolbar;
- GtkWidget *widget;
PhotosBaseManager *col_mngr;
PhotosBaseManager *item_mngr;
PhotosBaseManager *src_mngr;
@@ -60,7 +56,7 @@ struct _PhotosMainToolbarPrivate
};
-G_DEFINE_TYPE (PhotosMainToolbar, photos_main_toolbar, G_TYPE_OBJECT);
+G_DEFINE_TYPE (PhotosMainToolbar, photos_main_toolbar, GTK_TYPE_BOX);
static void
@@ -253,34 +249,6 @@ photos_main_toolbar_clear_toolbar (PhotosMainToolbar *self)
static void
-photos_main_toolbar_destroy (GtkWidget *widget, gpointer user_data)
-{
- PhotosMainToolbar *self = PHOTOS_MAIN_TOOLBAR (user_data);
- PhotosMainToolbarPrivate *priv = self->priv;
-
- photos_main_toolbar_clear_state_data (self);
-
- if (priv->window_mode_id != 0)
- {
- g_signal_handler_disconnect (priv->mode_cntrlr, priv->window_mode_id);
- priv->window_mode_id = 0;
- }
-
- if (priv->selection_mode_id != 0)
- {
- g_signal_handler_disconnect (priv->sel_cntrlr, priv->selection_mode_id);
- priv->selection_mode_id = 0;
- }
-
- if (priv->search_source_id != 0)
- {
- g_signal_handler_disconnect (priv->src_mngr, priv->search_source_id);
- priv->search_source_id = 0;
- }
-}
-
-
-static void
photos_main_toolbar_done_button_clicked (GtkButton *button, gpointer user_data)
{
PhotosMainToolbar *self = PHOTOS_MAIN_TOOLBAR (user_data);
@@ -429,6 +397,26 @@ photos_main_toolbar_dispose (GObject *object)
PhotosMainToolbar *self = PHOTOS_MAIN_TOOLBAR (object);
PhotosMainToolbarPrivate *priv = self->priv;
+ photos_main_toolbar_clear_state_data (self);
+
+ if (priv->window_mode_id != 0)
+ {
+ g_signal_handler_disconnect (priv->mode_cntrlr, priv->window_mode_id);
+ priv->window_mode_id = 0;
+ }
+
+ if (priv->selection_mode_id != 0)
+ {
+ g_signal_handler_disconnect (priv->sel_cntrlr, priv->selection_mode_id);
+ priv->selection_mode_id = 0;
+ }
+
+ if (priv->search_source_id != 0)
+ {
+ g_signal_handler_disconnect (priv->src_mngr, priv->search_source_id);
+ priv->search_source_id = 0;
+ }
+
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->src_mngr);
@@ -448,14 +436,14 @@ photos_main_toolbar_init (PhotosMainToolbar *self)
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_MAIN_TOOLBAR, PhotosMainToolbarPrivate);
priv = self->priv;
- priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- priv->actor = gtk_clutter_actor_new_with_contents (priv->widget);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
+ gtk_widget_show (GTK_WIDGET (self));
priv->toolbar = gd_main_toolbar_new ();
gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->toolbar), GTK_ICON_SIZE_MENU);
context = gtk_widget_get_style_context (priv->toolbar);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUBAR);
- gtk_container_add (GTK_CONTAINER (priv->widget), priv->toolbar);
+ gtk_container_add (GTK_CONTAINER (self), priv->toolbar);
gtk_widget_show (priv->toolbar);
priv->col_mngr = photos_collection_manager_new ();
@@ -481,8 +469,6 @@ photos_main_toolbar_init (PhotosMainToolbar *self)
self);
photos_main_toolbar_reset_toolbar_mode (self);
-
- g_signal_connect (priv->widget, "destroy", G_CALLBACK (photos_main_toolbar_destroy), self);
}
@@ -497,15 +483,8 @@ photos_main_toolbar_class_init (PhotosMainToolbarClass *class)
}
-PhotosMainToolbar *
+GtkWidget *
photos_main_toolbar_new (void)
{
return g_object_new (PHOTOS_TYPE_MAIN_TOOLBAR, NULL);
}
-
-
-ClutterActor *
-photos_main_toolbar_get_actor (PhotosMainToolbar *self)
-{
- return self->priv->actor;
-}
diff --git a/src/photos-main-toolbar.h b/src/photos-main-toolbar.h
index dfae22a..f82e5df 100644
--- a/src/photos-main-toolbar.h
+++ b/src/photos-main-toolbar.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_MAIN_TOOLBAR_H
#define PHOTOS_MAIN_TOOLBAR_H
-#include <clutter/clutter.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,20 +57,18 @@ typedef struct _PhotosMainToolbarPrivate PhotosMainToolbarPrivate;
struct _PhotosMainToolbar
{
- GObject parent_instance;
+ GtkBox parent_instance;
PhotosMainToolbarPrivate *priv;
};
struct _PhotosMainToolbarClass
{
- GObjectClass parent_class;
+ GtkBoxClass parent_class;
};
GType photos_main_toolbar_get_type (void) G_GNUC_CONST;
-PhotosMainToolbar *photos_main_toolbar_new (void);
-
-ClutterActor *photos_main_toolbar_get_actor (PhotosMainToolbar *self);
+GtkWidget *photos_main_toolbar_new (void);
G_END_DECLS
diff --git a/src/photos-notification-manager.c b/src/photos-notification-manager.c
index 36aa468..7f89e0d 100644
--- a/src/photos-notification-manager.c
+++ b/src/photos-notification-manager.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -27,7 +27,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libgd/gd.h>
#include "photos-notification-manager.h"
#include "photos-utils.h"
@@ -36,22 +35,20 @@
struct _PhotosNotificationManagerPrivate
{
GtkWidget *grid;
- GtkWidget *widget;
};
-G_DEFINE_TYPE (PhotosNotificationManager, photos_notification_manager, GTK_CLUTTER_TYPE_ACTOR);
+G_DEFINE_TYPE (PhotosNotificationManager, photos_notification_manager, GD_TYPE_NOTIFICATION);
static void
photos_notification_manager_remove (PhotosNotificationManager *self)
{
- PhotosNotificationManagerPrivate *priv = self->priv;
GList *children;
- children = gtk_container_get_children (GTK_CONTAINER (priv->grid));
+ children = gtk_container_get_children (GTK_CONTAINER (self->priv->grid));
if (children == NULL)
- gtk_widget_hide (priv->widget);
+ gtk_widget_hide (GTK_WIDGET (self));
else
g_list_free (children);
}
@@ -78,43 +75,28 @@ photos_notification_manager_constructor (GType type,
static void
-photos_notification_manager_constructed (GObject *object)
+photos_notification_manager_init (PhotosNotificationManager *self)
{
- PhotosNotificationManager *self = PHOTOS_NOTIFICATION_MANAGER (object);
- PhotosNotificationManagerPrivate *priv = self->priv;
- GtkWidget *bin;
+ PhotosNotificationManagerPrivate *priv;
- G_OBJECT_CLASS (photos_notification_manager_parent_class)->constructed (object);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ PHOTOS_TYPE_NOTIFICATION_MANAGER,
+ PhotosNotificationManagerPrivate);
+ priv = self->priv;
- priv->widget = gd_notification_new ();
- gd_notification_set_show_close_button (GD_NOTIFICATION (priv->widget), FALSE);
- gd_notification_set_timeout (GD_NOTIFICATION (priv->widget), -1);
+ gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_START);
+ gd_notification_set_show_close_button (GD_NOTIFICATION (self), FALSE);
+ gd_notification_set_timeout (GD_NOTIFICATION (self), -1);
priv->grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->grid), GTK_ORIENTATION_HORIZONTAL);
gtk_grid_set_column_spacing (GTK_GRID (priv->grid), 6);
- gtk_container_add (GTK_CONTAINER (priv->widget), priv->grid);
+ gtk_container_add (GTK_CONTAINER (self), priv->grid);
+
g_signal_connect_swapped (priv->grid, "remove", G_CALLBACK (photos_notification_manager_remove), self);
gtk_widget_show (priv->grid);
-
- bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (self));
- gtk_container_add (GTK_CONTAINER (bin), priv->widget);
- photos_utils_alpha_gtk_widget (bin);
-}
-
-
-static void
-photos_notification_manager_init (PhotosNotificationManager *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- PHOTOS_TYPE_NOTIFICATION_MANAGER,
- PhotosNotificationManagerPrivate);
-
- clutter_actor_set_opacity (CLUTTER_ACTOR (self), 0);
- clutter_actor_set_x_align (CLUTTER_ACTOR (self), CLUTTER_ACTOR_ALIGN_CENTER);
- clutter_actor_set_y_align (CLUTTER_ACTOR (self), CLUTTER_ACTOR_ALIGN_START);
- clutter_actor_set_y_expand (CLUTTER_ACTOR (self), TRUE);
}
@@ -123,14 +105,13 @@ photos_notification_manager_class_init (PhotosNotificationManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->constructed = photos_notification_manager_constructed;
object_class->constructor = photos_notification_manager_constructor;
g_type_class_add_private (class, sizeof (PhotosNotificationManagerPrivate));
}
-ClutterActor *
+GtkWidget *
photos_notification_manager_new (void)
{
return g_object_new (PHOTOS_TYPE_NOTIFICATION_MANAGER, NULL);
@@ -144,6 +125,5 @@ photos_notification_manager_add_notification (PhotosNotificationManager *self, G
gtk_container_add (GTK_CONTAINER (priv->grid), notification);
gtk_widget_show_all (notification);
- gtk_widget_show (priv->widget);
- clutter_actor_set_opacity (CLUTTER_ACTOR (self), 255);
+ gtk_widget_show (GTK_WIDGET (self));
}
diff --git a/src/photos-notification-manager.h b/src/photos-notification-manager.h
index 5d33bad..4ca0aeb 100644
--- a/src/photos-notification-manager.h
+++ b/src/photos-notification-manager.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_NOTIFICATION_MANAGER_H
#define PHOTOS_NOTIFICATION_MANAGER_H
-#include <clutter-gtk/clutter-gtk.h>
+#include <libgd/gd.h>
G_BEGIN_DECLS
@@ -57,18 +57,18 @@ typedef struct _PhotosNotificationManagerPrivate PhotosNotificationManagerPrivat
struct _PhotosNotificationManager
{
- GtkClutterActor parent_instance;
+ GdNotification parent_instance;
PhotosNotificationManagerPrivate *priv;
};
struct _PhotosNotificationManagerClass
{
- GtkClutterActorClass parent_class;
+ GdNotificationClass parent_class;
};
GType photos_notification_manager_get_type (void) G_GNUC_CONST;
-ClutterActor *photos_notification_manager_new (void);
+GtkWidget *photos_notification_manager_new (void);
void photos_notification_manager_add_notification (PhotosNotificationManager *self,
GtkWidget *notification);
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index b5b2cb6..f0804fb 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,10 +25,8 @@
#include "config.h"
-#include <clutter-gtk/clutter-gtk.h>
#include <glib.h>
#include <glib/gi18n.h>
-#include <gtk/gtk.h>
#include "photos-application.h"
#include "photos-base-item.h"
@@ -42,8 +40,6 @@
struct _PhotosSelectionToolbarPrivate
{
- ClutterActor *actor;
- ClutterActor *parent_actor;
GHashTable *item_listeners;
GtkToolItem *left_group;
GtkToolItem *right_group;
@@ -56,20 +52,12 @@ struct _PhotosSelectionToolbarPrivate
GtkWidget *toolbar_print;
GtkWidget *toolbar_properties;
GtkWidget *toolbar_trash;
- GtkWidget *widget;
PhotosBaseManager *item_mngr;
PhotosSelectionController *sel_cntrlr;
gboolean inside_refresh;
};
-enum
-{
- PROP_0,
- PROP_PARENT_ACTOR
-};
-
-
-G_DEFINE_TYPE (PhotosSelectionToolbar, photos_selection_toolbar, G_TYPE_OBJECT);
+G_DEFINE_TYPE (PhotosSelectionToolbar, photos_selection_toolbar, GTK_TYPE_TOOLBAR);
enum
@@ -81,26 +69,22 @@ enum
static void
photos_selection_toolbar_fade_in (PhotosSelectionToolbar *self)
{
- PhotosSelectionToolbarPrivate *priv = self->priv;
- guint8 opacity;
-
- opacity = clutter_actor_get_opacity (priv->actor);
- if (opacity != 0)
- return;
-
- clutter_actor_show (priv->actor);
- clutter_actor_animate (priv->actor, CLUTTER_EASE_OUT_QUAD, 300, "opacity", 255, NULL);
+ gtk_widget_show_all (GTK_WIDGET (self));
+ /* TODO: animate the "opacity" to 1.0 in 300 ms using quadratic
+ * tweening
+ */
+ gtk_widget_set_opacity (GTK_WIDGET (self), 1.0);
}
static void
photos_selection_toolbar_fade_out (PhotosSelectionToolbar *self)
{
- ClutterAnimation *animation;
- PhotosSelectionToolbarPrivate *priv = self->priv;
-
- animation = clutter_actor_animate (priv->actor, CLUTTER_EASE_OUT_QUAD, 300, "opacity", 0, NULL);
- g_signal_connect_swapped (animation, "completed", G_CALLBACK (clutter_actor_hide), priv->actor);
+ /* TODO: animate the "opacity" to 0.0 in 300 ms using quadratic
+ * tweening
+ */
+ gtk_widget_set_opacity (GTK_WIDGET (self), 0.0);
+ gtk_widget_hide (GTK_WIDGET (self));
}
@@ -125,7 +109,7 @@ photos_selection_toolbar_collection_clicked (GtkButton *button, gpointer user_da
GtkWidget *dialog;
GtkWidget *toplevel;
- toplevel = gtk_widget_get_toplevel (priv->widget);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
if (!gtk_widget_is_toplevel (toplevel))
return;
@@ -425,30 +409,11 @@ photos_selection_toolbar_trash_clicked (GtkButton *button, gpointer user_data)
static void
-photos_selection_toolbar_constructed (GObject *object)
-{
- PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (object);
- PhotosSelectionToolbarPrivate *priv = self->priv;
- ClutterConstraint *constraint;
-
- G_OBJECT_CLASS (photos_selection_toolbar_parent_class)->constructed (object);
-
- constraint = clutter_align_constraint_new (priv->parent_actor, CLUTTER_ALIGN_X_AXIS, 0.50);
- clutter_actor_add_constraint (priv->actor, constraint);
-
- constraint = clutter_align_constraint_new (priv->parent_actor, CLUTTER_ALIGN_Y_AXIS, 0.95);
- clutter_actor_add_constraint (priv->actor, constraint);
-}
-
-
-static void
photos_selection_toolbar_dispose (GObject *object)
{
PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (object);
PhotosSelectionToolbarPrivate *priv = self->priv;
- g_clear_object (&priv->parent_actor);
-
if (priv->item_listeners != NULL)
{
g_hash_table_unref (priv->item_listeners);
@@ -463,28 +428,9 @@ photos_selection_toolbar_dispose (GObject *object)
static void
-photos_selection_toolbar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec
*pspec)
-{
- PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (object);
-
- switch (prop_id)
- {
- case PROP_PARENT_ACTOR:
- self->priv->parent_actor = CLUTTER_ACTOR (g_value_dup_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
photos_selection_toolbar_init (PhotosSelectionToolbar *self)
{
PhotosSelectionToolbarPrivate *priv;
- GtkWidget *bin;
GtkWidget *image;
GtkStyleContext *context;
@@ -493,24 +439,20 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
priv->item_listeners = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
- priv->widget = gtk_toolbar_new ();
- gtk_toolbar_set_show_arrow (GTK_TOOLBAR (priv->widget), FALSE);
- gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->widget), GTK_ICON_SIZE_LARGE_TOOLBAR);
- context = gtk_widget_get_style_context (priv->widget);
+ gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_END);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (self), 40);
+ gtk_widget_set_opacity (GTK_WIDGET (self), 0.0);
+ gtk_toolbar_set_show_arrow (GTK_TOOLBAR (self), FALSE);
+ gtk_toolbar_set_icon_size (GTK_TOOLBAR (self), GTK_ICON_SIZE_LARGE_TOOLBAR);
+ context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, "osd");
- gtk_widget_set_size_request (priv->widget, SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
-
- priv->actor = gtk_clutter_actor_new_with_contents (priv->widget);
- clutter_actor_set_opacity (priv->actor, 0);
- g_object_set (priv->actor, "show-on-set-parent", FALSE, NULL);
-
- bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (priv->actor));
- photos_utils_alpha_gtk_widget (bin);
+ gtk_widget_set_size_request (GTK_WIDGET (self), SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
priv->left_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
priv->left_group = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (priv->left_group), priv->left_box);
- gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->left_group, -1);
+ gtk_toolbar_insert (GTK_TOOLBAR (self), priv->left_group, -1);
priv->toolbar_favorite = gtk_toggle_button_new ();
image = gtk_image_new_from_icon_name ("emblem-favorite-symbolic", GTK_ICON_SIZE_INVALID);
@@ -558,12 +500,12 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (priv->separator), FALSE);
gtk_widget_set_visible (GTK_WIDGET (priv->separator), TRUE);
gtk_tool_item_set_expand (priv->separator, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->separator, -1);
+ gtk_toolbar_insert (GTK_TOOLBAR (self), priv->separator, -1);
priv->right_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
priv->right_group = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (priv->right_group), priv->right_box);
- gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->right_group, -1);
+ gtk_toolbar_insert (GTK_TOOLBAR (self), priv->right_group, -1);
priv->toolbar_collection = gtk_button_new ();
image = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_INVALID);
@@ -587,7 +529,7 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
G_CALLBACK (photos_selection_toolbar_properties_clicked),
self);
- gtk_widget_show_all (priv->widget);
+ gtk_widget_show_all (GTK_WIDGET (self));
priv->item_mngr = photos_item_manager_new ();
@@ -608,32 +550,14 @@ photos_selection_toolbar_class_init (PhotosSelectionToolbarClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->constructed= photos_selection_toolbar_constructed;
object_class->dispose = photos_selection_toolbar_dispose;
- object_class->set_property = photos_selection_toolbar_set_property;
-
- g_object_class_install_property (object_class,
- PROP_PARENT_ACTOR,
- g_param_spec_object ("parent-actor",
- "Parent actor",
- "A ClutterActor used for calculating the the
alignment and "
- "width of the toolbar",
- CLUTTER_TYPE_ACTOR,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
g_type_class_add_private (class, sizeof (PhotosSelectionToolbarPrivate));
}
-PhotosSelectionToolbar *
-photos_selection_toolbar_new (ClutterActor *parent_actor)
-{
- return g_object_new (PHOTOS_TYPE_SELECTION_TOOLBAR, "parent-actor", parent_actor, NULL);
-}
-
-
-ClutterActor *
-photos_selection_toolbar_get_actor (PhotosSelectionToolbar *self)
+GtkWidget *
+photos_selection_toolbar_new (void)
{
- return self->priv->actor;
+ return g_object_new (PHOTOS_TYPE_SELECTION_TOOLBAR, NULL);
}
diff --git a/src/photos-selection-toolbar.h b/src/photos-selection-toolbar.h
index 9a432dc..601a0e0 100644
--- a/src/photos-selection-toolbar.h
+++ b/src/photos-selection-toolbar.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,7 +25,7 @@
#ifndef PHOTOS_SELECTION_TOOLBAR_H
#define PHOTOS_SELECTION_TOOLBAR_H
-#include <clutter/clutter.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,20 +57,19 @@ typedef struct _PhotosSelectionToolbarPrivate PhotosSelectionToolbarPrivate;
struct _PhotosSelectionToolbar
{
- GObject parent_instance;
+ GtkToolbar parent_instance;
PhotosSelectionToolbarPrivate *priv;
};
struct _PhotosSelectionToolbarClass
{
- GObjectClass parent_class;
+ GtkToolbarClass parent_class;
};
GType photos_selection_toolbar_get_type (void) G_GNUC_CONST;
-PhotosSelectionToolbar *photos_selection_toolbar_new (ClutterActor *parent_actor);
+GtkWidget *photos_selection_toolbar_new (void);
-ClutterActor *photos_selection_toolbar_get_actor (PhotosSelectionToolbar *self);
G_END_DECLS
#endif /* PHOTOS_SELECTION_TOOLBAR_H */
diff --git a/src/photos-spinner-box.c b/src/photos-spinner-box.c
index ee104b2..4f35296 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 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -25,10 +25,8 @@
#include "config.h"
-#include <clutter/clutter.h>
#include <glib.h>
#include <glib/gi18n.h>
-#include <gtk/gtk.h>
#include "photos-spinner-box.h"
@@ -36,11 +34,11 @@
struct _PhotosSpinnerBoxPrivate
{
GtkWidget *spinner;
- guint delayed_move_id;
+ guint delayed_show_id;
};
-G_DEFINE_TYPE (PhotosSpinnerBox, photos_spinner_box, GTK_CLUTTER_TYPE_ACTOR);
+G_DEFINE_TYPE (PhotosSpinnerBox, photos_spinner_box, GTK_TYPE_GRID);
static void
@@ -48,64 +46,47 @@ photos_spinner_box_clear_delay_id (PhotosSpinnerBox *self)
{
PhotosSpinnerBoxPrivate *priv = self->priv;
- if (priv->delayed_move_id != 0)
+ if (priv->delayed_show_id != 0)
{
- g_source_remove (priv->delayed_move_id);
- priv->delayed_move_id = 0;
+ g_source_remove (priv->delayed_show_id);
+ priv->delayed_show_id = 0;
}
}
static gboolean
-photos_spinner_box_move_in_delayed_timeout (gpointer user_data)
+photos_spinner_box_start_delayed_timeout (gpointer user_data)
{
PhotosSpinnerBox *self = PHOTOS_SPINNER_BOX (user_data);
- self->priv->delayed_move_id = 0;
- photos_spinner_box_move_in (self);
+ self->priv->delayed_show_id = 0;
+ photos_spinner_box_start (self);
return G_SOURCE_REMOVE;
}
static void
-photos_spinner_box_move_out_completed (PhotosSpinnerBox *self)
-{
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
- if (parent == NULL)
- return;
-
- clutter_actor_set_child_below_sibling (parent, CLUTTER_ACTOR (self), NULL);
- gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
-}
-
-
-static void
photos_spinner_box_constructed (GObject *object)
{
PhotosSpinnerBox *self = PHOTOS_SPINNER_BOX (object);
PhotosSpinnerBoxPrivate *priv = self->priv;
- GtkWidget *bin;
GtkWidget *label;
- GtkWidget *widget;
gchar *text;
G_OBJECT_CLASS (photos_spinner_box_parent_class)->constructed (object);
- widget = gtk_grid_new ();
- gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (widget, TRUE);
- gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
- gtk_widget_set_vexpand (widget, TRUE);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (widget), 24);
+ 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);
gtk_widget_set_valign (priv->spinner, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (widget), priv->spinner);
+ gtk_container_add (GTK_CONTAINER (self), priv->spinner);
label = gtk_label_new (NULL);
@@ -116,12 +97,9 @@ photos_spinner_box_constructed (GObject *object)
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (widget), label);
-
- gtk_widget_show_all (widget);
+ gtk_container_add (GTK_CONTAINER (self), label);
- bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (self));
- gtk_container_add (GTK_CONTAINER (bin), widget);
+ gtk_widget_show_all (GTK_WIDGET (self));
}
@@ -140,9 +118,6 @@ static void
photos_spinner_box_init (PhotosSpinnerBox *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_SPINNER_BOX, PhotosSpinnerBoxPrivate);
-
- clutter_actor_set_x_expand (CLUTTER_ACTOR (self), TRUE);
- clutter_actor_set_y_expand (CLUTTER_ACTOR (self), TRUE);
}
@@ -158,7 +133,7 @@ photos_spinner_box_class_init (PhotosSpinnerBoxClass *class)
}
-ClutterActor *
+GtkWidget *
photos_spinner_box_new (void)
{
return g_object_new (PHOTOS_TYPE_SPINNER_BOX, NULL);
@@ -166,35 +141,24 @@ photos_spinner_box_new (void)
void
-photos_spinner_box_move_in (PhotosSpinnerBox *self)
+photos_spinner_box_start (PhotosSpinnerBox *self)
{
- ClutterActor *parent;
-
photos_spinner_box_clear_delay_id (self);
- parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
- if (parent == NULL)
- return;
-
- clutter_actor_set_child_above_sibling (parent, CLUTTER_ACTOR (self), NULL);
gtk_spinner_start (GTK_SPINNER (self->priv->spinner));
- clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 255, NULL);
}
void
-photos_spinner_box_move_out (PhotosSpinnerBox *self)
+photos_spinner_box_stop (PhotosSpinnerBox *self)
{
- ClutterAnimation *animation;
-
photos_spinner_box_clear_delay_id (self);
- animation = clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 0, NULL);
- g_signal_connect_swapped (animation, "completed", G_CALLBACK (photos_spinner_box_move_out_completed),
self);
+ gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
}
void
-photos_spinner_box_move_in_delayed (PhotosSpinnerBox *self, guint delay)
+photos_spinner_box_start_delayed (PhotosSpinnerBox *self, guint delay)
{
photos_spinner_box_clear_delay_id (self);
- self->priv->delayed_move_id = g_timeout_add (delay, photos_spinner_box_move_in_delayed_timeout, self);
+ self->priv->delayed_show_id = g_timeout_add (delay, photos_spinner_box_start_delayed_timeout, self);
}
diff --git a/src/photos-spinner-box.h b/src/photos-spinner-box.h
index 5eb57fa..4aeb450 100644
--- a/src/photos-spinner-box.h
+++ b/src/photos-spinner-box.h
@@ -25,7 +25,7 @@
#ifndef PHOTOS_SPINNER_BOX_H
#define PHOTOS_SPINNER_BOX_H
-#include <clutter-gtk/clutter-gtk.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -57,24 +57,24 @@ typedef struct _PhotosSpinnerBoxPrivate PhotosSpinnerBoxPrivate;
struct _PhotosSpinnerBox
{
- GtkClutterActor parent_instance;
+ GtkGrid parent_instance;
PhotosSpinnerBoxPrivate *priv;
};
struct _PhotosSpinnerBoxClass
{
- GtkClutterActorClass parent_class;
+ GtkGridClass parent_class;
};
GType photos_spinner_box_get_type (void) G_GNUC_CONST;
-ClutterActor *photos_spinner_box_new (void);
+GtkWidget *photos_spinner_box_new (void);
-void photos_spinner_box_move_in (PhotosSpinnerBox *self);
+void photos_spinner_box_start (PhotosSpinnerBox *self);
-void photos_spinner_box_move_in_delayed (PhotosSpinnerBox *self, guint delay);
+void photos_spinner_box_start_delayed (PhotosSpinnerBox *self, guint delay);
-void photos_spinner_box_move_out (PhotosSpinnerBox *self);
+void photos_spinner_box_stop (PhotosSpinnerBox *self);
G_END_DECLS
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 9dbe13f..c69468d 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -41,14 +41,6 @@
static const gchar *dot_dir;
-void
-photos_utils_alpha_gtk_widget (GtkWidget *widget)
-{
- GdkRGBA color = {0.0, 0.0, 0.0, 0.0};
- gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &color);
-}
-
-
GIcon *
photos_utils_create_symbolic_icon (const gchar *name, gint base_size)
{
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 77d6efc..4083365 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -33,8 +33,6 @@
G_BEGIN_DECLS
-void photos_utils_alpha_gtk_widget (GtkWidget *widget);
-
GIcon *photos_utils_create_symbolic_icon (const gchar *name, gint base_size);
const gchar *photos_utils_dot_dir (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]