Add projects to Recent files in GTK

Now, when a Devede project is opened or saved, it is added to the list
of Recent files, thus being shown there when choosing to open a project.
This commit is contained in:
Sergio Costas 2019-01-02 23:25:45 +01:00
parent 64a0da4504
commit 8719778d22
2 changed files with 12 additions and 7 deletions

View file

@ -15,7 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from gi.repository import Gtk, Gdk
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
import os
import time
import shutil
@ -701,6 +703,9 @@ class devede_project:
with open(self.project_file, 'wb') as f:
pickle.dump(project, f, 3)
recent_mgr = Gtk.RecentManager.get_default()
uri = GLib.filename_to_uri(self.project_file)
recent_mgr.add_item(uri)
def load_project(self, project_file):
@ -730,10 +735,12 @@ class devede_project:
self.wliststore_files.append([new_file, new_file.title_name, True, self.duration_to_string(
new_file.get_duration()), new_file.show_in_menu])
if (len(error_list) != 0):
devedeng.message.message_window(_("The following files in the project could not be added again:"), _(
"Error while adding files"), error_list)
devedeng.message.message_window(_("The following files in the project could not be added again:"), _("Error while adding files"), error_list)
self.set_interface_status(None)
self.refresh_disc_usage()
recent_mgr = Gtk.RecentManager.get_default()
uri = GLib.filename_to_uri(self.project_file)
recent_mgr.add_item(uri)
def on_multiproperties_activate(self, b):