diff options
Diffstat (limited to 'mate-panel/panel-test-applets.c')
-rw-r--r-- | mate-panel/panel-test-applets.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/mate-panel/panel-test-applets.c b/mate-panel/panel-test-applets.c index 83f27ca7..79b48d36 100644 --- a/mate-panel/panel-test-applets.c +++ b/mate-panel/panel-test-applets.c @@ -7,6 +7,7 @@ * * Copyright 2002 Sun Microsystems, Inc. * 2012 Stefano Karapetsas + * Copyright (C) 2012-2021 MATE Developers */ #include <config.h> @@ -40,7 +41,7 @@ static const GOptionEntry options [] = { { "prefs-path", 0, 0, G_OPTION_ARG_STRING, &cli_prefs_path, N_("Specify a gsettings path in which the applet preferences should be stored"), NULL}, { "size", 0, 0, G_OPTION_ARG_STRING, &cli_size, N_("Specify the initial size of the applet (xx-small, medium, large etc.)"), NULL}, { "orient", 0, 0, G_OPTION_ARG_STRING, &cli_orient, N_("Specify the initial orientation of the applet (top, bottom, left or right)"), NULL}, - { NULL} + { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; enum { @@ -61,7 +62,6 @@ static ComboItem orient_items [] = { { NC_("Orientation", "Right"), PANEL_ORIENTATION_RIGHT } }; - static ComboItem size_items [] = { { NC_("Size", "XX Small"), 12 }, { NC_("Size", "X Small"), 24 }, @@ -178,13 +178,12 @@ static void load_applet_from_command_line (void) { guint size = 24, orient = PANEL_ORIENTATION_TOP; - gint i; g_assert (cli_iid != NULL); if (cli_size || cli_orient) { if (cli_size) { - for (i = 0; i < G_N_ELEMENTS (size_items); i++) { + for (gsize i = 0; i < G_N_ELEMENTS (size_items); i++) { if (strcmp (g_dpgettext2 (NULL, "Size", size_items[i].name), cli_size) == 0) { size = size_items[i].value; break; @@ -193,7 +192,7 @@ load_applet_from_command_line (void) } if (cli_orient) { - for (i = 0; i < G_N_ELEMENTS (orient_items); i++) { + for (gsize i = 0; i < G_N_ELEMENTS (orient_items); i++) { if (strcmp (g_dpgettext2 (NULL, "Orientation", orient_items[i].name), cli_orient) == 0) { orient = orient_items[i].value; break; @@ -240,7 +239,6 @@ setup_combo (GtkWidget *combo_box, gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (model)); - for (i = 0; i < nb_items; i++) { gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, @@ -268,7 +266,6 @@ setup_options (void) char *prefs_path = NULL; char *unique_key = NULL; gboolean unique_key_found = FALSE; - gchar **dconf_paths; GtkListStore *model; GtkTreeIter iter; GtkCellRenderer *renderer; @@ -287,8 +284,8 @@ setup_options (void) gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, - COLUMN_TEXT, g_strdup (mate_panel_applet_info_get_name (info)), - COLUMN_ITEM, g_strdup (mate_panel_applet_info_get_iid (info)), + COLUMN_TEXT, mate_panel_applet_info_get_name (info), + COLUMN_ITEM, mate_panel_applet_info_get_iid (info), -1); } g_list_free (applet_list); @@ -312,7 +309,7 @@ setup_options (void) g_free (unique_key); unique_key = g_strdup_printf ("mate-panel-test-applet-%d", i); unique_key_found = TRUE; - dconf_paths = mate_dconf_list_subdirs ("/tmp/", TRUE); + gchar **dconf_paths = mate_dconf_list_subdirs ("/tmp/", TRUE); for (j = 0; dconf_paths[j] != NULL; j++) { if (g_strcmp0(unique_key, dconf_paths[j]) == 0) { @@ -335,7 +332,6 @@ int main (int argc, char **argv) { GtkBuilder *builder; - char *applets_dir; GError *error; bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); @@ -357,11 +353,8 @@ main (int argc, char **argv) panel_modules_ensure_loaded (); - if (g_file_test ("../libmate-panel-applet", G_FILE_TEST_IS_DIR)) { - applets_dir = g_strdup_printf ("%s:../libmate-panel-applet", MATE_PANEL_APPLETS_DIR); - g_setenv ("MATE_PANEL_APPLETS_DIR", applets_dir, FALSE); - g_free (applets_dir); - } + if (g_file_test ("../libmate-panel-applet", G_FILE_TEST_IS_DIR)) + g_setenv ("MATE_PANEL_APPLETS_DIR", MATE_PANEL_APPLETS_DIR ":../libmate-panel-applet", FALSE); if (cli_iid) { load_applet_from_command_line (); |