[nautilus/sandboxed-recent: 3/4] recent: Remove recent
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/sandboxed-recent: 3/4] recent: Remove recent
- Date: Thu, 14 Jun 2018 13:23:03 +0000 (UTC)
commit fd43da06beb2307ac3e7963b44e84bf8a2eaaed4
Author: Carlos Soriano <csoriano redhat com>
Date: Tue Jun 12 18:23:59 2018 +0200
recent: Remove recent
The custom handling is used only in one place, and it's simply creating
some wrapper around GtkRecentManager.
In a future commit we would need to provide some API for the simple case
of a adding an URI, which is what GtkRecentManager does by default,
so it's even more useless.
This commits removes the recent file.
src/meson.build | 2 -
src/nautilus-program-choosing.c | 53 ++++++++++++++++++++++++-
src/nautilus-recent.c | 87 -----------------------------------------
src/nautilus-recent.h | 8 ----
4 files changed, 51 insertions(+), 99 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 3f7ae077d..d3b44c414 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -217,8 +217,6 @@ libnautilus_sources = [
'nautilus-progress-info-manager.h',
'nautilus-program-choosing.c',
'nautilus-program-choosing.h',
- 'nautilus-recent.c',
- 'nautilus-recent.h',
'nautilus-search-directory.c',
'nautilus-search-directory.h',
'nautilus-search-directory-file.c',
diff --git a/src/nautilus-program-choosing.c b/src/nautilus-program-choosing.c
index 81a9dee58..84d9e6abd 100644
--- a/src/nautilus-program-choosing.c
+++ b/src/nautilus-program-choosing.c
@@ -25,8 +25,8 @@
#include "nautilus-global-preferences.h"
#include "nautilus-icon-info.h"
-#include "nautilus-recent.h"
#include "nautilus-ui-utilities.h"
+#include <eel/eel-vfs-extensions.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
@@ -36,6 +36,55 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+static void
+add_file_to_recent (NautilusFile *file,
+ GAppInfo *application)
+{
+ GtkRecentData recent_data;
+ char *uri;
+
+ uri = nautilus_file_get_activation_uri (file);
+ if (uri == NULL)
+ {
+ uri = nautilus_file_get_uri (file);
+ }
+
+ /* do not add trash:// etc */
+ if (eel_uri_is_trash (uri) ||
+ eel_uri_is_search (uri) ||
+ eel_uri_is_recent (uri))
+ {
+ g_free (uri);
+ return;
+ }
+
+ recent_data.display_name = NULL;
+ recent_data.description = NULL;
+
+ recent_data.mime_type = nautilus_file_get_mime_type (file);
+ recent_data.app_name = g_strdup (g_get_application_name ());
+
+ if (application != NULL)
+ {
+ recent_data.app_exec = g_strdup (g_app_info_get_commandline (application));
+ }
+ else
+ {
+ recent_data.app_exec = g_strdup ("gio open");
+ }
+
+ recent_data.groups = NULL;
+ recent_data.is_private = FALSE;
+
+ gtk_recent_manager_add_full (gtk_recent_manager_get_default (),
+ uri, &recent_data);
+
+ g_free (recent_data.mime_type);
+ g_free (recent_data.app_name);
+ g_free (recent_data.app_exec);
+
+ g_free (uri);
+}
void
nautilus_launch_application_for_mount (GAppInfo *app_info,
GMount *mount,
@@ -186,7 +235,7 @@ nautilus_launch_application_by_uri (GAppInfo *application,
for (l = uris; l != NULL; l = l->next)
{
file = nautilus_file_get_by_uri (l->data);
- nautilus_recent_add_file (file, application);
+ add_file_to_recent (file, application);
nautilus_file_unref (file);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]