[gnome-photos] embed, notification-manager: Shuffle some code around
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] embed, notification-manager: Shuffle some code around
- Date: Mon, 17 Mar 2014 09:12:44 +0000 (UTC)
commit 7c792fb3a39feecf9de6e01111edea0f6ab66783
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Mar 16 02:45:39 2014 +0100
embed, notification-manager: Shuffle some code around
This keeps the code in sync with gnome-documents.
src/photos-embed.c | 5 ----
src/photos-notification-manager.c | 38 ++++++++++++++++++++++++++++++++----
2 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index d54bfa2..a4b141d 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -35,7 +35,6 @@
#include "photos-collection-manager.h"
#include "photos-embed.h"
#include "photos-filterable.h"
-#include "photos-indexing-notification.h"
#include "photos-item-manager.h"
#include "photos-mode-controller.h"
#include "photos-notification-manager.h"
@@ -69,7 +68,6 @@ struct _PhotosEmbedPrivate
GCancellable *loader_cancellable;
GtkWidget *collections;
GtkWidget *favorites;
- GtkWidget *indexing_ntfctn;
GtkWidget *no_results;
GtkWidget *ntfctn_mngr;
GtkWidget *overview;
@@ -647,7 +645,6 @@ photos_embed_dispose (GObject *object)
g_clear_object (&priv->ntfctn_mngr);
g_clear_object (&priv->loader_cancellable);
- g_clear_object (&priv->indexing_ntfctn);
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->src_mngr);
@@ -721,8 +718,6 @@ photos_embed_init (PhotosEmbed *self)
priv->ntfctn_mngr = g_object_ref_sink (photos_notification_manager_dup_singleton ());
gtk_overlay_add_overlay (GTK_OVERLAY (priv->stack_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);
gtk_stack_add_titled (GTK_STACK (priv->stack), priv->overview, "overview", _("Recent"));
model = photos_view_container_get_model (PHOTOS_VIEW_CONTAINER (priv->overview));
diff --git a/src/photos-notification-manager.c b/src/photos-notification-manager.c
index 032916b..f89a521 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, 2013 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014 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
@@ -28,6 +28,7 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include "photos-indexing-notification.h"
#include "photos-notification-manager.h"
#include "photos-utils.h"
@@ -35,6 +36,7 @@
struct _PhotosNotificationManagerPrivate
{
GtkWidget *grid;
+ GtkWidget *indexing_ntfctn;
};
@@ -54,6 +56,22 @@ photos_notification_manager_remove (PhotosNotificationManager *self)
}
+static void
+photos_notification_manager_constructed (GObject *object)
+{
+ PhotosNotificationManager *self = PHOTOS_NOTIFICATION_MANAGER (object);
+
+ G_OBJECT_CLASS (photos_notification_manager_parent_class)->constructed (object);
+
+ /* PhotosIndexingNotification takes a reference on
+ * PhotosNotificationManager during construction. Hence we should
+ * instantiate PhotosIndexingNotification only after we have
+ * finished constructing this object.
+ */
+ self->priv->indexing_ntfctn = g_object_ref_sink (photos_indexing_notification_new ());
+}
+
+
static GObject *
photos_notification_manager_constructor (GType type,
guint n_construct_params,
@@ -75,6 +93,17 @@ photos_notification_manager_constructor (GType type,
static void
+photos_notification_manager_dispose (GObject *object)
+{
+ PhotosNotificationManager *self = PHOTOS_NOTIFICATION_MANAGER (object);
+
+ g_clear_object (&self->priv->indexing_ntfctn);
+
+ G_OBJECT_CLASS (photos_notification_manager_parent_class)->dispose (object);
+}
+
+
+static void
photos_notification_manager_init (PhotosNotificationManager *self)
{
PhotosNotificationManagerPrivate *priv;
@@ -91,8 +120,6 @@ photos_notification_manager_init (PhotosNotificationManager *self)
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);
}
@@ -101,7 +128,9 @@ 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;
+ object_class->dispose = photos_notification_manager_dispose;
}
@@ -118,6 +147,5 @@ photos_notification_manager_add_notification (PhotosNotificationManager *self, G
PhotosNotificationManagerPrivate *priv = self->priv;
gtk_container_add (GTK_CONTAINER (priv->grid), notification);
- gtk_widget_show_all (notification);
- gtk_widget_show (GTK_WIDGET (self));
+ gtk_widget_show_all (GTK_WIDGET (self));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]