[totem] main: Use set_accels_for_action()



commit 5f790114fb4e13a621840edbffd6759e655dfe3d
Author: Bastien Nocera <hadess hadess net>
Date:   Fri May 30 18:06:05 2014 +0200

    main: Use set_accels_for_action()
    
    Instead of add_accelerator() and remove_accelerator().

 src/totem-grilo.c |    3 ++-
 src/totem-menu.c  |   14 +++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index 81c6c53..02ff025 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -2183,6 +2183,7 @@ static void
 setup_browse (TotemGrilo *self)
 {
        GtkAdjustment *adj;
+       const char const * select_all_accels[] = { "<Primary>A", NULL };
 
        /* Search */
        gtk_search_bar_connect_entry (GTK_SEARCH_BAR (self->priv->search_bar),
@@ -2203,7 +2204,7 @@ setup_browse (TotemGrilo *self)
        g_signal_connect (G_OBJECT (self->priv->select_all_action), "activate",
                          G_CALLBACK (select_all_action_cb), self);
        g_action_map_add_action (G_ACTION_MAP (self->priv->totem), G_ACTION (self->priv->select_all_action));
-       gtk_application_add_accelerator (GTK_APPLICATION (self->priv->totem), "<Primary>A", "app.select-all", 
NULL);
+       gtk_application_set_accels_for_action (GTK_APPLICATION (self->priv->totem), "app.select-all", 
select_all_accels);
        g_object_bind_property (self->priv->header, "select-mode",
                                self->priv->select_all_action, "enabled",
                                G_BINDING_SYNC_CREATE);
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 7b0010b..800e58d 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -280,6 +280,7 @@ void
 totem_app_menu_setup (Totem *totem)
 {
        GMenuModel *appmenu;
+       char *accels[] = { NULL, NULL };
 
        g_action_map_add_action_entries (G_ACTION_MAP (totem), app_entries, G_N_ELEMENTS (app_entries), 
totem);
 
@@ -287,11 +288,14 @@ totem_app_menu_setup (Totem *totem)
        gtk_application_set_app_menu (GTK_APPLICATION (totem), appmenu);
 
        /* FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=700085 */
-       gtk_application_add_accelerator (GTK_APPLICATION (totem), "<Primary>G", "app.next-angle", NULL);
-       gtk_application_add_accelerator (GTK_APPLICATION (totem), "<Primary>M", "app.root-menu", NULL);
-       gtk_application_add_accelerator (GTK_APPLICATION (totem), "<Primary>P", "app.properties", NULL);
-       gtk_application_add_accelerator (GTK_APPLICATION (totem), "<Primary>E", "app.eject", NULL);
-
+       accels[0] = "<Primary>G";
+       gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.next-angle", (const char * const 
*) accels);
+       accels[0] = "<Primary>M";
+       gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.root-menu", (const char * const 
*) accels);
+       accels[0] = "<Primary>P";
+       gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.properties", (const char * const 
*) accels);
+       accels[0] = "<Primary>E";
+       gtk_application_set_accels_for_action (GTK_APPLICATION (totem), "app.eject", (const char * const *) 
accels);
        gtk_window_set_application (GTK_WINDOW (totem->win), GTK_APPLICATION (totem));
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]