From: JucaBlues Date: Sun, 11 Jan 2009 19:49:17 +0000 (+0000) Subject: Now it is possible to clear the list of documents in X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8e85155a9fc961fec0147daefa34b584301f53c5;p=inkscape.git Now it is possible to clear the list of documents in File -> Open recent Button added to the Interface page in Inkscape preferences dialog. --- diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 0d97c0b77..b4d5ee82e 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -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 diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 57b1da09e..0a90ad3d0 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -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();