]> www.fi.muni.cz Git - evince.git/commitdiff
null check uri before setting and getting metadata
authorMarco Pesenti Gritti <mpg@redhat.com>
Thu, 8 Sep 2005 11:05:55 +0000 (11:05 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Thu, 8 Sep 2005 11:05:55 +0000 (11:05 +0000)
2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>

        * shell/ev-window.c: (page_changed_cb),
        (setup_document_from_metadata), (update_sidebar_visibility),
        (setup_view_from_metadata), (ev_window_run_fullscreen),
        (ev_window_stop_fullscreen), (ev_window_run_presentation),
        (ev_window_stop_presentation), (ev_window_continuous_changed_cb),
        (ev_window_dual_mode_changed_cb),
        (ev_window_sidebar_current_page_changed_cb):

        null check uri before setting and getting metadata

ChangeLog
shell/ev-window.c

index 747aa8756348d2812b14e31bfba4d80918814ce9..ac8a37991e0ca4cd4eb8dd53c60fb67e563a8df6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * shell/ev-window.c: (page_changed_cb),
+       (setup_document_from_metadata), (update_sidebar_visibility),
+       (setup_view_from_metadata), (ev_window_run_fullscreen),
+       (ev_window_stop_fullscreen), (ev_window_run_presentation),
+       (ev_window_stop_presentation), (ev_window_continuous_changed_cb),
+       (ev_window_dual_mode_changed_cb),
+       (ev_window_sidebar_current_page_changed_cb):
+
+       null check uri before setting and getting metadata
+
 2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * dvi/Makefile.am:
index ac6dcd98c2557db868d0306203893b5e16310664..9bd1eac987c5c6aa2d1ab2f20c13a870edde39f9 100644 (file)
@@ -622,7 +622,9 @@ page_changed_cb (EvPageCache *page_cache,
 {
        update_action_sensitivity (ev_window);
 
-       ev_metadata_manager_set_int (ev_window->priv->uri, "page", page);
+       if (ev_window->priv->uri) {
+               ev_metadata_manager_set_int (ev_window->priv->uri, "page", page);
+       }
 }
 
 static void
@@ -643,7 +645,7 @@ setup_document_from_metadata (EvWindow *window)
        GValue page = { 0, };
 
        /* Page */
-       if (ev_metadata_manager_get (uri, "page", &page)) {
+       if (uri && ev_metadata_manager_get (uri, "page", &page)) {
                ev_page_cache_set_current_page (window->priv->page_cache,
                                                g_value_get_int (&page));
        }
@@ -919,7 +921,7 @@ update_sidebar_visibility (EvWindow *window)
        char *uri = window->priv->uri;
        GValue sidebar_visibility = { 0, };
 
-       if (ev_metadata_manager_get (uri, "sidebar_visibility", &sidebar_visibility)) {
+       if (uri && ev_metadata_manager_get (uri, "sidebar_visibility", &sidebar_visibility)) {
                set_widget_visibility (window->priv->sidebar,
                                       g_value_get_boolean (&sidebar_visibility));
        }
@@ -946,6 +948,10 @@ setup_view_from_metadata (EvWindow *window)
        GValue sidebar_size = { 0, };
        GValue sidebar_page = { 0, };
 
+       if (window->priv->uri == NULL) {
+               return;
+       }
+
        /* Window size */
        if (!GTK_WIDGET_VISIBLE (window)) {
                gboolean restore_size = TRUE;
@@ -1846,7 +1852,9 @@ ev_window_run_fullscreen (EvWindow *window)
        gtk_window_fullscreen (GTK_WINDOW (window));
        ev_window_update_fullscreen_popup (window);
 
-       ev_metadata_manager_set_boolean (window->priv->uri, "fullscreen", TRUE);
+       if (window->priv->uri) {
+               ev_metadata_manager_set_boolean (window->priv->uri, "fullscreen", TRUE);
+       }
 }
 
 static void
@@ -1875,7 +1883,9 @@ ev_window_stop_fullscreen (EvWindow *window)
        update_chrome_visibility (window);
        update_sidebar_visibility (window);
 
-       ev_metadata_manager_set_boolean (window->priv->uri, "fullscreen", FALSE);
+       if (window->priv->uri) {
+               ev_metadata_manager_set_boolean (window->priv->uri, "fullscreen", FALSE);
+       }
 }
 
 static void
@@ -1922,7 +1932,9 @@ ev_window_run_presentation (EvWindow *window)
        update_chrome_visibility (window);
        gtk_widget_hide (window->priv->sidebar);
 
-       ev_metadata_manager_set_boolean (window->priv->uri, "presentation", TRUE);
+       if (window->priv->uri) {
+               ev_metadata_manager_set_boolean (window->priv->uri, "presentation", TRUE);
+       }
 }
 
 static void
@@ -1940,7 +1952,9 @@ ev_window_stop_presentation (EvWindow *window)
        update_chrome_visibility (window);
        update_sidebar_visibility (window);
 
-       ev_metadata_manager_set_boolean (window->priv->uri, "presentation", FALSE);
+       if (window->priv->uri) {
+               ev_metadata_manager_set_boolean (window->priv->uri, "presentation", FALSE);
+       }
 }
 
 static void
@@ -2373,8 +2387,10 @@ ev_window_continuous_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *ev_w
 {
        ev_window_update_continuous_action (ev_window);
 
-       ev_metadata_manager_set_boolean (ev_window->priv->uri, "continuous",
-                                        ev_view_get_continuous (EV_VIEW (ev_window->priv->view)));
+       if (ev_window->priv->uri) {
+               ev_metadata_manager_set_boolean (ev_window->priv->uri, "continuous",
+                                                ev_view_get_continuous (EV_VIEW (ev_window->priv->view)));
+       }
 }
 
 static void     
@@ -2398,8 +2414,10 @@ ev_window_dual_mode_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *ev_wi
 {
        ev_window_update_dual_page_action (ev_window);
 
-       ev_metadata_manager_set_boolean (ev_window->priv->uri, "dual-page",
-                                        ev_view_get_dual_page (EV_VIEW (ev_window->priv->view)));
+       if (ev_window->priv->uri) {
+               ev_metadata_manager_set_boolean (ev_window->priv->uri, "dual-page",
+                                                ev_view_get_dual_page (EV_VIEW (ev_window->priv->view)));
+       }
 }
 
 static char *
@@ -2529,7 +2547,9 @@ ev_window_sidebar_current_page_changed_cb (EvSidebar  *ev_sidebar,
 
        g_object_unref (current_page);
 
-       ev_metadata_manager_set_string (ev_window->priv->uri, "sidebar_page", id);
+       if (ev_window->priv->uri) {
+               ev_metadata_manager_set_string (ev_window->priv->uri, "sidebar_page", id);
+       }
 }
 
 static void