[gnome-photos/wip/rishi/edit-mode: 21/28] Revert "preview-nav-buttons: Use EditBar for showing the editing controls"



commit 6e789dc6694f1f3dc8ac3b2bb73cf5fdb8a4d925
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jun 1 08:43:25 2015 +0200

    Revert "preview-nav-buttons: Use EditBar for showing the editing controls"
    
    This reverts commit 4dd36ced961eea478819e1125af4f327d698f0f0.

 src/photos-preview-nav-buttons.c |   75 +-------------------------------------
 src/photos-preview-view.c        |    2 +-
 2 files changed, 2 insertions(+), 75 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 0698857..9af5d29 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -29,10 +29,8 @@
 #include <glib/gi18n.h>
 
 #include "photos-base-manager.h"
-#include "photos-edit-bar.h"
 #include "photos-enums.h"
 #include "photos-icons.h"
-#include "photos-mode-controller.h"
 #include "photos-preview-model.h"
 #include "photos-preview-nav-buttons.h"
 #include "photos-search-context.h"
@@ -44,15 +42,12 @@ struct _PhotosPreviewNavButtonsPrivate
   GtkGesture *tap_gesture;
   GtkTreeModel *model;
   GtkTreePath *current_path;
-  GtkWidget *bar_widget;
   GtkWidget *next_widget;
   GtkWidget *overlay;
   GtkWidget *prev_widget;
   GtkWidget *preview_view;
   PhotosBaseManager *item_mngr;
-  PhotosModeController *mode_cntrlr;
   PhotosPreviewAction action;
-  PhotosWindowMode mode;
   gboolean enable_next;
   gboolean enable_prev;
   gboolean visible;
@@ -119,19 +114,7 @@ photos_preview_nav_buttons_fade_out_button (PhotosPreviewNavButtons *self, GtkWi
 
 
 static void
-photos_preview_nav_buttons_update_visibility_edit (PhotosPreviewNavButtons *self)
-{
-  PhotosPreviewNavButtonsPrivate *priv = self->priv;
-
-  if (priv->mode == PHOTOS_WINDOW_MODE_EDIT && priv->visible && priv->visible_internal)
-    photos_preview_nav_buttons_fade_in_button (self, priv->bar_widget);
-  else
-    photos_preview_nav_buttons_fade_out_button (self, priv->bar_widget);
-}
-
-
-static void
-photos_preview_nav_buttons_update_visibility_prev_next (PhotosPreviewNavButtons *self)
+photos_preview_nav_buttons_update_visibility (PhotosPreviewNavButtons *self)
 {
   PhotosPreviewNavButtonsPrivate *priv = self->priv;
   GtkTreeIter iter;
@@ -139,7 +122,6 @@ photos_preview_nav_buttons_update_visibility_prev_next (PhotosPreviewNavButtons
 
   if (priv->model == NULL
       || priv->current_path == NULL
-      || priv->mode != PHOTOS_WINDOW_MODE_PREVIEW
       || !priv->visible
       || !gtk_tree_model_get_iter (priv->model, &iter, priv->current_path))
     {
@@ -167,14 +149,6 @@ photos_preview_nav_buttons_update_visibility_prev_next (PhotosPreviewNavButtons
 }
 
 
-static void
-photos_preview_nav_buttons_update_visibility (PhotosPreviewNavButtons *self)
-{
-  photos_preview_nav_buttons_update_visibility_edit (self);
-  photos_preview_nav_buttons_update_visibility_prev_next (self);
-}
-
-
 static gboolean
 photos_preview_nav_buttons_auto_hide (PhotosPreviewNavButtons *self)
 {
@@ -230,28 +204,6 @@ photos_preview_nav_buttons_leave_notify (PhotosPreviewNavButtons *self)
 }
 
 
-static void
-photos_preview_nav_buttons_notify_hover (PhotosEditBar *bar, GParamSpec *pspec, gpointer user_data)
-{
-  PhotosPreviewNavButtons *self = PHOTOS_PREVIEW_NAV_BUTTONS (user_data);
-
-  if (photos_edit_bar_get_hover (bar))
-    photos_preview_nav_buttons_enter_notify (self);
-  else
-    photos_preview_nav_buttons_leave_notify (self);
-}
-
-
-static void
-photos_preview_nav_buttons_mode_changed (PhotosPreviewNavButtons *self,
-                                         PhotosWindowMode mode,
-                                         PhotosWindowMode old_mode)
-{
-  self->priv->mode = mode;
-  photos_preview_nav_buttons_update_visibility (self);
-}
-
-
 static gboolean
 photos_preview_nav_buttons_motion_notify_timeout (PhotosPreviewNavButtons *self)
 {
@@ -342,7 +294,6 @@ photos_preview_nav_buttons_dispose (GObject *object)
   g_clear_object (&priv->overlay);
   g_clear_object (&priv->preview_view);
   g_clear_object (&priv->item_mngr);
-  g_clear_object (&priv->mode_cntrlr);
 
   G_OBJECT_CLASS (photos_preview_nav_buttons_parent_class)->dispose (object);
 }
@@ -366,27 +317,11 @@ photos_preview_nav_buttons_constructed (GObject *object)
   PhotosPreviewNavButtons *self = PHOTOS_PREVIEW_NAV_BUTTONS (object);
   PhotosPreviewNavButtonsPrivate *priv = self->priv;
   GtkStyleContext *context;
-  GtkWidget *bar;
   GtkWidget *button;
   GtkWidget *image;
 
   G_OBJECT_CLASS (photos_preview_nav_buttons_parent_class)->constructed (object);
 
-  priv->bar_widget = gtk_revealer_new ();
-  gtk_widget_set_margin_start (priv->bar_widget, 30);
-  gtk_widget_set_margin_end (priv->bar_widget, 30);
-  gtk_widget_set_margin_bottom (priv->bar_widget, 30);
-  gtk_widget_set_margin_top (priv->bar_widget, 30);
-  gtk_widget_set_valign (priv->bar_widget, GTK_ALIGN_END);
-  gtk_revealer_set_transition_type (GTK_REVEALER (priv->bar_widget), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
-  gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->bar_widget);
-
-  bar = photos_edit_bar_new ();
-  context = gtk_widget_get_style_context (bar);
-  gtk_style_context_add_class (context, "osd");
-  gtk_container_add (GTK_CONTAINER (priv->bar_widget), bar);
-  g_signal_connect (bar, "notify::hover", G_CALLBACK (photos_preview_nav_buttons_notify_hover), self);
-
   priv->prev_widget = gtk_revealer_new ();
   gtk_widget_set_halign (priv->prev_widget, GTK_ALIGN_START);
   gtk_widget_set_margin_start (priv->prev_widget, 30);
@@ -501,14 +436,6 @@ photos_preview_nav_buttons_init (PhotosPreviewNavButtons *self)
 
   priv->item_mngr = g_object_ref (state->item_mngr);
 
-  priv->mode_cntrlr = photos_mode_controller_dup_singleton ();
-  priv->mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr);
-  g_signal_connect_object (priv->mode_cntrlr,
-                           "window-mode-changed",
-                           G_CALLBACK (photos_preview_nav_buttons_mode_changed),
-                           self,
-                           G_CONNECT_SWAPPED);
-
   priv->action = PHOTOS_PREVIEW_ACTION_NONE;
 }
 
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index eac1da9..914d2de 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -305,13 +305,13 @@ photos_preview_view_window_mode_changed (PhotosPreviewView *self, PhotosWindowMo
   switch (mode)
     {
     case PHOTOS_WINDOW_MODE_COLLECTIONS:
+    case PHOTOS_WINDOW_MODE_EDIT:
     case PHOTOS_WINDOW_MODE_FAVORITES:
     case PHOTOS_WINDOW_MODE_OVERVIEW:
     case PHOTOS_WINDOW_MODE_SEARCH:
       photos_preview_nav_buttons_hide (priv->nav_buttons);
       break;
 
-    case PHOTOS_WINDOW_MODE_EDIT:
     case PHOTOS_WINDOW_MODE_PREVIEW:
       photos_preview_nav_buttons_show (priv->nav_buttons);
       break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]