aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-geometry.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-08-01 16:32:39 +0800
committerCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-08-01 16:32:39 +0800
commit3e8f25168aadd741ecc0fe8da4d1847eece5ff83 (patch)
tree69b2fc8984c98b9cad38d2ca5e8563da2b9aad8a /libempathy-gtk/empathy-geometry.c
parent41e5b31c1918f40c3ba47bff2dc9ab682fe0391f (diff)
parent87070d25c5f2d9a0ecba73e8ce913eca7f183c79 (diff)
downloadgsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.gz
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.bz2
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.lz
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.xz
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.tar.zst
gsoc2013-empathy-3e8f25168aadd741ecc0fe8da4d1847eece5ff83.zip
Merge branch 'sjoerd-mc5' into mc5
Conflicts: libempathy-gtk/empathy-account-widget.c libempathy-gtk/empathy-protocol-chooser.c
Diffstat (limited to 'libempathy-gtk/empathy-geometry.c')
-rw-r--r--libempathy-gtk/empathy-geometry.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-geometry.c b/libempathy-gtk/empathy-geometry.c
index 882e15aa9..14e794c44 100644
--- a/libempathy-gtk/empathy-geometry.c
+++ b/libempathy-gtk/empathy-geometry.c
@@ -49,7 +49,7 @@ geometry_get_filename (void)
gchar *dir;
gchar *filename;
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
DEBUG ("Creating directory:'%s'", dir);
g_mkdir_with_parents (dir, GEOMETRY_DIR_CREATE_MODE);
@@ -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);
}