summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-11-07 20:25:30 -0200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-11-11 23:42:00 -0200
commit867a35dc89b446e2b4540e2d0a5dea8cfc64e609 (patch)
tree92b48e3b8d8e58d338f9949157afb79699cce4f9 /shell
parent31a5d558966ea0fac2475df87f2a6a7cd7ac82fc (diff)
downloadgnome-control-center-867a35dc89b446e2b4540e2d0a5dea8cfc64e609.tar.gz
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.
Diffstat (limited to 'shell')
-rw-r--r--shell/cc-application.c10
-rw-r--r--shell/cc-panel-loader.c11
-rw-r--r--shell/cc-panel-loader.h2
3 files changed, 8 insertions, 15 deletions
diff --git a/shell/cc-application.c b/shell/cc-application.c
index 08b27000e..67beb383c 100644
--- a/shell/cc-application.c
+++ b/shell/cc-application.c
@@ -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;
}
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 42334e23b..8ce95372e 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -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;
+ g_print ("%s\n", _("Available panels:"));
+
for (i = 0; i < G_N_ELEMENTS (default_panels); i++)
- l = g_list_prepend (l, (gpointer) default_panels[i].name);
+ g_print ("\t%s\n", default_panels[i].name);
- return g_list_reverse (l);
}
diff --git a/shell/cc-panel-loader.h b/shell/cc-panel-loader.h
index 84feee549..f9847600e 100644
--- a/shell/cc-panel-loader.h
+++ b/shell/cc-panel-loader.h
@@ -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);