]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] Update window icon too when the inverted colors option is active
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 29 Nov 2009 15:19:13 +0000 (16:19 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 29 Nov 2009 15:30:45 +0000 (16:30 +0100)
shell/ev-window.c

index 1b82aa4e45a39e04b434e7dac6b165b89b2be2c4..a07bea71a38276916682373e4ea3f78bc3e0a0bf 100644 (file)
@@ -1136,6 +1136,8 @@ ev_window_set_icon_from_thumbnail (EvJobThumbnail *job,
                                   EvWindow       *ev_window)
 {
        if (job->thumbnail) {
+               if (ev_document_model_get_inverted_colors (ev_window->priv->model))
+                       ev_document_misc_invert_pixbuf (job->thumbnail);
                gtk_window_set_icon (GTK_WINDOW (ev_window),
                                     job->thumbnail);
        }
@@ -4167,6 +4169,21 @@ ev_window_rotation_changed_cb (EvDocumentModel *model,
        ev_window_refresh_window_thumbnail (window, rotation);
 }
 
+static void
+ev_window_inverted_colors_changed_cb (EvDocumentModel *model,
+                                     GParamSpec      *pspec,
+                                     EvWindow        *window)
+{
+       gboolean inverted_colors = ev_document_model_get_inverted_colors (model);
+       gint rotation = ev_document_model_get_rotation (model);
+
+       if (window->priv->metadata && !ev_window_is_empty (window))
+               ev_metadata_set_boolean (window->priv->metadata, "inverted-colors",
+                                        inverted_colors);
+
+       ev_window_refresh_window_thumbnail (window, rotation);
+}
+
 static void
 ev_window_has_selection_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *window)
 {
@@ -6333,6 +6350,10 @@ ev_window_init (EvWindow *ev_window)
                          ev_window);
 
        /* Connect to view signals */
+       g_signal_connect (ev_window->priv->model,
+                         "notify::inverted-colors",
+                         G_CALLBACK (ev_window_inverted_colors_changed_cb),
+                         ev_window);
        g_signal_connect (ev_window->priv->view,
                          "notify::has-selection",
                          G_CALLBACK (ev_window_has_selection_changed_cb),