From 607dab949e834913f3f3de9f183de393a7977d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Sat, 20 May 2023 08:28:46 +0200 Subject: [PATCH] ev-application: remove loading and saving of custom accels file This is an undocumented feature, since the ability to change shortcuts was removed somewhere in GTK 3.10, according to the commit that updated the documentation: 54f43719c658a0bff3946bf2be2a7a76d679773a The shortcuts documentation was later completely removed in a050ee73d7a55b489c085ff81e654c656043e1fa since the help-overlay in the shell takes care of it. Another reason to drop this is the lack of first-class support in GTK4: "There is no direct replacement for loading and saving accelerators with GtkAccelMap. But since GtkShortcutController implements GListModel and both GtkShortcutTrigger and GtkShortcutAction can be serialized to strings, it is relatively easy to implement saving and loading yourself." So in GTK4 it's possible, but requires further development. Which is likely of very little use for an undocumented feature introduced 15 years ago as a copy-paste in 83a7a11ba109b8aee5cdc047dec8b93967ccfc0e Relates !373 --- shell/ev-application.c | 44 ------------------------------------------ 1 file changed, 44 deletions(-) diff --git a/shell/ev-application.c b/shell/ev-application.c index 5507f44da..ac60e47f2 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -809,46 +809,6 @@ ev_application_open_uri_list (EvApplication *application, } } -static void -ev_application_accel_map_save (EvApplication *application) -{ - gchar *accel_map_file; - gchar *tmp_filename; - gint fd; - - accel_map_file = g_build_filename (application->dot_dir, "accels", NULL); - tmp_filename = g_strdup_printf ("%s.XXXXXX", accel_map_file); - - fd = g_mkstemp (tmp_filename); - if (fd == -1) { - g_free (accel_map_file); - g_free (tmp_filename); - - return; - } - gtk_accel_map_save_fd (fd); - close (fd); - - g_mkdir_with_parents (application->dot_dir, 0700); - if (g_rename (tmp_filename, accel_map_file) == -1) { - /* FIXME: win32? */ - g_unlink (tmp_filename); - } - - g_free (accel_map_file); - g_free (tmp_filename); -} - -static void -ev_application_accel_map_load (EvApplication *application) -{ - gchar *accel_map_file; - - accel_map_file = g_build_filename (application->dot_dir, "accels", NULL); - gtk_accel_map_load (accel_map_file); - g_free (accel_map_file); -} - static void ev_application_startup (GApplication *gapplication) { @@ -926,8 +886,6 @@ ev_application_shutdown (GApplication *gapplication) #endif g_clear_pointer (&application->uri, g_free); - ev_application_accel_map_save (application); - g_clear_pointer (&application->dot_dir, g_free); G_APPLICATION_CLASS (ev_application_parent_class)->shutdown (gapplication); @@ -1027,8 +985,6 @@ ev_application_init (EvApplication *ev_application) { ev_application->dot_dir = g_build_filename (g_get_user_config_dir (), "evince", NULL); - - ev_application_accel_map_load (ev_application); } gboolean