Make actions work with named icons. (#323484, Jorn Baayen)
2006-03-13 Matthias Clasen <mclasen@redhat.com> Make actions work with named icons. (#323484, Jorn Baayen) * gtk/gtkactiongroup.c: If the stock-id field of a GtkActionEntry does not contain a registered stock id, interpret it as an icon name. * gtk/gtkaction.c: Add an icon-name property to actions and use it for icons if a stock-id is not specified.
This commit is contained in:
		 Matthias Clasen
					Matthias Clasen
				
			
				
					committed by
					
						 Matthias Clasen
						Matthias Clasen
					
				
			
			
				
	
			
			
			 Matthias Clasen
						Matthias Clasen
					
				
			
						parent
						
							a83b615863
						
					
				
				
					commit
					fe7a5ebb7b
				
			| @ -777,8 +777,18 @@ gtk_action_group_add_actions_full (GtkActionGroup       *action_group, | ||||
|       action = gtk_action_new (entries[i].name, | ||||
| 			       label, | ||||
| 			       tooltip, | ||||
| 			       entries[i].stock_id); | ||||
| 			       NULL); | ||||
|  | ||||
|       if (entries[i].stock_id)  | ||||
| 	{ | ||||
| 	  GtkStockItem item; | ||||
|  | ||||
| 	  if (gtk_stock_lookup (entries[i].stock_id, &item)) | ||||
| 	    g_object_set (action, "stock-id", entries[i].stock_id, NULL); | ||||
| 	  else | ||||
| 	    g_object_set (action, "icon-name", entries[i].stock_id, NULL); | ||||
| 	} | ||||
| 	   | ||||
|       if (entries[i].callback) | ||||
| 	{ | ||||
| 	  GClosure *closure; | ||||
| @ -873,7 +883,17 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup             *action_gro | ||||
|       action = gtk_toggle_action_new (entries[i].name, | ||||
| 				      label, | ||||
| 				      tooltip, | ||||
| 				      entries[i].stock_id); | ||||
| 				      NULL); | ||||
|  | ||||
|       if (entries[i].stock_id)  | ||||
| 	{ | ||||
| 	  GtkStockItem item; | ||||
|  | ||||
| 	  if (gtk_stock_lookup (entries[i].stock_id, &item)) | ||||
| 	    g_object_set (action, "stock-id", entries[i].stock_id, NULL); | ||||
| 	  else | ||||
| 	    g_object_set (action, "icon-name", entries[i].stock_id, NULL); | ||||
| 	} | ||||
|  | ||||
|       gtk_toggle_action_set_active (action, entries[i].is_active); | ||||
|  | ||||
| @ -977,9 +997,19 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup            *action_group | ||||
|       action = gtk_radio_action_new (entries[i].name, | ||||
| 				     label, | ||||
| 				     tooltip, | ||||
| 				     entries[i].stock_id, | ||||
| 				     NULL, | ||||
| 				     entries[i].value); | ||||
|  | ||||
|       if (entries[i].stock_id)  | ||||
| 	{ | ||||
| 	  GtkStockItem item; | ||||
|  | ||||
| 	  if (gtk_stock_lookup (entries[i].stock_id, &item)) | ||||
| 	    g_object_set (action, "stock-id", entries[i].stock_id, NULL); | ||||
| 	  else | ||||
| 	    g_object_set (action, "icon-name", entries[i].stock_id, NULL); | ||||
| 	} | ||||
|  | ||||
|       if (i == 0)  | ||||
| 	first_action = action; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user