aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-02 10:56:46 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-02 11:24:40 +0100
commitbaaca4c58f92115676638599fa50c35b50351f9c (patch)
treedb517542b414c11ff8e0be5d03373a409d892027 /src
parent7499f92811cadbd5928dab8d092014bc72aa2b1d (diff)
downloadlogdiag-baaca4c58f92115676638599fa50c35b50351f9c.tar.gz
logdiag-baaca4c58f92115676638599fa50c35b50351f9c.tar.xz
logdiag-baaca4c58f92115676638599fa50c35b50351f9c.zip
Add all opened files to the recent list
The GTK+ file open/save dialog has already been adding them, but opening files from the command line would circumvent that path.
Diffstat (limited to 'src')
-rw-r--r--src/ld-window-main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index cbf9fd9..51769f6 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -712,9 +712,10 @@ diagram_save (LdWindowMain *self, GtkWindow *dialog_parent,
static gboolean
diagram_open (LdWindowMain *self, const gchar *filename)
{
- GError *error;
+ GError *error = NULL;
+ GFile *file;
+ gchar *uri;
- error = NULL;
ld_diagram_load_from_file (self->priv->diagram, filename, &error);
if (error)
{
@@ -748,6 +749,12 @@ diagram_open (LdWindowMain *self, const gchar *filename)
return FALSE;
}
+ file = g_file_new_for_path (filename);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+ gtk_recent_manager_add_item (gtk_recent_manager_get_default (), uri);
+ g_free (uri);
+
ld_diagram_set_modified (self->priv->diagram, FALSE);
diagram_set_filename (self, g_strdup (filename));
return TRUE;