]> www.fi.muni.cz Git - evince.git/commitdiff
Do not update links treeview when sidepane is not visible.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 28 Jan 2007 12:16:21 +0000 (12:16 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sun, 28 Jan 2007 12:16:21 +0000 (12:16 +0000)
2007-01-28  Carlos Garcia Campos  <carlosgc@gnome.org>
* shell/ev-sidebar-links.c: (ev_sidebar_links_map),
(ev_sidebar_links_class_init), (update_page_callback):
Do not update links treeview when sidepane is not visible.

svn path=/trunk/; revision=2257

ChangeLog
shell/ev-sidebar-links.c
shell/ev-sidebar-thumbnails.c

index 582bc6d3c66ebf0d6c98f2446f9cfe73dcbaa950..1ff8c5dda6bd025223e9249bdedce4db0d4d209c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-28  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * shell/ev-sidebar-links.c: (ev_sidebar_links_map),
+       (ev_sidebar_links_class_init), (update_page_callback):
+
+       Do not update links treeview when sidepane is not visible. 
+
 2007-01-28  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-marshal.list:
index 4f677e67fdbfc777d78ab384bb59a06ba5bc00cf..50eb29f6b30157420985489dc3c01743a18c0ccc 100644 (file)
@@ -166,21 +166,40 @@ ev_sidebar_links_dispose (GObject *object)
                sidebar->priv->page_cache = NULL;
        }
 
-
        G_OBJECT_CLASS (ev_sidebar_links_parent_class)->dispose (object);
 }
 
+static void
+ev_sidebar_links_map (GtkWidget *widget)
+{
+       EvSidebarLinks *links;
+
+       links = EV_SIDEBAR_LINKS (widget);
+
+       GTK_WIDGET_CLASS (ev_sidebar_links_parent_class)->map (widget);
+
+       if (links->priv->page_cache) {
+               update_page_callback (links->priv->page_cache,
+                                     ev_page_cache_get_current_page (links->priv->page_cache),
+                                     links);
+       }
+}
+
 static void
 ev_sidebar_links_class_init (EvSidebarLinksClass *ev_sidebar_links_class)
 {
-       GObjectClass *g_object_class;
+       GObjectClass   *g_object_class;
+       GtkWidgetClass *widget_class;
 
        g_object_class = G_OBJECT_CLASS (ev_sidebar_links_class);
+       widget_class = GTK_WIDGET_CLASS (ev_sidebar_links_class);
 
        g_object_class->set_property = ev_sidebar_links_set_property;
        g_object_class->get_property = ev_sidebar_links_get_property;
        g_object_class->dispose = ev_sidebar_links_dispose;
 
+       widget_class->map = ev_sidebar_links_map;
+
        signals[LINK_ACTIVATED] = g_signal_new ("link-activated",
                         G_TYPE_FROM_CLASS (g_object_class),
                         G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@@ -211,8 +230,6 @@ selection_changed_callback (GtkTreeSelection   *selection,
        GtkTreeModel *model;
        GtkTreeIter iter;
 
-       g_return_if_fail (EV_IS_SIDEBAR_LINKS (ev_sidebar_links));
-
        document = EV_DOCUMENT (ev_sidebar_links->priv->document);
        g_return_if_fail (ev_sidebar_links->priv->document != NULL);
 
@@ -569,6 +586,10 @@ update_page_callback (EvPageCache    *page_cache,
        GtkTreeModel *model;
        GtkTreeIter iter;
 
+       /* Widget is not currently visible */
+       if (!GTK_WIDGET_MAPPED (sidebar_links))
+               return;
+       
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view));
 
        if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -578,13 +599,11 @@ update_page_callback (EvPageCache    *page_cache,
                                    EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
                                    -1);
                if (link) {
-                       gint current_page;
                        gint dest_page;
 
                        dest_page = get_page_from_link (link);
                        g_object_unref (link);
                        
-                       current_page = ev_page_cache_get_current_page (sidebar_links->priv->page_cache);
                        if (dest_page == current_page)
                                return;
                }
@@ -602,24 +621,21 @@ update_page_callback (EvPageCache    *page_cache,
                                update_page_callback_foreach,
                                sidebar_links);
        
-
        g_signal_handler_unblock (selection, sidebar_links->priv->selection_id);
        g_signal_handler_unblock (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id);
 }
 
 static void 
-row_activated_callback                         (GtkTreeView *treeview,
-                                         GtkTreePath *arg1,
-                                         GtkTreeViewColumn *arg2,
-                                         gpointer user_data)
+row_activated_callback (GtkTreeView       *treeview,
+                       GtkTreePath       *arg1,
+                       GtkTreeViewColumn *arg2,
+                       gpointer           user_data)
 {      
        if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (treeview), arg1)) {
-                   gtk_tree_view_collapse_row (GTK_TREE_VIEW (treeview), arg1);
+               gtk_tree_view_collapse_row (GTK_TREE_VIEW (treeview), arg1);
        } else {
-                   gtk_tree_view_expand_row (GTK_TREE_VIEW (treeview), arg1, FALSE);
+               gtk_tree_view_expand_row (GTK_TREE_VIEW (treeview), arg1, FALSE);
        }
-       
-        return;
 }
 
 static void
@@ -635,7 +651,7 @@ expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *par
                                            -1);
                        if (expand) {
                                GtkTreePath *path;
-
+                               
                                path = gtk_tree_model_get_path (model, &iter);
                                gtk_tree_view_expand_row (tree_view, path, FALSE);
                                gtk_tree_path_free (path);
index 01c996bb48f446413cbdbcfca69d711a829c84c7..eac7073f916e6d2f613e72c9e71626b4b23bc927 100644 (file)
@@ -396,6 +396,7 @@ ev_sidebar_thumbnails_set_loading_icon (EvSidebarThumbnails *sidebar_thumbnails)
        }
 
 }
+
 void
 ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails,
                               int                  rotation)