From 2f25c9297f7de0d3caa5e2870f1b2af9e2d5de55 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Mon, 13 Apr 2020 16:50:20 +0200 Subject: [PATCH] Use URI to identify bookmarks instead of md5 checksum in order to simplify modifications in accels.scm (Bug #16691) --- thunar/thunar-window.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index b5e2f0fd..d94e313a 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -2181,14 +2181,12 @@ thunar_window_bookmark_add_menu_item (GFile *file_path, gpointer user_data) { ThunarWindow *window = THUNAR_WINDOW (user_data); - GChecksum *checksum; gchar *uri; ThunarFile *file; gchar *parse_name; gchar *accel_path; gchar *tooltip; gchar *remote_name = NULL; - const gchar *unique_name; GtkIconTheme *icon_theme; const gchar *icon_name; GtkWidget *menu_item = NULL; @@ -2198,20 +2196,16 @@ thunar_window_bookmark_add_menu_item (GFile *file_path, _thunar_return_if_fail (name == NULL || g_utf8_validate (name, -1, NULL)); _thunar_return_if_fail (THUNAR_IS_WINDOW (window)); - /* create unique id based on the uri */ - uri = g_file_get_uri (file_path); - checksum = g_checksum_new (G_CHECKSUM_MD5); - g_checksum_update (checksum, (const guchar *) uri, strlen (uri)); - unique_name = g_checksum_get_string (checksum); - accel_path = g_strconcat("/ThunarBookmarks/", unique_name, NULL); - g_free (uri); - parse_name = g_file_get_parse_name (file_path); tooltip = g_strdup_printf (_("Open the location \"%s\""), parse_name); g_free (parse_name); icon_theme = gtk_icon_theme_get_for_screen (gtk_window_get_screen (GTK_WINDOW (window))); + uri = g_file_get_uri (file_path); + accel_path = g_strdup_printf("/ThunarBookmarks/%s", uri); + g_free (uri); + if (g_file_has_uri_scheme (file_path, "file")) { /* try to open the file corresponding to the uri */ @@ -2259,7 +2253,6 @@ thunar_window_bookmark_add_menu_item (GFile *file_path, g_free (tooltip); g_free (accel_path); - g_checksum_free (checksum); } -- 2.25.1