panel-loader: Simplify listing panels
Instead of enumerating them, putting that in a GList, then iterating the GList printing the panel names, simply print them while enumerating.
This commit is contained in:
parent
31a5d55896
commit
867a35dc89
3 changed files with 9 additions and 16 deletions
|
@ -125,15 +125,7 @@ cc_application_handle_local_options (GApplication *application,
|
|||
|
||||
if (g_variant_dict_contains (options, "list"))
|
||||
{
|
||||
g_autoptr(GList) panels = NULL;
|
||||
g_autoptr(GList) l = NULL;
|
||||
|
||||
panels = cc_panel_loader_get_panels ();
|
||||
|
||||
g_print ("%s\n", _("Available panels:"));
|
||||
for (l = panels; l != NULL; l = l->next)
|
||||
g_print ("\t%s\n", (char *) l->data);
|
||||
|
||||
cc_panel_loader_list_panels ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "cc-panel.h"
|
||||
#include "cc-panel-loader.h"
|
||||
|
@ -236,14 +237,14 @@ cc_panel_loader_fill_model (CcShellModel *model)
|
|||
#endif
|
||||
}
|
||||
|
||||
GList *
|
||||
cc_panel_loader_get_panels (void)
|
||||
void
|
||||
cc_panel_loader_list_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);
|
||||
g_print ("%s\n", _("Available panels:"));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (default_panels); i++)
|
||||
g_print ("\t%s\n", default_panels[i].name);
|
||||
|
||||
return g_list_reverse (l);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct
|
|||
} CcPanelLoaderVtable;
|
||||
|
||||
void cc_panel_loader_fill_model (CcShellModel *model);
|
||||
GList *cc_panel_loader_get_panels (void);
|
||||
void cc_panel_loader_list_panels (void);
|
||||
CcPanel *cc_panel_loader_load_by_name (CcShell *shell,
|
||||
const char *name,
|
||||
GVariant *parameters);
|
||||
|
|
Loading…
Add table
Reference in a new issue