[gnome-pilot-conduits] Avoid deprecated gtk symbols for memo_file-conduit and time-conduit. #594214
- From: Matthew Charles Davey <mcdavey src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-pilot-conduits] Avoid deprecated gtk symbols for memo_file-conduit and time-conduit. #594214
- Date: Sun, 10 Oct 2010 21:56:11 +0000 (UTC)
commit cb661ce41a97c406a38010c0f5aaf00acec865c4
Author: Matt Davey <mcdavey mrao cam ac uk>
Date: Sun Oct 10 22:10:34 2010 +0100
Avoid deprecated gtk symbols for memo_file-conduit and time-conduit. #594214
Also, removed obsolete "ThinkMemo" conduit, which was not part of build.
memo/.cvsignore | 7 -
memo/AUTHORS | 1 -
memo/ChangeLog | 27 ---
memo/Makefile.am | 51 -----
memo/README | 1 -
memo/memo-conduit-control-applet.c | 317 --------------------------
memo/memo-conduit-control-applet.desktop | 28 ---
memo/memo_conduit.c | 361 ------------------------------
memo/memo_conduit.h | 123 ----------
memo/memo_conduit_abs.h | 79 -------
memo_file/memo_file_conduit.c | 271 ++++++++++++++++++-----
memo_file/memo_file_conduit.h | 11 +-
time/time-conduit.c | 33 +--
time/time-conduit.h | 8 +-
14 files changed, 231 insertions(+), 1087 deletions(-)
---
diff --git a/memo_file/memo_file_conduit.c b/memo_file/memo_file_conduit.c
index f25c9a1..f45c8bd 100644
--- a/memo_file/memo_file_conduit.c
+++ b/memo_file/memo_file_conduit.c
@@ -25,7 +25,9 @@
#endif
#include <glib.h>
-#include <gnome.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
#include <pi-source.h>
#include <pi-socket.h>
@@ -49,6 +51,8 @@
#define MC_DEBUG
+#define MC_PAD 8
+
#ifdef MC_DEBUG
#define LOG(args...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_MESSAGE, \
@@ -59,38 +63,64 @@
GnomePilotConduit *conduit_get_gpilot_conduit (guint32 pilotId);
void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit);
+static gboolean save_config (GKeyFile *kfile, const gchar *conf);
+static GKeyFile* get_kfile (const gchar *conf);
+static void migrate_conf (const gchar *old, const gchar *new);
#define CONDUIT_VERSION "0.9"
static void
load_configuration (GnomePilotConduit *conduit, ConduitCfg **c,guint32 pilotId)
{
- char *prefix;
+ gchar *iPilot;
+ GKeyFile *kfile;
+ GError *error = NULL;
+
char *buf, *key;
g_return_if_fail (c!=NULL);
- prefix = g_strdup_printf (CONFIG_PREFIX, pilotId);
-
+ kfile = get_kfile("memo_file-conduit");
+ iPilot = g_strdup_printf ("Pilot_%u", pilotId);
+
*c = g_new0 (ConduitCfg, 1);
- gnome_config_push_prefix (prefix);
+
(*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* this will be reset by capplet */
- (*c)->open_secret = gnome_config_get_bool ("open secret=FALSE");
-
- buf = gnome_config_get_string ("file mode=0600");
+ (*c)->open_secret = g_key_file_get_boolean (kfile, iPilot, "open secret", &error);
+ if (error) {
+ (*c)->open_secret = FALSE;
+ error = NULL;
+ }
+
+ buf = g_key_file_get_string (kfile, iPilot, "file mode", &error);
+ if (error) {
+ buf = g_strdup("0600");
+ error = NULL;
+ }
(*c)->file_mode =(mode_t)strtol (buf, NULL, 0);
g_free (buf);
- buf = gnome_config_get_string ("dir mode=0700");
+ buf = g_key_file_get_string (kfile, iPilot, "dir mode", &error);
+ if (error) {
+ buf = g_strdup("0700");
+ error = NULL;
+ }
(*c)->dir_mode =(mode_t)strtol (buf, NULL, 0);
g_free (buf);
- buf = gnome_config_get_string ("secret mode=0600");
+ buf = g_key_file_get_string (kfile, iPilot, "secret mode", &error);
+ if (error) {
+ buf = g_strdup("0600");
+ error = NULL;
+ }
(*c)->secret_mode =(mode_t)strtol (buf, NULL, 0);
g_free (buf);
- key = g_strdup_printf ("dir=%s/memo_file", gnome_pilot_conduit_get_base_dir (conduit));
- (*c)->dir = gnome_config_get_string (key);
- g_free (key);
+ (*c)->dir = g_key_file_get_string (kfile, iPilot, "dir", &error);
+ if (error) {
+ (*c)->dir = g_strdup_printf ("%s/memo_file",
+ gnome_pilot_conduit_get_base_dir (conduit));
+ error = NULL;
+ }
while ((*c)->dir && strlen ((*c)->dir) > 0 && (*c)->dir[strlen ((*c)->dir)-1] == '/') {
(*c)->dir[strlen ((*c)->dir)-1] = '\0';
@@ -104,11 +134,21 @@ load_configuration (GnomePilotConduit *conduit, ConduitCfg **c,guint32 pilotId)
}
}
- (*c)->ignore_end=gnome_config_get_string ("ignore end");
- (*c)->ignore_start=gnome_config_get_string ("ignore start");
- gnome_config_pop_prefix ();
- g_free (prefix);
+ (*c)->ignore_end=g_key_file_get_string (kfile, iPilot, "ignore end", &error);
+ if (error) {
+ (*c)->ignore_end=NULL;
+ error = NULL;
+ }
+
+ (*c)->ignore_start=g_key_file_get_string (kfile, iPilot, "ignore start", &error);
+ if (error) {
+ (*c)->ignore_start=NULL;
+ error = NULL;
+ }
+
(*c)->pilotId = pilotId;
+ g_free (iPilot);
+ g_key_file_free (kfile);
}
static void
@@ -155,35 +195,36 @@ destroy_configuration (ConduitCfg **c)
static void
save_configuration (ConduitCfg *c)
{
- char *prefix;
+ gchar *iPilot;
+ GKeyFile *kfile;
+
char *entry;
g_return_if_fail (c!=NULL);
- prefix = g_strdup_printf (CONFIG_PREFIX, c->pilotId);
+ kfile = get_kfile("memo_file-conduit");
+ iPilot = g_strdup_printf ("Pilot_%u", c->pilotId);
- gnome_config_push_prefix (prefix);
- gnome_config_set_bool ("open secret", c->open_secret);
+ g_key_file_set_boolean (kfile, iPilot, "open secret", c->open_secret);
entry = g_strdup_printf ("0%o", c->secret_mode);
- gnome_config_set_string ("secret mode", entry);
+ g_key_file_set_string (kfile, iPilot, "secret mode", entry);
g_free (entry);
entry = g_strdup_printf ("0%o", c->file_mode);
- gnome_config_set_string ("file mode", entry);
+ g_key_file_set_string (kfile, iPilot, "file mode", entry);
g_free (entry);
entry = g_strdup_printf ("0%o", c->dir_mode);
- gnome_config_set_string ("dir mode", entry);
+ g_key_file_set_string (kfile, iPilot, "dir mode", entry);
g_free (entry);
- gnome_config_set_string ("dir", c->dir);
- gnome_config_set_string ("ignore end", c->ignore_end);
- gnome_config_set_string ("ignore start", c->ignore_start);
- gnome_config_pop_prefix ();
- g_free (prefix);
+ g_key_file_set_string (kfile, iPilot, "dir", c->dir);
+ g_key_file_set_string (kfile, iPilot, "ignore end", c->ignore_end);
+ g_key_file_set_string (kfile, iPilot, "ignore start", c->ignore_start);
+
+ g_free (iPilot);
- gnome_config_sync ();
- gnome_config_drop_all ();
+ save_config (kfile, "memo_file-conduit");
}
@@ -1266,8 +1307,8 @@ secret_toggled_cb (GtkWidget *widget, gpointer data)
ConduitCfg * curState = GET_CONDUIT_CFG (conduit);
GtkWidget * main_widget = GET_CONDUIT_WINDOW (conduit);
curState->open_secret = GTK_TOGGLE_BUTTON (widget)->active;
- gtk_widget_set_sensitive (gtk_object_get_data (GTK_OBJECT (main_widget),"secret_mode"), curState->open_secret);
- gtk_widget_set_sensitive (gtk_object_get_data (GTK_OBJECT (main_widget),"secret_label"), curState->open_secret);
+ gtk_widget_set_sensitive (g_object_get_data (G_OBJECT (main_widget),"secret_mode"), curState->open_secret);
+ gtk_widget_set_sensitive (g_object_get_data (G_OBJECT (main_widget),"secret_label"), curState->open_secret);
}
@@ -1282,22 +1323,23 @@ static GtkWidget
/* how many fields do we have */
while (fields[count].name!=0) count++;
- vbox = gtk_vbox_new (FALSE, GNOME_PAD);
+ vbox = gtk_vbox_new (FALSE, MC_PAD);
table = gtk_table_new (count, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, GNOME_PAD);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, MC_PAD);
for (i=0;i<count;i++) {
label = gtk_label_new (_(fields[i].name));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, i, i+1);
if (fields[i].label_data!=NULL) {
- gtk_object_set_data (GTK_OBJECT (vbox), fields[i].label_data, label);
+ g_object_set_data (G_OBJECT (vbox), fields[i].label_data, label);
}
- entry = gtk_entry_new_with_max_length (128);
- gtk_object_set_data (GTK_OBJECT (vbox), fields[i].obj_data, entry);
+ entry = gtk_entry_new();
+ gtk_entry_set_max_length (GTK_ENTRY(entry), 128);
+ g_object_set_data (G_OBJECT (vbox), fields[i].obj_data, entry);
gtk_table_attach (GTK_TABLE (table), entry, 2, 3, i, i+1, 0, 0, 0, 0);
g_signal_connect (GTK_OBJECT (entry), "insert_text",
G_CALLBACK (fields[i].insert_func),
@@ -1306,7 +1348,7 @@ static GtkWidget
button = gtk_check_button_new ();
- gtk_object_set_data (GTK_OBJECT (vbox),"secret_on", button);
+ g_object_set_data (G_OBJECT (vbox),"secret_on", button);
g_signal_connect (GTK_OBJECT (button), "toggled",
G_CALLBACK (secret_toggled_cb),
conduit);
@@ -1324,13 +1366,13 @@ setOptionsCfg (GtkWidget *pilotcfg, ConduitCfg *state)
GtkWidget *dir,*ignore_end,*ignore_start,*dir_mode;
GtkWidget *secret_button, *file_mode,*secret_mode;
- dir = gtk_object_get_data (GTK_OBJECT (pilotcfg), "dir");
- ignore_end = gtk_object_get_data (GTK_OBJECT (pilotcfg), "ignore_end");
- ignore_start = gtk_object_get_data (GTK_OBJECT (pilotcfg), "ignore_start");
- dir_mode = gtk_object_get_data (GTK_OBJECT (pilotcfg), "dir_mode");
- file_mode = gtk_object_get_data (GTK_OBJECT (pilotcfg), "file_mode");
- secret_mode = gtk_object_get_data (GTK_OBJECT (pilotcfg), "secret_mode");
- secret_button = gtk_object_get_data (GTK_OBJECT (pilotcfg),"secret_on");
+ dir = g_object_get_data (G_OBJECT (pilotcfg), "dir");
+ ignore_end = g_object_get_data (G_OBJECT (pilotcfg), "ignore_end");
+ ignore_start = g_object_get_data (G_OBJECT (pilotcfg), "ignore_start");
+ dir_mode = g_object_get_data (G_OBJECT (pilotcfg), "dir_mode");
+ file_mode = g_object_get_data (G_OBJECT (pilotcfg), "file_mode");
+ secret_mode = g_object_get_data (G_OBJECT (pilotcfg), "secret_mode");
+ secret_button = g_object_get_data (G_OBJECT (pilotcfg),"secret_on");
gtk_entry_set_text (GTK_ENTRY (dir), state->dir);
if (state->ignore_start) gtk_entry_set_text (GTK_ENTRY (ignore_start), state->ignore_start);
@@ -1342,8 +1384,8 @@ setOptionsCfg (GtkWidget *pilotcfg, ConduitCfg *state)
g_snprintf (buf, 7,"0%o", state->secret_mode);
gtk_entry_set_text (GTK_ENTRY (secret_mode), buf);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (secret_button), state->open_secret);
- gtk_widget_set_sensitive (gtk_object_get_data (GTK_OBJECT (pilotcfg),"secret_mode"), state->open_secret);
- gtk_widget_set_sensitive (gtk_object_get_data (GTK_OBJECT (pilotcfg),"secret_label"), state->open_secret);
+ gtk_widget_set_sensitive (g_object_get_data (G_OBJECT (pilotcfg),"secret_mode"), state->open_secret);
+ gtk_widget_set_sensitive (g_object_get_data (G_OBJECT (pilotcfg),"secret_label"), state->open_secret);
}
@@ -1354,7 +1396,7 @@ readOptionsCfg (GtkWidget *pilotcfg, ConduitCfg *state)
{
GtkWidget *entry;
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "dir");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "dir");
if (state->dir) g_free (state->dir);
state->dir = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
@@ -1362,21 +1404,21 @@ readOptionsCfg (GtkWidget *pilotcfg, ConduitCfg *state)
state->dir[strlen (state->dir)-1] = '\0';
}
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "ignore_start");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "ignore_start");
if (state->ignore_start) g_free (state->ignore_start);
state->ignore_start = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "ignore_end");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "ignore_end");
if (state->ignore_end) g_free (state->ignore_end);
state->ignore_end = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "dir_mode");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "dir_mode");
state->dir_mode = strtol (gtk_entry_get_text (GTK_ENTRY (entry)), NULL, 0);
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "file_mode");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "file_mode");
state->file_mode = strtol (gtk_entry_get_text (GTK_ENTRY (entry)), NULL, 0);
- entry = gtk_object_get_data (GTK_OBJECT (pilotcfg), "secret_mode");
+ entry = g_object_get_data (G_OBJECT (pilotcfg), "secret_mode");
state->secret_mode = strtol (gtk_entry_get_text (GTK_ENTRY (entry)), NULL, 0);
}
@@ -1391,7 +1433,7 @@ create_settings_window (GnomePilotConduit *conduit, GtkWidget *parent, gpointer
gtk_container_add (GTK_CONTAINER (parent), cfgWindow);
gtk_widget_show_all (cfgWindow);
- gtk_object_set_data (GTK_OBJECT (conduit), OBJ_DATA_CONFIG_WINDOW, cfgWindow);
+ g_object_set_data (G_OBJECT (conduit), OBJ_DATA_CONFIG_WINDOW, cfgWindow);
setOptionsCfg (GET_CONDUIT_WINDOW (conduit), GET_CONDUIT_CFG (conduit));
return 0;
}
@@ -1462,9 +1504,9 @@ conduit_get_gpilot_conduit (guint32 pilotId)
load_configuration (GNOME_PILOT_CONDUIT (retval), &cfg, pilotId);
cfg2 = dupe_configuration (cfg);
- gtk_object_set_data (GTK_OBJECT (retval), OBJ_DATA_CONFIG, cfg);
- gtk_object_set_data (GTK_OBJECT (retval), OBJ_DATA_OLDCONFIG, cfg2);
- gtk_object_set_data (GTK_OBJECT (retval), OBJ_DATA_CONDUIT, cd);
+ g_object_set_data (G_OBJECT (retval), OBJ_DATA_CONFIG, cfg);
+ g_object_set_data (G_OBJECT (retval), OBJ_DATA_OLDCONFIG, cfg2);
+ g_object_set_data (G_OBJECT (retval), OBJ_DATA_CONDUIT, cd);
if (cfg->dir==NULL) {
g_warning (_("No dir specified. Please run memo_file conduit capplet first."));
@@ -1501,3 +1543,116 @@ conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
}
+#define OLD_PREFIX ".gnome2/gnome-pilot.d"
+#define NEW_PREFIX ".gnome-pilot"
+
+#define IS_STR_SET(x) (x != NULL && x[0] != '\0')
+
+static void
+migrate_conf (const gchar *old, const gchar *new)
+{
+ gchar *basename = g_path_get_dirname (new);
+
+ if (!g_file_test (basename, G_FILE_TEST_EXISTS)) {
+ g_mkdir_with_parents (basename, S_IRUSR | S_IWUSR | S_IXUSR);
+ } else {
+ if (!g_file_test (basename, G_FILE_TEST_IS_DIR)) {
+ gchar *tmp = g_strdup_printf ("%s.old", basename);
+ rename (basename, tmp);
+ g_free (tmp);
+ g_mkdir_with_parents (basename, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
+ }
+ g_free (basename);
+
+ if (g_file_test (new, G_FILE_TEST_IS_REGULAR)) {
+ return;
+ } else if (g_file_test (old, G_FILE_TEST_IS_REGULAR)) {
+ rename (old, new);
+ } else {
+ creat (new, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ }
+}
+
+static GKeyFile*
+get_kfile (const gchar *conf)
+{
+ GKeyFile *kfile = g_key_file_new ();
+ const char *homedir = g_getenv ("HOME");
+ char *old = NULL;
+ char *new = NULL;
+
+ if (!homedir)
+ homedir = g_get_home_dir ();
+
+ old = g_build_filename (homedir, OLD_PREFIX, conf, NULL);
+ new = g_build_filename (homedir, NEW_PREFIX, conf, NULL);
+
+ migrate_conf (old, new);
+
+ g_key_file_load_from_file (kfile, new, G_KEY_FILE_NONE, NULL);
+ g_key_file_set_list_separator (kfile, ' ');
+
+ g_free (new);
+ g_free (old);
+ return kfile;
+}
+
+static gboolean
+save_config (GKeyFile *kfile,
+ const gchar *conf)
+{
+ const char *homedir = g_getenv ("HOME");
+ GError *error = NULL;
+ gchar *data = NULL;
+ gsize size;
+ gchar *filename = NULL;
+
+ g_return_val_if_fail (kfile, FALSE);
+ g_return_val_if_fail (IS_STR_SET (conf), FALSE);
+
+ if (!homedir)
+ homedir = g_get_home_dir ();
+
+ filename = g_build_filename (homedir, NEW_PREFIX, conf, NULL);
+
+ if (! g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ g_free (filename);
+ g_warning ("File %s does not exsit", filename);
+ return FALSE;
+ }
+
+ g_message ("Saving config to disk...");
+
+ g_key_file_set_list_separator (kfile, ' ');
+ data = g_key_file_to_data (kfile, &size, &error);
+ if (error) {
+ g_warning ("Could not get config data to write to file, %s",
+ error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ g_file_set_contents (filename, data, size, &error);
+ g_free (data);
+
+ if (error) {
+ g_warning ("Could not write %" G_GSIZE_FORMAT " bytes to file '%s', %s",
+ size,
+ filename,
+ error->message);
+ g_free (filename);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ g_message ("Wrote config to '%s' (%" G_GSIZE_FORMAT " bytes)",
+ filename,
+ size);
+
+ g_free (filename);
+
+ return TRUE;
+}
diff --git a/memo_file/memo_file_conduit.h b/memo_file/memo_file_conduit.h
index d58276c..c2458b5 100644
--- a/memo_file/memo_file_conduit.h
+++ b/memo_file/memo_file_conduit.h
@@ -29,7 +29,7 @@
#include <pi-appinfo.h>
#include <pi-memo.h>
#include <glib.h>
-#include <gnome.h>
+#include <gtk/gtk.h>
#include <errno.h>
#include <gpilotd/gnome-pilot-conduit.h>
@@ -39,7 +39,6 @@
#define OBJ_DATA_CONFIG "conduit_config"
#define OBJ_DATA_OLDCONFIG "conduit_oldconfig"
#define OBJ_DATA_CONFIG_WINDOW "config_window"
-#define CONFIG_PREFIX "/gnome-pilot.d/memo_file-conduit/Pilot_%u/"
typedef struct _MemoLocalRecord MemoLocalRecord;
@@ -65,10 +64,10 @@ struct _ConduitData {
GnomePilotDBInfo *dbi;
};
-#define GET_CONDUIT_CFG(s) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONFIG))
-#define GET_CONDUIT_OLDCFG(s) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_OLDCONFIG))
-#define GET_CONDUIT_DATA(s) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONDUIT))
-#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
+#define GET_CONDUIT_CFG(s) ((ConduitCfg*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONFIG))
+#define GET_CONDUIT_OLDCFG(s) ((ConduitCfg*)g_object_get_data(G_OBJECT(s),OBJ_DATA_OLDCONFIG))
+#define GET_CONDUIT_DATA(s) ((ConduitData*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONDUIT))
+#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
typedef struct IterateData {
int flag;
diff --git a/time/time-conduit.c b/time/time-conduit.c
index 786d452..a4e6599 100644
--- a/time/time-conduit.c
+++ b/time/time-conduit.c
@@ -21,7 +21,8 @@
*/
#include <glib.h>
-#include <gnome.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <pi-source.h>
#include <pi-socket.h>
@@ -33,6 +34,8 @@
#include "time-conduit.h"
+#define TC_PAD 8
+
#define TC_DEBUG 1
#ifdef TC_DEBUG
@@ -51,21 +54,12 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit);
static void
load_configuration(ConduitCfg **c,guint32 pilotId)
{
- gchar *prefix;
- gchar *buf;
g_return_if_fail(c!=NULL);
- prefix = g_strdup_printf (CONFIG_PREFIX, pilotId);
-
*c = g_new0(ConduitCfg,1);
- gnome_config_push_prefix(prefix);
(*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* this will be reset by capplet */
- gnome_config_pop_prefix();
-
(*c)->pilotId = pilotId;
-
- g_free (prefix);
}
static void
@@ -97,16 +91,7 @@ destroy_configuration(ConduitCfg **c)
static void
save_configuration(ConduitCfg *c)
{
- gchar *prefix;
-
- g_return_if_fail(c!=NULL);
- prefix = g_strdup_printf (CONFIG_PREFIX, c->pilotId);
- gnome_config_push_prefix(prefix);
- gnome_config_pop_prefix();
- gnome_config_sync();
- gnome_config_drop_all();
- g_free (prefix);
}
static GtkWidget
@@ -118,10 +103,10 @@ static GtkWidget
GtkWidget *m1, *m2;
GtkWidget *label;
- vbox = gtk_vbox_new (FALSE, GNOME_PAD);
+ vbox = gtk_vbox_new (FALSE, TC_PAD);
label = gtk_label_new (_("Please note, that PalmOS 3.3 can not properly set the time."));
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, GNOME_PAD);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, TC_PAD);
return vbox;
}
@@ -150,7 +135,7 @@ create_settings_window (GnomePilotConduit *conduit, GtkWidget *parent, gpointer
gtk_container_add(GTK_CONTAINER(parent),cfgWindow);
gtk_widget_show_all(cfgWindow);
- gtk_object_set_data(GTK_OBJECT(conduit),OBJ_DATA_CONFIG_WINDOW,cfgWindow);
+ g_object_set_data(G_OBJECT(conduit),OBJ_DATA_CONFIG_WINDOW,cfgWindow);
setOptionsCfg(GET_CONDUIT_WINDOW(conduit),GET_CONDUIT_CFG(conduit));
return 0;
}
@@ -218,8 +203,8 @@ conduit_load_gpilot_conduit (GPilotPilot *pilot)
load_configuration (&cfg, pilot->pilot_id);
cfg2 = dupe_configuration (cfg);
- gtk_object_set_data(GTK_OBJECT(retval),OBJ_DATA_CONFIG,cfg);
- gtk_object_set_data(GTK_OBJECT(retval),OBJ_DATA_OLDCONFIG,cfg2);
+ g_object_set_data(G_OBJECT(retval),OBJ_DATA_CONFIG,cfg);
+ g_object_set_data(G_OBJECT(retval),OBJ_DATA_OLDCONFIG,cfg2);
g_signal_connect (retval, "synchronize", (GCallback)synchronize, cfg);
g_signal_connect (retval, "create_settings_window", (GCallback)create_settings_window, NULL);
diff --git a/time/time-conduit.h b/time/time-conduit.h
index 3f0d543..3de8437 100644
--- a/time/time-conduit.h
+++ b/time/time-conduit.h
@@ -31,10 +31,10 @@
#define OBJ_DATA_CONFIG_WINDOW "config_window"
#define CONFIG_PREFIX "/gnome-pilot.d/time-conduit/Pilot_%u/"
-#define GET_CONDUIT_CFG(s) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONFIG))
-#define GET_CONDUIT_OLDCFG(s) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_OLDCONFIG))
-#define GET_CONDUIT_DATA(s) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONDUIT))
-#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
+#define GET_CONDUIT_CFG(s) ((ConduitCfg*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONFIG))
+#define GET_CONDUIT_OLDCFG(s) ((ConduitCfg*)g_object_get_data(G_OBJECT(s),OBJ_DATA_OLDCONFIG))
+#define GET_CONDUIT_DATA(s) ((ConduitData*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONDUIT))
+#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
typedef struct ConduitCfg {
GnomePilotConduitSyncType sync_type; /* only used by capplet */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]