gtk+ r22290 - in trunk: . gtk



Author: matthiasc
Date: Sat Feb  7 03:17:43 2009
New Revision: 22290
URL: http://svn.gnome.org/viewvc/gtk+?rev=22290&view=rev

Log:
        Make the new GtkAction code work with PolicyKit-gnome's use of actions.

        * gtk/gtkaction.c (gtk_action_[un]block_activate_from): Block
        the action.

        * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_activatable_reset):
        * gtk/gtktogglebutton. (gtk_toggle_button_activatable_reset):
        * gtk/gtktoggletoolbutton.c (gtk_toggle_tool_button_activatable_reset):
        Work with non-toggle actions without complaining.

        * gtk/gtktoolbutton.c (gtk_tool_button_activatable_update): Updating
        the icon-name should not remove the label.

        * gtk/gtkimagemenuitem.c (activatable_update_icon_name): Also
        update the image when the icon name is set to NULL.



Modified:
   trunk/ChangeLog
   trunk/gtk/gtkaction.c
   trunk/gtk/gtkcheckmenuitem.c
   trunk/gtk/gtkimagemenuitem.c
   trunk/gtk/gtktogglebutton.c
   trunk/gtk/gtktoggletoolbutton.c
   trunk/gtk/gtktoolbutton.c

Modified: trunk/gtk/gtkaction.c
==============================================================================
--- trunk/gtk/gtkaction.c	(original)
+++ trunk/gtk/gtkaction.c	Sat Feb  7 03:17:43 2009
@@ -1509,8 +1509,6 @@
 
   g_return_if_fail (GTK_IS_ACTION (action));
 
-  g_return_if_fail (GTK_IS_ACTION (action));
-
   tmp = action->private_data->icon_name;
   action->private_data->icon_name = g_strdup (icon_name);
   g_free (tmp);
@@ -1604,6 +1602,8 @@
   
   g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate),
 				   action);
+
+  gtk_action_block_activate (action);
 }
 
 /**
@@ -1630,6 +1630,8 @@
 
   g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate),
 				     action);
+
+  gtk_action_unblock_activate (action);
 }
 
 static void

Modified: trunk/gtk/gtkcheckmenuitem.c
==============================================================================
--- trunk/gtk/gtkcheckmenuitem.c	(original)
+++ trunk/gtk/gtkcheckmenuitem.c	Sat Feb  7 03:17:43 2009
@@ -188,7 +188,7 @@
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   gtk_action_block_activate (action);

Modified: trunk/gtk/gtkimagemenuitem.c
==============================================================================
--- trunk/gtk/gtkimagemenuitem.c	(original)
+++ trunk/gtk/gtkimagemenuitem.c	Sat Feb  7 03:17:43 2009
@@ -601,7 +601,7 @@
 
   image = gtk_image_menu_item_get_image (image_menu_item);
 	  
-  if (GTK_IS_IMAGE (image) && icon_name &&
+  if (GTK_IS_IMAGE (image) && 
       (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY ||
        gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME))
     {

Modified: trunk/gtk/gtktogglebutton.c
==============================================================================
--- trunk/gtk/gtktogglebutton.c	(original)
+++ trunk/gtk/gtktogglebutton.c	Sat Feb  7 03:17:43 2009
@@ -188,7 +188,7 @@
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   button = GTK_TOGGLE_BUTTON (activatable);

Modified: trunk/gtk/gtktoggletoolbutton.c
==============================================================================
--- trunk/gtk/gtktoggletoolbutton.c	(original)
+++ trunk/gtk/gtktoggletoolbutton.c	Sat Feb  7 03:17:43 2009
@@ -346,7 +346,7 @@
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   button = GTK_TOGGLE_TOOL_BUTTON (activatable);

Modified: trunk/gtk/gtktoolbutton.c
==============================================================================
--- trunk/gtk/gtktoolbutton.c	(original)
+++ trunk/gtk/gtktoolbutton.c	Sat Feb  7 03:17:43 2009
@@ -760,24 +760,9 @@
   button = GTK_TOOL_BUTTON (activatable);
   
   if (strcmp (property_name, "short-label") == 0)
-    {
-      if (!gtk_action_get_stock_id (action) &&
-	  !gtk_action_get_icon_name (action))
-	{
-	  gtk_tool_button_set_use_underline (button, TRUE);
-	  gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
-	}
-    }
+    gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
   else if (strcmp (property_name, "stock-id") == 0)
-    {
-      if (gtk_action_get_stock_id (action))
-	{	
-	  gtk_tool_button_set_label (button, NULL);
-	  gtk_tool_button_set_icon_name (button, NULL);
-	}
-      gtk_tool_button_set_icon_widget (button, NULL);
-      gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
-    }
+    gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
   else if (strcmp (property_name, "gicon") == 0)
     {
       const gchar *stock_id = gtk_action_get_stock_id (action);
@@ -800,14 +785,7 @@
 
     }
   else if (strcmp (property_name, "icon-name") == 0)
-    {
-      if (gtk_action_get_icon_name (action))
-	{	
-	  gtk_tool_button_set_label (button, NULL);
-	  gtk_tool_button_set_stock_id (button, NULL);
-	}
-      gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
-    }
+    gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
 }
 
 static void



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