[monkey-bubble: 14/753] gnome_config_set_prefix and gnome_config_drop_prefix are now gone. They
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 14/753] gnome_config_set_prefix and gnome_config_drop_prefix are now gone. They
- Date: Wed, 14 Jul 2010 21:56:52 +0000 (UTC)
commit 8d8d6bec143fda30cee1857eb70711b630b86b83
Author: Miguel de Icaza <miguel nuclecu unam mx>
Date: Sat Dec 20 23:13:00 1997 +0000
gnome_config_set_prefix and gnome_config_drop_prefix are now gone. They
1997-12-20 Miguel de Icaza <miguel nuclecu unam mx>
* libgnome/gnome-config.c: gnome_config_set_prefix and
gnome_config_drop_prefix are now gone. They are replaced by
gnome_config_push_prefix and gnome_config_pop_prefix that
implement a stack of prefixes.
* guile-gnome/gnomeg.c: updated to above changes
* guile-gnome/gnome-dentry.c: likewise
libgnome/gnome-config.c | 31 ++++++++++++++++++++++++-------
libgnome/gnome-config.h | 6 ++++--
libgnome/gnome-dentry.c | 12 ++++++------
3 files changed, 34 insertions(+), 15 deletions(-)
---
diff --git a/libgnome/gnome-config.c b/libgnome/gnome-config.c
index ef024e0..ca8438b 100644
--- a/libgnome/gnome-config.c
+++ b/libgnome/gnome-config.c
@@ -97,11 +97,21 @@ typedef struct {
char *path, *opath;
} ParsedPath;
+struct _prefix_list {
+ char *p_prefix;
+ struct _prefix_list *p_back;
+};
+
+typedef struct _prefix_list prefix_list_t;
+
/*
* Prefix for all the configuration operations
* iff the path does not begin with / or with #
*/
-static char *prefix;
+
+#define prefix (prefix_list ? prefix_list->p_prefix : NULL)
+
+static prefix_list_t *prefix_list;
static TProfile *Current = 0;
@@ -667,16 +677,23 @@ gnome_config_set_bool (char *path, int new_value)
}
void
-gnome_config_set_prefix (char *path)
+gnome_config_push_prefix (char *path)
{
- prefix = strdup (path);
+ prefix_list_t *p = g_malloc (sizeof (prefix_list_t));
+
+ p->p_back = prefix_list;
+ p->p_prefix = strdup (path);
}
void
-gnome_config_drop_prefix (void)
+gnome_config_pop_prefix (void)
{
- if (!prefix)
+ prefix_list_t *p = prefix_list;
+
+ if (!p)
return;
- free (prefix);
- prefix = 0;
+
+ free (p->p_prefix);
+ prefix_list = p->p_back;
+ free (p);
}
diff --git a/libgnome/gnome-config.h b/libgnome/gnome-config.h
index f0b21ab..a1962da 100644
--- a/libgnome/gnome-config.h
+++ b/libgnome/gnome-config.h
@@ -52,8 +52,10 @@ void gnome_config_clean_section (char *path);
/* Drops the information for a specific key */
void gnome_config_clean_key (char *path);
-void gnome_config_set_prefix (char *path);
-void gnome_config_drop_prefix (void);
+
+/* Set an active prefix and remove an active prefix */
+void gnome_config_push_prefix (char *path);
+void gnome_config_pop_prefix (void);
END_GNOME_DECLS
diff --git a/libgnome/gnome-dentry.c b/libgnome/gnome-dentry.c
index d2bf395..9428313 100644
--- a/libgnome/gnome-dentry.c
+++ b/libgnome/gnome-dentry.c
@@ -69,12 +69,12 @@ gnome_desktop_entry_load (char *file)
prefix = g_copy_strings ("=", file, "=/Desktop Entry/", NULL);
- gnome_config_set_prefix (prefix);
+ gnome_config_push_prefix (prefix);
g_free (prefix);
exec_file = gnome_config_get_string ("Exec");
if (!exec_file){
- gnome_config_drop_prefix ();
+ gnome_config_pop_prefix ();
return 0;
}
try_file = gnome_config_get_string ("TryExec");
@@ -82,7 +82,7 @@ gnome_desktop_entry_load (char *file)
if (!gnome_is_program_in_path (try_file)){
g_free (try_file);
g_free (exec_file);
- gnome_config_drop_prefix ();
+ gnome_config_pop_prefix ();
return 0;
}
}
@@ -122,7 +122,7 @@ gnome_desktop_entry_load (char *file)
} else {
newitem->small_icon = newitem->transparent_icon = 0;
}
- gnome_config_drop_prefix ();
+ gnome_config_pop_prefix ();
return newitem;
}
@@ -139,7 +139,7 @@ gnome_desktop_entry_save (GnomeDesktopEntry *dentry)
gnome_config_clean_section(prefix);
prefix = g_copy_strings(prefix, "/", NULL);
- gnome_config_set_prefix(prefix);
+ gnome_config_push_prefix(prefix);
g_free(prefix);
if (dentry->exec)
@@ -162,7 +162,7 @@ gnome_desktop_entry_save (GnomeDesktopEntry *dentry)
if (dentry->type)
gnome_config_set_string("Type", dentry->type);
- gnome_config_drop_prefix();
+ gnome_config_pop_prefix();
gnome_config_sync();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]