Code

Now it is possible to clear the list of documents in
authorJucaBlues <JucaBlues@users.sourceforge.net>
Sun, 11 Jan 2009 19:49:17 +0000 (19:49 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Sun, 11 Jan 2009 19:49:17 +0000 (19:49 +0000)
File -> Open recent

Button added to the Interface page in Inkscape preferences dialog.

src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 0d97c0b778e80cdb8d92715f9cf296c5e03e3da3..b4d5ee82e233cf23a674de926588341ca7f6669f 100644 (file)
@@ -1069,7 +1069,14 @@ void InkscapePreferences::initPageUI()
                               _("Set the size for the main tools to use (requires restart)"), false);
 
     _misc_recent.init("/options/maxrecentdocuments/value", 0.0, 1000.0, 1.0, 1.0, 1.0, true, false);
-    _page_ui.add_line( false, _("Maximum documents in Open Recent:"), _misc_recent, "",
+
+    Gtk::HBox* recent_hbox = Gtk::manage(new Gtk::HBox());
+    Gtk::Button* reset_recent = Gtk::manage(new Gtk::Button(_("Reset list of recently opened files")));
+    reset_recent->signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::on_reset_open_recent_clicked));
+    recent_hbox->pack_start(_misc_recent, false, false);
+    recent_hbox->pack_start(*reset_recent, false, false);
+
+    _page_ui.add_line( false, _("Maximum documents in Open Recent:"), *recent_hbox, "",
                               _("The maximum length of the Open Recent list in the File menu"), false);
 
     _ui_zoom_correction.init(300, 30, 1.00, 200.0, 1.0, 10.0, 1.0);
@@ -1204,6 +1211,25 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter)
     return false;
 }
 
+void InkscapePreferences::on_reset_open_recent_clicked()
+{
+    GtkRecentManager* manager = gtk_recent_manager_get_default();
+    GList* recent_list = gtk_recent_manager_get_items(manager);
+    GList* element;
+    GError* error;
+
+    //Remove only elements that were added by Inkscape
+    for (element = g_list_first(recent_list); element; element = g_list_next(element)){
+        error = NULL;
+        GtkRecentInfo* info = (GtkRecentInfo*) element->data;
+        if (gtk_recent_info_has_application(info, g_get_prgname())){
+            gtk_recent_manager_remove_item(manager, gtk_recent_info_get_uri(info), &error);
+        }
+        gtk_recent_info_unref (info);
+    }
+    g_list_free(recent_list);
+}
+
 void InkscapePreferences::on_pagelist_selection_changed()
 {
     // show new selection
index 57b1da09e6ba0a87503ffd66eb94e1d62263d9c6..0a90ad3d0fc980abae24bc1ca9c1f508dfe13d69 100644 (file)
@@ -265,6 +265,7 @@ protected:
     static void AddNewObjectsStyle(DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
 
     void on_pagelist_selection_changed();
+    void on_reset_open_recent_clicked();
     void initPageMouse();
     void initPageScrolling();
     void initPageSnapping();