Skip to content

Commit

Permalink
ev-application: remove loading and saving of custom accels file
Browse files Browse the repository at this point in the history
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: 54f4371

The shortcuts documentation was later completely removed in
a050ee7 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 83a7a11

Relates !373
  • Loading branch information
pabloyoyoista authored and gpoo committed Jun 19, 2023
1 parent c6251bd commit 607dab9
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions shell/ev-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 607dab9

Please sign in to comment.