[empathy/gnome-3-12] roster-window: Fix the GActions not working



commit 27de2c6f036b1e2f1d8882ca249755bf33ac1e2f
Author: Daniel Boles <dboles src gnome org>
Date:   Thu Dec 1 04:10:54 2016 +0000

    roster-window: Fix the GActions not working
    
    Underscores are not allowed in GAction names. This led to a pile of
    warnings during startup and ultimately none of these actions working.
    Fix by substituting the underscores with hyphens, an allowed character.
    
    We can also omit the NULLs in the GActionEntries, as they are implied:
    struct fields not explicitly initialised are zero-initialised anyway.

 src/empathy-roster-window-menubar.ui |   30 +++++++++---------
 src/empathy-roster-window.c          |   56 +++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 43 deletions(-)
---
diff --git a/src/empathy-roster-window-menubar.ui b/src/empathy-roster-window-menubar.ui
index f364d79..21170db 100644
--- a/src/empathy-roster-window-menubar.ui
+++ b/src/empathy-roster-window-menubar.ui
@@ -5,12 +5,12 @@
       <section>
         <item>
           <attribute translatable="yes" name="label">_New Conversation…</attribute>
-          <attribute name="action">win.chat_new_message</attribute>
+          <attribute name="action">win.chat-new-message</attribute>
           <attribute name="accel">&lt;Primary&gt;n</attribute>
         </item>
         <item>
           <attribute translatable="yes" name="label">New _Call…</attribute>
-          <attribute name="action">win.chat_new_call</attribute>
+          <attribute name="action">win.chat-new-call</attribute>
           <attribute name="accel">&lt;Primary&gt;m</attribute>
         </item>
       </section>
@@ -19,17 +19,17 @@
         <section>
           <item>
             <attribute translatable="yes" name="label">_Add Contacts…</attribute>
-            <attribute name="action">win.chat_add_contact</attribute>
+            <attribute name="action">win.chat-add-contact</attribute>
           </item>
           <item>
             <attribute translatable="yes" name="label">_Search for Contacts…</attribute>
-            <attribute name="action">win.chat_search_contacts</attribute>
+            <attribute name="action">win.chat-search-contacts</attribute>
           </item>
         </section>
         <section>
           <item>
             <attribute translatable="yes" name="label">_Blocked Contacts</attribute>
-            <attribute name="action">win.edit_blocked_contacts</attribute>
+            <attribute name="action">win.edit-blocked-contacts</attribute>
           </item>
         </section>
       </submenu>
@@ -38,12 +38,12 @@
         <section>
           <item>
             <attribute translatable="yes" name="label">_Join…</attribute>
-            <attribute name="action">win.room_join_new</attribute>
+            <attribute name="action">win.room-join-new</attribute>
             <attribute name="accel">&lt;Primary&gt;j</attribute>
           </item>
           <item>
             <attribute translatable="yes" name="label">Join _Favorites</attribute>
-            <attribute name="action">win.room_join_favorites</attribute>
+            <attribute name="action">win.room-join-favorites</attribute>
             <attribute name="accel">F5</attribute>
           </item>
         </section>
@@ -53,45 +53,45 @@
         <section>
           <item>
             <attribute translatable="yes" name="label">_Manage Favorites</attribute>
-            <attribute name="action">win.room_manage_favorites</attribute>
+            <attribute name="action">win.room-manage-favorites</attribute>
           </item>
         </section>
       </submenu>
       <section>
         <item>
           <attribute translatable="yes" name="label">_Previous Conversations</attribute>
-          <attribute name="action">win.view_history</attribute>
+          <attribute name="action">win.view-history</attribute>
           <attribute name="accel">F3</attribute>
         </item>
         <item>
           <attribute translatable="yes" name="label">_File Transfers</attribute>
-          <attribute name="action">win.view_show_ft_manager</attribute>
+          <attribute name="action">win.view-show-ft-manager</attribute>
         </item>
       </section>
       <section>
         <item>
           <attribute translatable="yes" name="label">_Accounts</attribute>
-          <attribute name="action">win.edit_accounts</attribute>
+          <attribute name="action">win.edit-accounts</attribute>
           <attribute name="accel">F4</attribute>
         </item>
         <item>
           <attribute translatable="yes" name="label">P_references</attribute>
-          <attribute name="action">win.edit_preferences</attribute>
+          <attribute name="action">win.edit-preferences</attribute>
         </item>
       </section>
       <section>
         <item>
           <attribute translatable="yes" name="label">Help</attribute>
-          <attribute name="action">win.help_contents</attribute>
+          <attribute name="action">win.help-contents</attribute>
           <attribute name="accel">F1</attribute>
         </item>
         <item>
           <attribute translatable="yes" name="label">About</attribute>
-          <attribute name="action">win.help_about</attribute>
+          <attribute name="action">win.help-about</attribute>
         </item>
        <item>
           <attribute translatable="yes" name="label">_Quit</attribute>
-          <attribute name="action">win.chat_quit</attribute>
+          <attribute name="action">win.chat-quit</attribute>
           <attribute name="accel">&lt;Primary&gt;q</attribute>
        </item>
       </section>
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index b953e0e..825bd03 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -789,7 +789,7 @@ roster_window_update_status (EmpathyRosterWindow *self)
   for (l = self->priv->actions_connected; l; l = l->next)
     g_simple_action_set_enabled (l->data, connected);
 
-  action = g_action_map_lookup_action (G_ACTION_MAP (self), "chat_add_contact");
+  action = g_action_map_lookup_action (G_ACTION_MAP (self), "chat-add-contact");
   if (!can_add_contact (self))
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 }
@@ -1759,13 +1759,13 @@ roster_window_connection_items_setup (EmpathyRosterWindow *self)
 {
   guint i;
   const gchar *actions_connected[] = {
-      "room_join_new",
-      "room_join_favorites",
-      "chat_new_message",
-      "chat_new_call",
-      "chat_search_contacts",
-      "chat_add_contact",
-      "edit_blocked_contacts",
+      "room-join-new",
+      "room-join-favorites",
+      "chat-new-message",
+      "chat-new-call",
+      "chat-search-contacts",
+      "chat-add-contact",
+      "edit-blocked-contacts",
   };
 
   for (i = 0; i < G_N_ELEMENTS (actions_connected); i++)
@@ -1876,26 +1876,26 @@ empathy_roster_window_constructor (GType type,
 }
 
 static GActionEntry menubar_entries[] = {
-  { "chat_new_message", roster_window_chat_new_message_cb, NULL, NULL, NULL },
-  { "chat_new_call", roster_window_chat_new_call_cb, NULL, NULL, NULL },
-  { "chat_add_contact", roster_window_chat_add_contact_cb, NULL, NULL, NULL },
-  { "chat_search_contacts", roster_window_chat_search_contacts_cb, NULL, NULL, NULL },
-  { "chat_quit", roster_window_chat_quit_cb, NULL, NULL, NULL },
-
-  { "edit_accounts", roster_window_edit_accounts_cb, NULL, NULL, NULL },
-  { "edit_blocked_contacts", roster_window_edit_blocked_contacts_cb, NULL, NULL, NULL },
-  { "edit_preferences", roster_window_edit_preferences_cb, NULL, NULL, NULL },
-
-  { "view_history", roster_window_view_history_cb, NULL, NULL, NULL },
-  { "view_show_ft_manager", roster_window_view_show_ft_manager, NULL, NULL, NULL },
-
-  { "room_join_new", roster_window_room_join_new_cb, NULL, NULL, NULL },
-  { "room_join_favorites", roster_window_room_join_favorites_cb, NULL, NULL, NULL },
-  { "join", roster_window_join_chatroom_menu_activate_cb, "(ss)", NULL, NULL },
-  { "room_manage_favorites", roster_window_room_manage_favorites_cb, NULL, NULL, NULL },
-
-  { "help_contents", roster_window_help_contents_cb, NULL, NULL, NULL },
-  { "help_about", roster_window_help_about_cb, NULL, NULL, NULL },
+  {"chat-new-message", roster_window_chat_new_message_cb},
+  {"chat-new-call", roster_window_chat_new_call_cb},
+  {"chat-add-contact", roster_window_chat_add_contact_cb},
+  {"chat-search-contacts", roster_window_chat_search_contacts_cb},
+  {"chat-quit", roster_window_chat_quit_cb},
+
+  {"edit-accounts", roster_window_edit_accounts_cb},
+  {"edit-blocked-contacts", roster_window_edit_blocked_contacts_cb},
+  {"edit-preferences", roster_window_edit_preferences_cb},
+
+  {"view-history", roster_window_view_history_cb},
+  {"view-show-ft-manager", roster_window_view_show_ft_manager},
+
+  {"room-join-new", roster_window_room_join_new_cb},
+  {"room-join-favorites", roster_window_room_join_favorites_cb},
+  {"join", roster_window_join_chatroom_menu_activate_cb, "(ss)"},
+  {"room-manage-favorites", roster_window_room_manage_favorites_cb},
+
+  {"help-contents", roster_window_help_contents_cb},
+  {"help-about", roster_window_help_about_cb},
 };
 
 static void


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