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:
parent
64a0da4504
commit
8719778d22
2 changed files with 12 additions and 7 deletions
|
|
@ -33,11 +33,9 @@ class opensave_window:
|
||||||
builder.set_translation_domain(self.config.gettext_domain)
|
builder.set_translation_domain(self.config.gettext_domain)
|
||||||
|
|
||||||
if self.save:
|
if self.save:
|
||||||
builder.add_from_file(os.path.join(
|
builder.add_from_file(os.path.join(self.config.glade, "wsave_project.ui"))
|
||||||
self.config.glade, "wsave_project.ui"))
|
|
||||||
else:
|
else:
|
||||||
builder.add_from_file(os.path.join(
|
builder.add_from_file(os.path.join(self.config.glade, "wopen_project.ui"))
|
||||||
self.config.glade, "wopen_project.ui"))
|
|
||||||
builder.connect_signals(self)
|
builder.connect_signals(self)
|
||||||
w_window = builder.get_object("data_project")
|
w_window = builder.get_object("data_project")
|
||||||
if current_file is not None:
|
if current_file is not None:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
# 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 os
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
|
|
@ -701,6 +703,9 @@ class devede_project:
|
||||||
|
|
||||||
with open(self.project_file, 'wb') as f:
|
with open(self.project_file, 'wb') as f:
|
||||||
pickle.dump(project, f, 3)
|
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):
|
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(
|
self.wliststore_files.append([new_file, new_file.title_name, True, self.duration_to_string(
|
||||||
new_file.get_duration()), new_file.show_in_menu])
|
new_file.get_duration()), new_file.show_in_menu])
|
||||||
if (len(error_list) != 0):
|
if (len(error_list) != 0):
|
||||||
devedeng.message.message_window(_("The following files in the project could not be added again:"), _(
|
devedeng.message.message_window(_("The following files in the project could not be added again:"), _("Error while adding files"), error_list)
|
||||||
"Error while adding files"), error_list)
|
|
||||||
self.set_interface_status(None)
|
self.set_interface_status(None)
|
||||||
self.refresh_disc_usage()
|
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):
|
def on_multiproperties_activate(self, b):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue