diff options
author | Nicolò Chieffo <84yelo3@gmail.com> | 2009-07-17 01:00:29 +0800 |
---|---|---|
committer | Davyd Madeley <davyd@madeley.id.au> | 2009-07-17 01:00:29 +0800 |
commit | 21127f20e2fe1254757e6bd5ee63ad71689fc4c6 (patch) | |
tree | 192ce0cc6626e587f9ab5b95f0a39cf4b72a36e0 /libempathy-gtk/empathy-geometry.c | |
parent | 19cc09b10307b7d5a03a48cd455c958a7419750f (diff) | |
download | gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar.gz gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar.bz2 gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar.lz gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar.xz gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.tar.zst gsoc2013-empathy-21127f20e2fe1254757e6bd5ee63ad71689fc4c6.zip |
Escape window names before saving them in geometry.ini
Fixes #586967
Diffstat (limited to 'libempathy-gtk/empathy-geometry.c')
-rw-r--r-- | libempathy-gtk/empathy-geometry.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-geometry.c b/libempathy-gtk/empathy-geometry.c index 882e15aa9..2bfa14e33 100644 --- a/libempathy-gtk/empathy-geometry.c +++ b/libempathy-gtk/empathy-geometry.c @@ -77,9 +77,13 @@ empathy_geometry_save (const gchar *name, gchar *content; gsize length; gchar *str; + gchar *escaped_name; - DEBUG ("Saving window geometry: x:%d, y:%d, w:%d, h:%d\n", - x, y, w, h); + /* escape the name so that unwanted characters such as # are removed */ + escaped_name = g_uri_escape_string (name, NULL, TRUE); + + DEBUG ("Saving window geometry: name:%s x:%d, y:%d, w:%d, h:%d\n", + escaped_name, x, y, w, h); screen = gdk_screen_get_default (); max_width = gdk_screen_get_width (screen); @@ -98,7 +102,7 @@ empathy_geometry_save (const gchar *name, filename = geometry_get_filename (); g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, NULL); - g_key_file_set_string (key_file, GEOMETRY_GROUP_NAME, name, str); + g_key_file_set_string (key_file, GEOMETRY_GROUP_NAME, escaped_name, str); g_free (str); @@ -111,6 +115,7 @@ empathy_geometry_save (const gchar *name, g_free (content); g_free (filename); + g_free (escaped_name); g_key_file_free (key_file); } @@ -124,6 +129,10 @@ empathy_geometry_load (const gchar *name, GKeyFile *key_file; gchar *filename; gchar *str = NULL; + gchar *escaped_name; + + /* escape the name so that unwanted characters such as # are removed */ + escaped_name = g_uri_escape_string (name, NULL, TRUE); if (x) { *x = -1; @@ -146,7 +155,7 @@ empathy_geometry_load (const gchar *name, filename = geometry_get_filename (); if (g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, NULL)) { - str = g_key_file_get_string (key_file, GEOMETRY_GROUP_NAME, name, NULL); + str = g_key_file_get_string (key_file, GEOMETRY_GROUP_NAME, escaped_name, NULL); } if (str) { @@ -177,6 +186,7 @@ empathy_geometry_load (const gchar *name, x ? *x : -1, y ? *y : -1, w ? *w : -1, h ? *h : -1); g_free (filename); + g_free (escaped_name); g_key_file_free (key_file); } |