summaryrefslogtreecommitdiff
path: root/stickynotes/stickynotes.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-17 11:52:29 +0200
committerRobert Antoni Buj Gelonch <[email protected]>2020-07-24 18:51:24 +0200
commite1e531145476d424ef7a882447fd411d18a974e8 (patch)
tree100434ca70d0dde03b768eb73bd6658abfe3fd48 /stickynotes/stickynotes.c
parent7b4863d13487a770738a22afa8cf3c108bc04cf2 (diff)
downloadmate-applets-e1e531145476d424ef7a882447fd411d18a974e8.tar.bz2
mate-applets-e1e531145476d424ef7a882447fd411d18a974e8.tar.xz
stickynotes: Fix -Wformat-nonliteral warning
Diffstat (limited to 'stickynotes/stickynotes.c')
-rw-r--r--stickynotes/stickynotes.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index 4c7ce215..0b163dc0 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -399,17 +399,21 @@ void stickynote_set_title(StickyNote *note, const gchar *title)
{
/* If title is NULL, use the current date as the title. */
if (!title) {
- gchar *date_title, *tmp;
- gchar *date_format = g_settings_get_string (stickynotes->settings, "date-format");
+ GDateTime *now;
+ gchar *date_title;
+ gchar *date_format;
+
+ date_format = g_settings_get_string (stickynotes->settings, "date-format");
if (!date_format)
date_format = g_strdup ("%x");
- tmp = get_current_date (date_format);
- date_title = g_locale_to_utf8 (tmp, -1, NULL, NULL, NULL);
+
+ now = g_date_time_new_now_local ();
+ date_title = g_date_time_format (now, date_format);
gtk_window_set_title(GTK_WINDOW(note->w_window), date_title);
gtk_label_set_text(GTK_LABEL (note->w_title), date_title);
- g_free (tmp);
+ g_date_time_unref (now);
g_free(date_title);
g_free(date_format);
}