+ info = (GtkRecentInfo *) l->data;
+
+ if (!gtk_recent_info_has_application (info, evince))
+ continue;
+
+ action_name = g_strdup_printf ("RecentFile%u", i++);
+ label = g_strdup_printf ("_%d. %s",
+ n_items + 1,
+ gtk_recent_info_get_display_name (info));
+
+ action = g_object_new (GTK_TYPE_ACTION,
+ "name", action_name,
+ "label", label,
+ NULL);
+
+ g_object_weak_ref (G_OBJECT (action),
+ (GWeakNotify) gtk_recent_info_unref,
+ gtk_recent_info_ref (info));
+ g_signal_connect (G_OBJECT (action), "activate",
+ G_CALLBACK (ev_window_cmd_recent_file_activate),
+ (gpointer) info);
+
+ gtk_action_group_add_action (ev_window->priv->recent_action_group,
+ action);
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (ev_window->priv->ui_manager,
+ ev_window->priv->recent_ui_id,
+ "/MainMenu/FileMenu/RecentFilesMenu",
+ label,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+ g_free (action_name);
+ g_free (label);
+
+ if (++n_items == 5)
+ break;
+ }
+
+ g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
+ g_list_free (items);
+#else /* HAVE_GTK_RECENT */