summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-11-25 11:51:19 +0100
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-12-09 10:34:11 +0100
commit53e0f957d0b239cbe1cff92b1d614826c1728c82 (patch)
tree0f84a89a5c8e6bb27c292debfa2e71cfe2668978
parent58ed481198200ef3228c02e491de44b177948e59 (diff)
drun: Early return if already initialized
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
-rw-r--r--source/dialogs/drun.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c
index 1014067e..d0200ef2 100644
--- a/source/dialogs/drun.c
+++ b/source/dialogs/drun.c
@@ -655,29 +655,30 @@ static void drun_mode_parse_entry_fields ()
static int drun_mode_init ( Mode *sw )
{
- if ( mode_get_private_data ( sw ) == NULL ) {
- static const gchar * const drun_icon_fallback_themes[] = {
- "Adwaita",
- "gnome",
- NULL
- };
- const gchar *themes[2] = {
- config.drun_icon_theme,
- NULL
- };
- DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) );
- pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL );
- mode_set_private_data ( sw, (void *) pd );
- // current destkop
- const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" );
- pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL;
-
- // Theme
- pd->xdg_context = nk_xdg_theme_context_new ( drun_icon_fallback_themes, NULL );
- nk_xdg_theme_preload_themes_icon ( pd->xdg_context, themes );
- get_apps ( pd );
- drun_mode_parse_entry_fields ();
- }
+ if ( mode_get_private_data ( sw ) != NULL )
+ return TRUE;
+
+ static const gchar * const drun_icon_fallback_themes[] = {
+ "Adwaita",
+ "gnome",
+ NULL
+ };
+ const gchar *themes[2] = {
+ config.drun_icon_theme,
+ NULL
+ };
+ DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) );
+ pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL );
+ mode_set_private_data ( sw, (void *) pd );
+ // current destkop
+ const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" );
+ pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL;
+
+ // Theme
+ pd->xdg_context = nk_xdg_theme_context_new ( drun_icon_fallback_themes, NULL );
+ nk_xdg_theme_preload_themes_icon ( pd->xdg_context, themes );
+ get_apps ( pd );
+ drun_mode_parse_entry_fields ();
return TRUE;
}
static void drun_entry_clear ( DRunModeEntry *e )