aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/bbdb
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 23:13:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-29 00:13:23 +0800
commitfad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch)
treeae78be371695c3dc18847b87d3f014f985aa3a40 /plugins/bbdb
parent6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff)
downloadgsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.bz2
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.lz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.xz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip
Prefer GLib basic types over C types.
Diffstat (limited to 'plugins/bbdb')
-rw-r--r--plugins/bbdb/bbdb.c34
-rw-r--r--plugins/bbdb/bbdb.h2
-rw-r--r--plugins/bbdb/gaimbuddies.c76
-rw-r--r--plugins/bbdb/test-evobuddy.c2
4 files changed, 57 insertions, 57 deletions
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 2f375ac43b..8cd8535a73 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -42,7 +42,7 @@
#define d(x)
/* Plugin hooks */
-int e_plugin_lib_enable (EPluginLib *ep, int enable);
+gint e_plugin_lib_enable (EPluginLib *ep, gint enable);
void bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target);
GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
@@ -59,11 +59,11 @@ struct bbdb_stuff {
/* Static forward declarations */
static gboolean bbdb_timeout (gpointer data);
-static void bbdb_do_it (EBook *book, const char *name, const char *email);
-static void add_email_to_contact (EContact *contact, const char *email);
+static void bbdb_do_it (EBook *book, const gchar *name, const gchar *email);
+static void add_email_to_contact (EContact *contact, const gchar *email);
static void enable_toggled_cb (GtkWidget *widget, gpointer data);
static void source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff);
-static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff, int type);
+static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff, gint type);
static void cleanup_cb (GObject *o, gpointer data);
static ESource *
@@ -105,8 +105,8 @@ find_esource_by_uri (ESourceList *source_list, const gchar *target_uri)
return NULL;
}
-int
-e_plugin_lib_enable (EPluginLib *ep, int enable)
+gint
+e_plugin_lib_enable (EPluginLib *ep, gint enable)
{
/* Start up the plugin. */
if (enable) {
@@ -134,8 +134,8 @@ bbdb_timeout (gpointer data)
typedef struct
{
- char *name;
- char *email;
+ gchar *name;
+ gchar *email;
} todo_struct;
static void
@@ -192,7 +192,7 @@ bbdb_do_in_thread (gpointer data)
}
static void
-bbdb_do_thread (const char *name, const char *email)
+bbdb_do_thread (const gchar *name, const gchar *email)
{
todo_struct *td;
@@ -271,9 +271,9 @@ bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target)
}
static void
-bbdb_do_it (EBook *book, const char *name, const char *email)
+bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
{
- char *query_string, *delim, *temp_name = NULL;
+ gchar *query_string, *delim, *temp_name = NULL;
EBookQuery *query;
GList *contacts, *l;
EContact *contact;
@@ -375,10 +375,10 @@ bbdb_do_it (EBook *book, const char *name, const char *email)
}
EBook *
-bbdb_open_addressbook (int type)
+bbdb_open_addressbook (gint type)
{
GConfClient *gconf;
- char *uri;
+ gchar *uri;
EBook *book = NULL;
gboolean status;
@@ -439,7 +439,7 @@ bbdb_check_gaim_enabled (void)
}
static void
-add_email_to_contact (EContact *contact, const char *email)
+add_email_to_contact (EContact *contact, const gchar *email)
{
GList *emails;
@@ -497,7 +497,7 @@ enable_gaim_toggled_cb (GtkWidget *widget, gpointer data)
struct bbdb_stuff *stuff = (struct bbdb_stuff *) data;
gboolean active;
ESource *selected_source;
- char *addressbook_gaim;
+ gchar *addressbook_gaim;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
@@ -562,12 +562,12 @@ gaim_source_changed_cb (ESourceComboBox *source_combo_box,
}
static GtkWidget *
-create_addressbook_option_menu (struct bbdb_stuff *stuff, int type)
+create_addressbook_option_menu (struct bbdb_stuff *stuff, gint type)
{
GtkWidget *combo_box;
ESourceList *source_list;
ESource *selected_source;
- char *selected_source_uri;
+ gchar *selected_source_uri;
GConfClient *gconf = stuff->target->gconf;
diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h
index 62887a8ed0..994aab0385 100644
--- a/plugins/bbdb/bbdb.h
+++ b/plugins/bbdb/bbdb.h
@@ -36,7 +36,7 @@
#define BBDB_BLIST_CHECK_INTERVAL (2 * 60)
/* bbdb.c */
-EBook *bbdb_open_addressbook (int type);
+EBook *bbdb_open_addressbook (gint type);
gboolean bbdb_check_gaim_enabled (void);
/* gaimbuddies.c */
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index d23749de66..f50498fc48 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -50,20 +50,20 @@
#include "bbdb.h"
typedef struct {
- char *account_name;
- char *proto;
- char *alias;
- char *icon;
+ gchar *account_name;
+ gchar *proto;
+ gchar *alias;
+ gchar *icon;
} GaimBuddy;
/* Forward declarations for this file. */
static gboolean bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c);
static GList *bbdb_get_gaim_buddy_list (void);
-static char *get_node_text (xmlNodePtr node);
-static char *get_buddy_icon_from_setting (xmlNodePtr setting);
+static gchar *get_node_text (xmlNodePtr node);
+static gchar *get_buddy_icon_from_setting (xmlNodePtr setting);
static void free_buddy_list (GList *blist);
static void parse_buddy_group (xmlNodePtr group, GList **buddies, GSList *blocked);
-static EContactField proto_to_contact_field (const char *proto);
+static EContactField proto_to_contact_field (const gchar *proto);
void
bbdb_sync_buddy_list_check (void)
@@ -71,8 +71,8 @@ bbdb_sync_buddy_list_check (void)
GConfClient *gconf;
struct stat statbuf;
time_t last_sync;
- char *blist_path;
- char *last_sync_str;
+ gchar *blist_path;
+ gchar *last_sync_str;
gconf = gconf_client_get_default ();
@@ -87,7 +87,7 @@ bbdb_sync_buddy_list_check (void)
/* Reprocess the buddy list if it's been updated. */
last_sync_str = gconf_client_get_string (gconf, GCONF_KEY_GAIM_LAST_SYNC, NULL);
- if (last_sync_str == NULL || ! strcmp ((const char *)last_sync_str, ""))
+ if (last_sync_str == NULL || ! strcmp ((const gchar *)last_sync_str, ""))
last_sync = (time_t) 0;
else
last_sync = (time_t) g_ascii_strtoull (last_sync_str, NULL, 10);
@@ -179,7 +179,7 @@ bbdb_sync_buddy_list (void)
{
GConfClient *gconf;
time_t last_sync;
- char *last_sync_str;
+ gchar *last_sync_str;
gconf = gconf_client_get_default ();
@@ -199,7 +199,7 @@ im_list_contains_buddy (GList *ims, GaimBuddy *b)
GList *l;
for (l = ims; l != NULL; l = l->next) {
- char *im = (char *) l->data;
+ gchar *im = (gchar *) l->data;
if (! strcmp (im, b->account_name))
return TRUE;
@@ -241,12 +241,12 @@ bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c)
g_warning ("bbdb: Could not read buddy icon: %s\n", error->message);
g_error_free (error);
for (l = ims; l != NULL; l = l->next)
- g_free ((char *) l->data);
+ g_free ((gchar *) l->data);
g_list_free (ims);
return dirty;
}
- photo->data.inlined.data = (unsigned char *)contents;
+ photo->data.inlined.data = (guchar *)contents;
e_contact_set (c, E_CONTACT_PHOTO, (gpointer) photo);
dirty = TRUE;
}
@@ -257,14 +257,14 @@ bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c)
e_contact_photo_free (photo);
for (l = ims; l != NULL; l = l->next)
- g_free ((char *) l->data);
+ g_free ((gchar *) l->data);
g_list_free (ims);
return dirty;
}
static EContactField
-proto_to_contact_field (const char *proto)
+proto_to_contact_field (const gchar *proto)
{
if (! strcmp (proto, "prpl-oscar"))
return E_CONTACT_IM_AIM;
@@ -296,8 +296,8 @@ get_all_blocked (xmlNodePtr node, GSList **blocked)
if (child->children)
get_all_blocked (child, blocked);
- if (!strcmp ((const char *)child->name, "block")) {
- char *name = get_node_text (child);
+ if (!strcmp ((const gchar *)child->name, "block")) {
+ gchar *name = get_node_text (child);
if (name)
*blocked = g_slist_prepend (*blocked, name);
@@ -308,7 +308,7 @@ get_all_blocked (xmlNodePtr node, GSList **blocked)
static GList *
bbdb_get_gaim_buddy_list (void)
{
- char *blist_path;
+ gchar *blist_path;
xmlDocPtr buddy_xml;
xmlNodePtr root, child, blist;
GList *buddies = NULL;
@@ -324,14 +324,14 @@ bbdb_get_gaim_buddy_list (void)
}
root = xmlDocGetRootElement (buddy_xml);
- if (strcmp ((const char *)root->name, "purple")) {
+ if (strcmp ((const gchar *)root->name, "purple")) {
fprintf (stderr, "bbdb: Could not parse Pidgin buddy list.\n");
xmlFreeDoc (buddy_xml);
return NULL;
}
for (child = root->children; child != NULL; child = child->next) {
- if (! strcmp ((const char *)child->name, "privacy")) {
+ if (! strcmp ((const gchar *)child->name, "privacy")) {
get_all_blocked (child, &blocked);
break;
}
@@ -339,7 +339,7 @@ bbdb_get_gaim_buddy_list (void)
blist = NULL;
for (child = root->children; child != NULL; child = child->next) {
- if (! strcmp ((const char *)child->name, "blist")) {
+ if (! strcmp ((const gchar *)child->name, "blist")) {
blist = child;
break;
}
@@ -351,7 +351,7 @@ bbdb_get_gaim_buddy_list (void)
}
for (child = blist->children; child != NULL; child = child->next) {
- if (! strcmp ((const char *)child->name, "group"))
+ if (! strcmp ((const gchar *)child->name, "group"))
parse_buddy_group (child, &buddies, blocked);
}
@@ -383,24 +383,24 @@ free_buddy_list (GList *blist)
g_list_free (blist);
}
-static char *
+static gchar *
get_node_text (xmlNodePtr node)
{
if (node->children == NULL || node->children->content == NULL ||
- strcmp ((char *)node->children->name, "text"))
+ strcmp ((gchar *)node->children->name, "text"))
return NULL;
- return g_strdup ((char *)node->children->content);
+ return g_strdup ((gchar *)node->children->content);
}
-static char *
+static gchar *
get_buddy_icon_from_setting (xmlNodePtr setting)
{
- char *icon = NULL;
+ gchar *icon = NULL;
icon = get_node_text (setting);
if (icon [0] != '/') {
- char *path;
+ gchar *path;
path = g_build_path ("/", getenv ("HOME"), ".purple/icons", icon, NULL);
g_free (icon);
@@ -420,7 +420,7 @@ parse_contact (xmlNodePtr contact, GList **buddies, GSList *blocked)
gboolean is_blocked = FALSE;
for (child = contact->children; child != NULL; child = child->next) {
- if (! strcmp ((const char *)child->name, "buddy")) {
+ if (! strcmp ((const gchar *)child->name, "buddy")) {
buddy = child;
break;
}
@@ -433,21 +433,21 @@ parse_contact (xmlNodePtr contact, GList **buddies, GSList *blocked)
gb = g_new0 (GaimBuddy, 1);
- gb->proto = e_xml_get_string_prop_by_name (buddy, (const unsigned char *)"proto");
+ gb->proto = e_xml_get_string_prop_by_name (buddy, (const guchar *)"proto");
for (child = buddy->children; child != NULL && !is_blocked; child = child->next) {
- if (! strcmp ((const char *)child->name, "setting")) {
- char *setting_type;
- setting_type = e_xml_get_string_prop_by_name (child, (const unsigned char *)"name");
+ if (! strcmp ((const gchar *)child->name, "setting")) {
+ gchar *setting_type;
+ setting_type = e_xml_get_string_prop_by_name (child, (const guchar *)"name");
- if (! strcmp ((const char *)setting_type, "buddy_icon"))
+ if (! strcmp ((const gchar *)setting_type, "buddy_icon"))
gb->icon = get_buddy_icon_from_setting (child);
g_free (setting_type);
- } else if (! strcmp ((const char *)child->name, "name")) {
+ } else if (! strcmp ((const gchar *)child->name, "name")) {
gb->account_name = get_node_text (child);
is_blocked = g_slist_find_custom (blocked, gb->account_name, (GCompareFunc)strcmp) != NULL;
- } else if (! strcmp ((const char *)child->name, "alias"))
+ } else if (! strcmp ((const gchar *)child->name, "alias"))
gb->alias = get_node_text (child);
}
@@ -464,7 +464,7 @@ parse_buddy_group (xmlNodePtr group, GList **buddies, GSList *blocked)
xmlNodePtr child;
for (child = group->children; child != NULL; child = child->next) {
- if (strcmp ((const char *)child->name, "contact"))
+ if (strcmp ((const gchar *)child->name, "contact"))
continue;
parse_contact (child, buddies, blocked);
diff --git a/plugins/bbdb/test-evobuddy.c b/plugins/bbdb/test-evobuddy.c
index 9d14aabebe..8d8486ac73 100644
--- a/plugins/bbdb/test-evobuddy.c
+++ b/plugins/bbdb/test-evobuddy.c
@@ -22,7 +22,7 @@
void bbdb_sync_buddy_list (void);
-int
+gint
main (void)
{
printf ("Syncing...\n");