[gnome-photos/wip/rishi/zoom: 7/11] preview-nav-buttons, preview-view: Allow disabling auto-hiding
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/zoom: 7/11] preview-nav-buttons, preview-view: Allow disabling auto-hiding
- Date: Sun, 18 Jun 2017 12:21:56 +0000 (UTC)
commit c167719e2de7a9018b0a9204737faaf8d21efbc3
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Jun 16 00:09:32 2017 +0200
preview-nav-buttons, preview-view: Allow disabling auto-hiding
A subsequent commit will use this to stop the zoom controls from
auto-hiding when an item is zoomed in.
https://bugzilla.gnome.org/show_bug.cgi?id=742662
src/photos-preview-nav-buttons.c | 37 +++++++++++++++++++++++++++++++++----
src/photos-preview-nav-buttons.h | 3 +++
src/photos-preview-view.c | 2 ++
3 files changed, 38 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index b8fbda0..e43fef6 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -52,6 +52,7 @@ struct _PhotosPreviewNavButtons
PhotosBaseManager *item_mngr;
PhotosModeController *mode_cntrlr;
PhotosWindowMode old_mode;
+ gboolean auto_hide;
gboolean enable_next;
gboolean enable_prev;
gboolean show_navigation;
@@ -280,7 +281,9 @@ static void
photos_preview_nav_buttons_queue_auto_hide (PhotosPreviewNavButtons *self)
{
photos_preview_nav_buttons_unqueue_auto_hide (self);
- self->auto_hide_id = g_timeout_add_seconds (2, (GSourceFunc) photos_preview_nav_buttons_auto_hide, self);
+
+ if (self->auto_hide)
+ self->auto_hide_id = g_timeout_add_seconds (2, (GSourceFunc) photos_preview_nav_buttons_auto_hide, self);
}
@@ -315,6 +318,9 @@ photos_preview_nav_buttons_motion_notify (PhotosPreviewNavButtons *self, GdkEven
if (self->motion_id != 0)
return FALSE;
+ if (!self->auto_hide)
+ return FALSE;
+
device = gdk_event_get_source_device ((GdkEvent *) event);
input_source = gdk_device_get_source (device);
if (input_source == GDK_SOURCE_TOUCHSCREEN)
@@ -345,9 +351,13 @@ photos_preview_nav_buttons_multi_press_end (PhotosPreviewNavButtons *self, GdkEv
return;
gtk_gesture_set_state (GTK_GESTURE (self->tap_gesture), GTK_EVENT_SEQUENCE_CLAIMED);
- self->visible_internal = !self->visible_internal;
- photos_preview_nav_buttons_unqueue_auto_hide (self);
- photos_preview_nav_buttons_update_visibility (self);
+
+ if (self->auto_hide)
+ {
+ self->visible_internal = !self->visible_internal;
+ photos_preview_nav_buttons_unqueue_auto_hide (self);
+ photos_preview_nav_buttons_update_visibility (self);
+ }
}
@@ -667,6 +677,25 @@ photos_preview_nav_buttons_hide (PhotosPreviewNavButtons *self)
void
+photos_preview_nav_buttons_set_auto_hide (PhotosPreviewNavButtons *self, gboolean auto_hide)
+{
+ g_return_if_fail (PHOTOS_IS_PREVIEW_NAV_BUTTONS (self));
+
+ if (self->auto_hide == auto_hide)
+ return;
+
+ self->auto_hide = auto_hide;
+ self->visible_internal = self->visible;
+ photos_preview_nav_buttons_update_visibility (self);
+
+ if (self->auto_hide)
+ photos_preview_nav_buttons_queue_auto_hide (self);
+ else
+ photos_preview_nav_buttons_unqueue_auto_hide (self);
+}
+
+
+void
photos_preview_nav_buttons_set_mode (PhotosPreviewNavButtons *self, PhotosWindowMode old_mode)
{
g_return_if_fail (PHOTOS_IS_PREVIEW_NAV_BUTTONS (self));
diff --git a/src/photos-preview-nav-buttons.h b/src/photos-preview-nav-buttons.h
index 128c286..3e8dc8d 100644
--- a/src/photos-preview-nav-buttons.h
+++ b/src/photos-preview-nav-buttons.h
@@ -41,6 +41,9 @@ PhotosPreviewNavButtons *photos_preview_nav_buttons_new (Photo
void photos_preview_nav_buttons_hide (PhotosPreviewNavButtons *self);
+void photos_preview_nav_buttons_set_auto_hide (PhotosPreviewNavButtons *self,
+ gboolean auto_hide);
+
void photos_preview_nav_buttons_set_mode (PhotosPreviewNavButtons *self,
PhotosWindowMode old_mode);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index f049017..4427e39 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -826,6 +826,7 @@ photos_preview_view_window_mode_changed (PhotosPreviewView *self, PhotosWindowMo
case PHOTOS_WINDOW_MODE_PREVIEW:
gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer), FALSE);
photos_edit_palette_hide_details (PHOTOS_EDIT_PALETTE (self->palette));
+ photos_preview_nav_buttons_set_auto_hide (self->nav_buttons, TRUE);
photos_preview_nav_buttons_set_show_navigation (self->nav_buttons, TRUE);
photos_preview_nav_buttons_show (self->nav_buttons);
break;
@@ -1154,6 +1155,7 @@ photos_preview_view_set_mode (PhotosPreviewView *self, PhotosWindowMode old_mode
g_return_if_fail (old_mode != PHOTOS_WINDOW_MODE_EDIT);
g_return_if_fail (old_mode != PHOTOS_WINDOW_MODE_PREVIEW);
+ photos_preview_nav_buttons_set_auto_hide (self->nav_buttons, TRUE);
photos_preview_nav_buttons_set_mode (self->nav_buttons, old_mode);
photos_preview_nav_buttons_set_show_navigation (self->nav_buttons, TRUE);
photos_preview_nav_buttons_show (self->nav_buttons);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]