+void
+ev_navigation_action_set_history (EvNavigationAction *action,
+ EvHistory *history)
+{
+ action->priv->history = history;
+
+ g_object_add_weak_pointer (G_OBJECT (action->priv->history),
+ (gpointer *) &action->priv->history);
+}
+
+static void
+activate_menu_item_cb (GtkWidget *widget, EvNavigationAction *action)
+{
+ int index;
+
+ g_return_if_fail (EV_IS_HISTORY (action->priv->history));
+
+ index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "index"));
+ ev_history_set_current_index (action->priv->history, index);
+}
+
+static GtkWidget *
+new_history_menu_item (EvNavigationAction *action,
+ EvLink *link,
+ int index)
+{
+ GtkLabel *label;
+ GtkWidget *item;
+ const char *title;
+
+ title = ev_link_get_title (link);
+ item = gtk_image_menu_item_new_with_label (title);
+ g_object_set_data (G_OBJECT (item), "index",
+ GINT_TO_POINTER (index));
+
+ label = GTK_LABEL (GTK_BIN (item)->child);
+ gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
+ gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH);
+
+ g_signal_connect (item, "activate",
+ G_CALLBACK (activate_menu_item_cb),
+ action);
+
+ gtk_widget_show (item);
+
+ return item;
+}
+