Fix to use correct termination condition and g_string API
2001-06-21 Bradford Hovinen <hovinen@ximian.com> * capplets/new-*/main.c (do_set_xml): Fix to use correct termination condition and g_string API * capplets/new-screensaver-properties/preferences.c (clone_cb): Remove debugging code
This commit is contained in:
parent
94736ab677
commit
f707e7350e
9 changed files with 99 additions and 81 deletions
|
@ -1,3 +1,8 @@
|
|||
2001-06-21 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* capplets/new-*/main.c (do_set_xml): Fix to use correct
|
||||
termination condition and g_string API
|
||||
|
||||
2001-06-20 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* capplets/new-*/main.c (do_set_xml): Don't save unless
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -153,23 +154,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -142,23 +143,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -142,23 +143,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-06-21 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* preferences.c (clone_cb): Remove debugging code
|
||||
|
||||
2001-05-06 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* preferences.c (preferences_clone): Implement. Create a copy of a
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <parser.h>
|
||||
#include <xmlIO.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -262,23 +263,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
|
@ -177,9 +177,6 @@ preferences_new (void)
|
|||
static gint
|
||||
clone_cb (gchar *key, gchar *value, Preferences *new_prefs)
|
||||
{
|
||||
if (!strcmp (key, "programs"))
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Programs value is:\n%s", value);
|
||||
|
||||
g_tree_insert (new_prefs->config_db, key, g_strdup (value));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -141,23 +142,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
|
@ -134,23 +135,24 @@ static void
|
|||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char *buffer = NULL;
|
||||
int len = 0;
|
||||
int bytes_read = 0;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
do {
|
||||
if (!len) buffer = g_new (char, 4097);
|
||||
else buffer = g_renew (char, buffer, len + 4097);
|
||||
bytes_read = read (fileno (stdin), buffer + len, 4096);
|
||||
buffer[len + bytes_read] = '\0';
|
||||
len += 4096;
|
||||
} while (bytes_read == 4096);
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
if (len >= 4096 && len > 0) {
|
||||
doc = xmlParseMemory (buffer, len - 4096 + bytes_read);
|
||||
g_free (buffer);
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue