+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):
PROP_BOTTOM,
PROP_RIGHT,
PROP_ZOOM,
- PROP_NAMED
+ PROP_NAMED,
+ PROP_PAGE_LABEL
};
struct _EvLinkDest {
double right;
double zoom;
gchar *named;
+ gchar *page_label;
};
G_DEFINE_TYPE (EvLinkDest, ev_link_dest, G_TYPE_OBJECT)
{ 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 }
};
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,
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,
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,
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);
}
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 *
"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));
+}
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;
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,
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
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;
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 ();
}
}
}
-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)
{
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,