summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-10 14:03:07 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2021-02-08 22:34:03 +0100
commit44193bc230d11676c8a2ae247f819deaaebb82c0 (patch)
treebb9275c76f93357954790870e8765bc0d29945fb
parentb3be7952074144fe4077ab12780b5bacb853729a (diff)
downloadmate-desktop-44193bc230d11676c8a2ae247f819deaaebb82c0.tar.bz2
mate-desktop-44193bc230d11676c8a2ae247f819deaaebb82c0.tar.xz
g_settings_get_string always returns a newly-allocated string
-rw-r--r--libmate-desktop/mate-bg.c14
-rw-r--r--libmate-desktop/mate-desktop-utils.c9
2 files changed, 9 insertions, 14 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 2bc7f66..647d38f 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -195,15 +195,10 @@ static FileSize *find_best_size (GSList *sizes,
static void
color_from_string (const char *string,
- GdkRGBA *colorp)
+ GdkRGBA *colorp)
{
- /* If all else fails use black */
- gdk_rgba_parse (colorp, "#000000");
-
- if (!string)
- return;
-
- gdk_rgba_parse (colorp, string);
+ if (!string || *string == '\0' || !gdk_rgba_parse (colorp, string))
+ gdk_rgba_parse (colorp, "#000000"); /* If all else fails use black */
}
static char *
@@ -403,8 +398,7 @@ mate_bg_load_from_gsettings (MateBG *bg,
mate_bg_set_placement (bg, placement);
mate_bg_set_filename (bg, filename);
- if (filename != NULL)
- g_free (filename);
+ g_free (filename);
}
void
diff --git a/libmate-desktop/mate-desktop-utils.c b/libmate-desktop/mate-desktop-utils.c
index b86253e..a5228b7 100644
--- a/libmate-desktop/mate-desktop-utils.c
+++ b/libmate-desktop/mate-desktop-utils.c
@@ -75,7 +75,7 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
int term_argc = 0;
GSettings *settings;
- gchar *terminal = NULL;
+ gchar *terminal;
char **the_argv;
@@ -100,12 +100,13 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
settings = g_settings_new ("org.mate.applications-terminal");
terminal = g_settings_get_string (settings, "exec");
- if (terminal) {
+ if (terminal && *terminal != '\0') {
gchar *command_line;
gchar *exec_flag;
+
exec_flag = g_settings_get_string (settings, "exec-arg");
- if (exec_flag == NULL)
+ if (!exec_flag || *exec_flag == '\0')
command_line = g_strdup (terminal);
else
command_line = g_strdup_printf ("%s %s", terminal,
@@ -118,8 +119,8 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
g_free (command_line);
g_free (exec_flag);
- g_free (terminal);
}
+ g_free (terminal);
g_object_unref (settings);
if (term_argv == NULL) {