Commit 3a2fd991 authored by Chris Mayo's avatar Chris Mayo Committed by Kai Willadsen

Initial URI support for file diffs

- Use GFiles in FileDiff
- Use GFiles in MeldWindow file functions
- Store URIs in recent comparison files

TODO:
 - Fix "Password dialogue cancelled" on accessing remote location
 - fileentry support for URIs
 - shorten_names() specific support for URIs
parent f766e90f
...@@ -641,10 +641,11 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -641,10 +641,11 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def get_comparison(self): def get_comparison(self):
root = self.model.get_iter_first() root = self.model.get_iter_first()
if root: if root:
folders = self.model.value_paths(root) uris = [Gio.File.new_for_path(d).get_uri()
for d in self.model.value_paths(root)]
else: else:
folders = [] uris = []
return recent.TYPE_FOLDER, folders return recent.TYPE_FOLDER, uris
def recursively_update( self, path ): def recursively_update( self, path ):
"""Recursively update from tree path 'path'. """Recursively update from tree path 'path'.
...@@ -1144,8 +1145,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1144,8 +1145,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
if not rows[pane]: if not rows[pane]:
return return
if os.path.isfile(rows[pane]): if os.path.isfile(rows[pane]):
self.emit("create-diff", [r for r in rows if os.path.isfile(r)], self.emit("create-diff", [Gio.File.new_for_path(r)
{}) for r in rows if os.path.isfile(r)], {})
elif os.path.isdir(rows[pane]): elif os.path.isdir(rows[pane]):
if view.row_expanded(path): if view.row_expanded(path):
view.collapse_row(path) view.collapse_row(path)
...@@ -1189,8 +1190,9 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1189,8 +1190,9 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def run_diff_from_iter(self, it): def run_diff_from_iter(self, it):
row_paths = self.model.value_paths(it) row_paths = self.model.value_paths(it)
paths = [p for p in row_paths if os.path.exists(p)] gfiles = [Gio.File.new_for_path(p)
self.emit("create-diff", paths, {}) for p in row_paths if os.path.exists(p)]
self.emit("create-diff", gfiles, {})
def on_button_diff_clicked(self, button): def on_button_diff_clicked(self, button):
pane = self._get_focused_pane() pane = self._get_focused_pane()
......
...@@ -1025,12 +1025,12 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1025,12 +1025,12 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.tooltip_text = self.label_text self.tooltip_text = self.label_text
self.label_changed() self.label_changed()
def set_files(self, files): def set_files(self, gfiles):
"""Load the given files """Load the given files
If an element is None, the text of a pane is left as is. If an element is None, the text of a pane is left as is.
""" """
if len(files) != self.num_panes: if len(gfiles) != self.num_panes:
return return
self._disconnect_buffer_handlers() self._disconnect_buffer_handlers()
...@@ -1039,14 +1039,16 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1039,14 +1039,16 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
custom_candidates = get_custom_encoding_candidates() custom_candidates = get_custom_encoding_candidates()
files = [(pane, Gio.File.new_for_path(filename)) gfiles_enum = [(pane, gfile)
for pane, filename in enumerate(files) if filename] for pane, gfile in enumerate(gfiles) if gfile]
if not files: if not gfiles_enum:
self.scheduler.add_task(self._compare_files_internal()) self.scheduler.add_task(self._compare_files_internal())
for pane, gfile in files: for pane, gfile in gfiles_enum:
self.fileentry[pane].set_file(gfile) self.fileentry[pane].set_file(gfile)
# TODO: filentry handling of URIs
self.fileentry[pane].set_sensitive(gfile.is_native())
self.msgarea_mgr[pane].clear() self.msgarea_mgr[pane].clear()
buf = self.textbuffer[pane] buf = self.textbuffer[pane]
...@@ -1067,8 +1069,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1067,8 +1069,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
) )
def get_comparison(self): def get_comparison(self):
files = [b.data.filename for b in self.textbuffer[:self.num_panes]] uris = [b.data.gfile.get_uri()
return recent.TYPE_FILE, files for b in self.textbuffer[:self.num_panes]]
return recent.TYPE_FILE, uris
def file_loaded(self, loader, result, user_data): def file_loaded(self, loader, result, user_data):
...@@ -1176,8 +1179,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1176,8 +1179,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
except ValueError: except ValueError:
# Notification for unknown buffer # Notification for unknown buffer
return return
gfile = Gio.File.new_for_path(data.filename) display_name = data.gfile.get_parse_name()
display_name = gfile.get_parse_name()
primary = _("File %s has changed on disk") % display_name primary = _("File %s has changed on disk") % display_name
secondary = _("Do you want to reload the file?") secondary = _("Do you want to reload the file?")
self.msgarea_mgr[pane].add_action_msg( self.msgarea_mgr[pane].add_action_msg(
...@@ -1463,7 +1465,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1463,7 +1465,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def save_file(self, pane, saveas=False, force_overwrite=False): def save_file(self, pane, saveas=False, force_overwrite=False):
buf = self.textbuffer[pane] buf = self.textbuffer[pane]
bufdata = buf.data bufdata = buf.data
if saveas or not (bufdata.filename or bufdata.savefile) \ if saveas or not (bufdata.gfile or bufdata.savefile) \
or not bufdata.writable: or not bufdata.writable:
if pane == 0: if pane == 0:
prompt = _("Save Left Pane As") prompt = _("Save Left Pane As")
...@@ -1622,9 +1624,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1622,9 +1624,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_fileentry_file_set(self, entry): def on_fileentry_file_set(self, entry):
entries = self.fileentry[:self.num_panes] entries = self.fileentry[:self.num_panes]
if self.check_save_modified() != Gtk.ResponseType.CANCEL: if self.check_save_modified() != Gtk.ResponseType.CANCEL:
files = [e.get_file() for e in entries] gfiles = [e.get_file() for e in entries]
paths = [f.get_path() if f is not None else f for f in files] self.set_files(gfiles)
self.set_files(paths)
else: else:
idx = entries.index(entry) idx = entries.index(entry)
existing_path = self.textbuffer[idx].data.filename existing_path = self.textbuffer[idx].data.filename
...@@ -1651,8 +1652,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component): ...@@ -1651,8 +1652,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
dialog.widget.destroy() dialog.widget.destroy()
if response == Gtk.ResponseType.OK: if response == Gtk.ResponseType.OK:
files = [b.data.filename for b in self.textbuffer[:self.num_panes]] gfiles = [b.data.gfile for b in self.textbuffer[:self.num_panes]]
self.set_files(files) self.set_files(gfiles)
def on_refresh_activate(self, *extra): def on_refresh_activate(self, *extra):
self.refresh_comparison() self.refresh_comparison()
......
...@@ -142,19 +142,17 @@ class MeldApp(Gtk.Application): ...@@ -142,19 +142,17 @@ class MeldApp(Gtk.Application):
return self.get_active_window().meldwindow return self.get_active_window().meldwindow
def open_files( def open_files(
self, files, *, window=None, close_on_error=False, **kwargs): self, gfiles, *, window=None, close_on_error=False, **kwargs):
"""Open a comparison between files in a Meld window """Open a comparison between files in a Meld window
:param files: list of Gio.File to be compared :param gfiles: list of Gio.File to be compared
:param window: window in which to open comparison tabs; if :param window: window in which to open comparison tabs; if
None, the current window is used None, the current window is used
:param close_on_error: if true, close window if an error occurs :param close_on_error: if true, close window if an error occurs
""" """
window = window or self.get_meld_window() window = window or self.get_meld_window()
paths = [f.get_path() for f in files]
try: try:
return window.open_paths(paths, **kwargs) return window.open_paths(gfiles, **kwargs)
except ValueError: except ValueError:
if close_on_error: if close_on_error:
self.remove_window(window.widget) self.remove_window(window.widget)
...@@ -345,7 +343,10 @@ class MeldApp(Gtk.Application): ...@@ -345,7 +343,10 @@ class MeldApp(Gtk.Application):
auto_merge = options.auto_merge and i == 0 auto_merge = options.auto_merge and i == 0
try: try:
for p, f in zip(paths, files): for p, f in zip(paths, files):
if f.get_path() is None: # TODO: support for directories specified by URIs
if f.get_uri() is None or (not f.is_native() and
f.query_file_type(Gio.FileQueryInfoFlags.NONE, None) ==
Gio.FileType.DIRECTORY):
raise ValueError(_("invalid path or URI “%s”") % p) raise ValueError(_("invalid path or URI “%s”") % p)
tab = self.open_files( tab = self.open_files(
files, window=window, files, window=window,
......
...@@ -118,7 +118,10 @@ class MeldBufferData(GObject.GObject): ...@@ -118,7 +118,10 @@ class MeldBufferData(GObject.GObject):
def reset(self, gfile): def reset(self, gfile):
same_file = gfile and self._gfile and gfile.equal(self._gfile) same_file = gfile and self._gfile and gfile.equal(self._gfile)
self.gfile = gfile self.gfile = gfile
self.label = self._label if same_file else self.filename if same_file:
self.label = self._label
else:
self.label = gfile.get_parse_name() if gfile else None
self.loaded = False self.loaded = False
self.savefile = None self.savefile = None
......
...@@ -107,7 +107,7 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject): ...@@ -107,7 +107,7 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
self._state = value self._state = value
def get_comparison(self): def get_comparison(self):
"""Get the comparison type and path(s) being compared""" """Get the comparison type and URI(s) being compared"""
pass pass
def save(self): def save(self):
......
...@@ -271,11 +271,8 @@ class MeldWindow(gnomeglade.Component): ...@@ -271,11 +271,8 @@ class MeldWindow(gnomeglade.Component):
def on_widget_drag_data_received(self, wid, context, x, y, selection_data, def on_widget_drag_data_received(self, wid, context, x, y, selection_data,
info, time): info, time):
if len(selection_data.get_uris()) != 0: if len(selection_data.get_files()) != 0:
paths = [] self.open_paths(selection_data.get_files())
for uri in selection_data.get_uris():
paths.append(Gio.File.new_for_uri(uri).get_path())
self.open_paths(paths)
return True return True
def on_idle(self): def on_idle(self):
...@@ -569,7 +566,8 @@ class MeldWindow(gnomeglade.Component): ...@@ -569,7 +566,8 @@ class MeldWindow(gnomeglade.Component):
doc.connect("diff-created", diff_created_cb) doc.connect("diff-created", diff_created_cb)
return doc return doc
def append_dirdiff(self, dirs, auto_compare=False): def append_dirdiff(self, gfiles, auto_compare=False):
dirs = [d.get_path() for d in gfiles if d]
assert len(dirs) in (1, 2, 3) assert len(dirs) in (1, 2, 3)
doc = dirdiff.DirDiff(len(dirs)) doc = dirdiff.DirDiff(len(dirs))
self._append_page(doc, "folder") self._append_page(doc, "folder")
...@@ -578,93 +576,101 @@ class MeldWindow(gnomeglade.Component): ...@@ -578,93 +576,101 @@ class MeldWindow(gnomeglade.Component):
doc.scheduler.add_task(doc.auto_compare) doc.scheduler.add_task(doc.auto_compare)
return doc return doc
def append_filediff(self, files, merge_output=None, meta=None): def append_filediff(self, gfiles, merge_output=None, meta=None):
assert len(files) in (1, 2, 3) assert len(gfiles) in (1, 2, 3)
doc = filediff.FileDiff(len(files)) doc = filediff.FileDiff(len(gfiles))
self._append_page(doc, "text-x-generic") self._append_page(doc, "text-x-generic")
doc.set_files(files) doc.set_files(gfiles)
if merge_output is not None: if merge_output is not None:
doc.set_merge_output_file(merge_output) doc.set_merge_output_file(merge_output)
if meta is not None: if meta is not None:
doc.set_meta(meta) doc.set_meta(meta)
return doc return doc
def append_filemerge(self, files, merge_output=None): def append_filemerge(self, gfiles, merge_output=None):
if len(files) != 3: if len(gfiles) != 3:
raise ValueError( raise ValueError(
_("Need three files to auto-merge, got: %r") % files) _("Need three files to auto-merge, got: %r") %
doc = filemerge.FileMerge(len(files)) [f.get_parse_name() for f in gfiles])
doc = filemerge.FileMerge(len(gfiles))
self._append_page(doc, "text-x-generic") self._append_page(doc, "text-x-generic")
doc.set_files(files) doc.set_files(gfiles)
if merge_output is not None: if merge_output is not None:
doc.set_merge_output_file(merge_output) doc.set_merge_output_file(merge_output)
return doc return doc
def append_diff(self, paths, auto_compare=False, auto_merge=False, def append_diff(self, gfiles, auto_compare=False, auto_merge=False,
merge_output=None, meta=None): merge_output=None, meta=None):
dirslist = [p for p in paths if os.path.isdir(p)] have_directories = False
fileslist = [p for p in paths if os.path.isfile(p)] have_files = False
if dirslist and fileslist: for f in gfiles:
if f.query_file_type(
Gio.FileQueryInfoFlags.NONE, None) == Gio.FileType.DIRECTORY:
have_directories = True
else:
have_files = True
if have_directories and have_files:
raise ValueError( raise ValueError(
_("Cannot compare a mixture of files and directories")) _("Cannot compare a mixture of files and directories"))
elif dirslist: elif have_directories:
return self.append_dirdiff(paths, auto_compare) return self.append_dirdiff(gfiles, auto_compare)
elif auto_merge: elif auto_merge:
return self.append_filemerge(paths, merge_output=merge_output) return self.append_filemerge(gfiles, merge_output=merge_output)
else: else:
return self.append_filediff( return self.append_filediff(
paths, merge_output=merge_output, meta=meta) gfiles, merge_output=merge_output, meta=meta)
def append_vcview(self, location, auto_compare=False): def append_vcview(self, location, auto_compare=False):
doc = vcview.VcView() doc = vcview.VcView()
self._append_page(doc, "meld-version-control") self._append_page(doc, "meld-version-control")
location = location[0] if isinstance(location, list) else location location = location[0] if isinstance(location, list) else location
doc.set_location(location) doc.set_location(location.get_path())
if auto_compare: if auto_compare:
doc.scheduler.add_task(doc.auto_compare) doc.scheduler.add_task(doc.auto_compare)
return doc return doc
def append_recent(self, uri): def append_recent(self, uri):
comparison_type, files, flags = recent_comparisons.read(uri) comparison_type, gfiles, flags = recent_comparisons.read(uri)
if comparison_type == recent.TYPE_MERGE: if comparison_type == recent.TYPE_MERGE:
tab = self.append_filemerge(files) tab = self.append_filemerge(gfiles)
elif comparison_type == recent.TYPE_FOLDER: elif comparison_type == recent.TYPE_FOLDER:
tab = self.append_dirdiff(files) tab = self.append_dirdiff(gfiles)
elif comparison_type == recent.TYPE_VC: elif comparison_type == recent.TYPE_VC:
# Files should be a single-element iterable # Files should be a single-element iterable
tab = self.append_vcview(files[0]) tab = self.append_vcview(gfiles[0])
else: # comparison_type == recent.TYPE_FILE: else: # comparison_type == recent.TYPE_FILE:
tab = self.append_filediff(files) tab = self.append_filediff(gfiles)
self.notebook.set_current_page(self.notebook.page_num(tab.widget)) self.notebook.set_current_page(self.notebook.page_num(tab.widget))
recent_comparisons.add(tab) recent_comparisons.add(tab)
return tab return tab
def _single_file_open(self, path): def _single_file_open(self, gfile):
doc = vcview.VcView() doc = vcview.VcView()
def cleanup(): def cleanup():
self.scheduler.remove_scheduler(doc.scheduler) self.scheduler.remove_scheduler(doc.scheduler)
self.scheduler.add_task(cleanup) self.scheduler.add_task(cleanup)
self.scheduler.add_scheduler(doc.scheduler) self.scheduler.add_scheduler(doc.scheduler)
path = os.path.abspath(path) path = gfile.get_path()
doc.set_location(path) doc.set_location(path)
doc.connect("create-diff", lambda obj, arg, kwargs: doc.connect("create-diff", lambda obj, arg, kwargs:
self.append_diff(arg, **kwargs)) self.append_diff(arg, **kwargs))
doc.run_diff(path) doc.run_diff(path)
def open_paths(self, paths, auto_compare=False, auto_merge=False, def open_paths(self, gfiles, auto_compare=False, auto_merge=False,
focus=False): focus=False):
tab = None tab = None
if len(paths) == 1: if len(gfiles) == 1:
a = paths[0] a = gfiles[0]
if os.path.isfile(a): if a.query_file_type(Gio.FileQueryInfoFlags.NONE, None) == \
self._single_file_open(a) Gio.FileType.DIRECTORY:
else:
tab = self.append_vcview(a, auto_compare) tab = self.append_vcview(a, auto_compare)
else:
self._single_file_open(a)
elif len(paths) in (2, 3): elif len(gfiles) in (2, 3):
tab = self.append_diff( tab = self.append_diff(gfiles, auto_compare=auto_compare,
paths, auto_compare=auto_compare, auto_merge=auto_merge) auto_merge=auto_merge)
if tab: if tab:
recent_comparisons.add(tab) recent_comparisons.add(tab)
if focus: if focus:
......
...@@ -249,7 +249,7 @@ def all_same(lst): ...@@ -249,7 +249,7 @@ def all_same(lst):
def shorten_names(*names): def shorten_names(*names):
"""Remove redunant parts of a list of names (e.g. /tmp/foo{1,2} -> foo{1,2} """Remove redunant parts of a list of names (e.g. /tmp/foo{1,2} -> foo{1,2}
""" """
# TODO: Update for different path separators # TODO: Update for different path separators and URIs
prefix = os.path.commonprefix(names) prefix = os.path.commonprefix(names)
prefixslash = prefix.rfind("/") + 1 prefixslash = prefix.rfind("/") + 1
...@@ -263,7 +263,7 @@ def shorten_names(*names): ...@@ -263,7 +263,7 @@ def shorten_names(*names):
else: else:
if all_same(basenames): if all_same(basenames):
def firstpart(alist): def firstpart(alist):
if len(alist) > 1: if len(alist) > 1 and alist[0]:
return "[%s] " % alist[0] return "[%s] " % alist[0]
else: else:
return "" return ""
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import os import os
from gi.repository import Gio
from gi.repository import GLib from gi.repository import GLib
from gi.repository import GObject from gi.repository import GObject
from gi.repository import Gtk from gi.repository import Gtk
...@@ -105,16 +106,9 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component): ...@@ -105,16 +106,9 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component):
def on_button_compare_clicked(self, *args): def on_button_compare_clicked(self, *args):
type_choosers = (self.file_chooser, self.dir_chooser, self.vc_chooser) type_choosers = (self.file_chooser, self.dir_chooser, self.vc_chooser)
compare_gfiles = [c.get_file() for c in
compare_paths = [] type_choosers[self.diff_type][:self._get_num_paths()]]
num_paths = self._get_num_paths() tab = self.diff_methods[self.diff_type](compare_gfiles)
for chooser in type_choosers[self.diff_type][:num_paths]:
gfile = chooser.get_file()
path = gfile.get_path() if gfile else ""
compare_paths.append(path)
# TODO: We should be migrating to passing around GFiles
tab = self.diff_methods[self.diff_type](compare_paths)
recent_comparisons.add(tab) recent_comparisons.add(tab)
self.emit('diff-created', tab) self.emit('diff-created', tab)
...@@ -122,8 +116,8 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component): ...@@ -122,8 +116,8 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component):
# TODO: This doesn't work the way I'd like for DirDiff and VCView. # TODO: This doesn't work the way I'd like for DirDiff and VCView.
# It should do something similar to FileDiff; give a tab with empty # It should do something similar to FileDiff; give a tab with empty
# file entries and no comparison done. # file entries and no comparison done.
compare_paths = [""] * self._get_num_paths() compare_gfiles = [Gio.File.new_for_path("")] * self._get_num_paths()
tab = self.diff_methods[self.diff_type](compare_paths) tab = self.diff_methods[self.diff_type](compare_gfiles)
self.emit('diff-created', tab) self.emit('diff-created', tab)
def on_container_switch_in_event(self, *args): def on_container_switch_in_event(self, *args):
......
...@@ -81,35 +81,35 @@ class RecentFiles(object): ...@@ -81,35 +81,35 @@ class RecentFiles(object):
The passed flags are currently ignored. In the future these are to be The passed flags are currently ignored. In the future these are to be
used for extra initialisation not captured by the tab itself. used for extra initialisation not captured by the tab itself.
""" """
comp_type, paths = tab.get_comparison() comp_type, uris = tab.get_comparison()
# While Meld handles comparisons including None, recording these as # While Meld handles comparisons including None, recording these as
# recently-used comparisons just isn't that sane. # recently-used comparisons just isn't that sane.
if None in paths: if None in uris:
return return
# If a (type, paths) comparison is already registered, then re-add # If a (type, uris) comparison is already registered, then re-add
# the corresponding comparison file # the corresponding comparison file
comparison_key = (comp_type, tuple(paths)) comparison_key = (comp_type, tuple(uris))
paths = [unicodeify(p) for p in paths] uris = [unicodeify(u) for u in uris]
if comparison_key in self._stored_comparisons: if comparison_key in self._stored_comparisons:
gio_file = Gio.File.new_for_uri( gfile = Gio.File.new_for_uri(
self._stored_comparisons[comparison_key]) self._stored_comparisons[comparison_key])
else: else:
recent_path = self._write_recent_file(comp_type, paths) recent_path = self._write_recent_file(comp_type, uris)
gio_file = Gio.File.new_for_path(recent_path) gfile = Gio.File.new_for_path(recent_path)
if len(paths) > 1: if len(uris) > 1:
display_name = " : ".join(meld.misc.shorten_names(*paths)) display_name = " : ".join(meld.misc.shorten_names(*uris))
else: else:
display_path = paths[0] display_path = uris[0]
userhome = os.path.expanduser("~") userhome = os.path.expanduser("~")
if display_path.startswith(userhome): if display_path.startswith(userhome):
# FIXME: What should we show on Windows? # FIXME: What should we show on Windows?
display_path = "~" + display_path[len(userhome):] display_path = "~" + display_path[len(userhome):]
display_name = _("Version control:") + " " + display_path display_name = _("Version control:") + " " + display_path
# FIXME: Should this be translatable? It's not actually used anywhere. # FIXME: Should this be translatable? It's not actually used anywhere.
description = "%s comparison\n%s" % (comp_type, ", ".join(paths)) description = "%s comparison\n%s" % (comp_type, ", ".join(uris))
recent_metadata = Gtk.RecentData() recent_metadata = Gtk.RecentData()
recent_metadata.mime_type = self.mime_type recent_metadata.mime_type = self.mime_type
...@@ -118,38 +118,45 @@ class RecentFiles(object): ...@@ -118,38 +118,45 @@ class RecentFiles(object):
recent_metadata.display_name = display_name recent_metadata.display_name = display_name
recent_metadata.description = description recent_metadata.description = description
recent_metadata.is_private = True recent_metadata.is_private = True
self.recent_manager.add_full(gio_file.get_uri(), recent_metadata) self.recent_manager.add_full(gfile.get_uri(), recent_metadata)