Use names as comments when a generic one is known

This applies only if there is no comment in the first place.
This commit is contained in:
Pierre Pronchery 2015-06-18 02:25:55 -04:00
parent 9a8333191a
commit af4b673fa5

View File

@ -206,6 +206,10 @@ static GtkWidget * _menu_applications(Menu * menu)
GtkWidget * menuitem; GtkWidget * menuitem;
Config * config; Config * config;
const char section[] = "Desktop Entry"; const char section[] = "Desktop Entry";
char const * name;
#if GTK_CHECK_VERSION(2, 12, 0)
char const * comment;
#endif
char const * q; char const * q;
char const * r; char const * r;
char const * path; char const * path;
@ -218,15 +222,25 @@ static GtkWidget * _menu_applications(Menu * menu)
for(p = menu->apps; p != NULL; p = p->next) for(p = menu->apps; p != NULL; p = p->next)
{ {
config = p->data; config = p->data;
if((q = config_get(config, section, "GenericName")) == NULL) /* should not fail */
/* should not fail */ name = config_get(config, section, "Name");
q = config_get(config, section, "Name"); #if GTK_CHECK_VERSION(2, 12, 0)
comment = config_get(config, section, "Comment");
#endif
if((q = config_get(config, section, "GenericName")) != NULL)
{
#if GTK_CHECK_VERSION(2, 12, 0)
if(comment == NULL)
comment = name;
#endif
name = q;
}
path = config_get(config, NULL, "path"); path = config_get(config, NULL, "path");
menuitem = _menu_menuitem(menu, path, q, menuitem = _menu_menuitem(menu, path, name,
config_get(config, section, "Icon")); config_get(config, section, "Icon"));
#if GTK_CHECK_VERSION(2, 12, 0) #if GTK_CHECK_VERSION(2, 12, 0)
if((q = config_get(config, section, "Comment")) != NULL) if(comment != NULL)
gtk_widget_set_tooltip_text(menuitem, q); gtk_widget_set_tooltip_text(menuitem, comment);
#endif #endif
if((q = config_get(config, section, "Type")) != NULL if((q = config_get(config, section, "Type")) != NULL
&& strcmp(q, "Application") == 0 && strcmp(q, "Application") == 0