[gnome-photos/gnome-3-16] preview-nav-buttons: Remove unnecessary properties
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/gnome-3-16] preview-nav-buttons: Remove unnecessary properties
- Date: Wed, 18 Mar 2015 09:19:36 +0000 (UTC)
commit 5c38dee5f47a6a65b2aba31af9ff3379bc16e478
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Mar 15 01:01:02 2015 +0100
preview-nav-buttons: Remove unnecessary properties
The enable-next and enable-prev properties introduced in
e8a445ee37c3ff53b82b1eb557afdbebdb8ea6b1 are not really necessary. We
can remove a bunch of code, and paves the way for the next commit.
https://bugzilla.gnome.org/show_bug.cgi?id=746152
src/photos-preview-nav-buttons.c | 103 +++++---------------------------------
1 files changed, 13 insertions(+), 90 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 80c8f55..962b67e 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -59,8 +59,6 @@ struct _PhotosPreviewNavButtonsPrivate
enum
{
PROP_0,
- PROP_ENABLE_NEXT,
- PROP_ENABLE_PREVIOUS,
PROP_OVERLAY,
PROP_PREVIEW_VIEW
};
@@ -121,8 +119,6 @@ photos_preview_nav_buttons_update_visibility (PhotosPreviewNavButtons *self)
PhotosPreviewNavButtonsPrivate *priv = self->priv;
GtkTreeIter iter;
GtkTreeIter tmp;
- gboolean enable_next = FALSE;
- gboolean enable_prev = FALSE;
if (priv->model == NULL
|| priv->current_path == NULL
@@ -130,19 +126,27 @@ photos_preview_nav_buttons_update_visibility (PhotosPreviewNavButtons *self)
|| !priv->visible_internal
|| !gtk_tree_model_get_iter (priv->model, &iter, priv->current_path))
{
- enable_prev = FALSE;
- enable_next = FALSE;
+ priv->enable_prev = FALSE;
+ priv->enable_next = FALSE;
goto out;
}
tmp = iter;
- enable_prev = gtk_tree_model_iter_previous (priv->model, &tmp);
+ priv->enable_prev = gtk_tree_model_iter_previous (priv->model, &tmp);
tmp = iter;
- enable_next = gtk_tree_model_iter_next (priv->model, &tmp);
+ priv->enable_next = gtk_tree_model_iter_next (priv->model, &tmp);
out:
- g_object_set (self, "enable-next", enable_next, "enable-previous", enable_prev, NULL);
+ if (priv->enable_next)
+ photos_preview_nav_buttons_fade_in_button (self, priv->next_widget);
+ else
+ photos_preview_nav_buttons_fade_out_button (self, priv->next_widget);
+
+ if (priv->enable_prev)
+ photos_preview_nav_buttons_fade_in_button (self, priv->prev_widget);
+ else
+ photos_preview_nav_buttons_fade_out_button (self, priv->prev_widget);
}
@@ -257,30 +261,6 @@ photos_preview_nav_buttons_multi_press_stopped (PhotosPreviewNavButtons *self)
static void
-photos_preview_nav_buttons_notify_enable_next (PhotosPreviewNavButtons *self)
-{
- PhotosPreviewNavButtonsPrivate *priv = self->priv;
-
- if (priv->enable_next)
- photos_preview_nav_buttons_fade_in_button (self, priv->next_widget);
- else
- photos_preview_nav_buttons_fade_out_button (self, priv->next_widget);
-}
-
-
-static void
-photos_preview_nav_buttons_notify_enable_previous (PhotosPreviewNavButtons *self)
-{
- PhotosPreviewNavButtonsPrivate *priv = self->priv;
-
- if (priv->enable_prev)
- photos_preview_nav_buttons_fade_in_button (self, priv->prev_widget);
- else
- photos_preview_nav_buttons_fade_out_button (self, priv->prev_widget);
-}
-
-
-static void
photos_preview_nav_buttons_set_active_path (PhotosPreviewNavButtons *self)
{
PhotosPreviewNavButtonsPrivate *priv = self->priv;
@@ -420,29 +400,6 @@ photos_preview_nav_buttons_constructed (GObject *object)
static void
-photos_preview_nav_buttons_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- PhotosPreviewNavButtons *self = PHOTOS_PREVIEW_NAV_BUTTONS (object);
- PhotosPreviewNavButtonsPrivate *priv = self->priv;
-
- switch (prop_id)
- {
- case PROP_ENABLE_NEXT:
- g_value_set_boolean (value, priv->enable_next);
- break;
-
- case PROP_ENABLE_PREVIOUS:
- g_value_set_boolean (value, priv->enable_prev);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
photos_preview_nav_buttons_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec
*pspec)
{
PhotosPreviewNavButtons *self = PHOTOS_PREVIEW_NAV_BUTTONS (object);
@@ -450,14 +407,6 @@ photos_preview_nav_buttons_set_property (GObject *object, guint prop_id, const G
switch (prop_id)
{
- case PROP_ENABLE_NEXT:
- priv->enable_next = g_value_get_boolean (value);
- break;
-
- case PROP_ENABLE_PREVIOUS:
- priv->enable_prev = g_value_get_boolean (value);
- break;
-
case PROP_OVERLAY:
priv->overlay = GTK_WIDGET (g_value_dup_object (value));
break;
@@ -489,15 +438,6 @@ photos_preview_nav_buttons_init (PhotosPreviewNavButtons *self)
priv->item_mngr = g_object_ref (state->item_mngr);
priv->action = PHOTOS_PREVIEW_ACTION_NONE;
-
- g_signal_connect (self,
- "notify::enable-next",
- G_CALLBACK (photos_preview_nav_buttons_notify_enable_next),
- NULL);
- g_signal_connect (self,
- "notify::enable-previous",
- G_CALLBACK (photos_preview_nav_buttons_notify_enable_previous),
- NULL);
}
@@ -509,26 +449,9 @@ photos_preview_nav_buttons_class_init (PhotosPreviewNavButtonsClass *class)
object_class->constructed = photos_preview_nav_buttons_constructed;
object_class->dispose = photos_preview_nav_buttons_dispose;
object_class->finalize = photos_preview_nav_buttons_finalize;
- object_class->get_property = photos_preview_nav_buttons_get_property;
object_class->set_property = photos_preview_nav_buttons_set_property;
g_object_class_install_property (object_class,
- PROP_ENABLE_NEXT,
- g_param_spec_boolean ("enable-next",
- "Enable next",
- "Allow moving to the next item",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_ENABLE_PREVIOUS,
- g_param_spec_boolean ("enable-previous",
- "Enable previous",
- "Allow moving to the previous item",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
PROP_OVERLAY,
g_param_spec_object ("overlay",
"GtkOverlay object",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]