[gnome-pilot-conduits] email-conduit: avoid gtk_object_get/set_data #594214
- From: Matthew Charles Davey <mcdavey src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-pilot-conduits] email-conduit: avoid gtk_object_get/set_data #594214
- Date: Sun, 10 Oct 2010 21:56:01 +0000 (UTC)
commit 92a6e8e3ab86342d90a2c40b6444d2c49e403e7e
Author: Matt Davey <mcdavey mrao cam ac uk>
Date: Thu Sep 30 00:48:55 2010 +0100
email-conduit: avoid gtk_object_get/set_data #594214
email/email_conduit.c | 81 ++++++++++++++++++++++++-------------------------
email/email_conduit.h | 6 ++--
2 files changed, 43 insertions(+), 44 deletions(-)
---
diff --git a/email/email_conduit.c b/email/email_conduit.c
index 3e63f8d..3d67796 100644
--- a/email/email_conduit.c
+++ b/email/email_conduit.c
@@ -7,7 +7,6 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-/*#include <gnome.h>*/
#include <pi-source.h>
#include <pi-socket.h>
@@ -333,12 +332,12 @@ write_message_to_pilot (GnomePilotConduit *c, GnomePilotDBInfo *dbi,
/* if this mail already exists in the Palms inbox then skip this mail */
needle.size = len;
needle.buffer = buffer;
- inbox_list = (GList*) gtk_object_get_data(GTK_OBJECT(c), "inbox_list");
+ inbox_list = (GList*) g_object_get_data(G_OBJECT(c), "inbox_list");
field = g_list_find_custom(inbox_list, &needle, match_mail);
if (field) {
/* remove the mail from the list as we've already seen it */
inbox_list = g_list_remove_link(inbox_list, field);
- gtk_object_set_data(GTK_OBJECT(c),"inbox_list",(gpointer)inbox_list);
+ g_object_set_data(G_OBJECT(c),"inbox_list",(gpointer)inbox_list);
free(field->data);
g_list_free_1(field);
LOG("Skipping message (already on Palm device)");
@@ -560,7 +559,7 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
/* read in all the existing records on the Palm so that we can
* spot duplicate mails
*/
- inbox_list = (GList*) gtk_object_get_data(GTK_OBJECT(c), "inbox_list");
+ inbox_list = (GList*) g_object_get_data(G_OBJECT(c), "inbox_list");
if ( strcmp( GET_CONFIG(c)->receiveAction, "copy" ) == 0 ||
strcmp( GET_CONFIG(c)->receiveAction, "mirror" ) == 0 ) {
for ( i = 0; ; i++ ) {
@@ -602,7 +601,7 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
/* the above loop is likely to change the value of inbox_list so we
* must put it back
*/
- gtk_object_set_data(GTK_OBJECT(c),"inbox_list",(gpointer)inbox_list);
+ g_object_set_data(G_OBJECT(c),"inbox_list",(gpointer)inbox_list);
@@ -761,7 +760,7 @@ static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
* remaining on the inbox_list
*/
if ( strcmp( GET_CONFIG(c)->receiveAction, "mirror" ) == 0 ) {
- GList *elem = (GList*) gtk_object_get_data(GTK_OBJECT(c), "inbox_list");
+ GList *elem = (GList*) g_object_get_data(G_OBJECT(c), "inbox_list");
for (; elem != NULL; elem = elem->next) {
MailDBRecord *record = (MailDBRecord *) elem->data;
LOG("purging out of date record %d", record->recID);
@@ -789,7 +788,7 @@ void
handleFileSelector (GtkWidget *widget, gpointer data)
{
GtkWidget *fs = data;
- GtkWidget *entry = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(fs), "entry"));
+ GtkWidget *entry = GTK_WIDGET(g_object_get_data(G_OBJECT(fs), "entry"));
const gchar *fname;
fname = gtk_file_selection_get_filename (GTK_FILE_SELECTION(fs));
@@ -803,7 +802,7 @@ createFileSelector (GtkWidget *widget, gpointer data)
GtkWidget *fs;
fs = gtk_file_selection_new(_("Select an mbox file or an MH directory"));
- gtk_object_set_data(GTK_OBJECT(fs), "entry", (gpointer) data);
+ g_object_set_data(G_OBJECT(fs), "entry", (gpointer) data);
g_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
"clicked", G_CALLBACK(handleFileSelector), fs);
@@ -838,18 +837,18 @@ static GtkWidget
menu = gtk_menu_new();
menuItem = gtk_menu_item_new_with_label (_("Delete from PDA"));
gtk_widget_show(menuItem);
- gtk_object_set_data(GTK_OBJECT(menuItem), "short", "delete");
- gtk_object_set_data(GTK_OBJECT(widget), "delete", (gpointer) 0);
+ g_object_set_data(G_OBJECT(menuItem), "short", "delete");
+ g_object_set_data(G_OBJECT(widget), "delete", (gpointer) 0);
gtk_menu_append (GTK_MENU (menu), GTK_WIDGET (menuItem));
menuItem = gtk_menu_item_new_with_label (_("File on PDA"));
gtk_widget_show(menuItem);
- gtk_object_set_data(GTK_OBJECT(menuItem), "short", "file");
- gtk_object_set_data(GTK_OBJECT(widget), "file", (gpointer) 1);
+ g_object_set_data(G_OBJECT(menuItem), "short", "file");
+ g_object_set_data(G_OBJECT(widget), "file", (gpointer) 1);
gtk_menu_append (GTK_MENU (menu), GTK_WIDGET (menuItem));
gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), GTK_WIDGET (menu));
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(table), widget, 1, 2, 0, 1);
- gtk_object_set_data(GTK_OBJECT(vbox), "send_action", widget);
+ g_object_set_data(G_OBJECT(vbox), "send_action", widget);
/* from_address entry */
label = gtk_label_new(_("From:"));
@@ -857,7 +856,7 @@ static GtkWidget
widget = gtk_entry_new_with_max_length(128);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(table), widget, 1, 2, 1, 2);
- gtk_object_set_data(GTK_OBJECT(vbox), "from_address", widget);
+ g_object_set_data(G_OBJECT(vbox), "from_address", widget);
/* sendmail entry */
label = gtk_label_new(_("Sendmail command:"));
@@ -865,7 +864,7 @@ static GtkWidget
widget = gtk_entry_new_with_max_length(128);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(table), widget, 1, 2, 2, 3);
- gtk_object_set_data(GTK_OBJECT(vbox), "sendmail", widget);
+ g_object_set_data(G_OBJECT(vbox), "sendmail", widget);
/* receive_action option menu */
label = gtk_label_new (_("Receive Action:"));
@@ -874,23 +873,23 @@ static GtkWidget
menu = gtk_menu_new ();
menuItem = gtk_menu_item_new_with_label (_("Copy from Inbox"));
gtk_widget_show(menuItem);
- gtk_object_set_data(GTK_OBJECT(menuItem), "short", "copy");
- gtk_object_set_data(GTK_OBJECT(widget), "copy", (gpointer) 0);
+ g_object_set_data(G_OBJECT(menuItem), "short", "copy");
+ g_object_set_data(G_OBJECT(widget), "copy", (gpointer) 0);
gtk_menu_append (GTK_MENU (menu), GTK_WIDGET (menuItem));
menuItem = gtk_menu_item_new_with_label (_("Delete from Inbox"));
gtk_widget_show(menuItem);
- gtk_object_set_data(GTK_OBJECT(menuItem), "short", "delete");
- gtk_object_set_data(GTK_OBJECT(widget), "delete", (gpointer) 1);
+ g_object_set_data(G_OBJECT(menuItem), "short", "delete");
+ g_object_set_data(G_OBJECT(widget), "delete", (gpointer) 1);
gtk_menu_append (GTK_MENU (menu), GTK_WIDGET (menuItem));
menuItem = gtk_menu_item_new_with_label (_("Mirror Inbox"));
gtk_widget_show(menuItem);
- gtk_object_set_data(GTK_OBJECT(menuItem), "short", "mirror");
- gtk_object_set_data(GTK_OBJECT(widget), "mirror", (gpointer) 2);
+ g_object_set_data(G_OBJECT(menuItem), "short", "mirror");
+ g_object_set_data(G_OBJECT(widget), "mirror", (gpointer) 2);
gtk_menu_append (GTK_MENU (menu), GTK_WIDGET (menuItem));
gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), GTK_WIDGET (menu));
gtk_table_attach_defaults (GTK_TABLE(table), label, 0, 1, 3, 4);
gtk_table_attach_defaults(GTK_TABLE(table), widget, 1, 2, 3, 4);
- gtk_object_set_data(GTK_OBJECT(vbox), "receive_action", widget);
+ g_object_set_data(G_OBJECT(vbox), "receive_action", widget);
/* mbox_file entry */
label = gtk_label_new(_("Copy mail from:"));
@@ -905,7 +904,7 @@ static GtkWidget
gtk_box_pack_end(GTK_BOX(box), widget, TRUE, TRUE, 0);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 4, 5);
gtk_table_attach_defaults(GTK_TABLE(table), box, 1, 2, 4, 5);
- gtk_object_set_data(GTK_OBJECT(vbox), "mbox_file", widget);
+ g_object_set_data(G_OBJECT(vbox), "mbox_file", widget);
return vbox;
}
@@ -918,19 +917,19 @@ setOptionsCfg(GtkWidget *cfg, ConduitCfg *c)
guint id;
/* fetch all the controls from the cfg window */
- send_action = gtk_object_get_data(GTK_OBJECT(cfg), "send_action");
- from_address = gtk_object_get_data(GTK_OBJECT(cfg), "from_address");
- sendmail = gtk_object_get_data(GTK_OBJECT(cfg), "sendmail");
- receive_action = gtk_object_get_data(GTK_OBJECT(cfg), "receive_action");
- mbox_file = gtk_object_get_data(GTK_OBJECT(cfg), "mbox_file");
+ send_action = g_object_get_data(G_OBJECT(cfg), "send_action");
+ from_address = g_object_get_data(G_OBJECT(cfg), "from_address");
+ sendmail = g_object_get_data(G_OBJECT(cfg), "sendmail");
+ receive_action = g_object_get_data(G_OBJECT(cfg), "receive_action");
+ mbox_file = g_object_get_data(G_OBJECT(cfg), "mbox_file");
- id = (guint) gtk_object_get_data(GTK_OBJECT(send_action), c->sendAction);
+ id = (guint) g_object_get_data(G_OBJECT(send_action), c->sendAction);
gtk_option_menu_set_history(GTK_OPTION_MENU(send_action), id);
gtk_entry_set_text(GTK_ENTRY(from_address), (c->fromAddr ? c->fromAddr : ""));
gtk_entry_set_text(GTK_ENTRY(sendmail), (c->sendmail ? c->sendmail : ""));
- id = (guint) gtk_object_get_data(GTK_OBJECT(receive_action), c->receiveAction);
+ id = (guint) g_object_get_data(G_OBJECT(receive_action), c->receiveAction);
gtk_option_menu_set_history(GTK_OPTION_MENU(receive_action), id);
if (c->mboxFile && 0 != strcmp(c->mboxFile, "")) {
@@ -951,15 +950,15 @@ readOptionsCfg(GtkWidget *cfg, ConduitCfg *c)
struct stat mboxStat;
/* fetch all the controls from the cfg window */
- send_action = gtk_object_get_data(GTK_OBJECT(cfg), "send_action");
- from_address = gtk_object_get_data(GTK_OBJECT(cfg), "from_address");
- sendmail = gtk_object_get_data(GTK_OBJECT(cfg), "sendmail");
- receive_action = gtk_object_get_data(GTK_OBJECT(cfg), "receive_action");
- mbox_file = gtk_object_get_data(GTK_OBJECT(cfg), "mbox_file");
+ send_action = g_object_get_data(G_OBJECT(cfg), "send_action");
+ from_address = g_object_get_data(G_OBJECT(cfg), "from_address");
+ sendmail = g_object_get_data(G_OBJECT(cfg), "sendmail");
+ receive_action = g_object_get_data(G_OBJECT(cfg), "receive_action");
+ mbox_file = g_object_get_data(G_OBJECT(cfg), "mbox_file");
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(send_action));
menuItem = gtk_menu_get_active(GTK_MENU(menu));
- str = g_strdup(gtk_object_get_data(GTK_OBJECT(menuItem), "short"));
+ str = g_strdup(g_object_get_data(G_OBJECT(menuItem), "short"));
g_free(c->sendAction);
c->sendAction = str;
@@ -981,7 +980,7 @@ readOptionsCfg(GtkWidget *cfg, ConduitCfg *c)
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(receive_action));
menuItem = gtk_menu_get_active(GTK_MENU(menu));
- str = g_strdup(gtk_object_get_data(GTK_OBJECT(menuItem), "short"));
+ str = g_strdup(g_object_get_data(G_OBJECT(menuItem), "short"));
g_free(c->receiveAction);
c->receiveAction = str;
@@ -1011,7 +1010,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_CONFIG(conduit));
return 0;
@@ -1068,8 +1067,8 @@ GnomePilotConduit *conduit_get_gpilot_conduit( guint32 pilotId )
load_configuration(&cfg1, pilotId );
cfg2 = dupe_configuration(cfg1);
- gtk_object_set_data(retval,OBJ_DATA_CONFIG,(gpointer)cfg1);
- gtk_object_set_data(retval,OBJ_DATA_OLDCONFIG,(gpointer)cfg2);
+ g_object_set_data(G_OBJECT(retval),OBJ_DATA_CONFIG,(gpointer)cfg1);
+ g_object_set_data(G_OBJECT(retval),OBJ_DATA_OLDCONFIG,(gpointer)cfg2);
return GNOME_PILOT_CONDUIT(retval);
}
@@ -1084,7 +1083,7 @@ void conduit_destroy_gpilot_conduit( GnomePilotConduit *c )
destroy_configuration( &cfg1 );
destroy_configuration( &cfg2 );
- inbox_list = (GList*) gtk_object_get_data(GTK_OBJECT(c), "inbox_list");
+ inbox_list = (GList*) g_object_get_data(G_OBJECT(c), "inbox_list");
for (list = inbox_list; list != NULL; list = list->next) {
free(list->data);
}
diff --git a/email/email_conduit.h b/email/email_conduit.h
index c19135d..e743f9d 100644
--- a/email/email_conduit.h
+++ b/email/email_conduit.h
@@ -24,8 +24,8 @@ typedef struct MailDBRecord {
guchar *buffer;
} MailDBRecord;
-#define GET_CONFIG(c) ((ConduitCfg*)(gtk_object_get_data(GTK_OBJECT(c),OBJ_DATA_CONFIG)))
-#define GET_OLDCONFIG(c) ((ConduitCfg*)(gtk_object_get_data(GTK_OBJECT(c),OBJ_DATA_OLDCONFIG)))
-#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)gtk_object_get_data(GTK_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
+#define GET_CONFIG(c) ((ConduitCfg*)(g_object_get_data(G_OBJECT(c),OBJ_DATA_CONFIG)))
+#define GET_OLDCONFIG(c) ((ConduitCfg*)(g_object_get_data(G_OBJECT(c),OBJ_DATA_OLDCONFIG)))
+#define GET_CONDUIT_WINDOW(s) ((GtkWidget*)g_object_get_data(G_OBJECT(s),OBJ_DATA_CONFIG_WINDOW))
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]