]> www.fi.muni.cz Git - evince.git/commitdiff
Fix page-label command line option. Bug #342070.
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 27 May 2006 11:25:00 +0000 (11:25 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 27 May 2006 11:25:00 +0000 (11:25 +0000)
* backend/ev-link-dest.c: (ev_link_dest_type_get_type),
(ev_link_dest_get_page_label), (ev_link_dest_get_property),
(ev_link_dest_set_property), (ev_link_dest_finalize),
(ev_link_dest_class_init), (ev_link_dest_new_named),
(ev_link_dest_new_page_label):
* backend/ev-link-dest.h:
* shell/ev-application.c: (ev_application_open_uri):
* shell/ev-view.c: (goto_dest):
* shell/ev-window.c:
* shell/ev-window.h:

Fix page-label command line option. Bug #342070.

ChangeLog
backend/ev-link-dest.c
backend/ev-link-dest.h
shell/ev-application.c
shell/ev-view.c
shell/ev-window.c
shell/ev-window.h

index 47e86c0b552f3298f329b0189cbda9e8d10502fe..0e08e1b98c416817acf51b4cc6c810e36c6eaf82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2006-05-27  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * backend/ev-link-dest.c: (ev_link_dest_type_get_type),
+       (ev_link_dest_get_page_label), (ev_link_dest_get_property),
+       (ev_link_dest_set_property), (ev_link_dest_finalize),
+       (ev_link_dest_class_init), (ev_link_dest_new_named),
+       (ev_link_dest_new_page_label):
+       * backend/ev-link-dest.h:
+       * shell/ev-application.c: (ev_application_open_uri):
+       * shell/ev-view.c: (goto_dest):
+       * shell/ev-window.c:
+       * shell/ev-window.h:
+       
+       Fix page-label command line option. Bug #342070.
+
 2006-05-27  Ricardo Markiewicz  <rmarkie@fi.uba.ar>
 
        * shell/ev-view.c: (ev_view_expose_event), (draw_one_page):
index 2fd2f4d55c64fdbf916bcb615846f806e51e7bae..09f840afb2079d1f98a3d4ddeb5d6b77e86cbfad 100644 (file)
@@ -29,7 +29,8 @@ enum {
        PROP_BOTTOM,
        PROP_RIGHT,
        PROP_ZOOM,
-       PROP_NAMED
+       PROP_NAMED,
+       PROP_PAGE_LABEL
 };
 
 struct _EvLinkDest {
@@ -51,6 +52,7 @@ struct _EvLinkDestPrivate {
        double         right;
        double         zoom;
        gchar         *named;
+       gchar         *page_label;
 };
 
 G_DEFINE_TYPE (EvLinkDest, ev_link_dest, G_TYPE_OBJECT)
@@ -72,6 +74,7 @@ ev_link_dest_type_get_type (void)
                        { EV_LINK_DEST_TYPE_FITV, "EV_LINK_DEST_TYPE_FITV", "fitv" },
                        { EV_LINK_DEST_TYPE_FITR, "EV_LINK_DEST_TYPE_FITR", "fitr" },
                        { EV_LINK_DEST_TYPE_NAMED, "EV_LINK_DEST_TYPE_NAMED", "named" },
+                       { EV_LINK_DEST_TYPE_PAGE_LABEL, "EV_LINK_DEST_TYPE_PAGE_LABEL", "page_label" },
                        { EV_LINK_DEST_TYPE_UNKNOWN, "EV_LINK_DEST_TYPE_UNKNOWN", "unknown" },
                        { 0, NULL, NULL }
                };
@@ -146,6 +149,14 @@ ev_link_dest_get_named_dest (EvLinkDest *self)
        return self->priv->named;
 }
 
+const gchar *
+ev_link_dest_get_page_label (EvLinkDest *self)
+{
+       g_return_val_if_fail (EV_IS_LINK_DEST (self), NULL);
+
+       return self->priv->page_label;
+}
+
 static void
 ev_link_dest_get_property (GObject    *object,
                           guint       prop_id,
@@ -181,6 +192,9 @@ ev_link_dest_get_property (GObject    *object,
                case PROP_NAMED:
                        g_value_set_string (value, self->priv->named);
                        break;
+               case PROP_PAGE_LABEL:
+                       g_value_set_string (value, self->priv->page_label);
+                       break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
                                                           prop_id,
@@ -222,6 +236,9 @@ ev_link_dest_set_property (GObject      *object,
                case PROP_NAMED:
                        self->priv->named = g_value_dup_string (value);
                        break;
+               case PROP_PAGE_LABEL:
+                       self->priv->page_label = g_value_dup_string (value);
+                       break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
                                                           prop_id,
@@ -241,6 +258,10 @@ ev_link_dest_finalize (GObject *object)
                g_free (priv->named);
                priv->named = NULL;
        }
+       if (priv->page_label) {
+               g_free (priv->page_label);
+               priv->page_label = NULL;
+       }
 
        G_OBJECT_CLASS (ev_link_dest_parent_class)->finalize (object);
 }
@@ -345,6 +366,14 @@ ev_link_dest_class_init (EvLinkDestClass *ev_link_dest_class)
                                                              NULL,
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (g_object_class,
+                                        PROP_PAGE_LABEL,
+                                        g_param_spec_string ("page_label",
+                                                             "Label of the page",
+                                                             "The label of the destination page",
+                                                             NULL,
+                                                             G_PARAM_READWRITE |
+                                                             G_PARAM_CONSTRUCT_ONLY));
 }
 
 EvLinkDest *
@@ -427,3 +456,12 @@ ev_link_dest_new_named (const gchar *named_dest)
                                           "type", EV_LINK_DEST_TYPE_NAMED,
                                           NULL));
 }
+
+EvLinkDest *
+ev_link_dest_new_page_label (const gchar *page_label)
+{
+       return EV_LINK_DEST (g_object_new (EV_TYPE_LINK_DEST,
+                                          "page_label", page_label,
+                                          "type", EV_LINK_DEST_TYPE_PAGE_LABEL,
+                                          NULL));
+}
index 40a8a9b0f80127a4e6683a9f25cece1668010051..a0c96f5818eba3004f0559f0f439bc6a763756bd 100644 (file)
@@ -46,6 +46,7 @@ typedef enum {
        EV_LINK_DEST_TYPE_FITV,
        EV_LINK_DEST_TYPE_FITR,
        EV_LINK_DEST_TYPE_NAMED,
+       EV_LINK_DEST_TYPE_PAGE_LABEL,
        EV_LINK_DEST_TYPE_UNKNOWN
 } EvLinkDestType; 
 
@@ -60,6 +61,7 @@ gdouble         ev_link_dest_get_bottom     (EvLinkDest  *self);
 gdouble         ev_link_dest_get_right      (EvLinkDest  *self);
 gdouble         ev_link_dest_get_zoom       (EvLinkDest  *self);
 const gchar    *ev_link_dest_get_named_dest (EvLinkDest  *self);
+const gchar    *ev_link_dest_get_page_label (EvLinkDest  *self);
 
 EvLinkDest     *ev_link_dest_new_page       (gint         page);
 EvLinkDest     *ev_link_dest_new_xyz        (gint         page,
@@ -77,6 +79,7 @@ EvLinkDest     *ev_link_dest_new_fitr       (gint         page,
                                             gdouble      right,
                                             gdouble      top);
 EvLinkDest     *ev_link_dest_new_named      (const gchar *named_dest);
+EvLinkDest     *ev_link_dest_new_page_label (const gchar *page_label);
 
 G_END_DECLS
 
index 01bf5a2f89b0e0d727337c0ec275184e1c6bb12e..381b4e36c8a7788da53e4e4d1264598a97eca08f 100644 (file)
@@ -278,13 +278,16 @@ ev_application_open_uri (EvApplication  *application,
                         guint           timestamp,
                         GError        **error)
 {
-       ev_application_open_uri_at_dest (application, uri, NULL, timestamp);
        
        if (page_label && strcmp (page_label, "") != 0) {
-               EvWindow *window;
-
-               window = ev_application_get_uri_window (application, uri);
-               ev_window_open_page_label (window, page_label);
+               EvLinkDest *dest;
+               
+               dest = ev_link_dest_new_page_label (page_label);
+
+               ev_application_open_uri_at_dest (application, uri, dest, timestamp);
+               g_object_unref (dest);
+       } else {
+               ev_application_open_uri_at_dest (application, uri, NULL, timestamp);
        }
 
        return TRUE;
index d883ecf059a971157a7abdf05627abb63a427467..32ba7c3ee28f8161f07d91978c66b7af1da1ee55 100644 (file)
@@ -1237,6 +1237,9 @@ goto_dest (EvView *view, EvLinkDest *dest)
                case EV_LINK_DEST_TYPE_XYZ:
                        goto_xyz_dest (view, dest);
                        break;
+               case EV_LINK_DEST_TYPE_PAGE_LABEL:
+                       ev_page_cache_set_page_label (view->page_cache, ev_link_dest_get_page_label (dest));
+                       break;
                default:
                        g_assert_not_reached ();
        }
index 29b6a039b17b6987ac0df4487897b95be378bd2a..1131b35ceeec7210e45c38b87f00d956c185044d 100644 (file)
@@ -516,16 +516,6 @@ update_sizing_buttons (EvWindow *window)
        }
 }
 
-void
-ev_window_open_page_label (EvWindow   *ev_window, 
-                          const char *label)
-{
-       if (ev_window->priv->page_cache) {
-               ev_page_cache_set_page_label (ev_window->priv->page_cache, 
-                                             label);
-       }
-}
-
 gboolean
 ev_window_is_empty (const EvWindow *ev_window)
 {
index 2551073e33490b9bf66cbb7e04e2b655e8350f54..e54a62ee36041c9fca6b88edf3eebe6a803a1032 100644 (file)
@@ -59,8 +59,6 @@ void          ev_window_open_uri        (EvWindow       *ev_window,
                                           EvLinkDest     *dest);
 void            ev_window_goto_dest       (EvWindow       *ev_window,
                                           EvLinkDest     *dest);
-void           ev_window_open_page_label (EvWindow       *ev_window,
-                                          const char     *label);
 gboolean       ev_window_is_empty        (const EvWindow *ev_window);
 #ifdef WITH_GNOME_PRINT
 void           ev_window_print_range     (EvWindow       *ev_window,