+2007-01-28 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * shell/ev-marshal.list:
+ * shell/ev-page-action.c: (activate_cb),
+ (ev_page_action_class_init):
+ * shell/ev-page-action.h:
+ * shell/ev-page-cache.c: (ev_page_cache_set_page_label):
+ * shell/ev-window.c:
+
+ Remove activate_link signal, not required.
+
2007-01-28 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* shell/ev-navigation-action.c: (build_menu):
enum
{
ACTIVATE_LINK,
- ACTIVATE_LABEL,
N_SIGNALS
};
EvPageCache *page_cache;
const char *text;
gchar *page_label;
- gint page_number;
- gboolean changed;
+
+ EvLinkDest *link_dest;
+ EvLinkAction *link_action;
+ EvLink *link;
text = gtk_entry_get_text (GTK_ENTRY (entry));
page_cache = page->priv->page_cache;
- g_signal_emit (action, signals[ACTIVATE_LABEL], 0, text, &changed);
-
- if (changed)
- return;
- /* Check whether it's a valid page number */
- page_number = atoi (text) - 1;
- if (page_number >= 0 &&
- page_number < ev_page_cache_get_n_pages (page_cache)) {
- page_label = ev_page_cache_get_page_label (page_cache, page_number);
- gtk_entry_set_text (GTK_ENTRY (entry), page_label);
- gtk_editable_set_position (GTK_EDITABLE (entry), -1);
-
- g_signal_emit (action, signals[ACTIVATE_LABEL], 0, page_label, &changed);
- g_free (page_label);
-
- return;
- }
+ link_dest = ev_link_dest_new_page_label (text);
+ link_action = ev_link_action_new_dest (link_dest);
+ link = ev_link_new (text, link_action);
+
+ g_signal_emit (action, signals[ACTIVATE_LINK], 0, link);
+
+ g_object_unref (link);
/* rest the entry to the current page if we were unable to
* change it */
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
- signals[ACTIVATE_LABEL] = g_signal_new ("activate_label",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (EvPageActionClass, activate_label),
- NULL, NULL,
- ev_marshal_BOOLEAN__STRING,
- G_TYPE_BOOLEAN, 1,
- G_TYPE_STRING);
g_object_class_install_property (object_class,
PROP_PAGE_CACHE,
gtk_widget_grab_focus (window->priv->view);
}
-static gboolean
-activate_label_cb (EvPageAction *page_action, const gchar *label, EvWindow *window)
-{
- g_return_val_if_fail (EV_IS_WINDOW (window), FALSE);
-
- gtk_widget_grab_focus (window->priv->view);
-
- return ev_page_cache_set_page_label (window->priv->page_cache, label);
-}
-
static void
register_custom_actions (EvWindow *window, GtkActionGroup *group)
{
NULL);
g_signal_connect (action, "activate_link",
G_CALLBACK (activate_link_cb), window);
- g_signal_connect (action, "activate_label",
- G_CALLBACK (activate_label_cb), window);
gtk_action_group_add_action (group, action);
g_object_unref (action);