[epiphany] ephy-overview-store: hide the close button while animating a removed item



commit aea0c271af64fef12c887c04cc2f760aca8391f8
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Sep 3 22:51:24 2012 +0300

    ephy-overview-store: hide the close button while animating a removed item
    
    To do this, add the render policy as a column to the model and use it
    as a cellrenderer attribute. The default value is already PRELIT. When
    removing the cell, flip it to NEVER.

 lib/widgets/ephy-overview-store.c |   13 +++++++++++++
 lib/widgets/ephy-overview-store.h |    1 +
 lib/widgets/gd-main-icon-view.c   |    3 +++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/lib/widgets/ephy-overview-store.c b/lib/widgets/ephy-overview-store.c
index 5ec9f99..312a24f 100644
--- a/lib/widgets/ephy-overview-store.c
+++ b/lib/widgets/ephy-overview-store.c
@@ -21,7 +21,9 @@
 #include "config.h"
 #include "ephy-history-service.h"
 #include "ephy-overview-store.h"
+#include "ephy-removable-pixbuf-renderer.h"
 #include "ephy-snapshot-service.h"
+#include "ephy-widgets-type-builtins.h"
 
 /* Update thumbnails after one week. */
 #define THUMBNAIL_UPDATE_THRESHOLD (60 * 60 * 24 * 7)
@@ -163,6 +165,7 @@ ephy_overview_store_init (EphyOverviewStore *self)
   types[EPHY_OVERVIEW_STORE_SELECTED] = G_TYPE_BOOLEAN;
   types[EPHY_OVERVIEW_STORE_SNAPSHOT_CANCELLABLE] = G_TYPE_CANCELLABLE;
   types[EPHY_OVERVIEW_STORE_SNAPSHOT_MTIME] = G_TYPE_LONG;
+  types[EPHY_OVERVIEW_STORE_CLOSE_BUTTON_RENDER_POLICY] = EPHY_TYPE_REMOVABLE_PIXBUF_RENDER_POLICY;
 
   gtk_list_store_set_column_types (GTK_LIST_STORE (self),
                                    EPHY_OVERVIEW_STORE_NCOLS, types);
@@ -572,12 +575,22 @@ ephy_overview_store_animated_remove (EphyOverviewStore *store,
                                      EphyOverviewStoreAnimRemoveFunc callback,
                                      gpointer user_data)
 {
+  GtkTreePath *path;
+  GtkTreeIter iter;
   AnimRemoveContext *ctx = g_slice_new0 (AnimRemoveContext);
 
   ctx->ref = ref;
   ctx->callback = callback;
   ctx->user_data = user_data;
 
+  path = gtk_tree_row_reference_get_path (ref);
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
+  gtk_tree_path_free (path);
+
+  gtk_list_store_set (GTK_LIST_STORE (store), &iter,
+                      EPHY_OVERVIEW_STORE_CLOSE_BUTTON_RENDER_POLICY,
+                      EPHY_REMOVABLE_PIXBUF_RENDER_NEVER, -1);
+
   g_timeout_add (40, (GSourceFunc) animated_remove_func, ctx);
 }
 
diff --git a/lib/widgets/ephy-overview-store.h b/lib/widgets/ephy-overview-store.h
index f6201bf..5732cab 100644
--- a/lib/widgets/ephy-overview-store.h
+++ b/lib/widgets/ephy-overview-store.h
@@ -64,6 +64,7 @@ enum {
   EPHY_OVERVIEW_STORE_SELECTED = GD_MAIN_COLUMN_SELECTED,
   EPHY_OVERVIEW_STORE_SNAPSHOT_CANCELLABLE,
   EPHY_OVERVIEW_STORE_SNAPSHOT_MTIME,
+  EPHY_OVERVIEW_STORE_CLOSE_BUTTON_RENDER_POLICY,
   EPHY_OVERVIEW_STORE_NCOLS
 };
 
diff --git a/lib/widgets/gd-main-icon-view.c b/lib/widgets/gd-main-icon-view.c
index 1f258f2..06584f7 100644
--- a/lib/widgets/gd-main-icon-view.c
+++ b/lib/widgets/gd-main-icon-view.c
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ephy-overview-store.h"
 #include "ephy-removable-pixbuf-renderer.h"
 #include "gd-main-icon-view.h"
 #include "gd-main-view.h"
@@ -119,6 +120,8 @@ gd_main_icon_view_constructed (GObject *obj)
                                  "active", GD_MAIN_COLUMN_SELECTED);
   gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self), cell,
                                  "pixbuf", GD_MAIN_COLUMN_ICON);
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self), cell,
+				 "render-policy", EPHY_OVERVIEW_STORE_CLOSE_BUTTON_RENDER_POLICY);
 
   cell = gd_two_lines_renderer_new ();
   g_object_set (cell,



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