panel-loader: Reorder functions

Put the externally visible functions at the bottom, and
the static functions at the top.
This commit is contained in:
Georges Basile Stavracas Neto 2018-11-07 20:17:43 -02:00
parent d1fe090bf4
commit 31a5d55896
No known key found for this signature in database
GPG key ID: 886C17EE170D1385

View file

@ -117,18 +117,6 @@ static CcPanelLoaderVtable default_panels[] =
#endif
};
GList *
cc_panel_loader_get_panels (void)
{
GList *l = NULL;
guint i;
for (i = 0; i < G_N_ELEMENTS (default_panels); i++)
l = g_list_prepend (l, (gpointer) default_panels[i].name);
return g_list_reverse (l);
}
static int
parse_categories (GDesktopAppInfo *app)
{
@ -167,6 +155,43 @@ parse_categories (GDesktopAppInfo *app)
return retval;
}
#ifndef CC_PANEL_LOADER_NO_GTYPES
static GHashTable *panel_types;
static void
ensure_panel_types (void)
{
int i;
if (G_LIKELY (panel_types != NULL))
return;
panel_types = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (default_panels); i++)
g_hash_table_insert (panel_types, (char*)default_panels[i].name, default_panels[i].get_type);
}
CcPanel *
cc_panel_loader_load_by_name (CcShell *shell,
const gchar *name,
GVariant *parameters)
{
GType (*get_type) (void);
ensure_panel_types ();
get_type = g_hash_table_lookup (panel_types, name);
g_assert (get_type != NULL);
return g_object_new (get_type (),
"shell", shell,
"parameters", parameters,
NULL);
}
#endif /* CC_PANEL_LOADER_NO_GTYPES */
void
cc_panel_loader_fill_model (CcShellModel *model)
{
@ -211,39 +236,14 @@ cc_panel_loader_fill_model (CcShellModel *model)
#endif
}
#ifndef CC_PANEL_LOADER_NO_GTYPES
static GHashTable *panel_types;
static void
ensure_panel_types (void)
GList *
cc_panel_loader_get_panels (void)
{
int i;
GList *l = NULL;
guint i;
if (G_LIKELY (panel_types != NULL))
return;
panel_types = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (default_panels); i++)
g_hash_table_insert (panel_types, (char*)default_panels[i].name, default_panels[i].get_type);
l = g_list_prepend (l, (gpointer) default_panels[i].name);
return g_list_reverse (l);
}
CcPanel *
cc_panel_loader_load_by_name (CcShell *shell,
const char *name,
GVariant *parameters)
{
GType (*get_type) (void);
ensure_panel_types ();
get_type = g_hash_table_lookup (panel_types, name);
g_assert (get_type != NULL);
return g_object_new (get_type (),
"shell", shell,
"parameters", parameters,
NULL);
}
#endif /* CC_PANEL_LOADER_NO_GTYPES */