panel-loader: Reorder functions
Put the externally visible functions at the bottom, and the static functions at the top.
This commit is contained in:
parent
d1fe090bf4
commit
31a5d55896
1 changed files with 44 additions and 44 deletions
|
@ -117,18 +117,6 @@ static CcPanelLoaderVtable default_panels[] =
|
||||||
#endif
|
#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
|
static int
|
||||||
parse_categories (GDesktopAppInfo *app)
|
parse_categories (GDesktopAppInfo *app)
|
||||||
{
|
{
|
||||||
|
@ -167,6 +155,43 @@ parse_categories (GDesktopAppInfo *app)
|
||||||
return retval;
|
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
|
void
|
||||||
cc_panel_loader_fill_model (CcShellModel *model)
|
cc_panel_loader_fill_model (CcShellModel *model)
|
||||||
{
|
{
|
||||||
|
@ -211,39 +236,14 @@ cc_panel_loader_fill_model (CcShellModel *model)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CC_PANEL_LOADER_NO_GTYPES
|
GList *
|
||||||
|
cc_panel_loader_get_panels (void)
|
||||||
static GHashTable *panel_types;
|
|
||||||
|
|
||||||
static void
|
|
||||||
ensure_panel_types (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++)
|
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 */
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue