[gnome-photos] facebook-item: Make it a final class
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] facebook-item: Make it a final class
- Date: Fri, 13 Nov 2015 14:52:17 +0000 (UTC)
commit 5424e071ed33fc69759c19d9ad93251c59a66677
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Nov 13 15:50:34 2015 +0100
facebook-item: Make it a final class
src/photos-facebook-item.c | 27 ++++++++++++++-------------
src/photos-facebook-item.h | 28 ++--------------------------
2 files changed, 16 insertions(+), 39 deletions(-)
---
diff --git a/src/photos-facebook-item.c b/src/photos-facebook-item.c
index 3d36bdb..197e20e 100644
--- a/src/photos-facebook-item.c
+++ b/src/photos-facebook-item.c
@@ -42,14 +42,19 @@
#include "photos-utils.h"
-struct _PhotosFacebookItemPrivate
+struct _PhotosFacebookItem
{
+ PhotosBaseItem parent_instance;
PhotosBaseManager *src_mngr;
};
+struct _PhotosFacebookItemClass
+{
+ PhotosBaseItemClass parent_class;
+};
+
G_DEFINE_TYPE_WITH_CODE (PhotosFacebookItem, photos_facebook_item, PHOTOS_TYPE_BASE_ITEM,
- G_ADD_PRIVATE (PhotosFacebookItem)
photos_utils_ensure_extension_points ();
g_io_extension_point_implement (PHOTOS_BASE_ITEM_EXTENSION_POINT_NAME,
g_define_type_id,
@@ -67,7 +72,7 @@ photos_facebook_item_create_name_fallback (PhotosBaseItem *item)
gchar *date_modified_str;
gint64 mtime;
- provider_name = photos_utils_get_provider_name (self->priv->src_mngr, item);
+ provider_name = photos_utils_get_provider_name (self->src_mngr, item);
mtime = photos_base_item_get_mtime (item);
date_modified = g_date_time_new_from_unix_local (mtime);
@@ -87,14 +92,14 @@ photos_facebook_item_create_name_fallback (PhotosBaseItem *item)
static GFBGraphPhoto *
photos_facebook_get_gfbgraph_photo (PhotosBaseItem *item, GCancellable *cancellable, GError **error)
{
- PhotosFacebookItemPrivate *priv = PHOTOS_FACEBOOK_ITEM (item)->priv;
+ PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (item);
PhotosSource *source;
const gchar *identifier, *resource_urn;
GFBGraphGoaAuthorizer *authorizer;
GFBGraphPhoto *photo = NULL;
resource_urn = photos_base_item_get_resource_urn (item);
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (priv->src_mngr, resource_urn));
+ source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (self->src_mngr, resource_urn));
authorizer = gfbgraph_goa_authorizer_new (photos_source_get_goa_object (source));
identifier = photos_base_item_get_identifier (item) + strlen ("facebook:");
@@ -238,7 +243,7 @@ photos_facebook_item_get_source_widget (PhotosBaseItem *item)
GtkWidget *source_widget;
const gchar *name;
- name = photos_utils_get_provider_name (self->priv->src_mngr, item);
+ name = photos_utils_get_provider_name (self->src_mngr, item);
source_widget = gtk_link_button_new_with_label ("https://www.facebook.com/", name);
gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
@@ -273,7 +278,7 @@ photos_facebook_item_constructed (GObject *object)
G_OBJECT_CLASS (photos_facebook_item_parent_class)->constructed (object);
- name = photos_utils_get_provider_name (self->priv->src_mngr, PHOTOS_BASE_ITEM (self));
+ name = photos_utils_get_provider_name (self->src_mngr, PHOTOS_BASE_ITEM (self));
photos_base_item_set_default_app_name (PHOTOS_BASE_ITEM (self), name);
}
@@ -283,7 +288,7 @@ photos_facebook_item_dispose (GObject *object)
{
PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (object);
- g_clear_object (&self->priv->src_mngr);
+ g_clear_object (&self->src_mngr);
G_OBJECT_CLASS (photos_facebook_item_parent_class)->dispose (object);
}
@@ -292,17 +297,13 @@ photos_facebook_item_dispose (GObject *object)
static void
photos_facebook_item_init (PhotosFacebookItem *self)
{
- PhotosFacebookItemPrivate *priv;
GApplication *app;
PhotosSearchContextState *state;
- self->priv = photos_facebook_item_get_instance_private (self);
- priv = self->priv;
-
app = g_application_get_default ();
state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
- priv->src_mngr = g_object_ref (state->src_mngr);
+ self->src_mngr = g_object_ref (state->src_mngr);
}
diff --git a/src/photos-facebook-item.h b/src/photos-facebook-item.h
index 2318836..19bdbde 100644
--- a/src/photos-facebook-item.h
+++ b/src/photos-facebook-item.h
@@ -35,36 +35,12 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PHOTOS_TYPE_FACEBOOK_ITEM, PhotosFacebookItem))
-#define PHOTOS_FACEBOOK_ITEM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- PHOTOS_TYPE_FACEBOOK_ITEM, PhotosFacebookItemClass))
-
#define PHOTOS_IS_FACEBOOK_ITEM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PHOTOS_TYPE_FACEBOOK_ITEM))
-#define PHOTOS_IS_FACEBOOK_ITEM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- PHOTOS_TYPE_FACEBOOK_ITEM))
-
-#define PHOTOS_FACEBOOK_ITEM_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- PHOTOS_TYPE_FACEBOOK_ITEM, PhotosFacebookItemClass))
-
-typedef struct _PhotosFacebookItem PhotosFacebookItem;
-typedef struct _PhotosFacebookItemClass PhotosFacebookItemClass;
-typedef struct _PhotosFacebookItemPrivate PhotosFacebookItemPrivate;
-
-struct _PhotosFacebookItem
-{
- PhotosBaseItem parent_instance;
- PhotosFacebookItemPrivate *priv;
-};
-
-struct _PhotosFacebookItemClass
-{
- PhotosBaseItemClass parent_class;
-};
+typedef struct _PhotosFacebookItem PhotosFacebookItem;
+typedef struct _PhotosFacebookItemClass PhotosFacebookItemClass;
GType photos_facebook_item_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]