[Libreoffice-commits] .: Branch 'feature/unitymenus' - vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 27 03:29:23 PDT 2012


 vcl/unx/gtk/window/gloactiongroup.cxx |   17 +++++++++++++++--
 vcl/unx/gtk/window/gtksalmenu.cxx     |    4 +---
 2 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit dacd6fc042074a205c89e8fcf8ed482da9ac1483
Author: Antonio Fernandez <antonio.fernandez at aentos.es>
Date:   Thu Sep 27 11:28:44 2012 +0100

    All special items are now correctly displayed.
    
    Change-Id: Ifce96d3e740a7ac89132dd23f9f51447e4372716

diff --git a/vcl/unx/gtk/window/gloactiongroup.cxx b/vcl/unx/gtk/window/gloactiongroup.cxx
index 37a2278..756779a 100644
--- a/vcl/unx/gtk/window/gloactiongroup.cxx
+++ b/vcl/unx/gtk/window/gloactiongroup.cxx
@@ -219,8 +219,15 @@ g_lo_action_group_change_state (GActionGroup *group,
                 g_lo_action_group_perform_submenu_action (lo_group, action_name, value);
             else
             {
+                gboolean is_new = FALSE;
+
+                /* If action already exists but has no state, it should be removed and added again. */
                 if (action->state_type == NULL)
+                {
+                    g_action_group_action_removed (G_ACTION_GROUP (group), action_name);
                     action->state_type = g_variant_type_copy (g_variant_get_type(value));
+                    is_new = TRUE;
+                }
 
                 if (g_variant_is_of_type (value, action->state_type) == TRUE)
                 {
@@ -229,7 +236,10 @@ g_lo_action_group_change_state (GActionGroup *group,
 
                     action->state = g_variant_ref (value);
 
-                    g_action_group_action_state_changed (group, action_name, value);
+                    if (is_new)
+                        g_action_group_action_added (G_ACTION_GROUP (group), action_name);
+                    else
+                        g_action_group_action_state_changed (group, action_name, value);
                 }
             }
         }
@@ -241,13 +251,16 @@ g_lo_action_group_change_state (GActionGroup *group,
 static void
 g_lo_action_group_activate (GActionGroup *group,
                             const gchar  *action_name,
-                            GVariant     */*parameter */)
+                            GVariant     *parameter)
 {
     GTK_YIELD_GRAB();
 
     GLOActionGroup *lo_group = G_LO_ACTION_GROUP (group);
     GtkSalFrame *pFrame = lo_group->priv->frame;
 
+    if ( parameter != NULL )
+        g_action_group_change_action_state( group, action_name, parameter );
+
     if ( pFrame != NULL )
     {
         GtkSalMenu* pSalMenu = static_cast< GtkSalMenu* >( pFrame->GetMenu() );
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index fa80ec4..1bfa247 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -321,9 +321,7 @@ static void NativeCheckItem( GLOMenu*        pMenu,
         GVariant *pCurrentState = g_action_group_get_action_state( G_ACTION_GROUP( pActionGroup ), aCommand );
 
         if ( bits & MIB_RADIOCHECK )
-        {
             pCheckValue = ( bCheck == TRUE ) ? g_variant_new_string( aCommand ) : g_variant_new_string( "" );
-        }
         else
         {
             // By default, all checked items are checkmark buttons.
@@ -334,7 +332,7 @@ static void NativeCheckItem( GLOMenu*        pMenu,
         if ( pCheckValue != NULL && ( pCurrentState == NULL || g_variant_equal( pCurrentState, pCheckValue ) == FALSE ) )
             g_action_group_change_action_state( G_ACTION_GROUP( pActionGroup ), aCommand, pCheckValue );
 
-        if ( pCurrentState )
+        if ( pCurrentState != NULL )
             g_variant_unref( pCurrentState );
     }
 


More information about the Libreoffice-commits mailing list