mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	src/action.c: Provide generic parsing of XML action arguments
.. and use it within src/config/rcxml.c and src/menu/menu.c. This fixes being unable to use the `direction` argument in menu entries. Reported-by: mahk via IRC
This commit is contained in:
		
							parent
							
								
									7ad5490ff0
								
							
						
					
					
						commit
						7cc80b7a99
					
				
					 4 changed files with 32 additions and 33 deletions
				
			
		
							
								
								
									
										26
									
								
								src/action.c
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								src/action.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -88,6 +88,32 @@ const char *action_names[] = {
 | 
			
		|||
	NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
action_arg_from_xml_node(struct action *action, char *nodename, char *content)
 | 
			
		||||
{
 | 
			
		||||
	assert(action);
 | 
			
		||||
	if (!strcmp(nodename, "command.action")) {
 | 
			
		||||
		/* Execute */
 | 
			
		||||
		action_arg_add_str(action, NULL, content);
 | 
			
		||||
	} else if (!strcmp(nodename, "execute.action")) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * <action name="Execute"><execute>foo</execute></action>
 | 
			
		||||
		 * is deprecated, but we support it anyway for backward
 | 
			
		||||
		 * compatibility with old openbox-menu generators
 | 
			
		||||
		 */
 | 
			
		||||
		action_arg_add_str(action, NULL, content);
 | 
			
		||||
	} else if (!strcmp(nodename, "direction.action")) {
 | 
			
		||||
		/* MoveToEdge, SnapToEdge */
 | 
			
		||||
		action_arg_add_str(action, NULL, content);
 | 
			
		||||
	} else if (!strcmp(nodename, "menu.action")) {
 | 
			
		||||
		/* ShowMenu */
 | 
			
		||||
		action_arg_add_str(action, NULL, content);
 | 
			
		||||
	} else if (!strcmp(nodename, "to.action")) {
 | 
			
		||||
		/* GoToDesktop, SendToDesktop */
 | 
			
		||||
		action_arg_add_str(action, NULL, content);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char *
 | 
			
		||||
action_str_from_arg(struct action_arg *arg)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue