summaryrefslogtreecommitdiff
path: root/shell/ev-sidebar-layers.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 11:54:19 +0100
committerinfirit <[email protected]>2014-12-09 23:02:27 +0100
commit83ca334c004a0464322b7bba3f7aa4c83e63945d (patch)
treed1291c6cc9c63148bd8ce48d239eb5c4f93678d2 /shell/ev-sidebar-layers.c
parenta81dc81efad42fb0c8752bd7d33a0c3f0e81c3bd (diff)
downloadatril-83ca334c004a0464322b7bba3f7aa4c83e63945d.tar.bz2
atril-83ca334c004a0464322b7bba3f7aa4c83e63945d.tar.xz
[shell] Update layers sidebar page when layers have changed
Based on evince commit: b151de0dab3a7c3355f8206b8f95548d11714e9e From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'shell/ev-sidebar-layers.c')
-rw-r--r--shell/ev-sidebar-layers.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/shell/ev-sidebar-layers.c b/shell/ev-sidebar-layers.c
index 4d201bbd..80afd0ef 100644
--- a/shell/ev-sidebar-layers.c
+++ b/shell/ev-sidebar-layers.c
@@ -332,6 +332,49 @@ ev_sidebar_layers_new (void)
}
static void
+update_layers_state (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EvDocumentLayers *document_layers)
+{
+ EvLayer *layer;
+ gboolean visible;
+ GtkTreeIter child_iter;
+
+ do {
+ gtk_tree_model_get (model, iter,
+ EV_DOCUMENT_LAYERS_COLUMN_VISIBLE, &visible,
+ EV_DOCUMENT_LAYERS_COLUMN_LAYER, &layer,
+ -1);
+ if (layer) {
+ gboolean layer_visible;
+
+ layer_visible = ev_document_layers_layer_is_visible (document_layers, layer);
+ if (layer_visible != visible) {
+ gtk_tree_store_set (GTK_TREE_STORE (model), iter,
+ EV_DOCUMENT_LAYERS_COLUMN_VISIBLE, layer_visible,
+ -1);
+ }
+ }
+
+ if (gtk_tree_model_iter_children (model, &child_iter, iter))
+ update_layers_state (model, &child_iter, document_layers);
+ } while (gtk_tree_model_iter_next (model, iter));
+}
+
+void
+ev_sidebar_layers_update_layers_state (EvSidebarLayers *sidebar_layers)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ EvDocumentLayers *document_layers;
+
+ document_layers = EV_DOCUMENT_LAYERS (sidebar_layers->priv->document);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (sidebar_layers->priv->tree_view));
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ update_layers_state (model, &iter, document_layers);
+}
+
+static void
job_finished_callback (EvJobLayers *job,
EvSidebarLayers *sidebar_layers)
{