[sound-juicer] Replace call to deprecated function



commit 3416577b1bb8fc3b31c24eac825de4a356dd81b2
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Fri Sep 9 17:13:09 2016 +0100

    Replace call to deprecated function
    
    gtk_application_add_accelerator() has been replaced by
    gtk_application_set_accels_for_action().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771107

 src/sj-main.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/sj-main.c b/src/sj-main.c
index 402e1da..430f1a7 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -1762,9 +1762,23 @@ add_editable_listview_column (const char       *title,
   return renderer;
 }
 
+/*
+ * Action accelerator definitions. For each action the first entry is
+ * the detailed name of the action followed by up to 3 accelerators
+ * followed by NULL.
+ */
+static const gchar *action_accels[][5] = {
+  { "win.play", "<Primary>p", NULL },
+  { "win.next-track", "<Primary>n", NULL },
+  { "win.previous-track", "<Primary>b", NULL},
+  { "win.select-all", "<Primary>a", NULL},
+  { "win.deselect-all", "<Primary><Shift>a", NULL}
+};
+
 static void
 startup_cb (GApplication *app, gpointer user_data)
 {
+  gsize i;
   GtkTreeSelection *selection;
   GError *error = NULL;
 
@@ -1841,16 +1855,10 @@ startup_cb (GApplication *app, gpointer user_data)
   gtk_actionable_set_action_name(GTK_ACTIONABLE(play_button), "win.play");
 
   /* window actions are only available via shortcuts */
-  gtk_application_add_accelerator (GTK_APPLICATION (app),
-                                   "<Primary>p", "win.play", NULL);
-  gtk_application_add_accelerator (GTK_APPLICATION (app),
-                                   "<Primary>n", "win.next-track", NULL);
-  gtk_application_add_accelerator (GTK_APPLICATION (app),
-                                   "<Primary>b", "win.previous-track", NULL);
-  gtk_application_add_accelerator (GTK_APPLICATION (app),
-                                   "<Primary>a", "win.select-all", NULL);
-  gtk_application_add_accelerator (GTK_APPLICATION (app),
-                                   "<Primary><Shift>a", "win.deselect-all", NULL);
+  for (i = 0; i < G_N_ELEMENTS (action_accels); i++)
+    gtk_application_set_accels_for_action (GTK_APPLICATION (app),
+                                           action_accels[i][0],
+                                           &action_accels[i][1]);
 
   { /* ensure that the play/pause button's size is constant */
     GtkWidget *fake_button1, *fake_button2;


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