Fixed the homescreen

This commit is contained in:
Pierre Pronchery 2014-10-14 01:24:03 +02:00
parent 93bbaf1fa6
commit 040a5ac9b4

View File

@ -877,7 +877,6 @@ static int _icons_applications(Desktop * desktop)
DesktopIcon * desktopicon; DesktopIcon * desktopicon;
GdkPixbuf * icon; GdkPixbuf * icon;
/* FIXME list all applications otherwise? */
if(desktop->category == NULL) if(desktop->category == NULL)
return 0; return 0;
if((desktopicon = desktopicon_new(desktop, _("Back"), NULL)) == NULL) if((desktopicon = desktopicon_new(desktop, _("Back"), NULL)) == NULL)
@ -903,7 +902,6 @@ static int _icons_categories(Desktop * desktop)
GdkPixbuf * icon; GdkPixbuf * icon;
desktop->category = NULL; desktop->category = NULL;
_icons_applications(desktop); /* XXX hack */
if((desktopicon = desktopicon_new(desktop, _("Back"), NULL)) == NULL) if((desktopicon = desktopicon_new(desktop, _("Back"), NULL)) == NULL)
return -_desktop_serror(desktop, "Back", 1); return -_desktop_serror(desktop, "Back", 1);
desktopicon_set_callback(desktopicon, _icons_set_homescreen, NULL); desktopicon_set_callback(desktopicon, _icons_set_homescreen, NULL);
@ -1083,10 +1081,9 @@ int desktop_error(Desktop * desktop, char const * message, int ret)
/* desktop_refresh */ /* desktop_refresh */
static void _refresh_applications(Desktop * desktop);
static void _refresh_categories(Desktop * desktop); static void _refresh_categories(Desktop * desktop);
static void _refresh_files(Desktop * desktop); static void _refresh_files(Desktop * desktop);
static void _refresh_none(Desktop * desktop); static void _refresh_homescreen(Desktop * desktop);
void desktop_refresh(Desktop * desktop) void desktop_refresh(Desktop * desktop)
{ {
@ -1098,8 +1095,6 @@ void desktop_refresh(Desktop * desktop)
switch(desktop->prefs.icons) switch(desktop->prefs.icons)
{ {
case DESKTOP_ICONS_APPLICATIONS: case DESKTOP_ICONS_APPLICATIONS:
_refresh_applications(desktop);
break;
case DESKTOP_ICONS_CATEGORIES: case DESKTOP_ICONS_CATEGORIES:
_refresh_categories(desktop); _refresh_categories(desktop);
break; break;
@ -1108,19 +1103,11 @@ void desktop_refresh(Desktop * desktop)
break; break;
case DESKTOP_ICONS_HOMESCREEN: case DESKTOP_ICONS_HOMESCREEN:
case DESKTOP_ICONS_NONE: case DESKTOP_ICONS_NONE:
_refresh_none(desktop); _refresh_homescreen(desktop);
break; break;
} }
} }
static void _refresh_applications(Desktop * desktop)
{
g_slist_foreach(desktop->apps, (GFunc)config_delete, NULL);
g_slist_free(desktop->apps);
desktop->apps = NULL;
desktop->refresh_source = g_idle_add(_desktop_on_refresh, desktop);
}
static void _refresh_categories(Desktop * desktop) static void _refresh_categories(Desktop * desktop)
{ {
g_slist_foreach(desktop->apps, (GFunc)config_delete, NULL); g_slist_foreach(desktop->apps, (GFunc)config_delete, NULL);
@ -1146,7 +1133,7 @@ static void _refresh_files(Desktop * desktop)
desktop->refresh_source = g_idle_add(_desktop_on_refresh, desktop); desktop->refresh_source = g_idle_add(_desktop_on_refresh, desktop);
} }
static void _refresh_none(Desktop * desktop) static void _refresh_homescreen(Desktop * desktop)
{ {
/* for cleanup */ /* for cleanup */
desktop->refresh_source = g_idle_add(_desktop_on_refresh, desktop); desktop->refresh_source = g_idle_add(_desktop_on_refresh, desktop);
@ -2522,7 +2509,7 @@ static int _refresh_loop(Desktop * desktop)
return _refresh_loop_files(desktop); return _refresh_loop_files(desktop);
case DESKTOP_ICONS_HOMESCREEN: case DESKTOP_ICONS_HOMESCREEN:
case DESKTOP_ICONS_NONE: case DESKTOP_ICONS_NONE:
return 0; /* nothing to do */ return 1; /* nothing to do */
} }
return -1; return -1;
} }