aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
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 /addressbook/gui/contact-editor
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 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c6
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c104
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h2
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c2
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c4
-rw-r--r--addressbook/gui/contact-editor/eab-editor.h2
-rw-r--r--addressbook/gui/contact-editor/test-editor.c16
7 files changed, 68 insertions, 68 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index 3897d605e3..5040b96570 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -99,7 +99,7 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
{
GladeXML *gui;
GtkWidget *widget;
- char *gladefile;
+ gchar *gladefile;
gtk_widget_realize (GTK_WIDGET (e_contact_editor_fullname));
gtk_dialog_set_has_separator (GTK_DIALOG (e_contact_editor_fullname),
@@ -189,7 +189,7 @@ e_contact_editor_fullname_set_property (GObject *object, guint prop_id,
}
break;
case PROP_EDITABLE: {
- int i;
+ gint i;
const gchar *widget_names[] = {
"comboentry-title",
"comboentry-suffix",
@@ -283,7 +283,7 @@ fill_in_info(EContactEditorFullname *editor)
}
}
-static char *
+static gchar *
extract_field (EContactEditorFullname *editor,
const gchar *field)
{
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index c7ce449ec4..305511d5d5 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -93,7 +93,7 @@ static GtkWindow* e_contact_editor_get_window (EABEditor *editor);
static void save_contact (EContactEditor *ce, gboolean should_close);
static void entry_activated (EContactEditor *editor);
-static void set_entry_text(EContactEditor *editor, GtkEntry *entry, const char *string);
+static void set_entry_text(EContactEditor *editor, GtkEntry *entry, const gchar *string);
static void sensitize_ok (EContactEditor *ce);
static EABEditorClass *parent_class = NULL;
@@ -339,7 +339,7 @@ is_field_supported (EContactEditor *editor, EContactField field_id)
/* This function tells you whether name_to_style will make sense. */
static gboolean
-style_makes_sense (const EContactName *name, const gchar *company, int style)
+style_makes_sense (const EContactName *name, const gchar *company, gint style)
{
switch (style) {
case 0: /* Fall Through */
@@ -368,13 +368,13 @@ style_makes_sense (const EContactName *name, const gchar *company, int style)
}
}
-static char *
-name_to_style (const EContactName *name, const gchar *company, int style)
+static gchar *
+name_to_style (const EContactName *name, const gchar *company, gint style)
{
- char *string;
- char *strings[4], **stringptr;
- char *midstring[4], **midstrptr;
- char *substring;
+ gchar *string;
+ gchar *strings[4], **stringptr;
+ gchar *midstring[4], **midstrptr;
+ gchar *substring;
switch (style) {
case 0:
stringptr = strings;
@@ -449,11 +449,11 @@ file_as_get_style (EContactEditor *editor)
{
GtkEntry *file_as = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (glade_xml_get_widget(editor->gui, "combo-file-as"))));
GtkEntry *company_w = GTK_ENTRY (glade_xml_get_widget (editor->gui, "entry-company"));
- char *filestring;
- char *trystring;
+ gchar *filestring;
+ gchar *trystring;
EContactName *name = editor->name;
const gchar *company;
- int i;
+ gint i;
if (!(file_as && GTK_IS_ENTRY(file_as)))
return -1;
@@ -475,10 +475,10 @@ file_as_get_style (EContactEditor *editor)
}
static void
-file_as_set_style (EContactEditor *editor, int style)
+file_as_set_style (EContactEditor *editor, gint style)
{
- char *string;
- int i;
+ gchar *string;
+ gint i;
GList *strings = NULL;
GtkComboBox *combo_file_as = GTK_COMBO_BOX (glade_xml_get_widget (editor->gui, "combo-file-as"));
GtkEntry *company_w = GTK_ENTRY (glade_xml_get_widget (editor->gui, "entry-company"));
@@ -496,7 +496,7 @@ file_as_set_style (EContactEditor *editor, int style)
for (i = 0; i < 6; i++) {
if (style_makes_sense (editor->name, company, i)) {
- char *u;
+ gchar *u;
u = name_to_style (editor->name, company, i);
if (!STRING_IS_EMPTY (u))
strings = g_list_append (strings, u);
@@ -528,8 +528,8 @@ file_as_set_style (EContactEditor *editor, int style)
static void
name_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
- int style = 0;
- const char *string;
+ gint style = 0;
+ const gchar *string;
style = file_as_get_style (editor);
e_contact_name_free (editor->name);
@@ -545,7 +545,7 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor)
static void
file_as_combo_changed (GtkWidget *widget, EContactEditor *editor)
{
- char *string = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+ gchar *string = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
if (string && *string) {
gchar *title;
@@ -564,7 +564,7 @@ file_as_combo_changed (GtkWidget *widget, EContactEditor *editor)
static void
company_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
- int style = 0;
+ gint style = 0;
style = file_as_get_style (editor);
file_as_set_style (editor, style);
@@ -600,9 +600,9 @@ sensitize_ok (EContactEditor *ce)
GtkWidget *entry_fullname = glade_xml_get_widget (ce->gui, "entry-fullname" );
GtkWidget *entry_file_as = gtk_bin_get_child (GTK_BIN (glade_xml_get_widget (ce->gui, "combo-file-as")));
GtkWidget *company_name = glade_xml_get_widget (ce->gui, "entry-company");
- const char *name_entry_string = gtk_entry_get_text (GTK_ENTRY (entry_fullname));
- const char *file_as_entry_string = gtk_entry_get_text (GTK_ENTRY (entry_file_as));
- const char *company_name_string = gtk_entry_get_text (GTK_ENTRY (company_name));
+ const gchar *name_entry_string = gtk_entry_get_text (GTK_ENTRY (entry_fullname));
+ const gchar *file_as_entry_string = gtk_entry_get_text (GTK_ENTRY (entry_file_as));
+ const gchar *company_name_string = gtk_entry_get_text (GTK_ENTRY (company_name));
allow_save = ce->target_editable && ce->changed ? TRUE : FALSE;
@@ -641,7 +641,7 @@ image_chooser_changed (GtkWidget *widget, EContactEditor *editor)
static void
set_entry_text (EContactEditor *editor, GtkEntry *entry, const gchar *string)
{
- const char *oldstring = gtk_entry_get_text (entry);
+ const gchar *oldstring = gtk_entry_get_text (entry);
if (!string)
string = "";
@@ -2197,7 +2197,7 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
EContactPhoto *photo = e_contact_get (contact, field_id);
if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
e_image_chooser_set_image_data (E_IMAGE_CHOOSER (widget),
- (char *)photo->data.inlined.data,
+ (gchar *)photo->data.inlined.data,
photo->data.inlined.length);
editor->image_set = TRUE;
}
@@ -2235,7 +2235,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
e_contact_set (contact, field_id, (gchar *) text);
}
else if (GTK_IS_COMBO_BOX_ENTRY (widget)) {
- char *text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+ gchar *text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
e_contact_set (contact, field_id, text);
@@ -2260,9 +2260,9 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
else if (E_IS_DATE_EDIT (widget)) {
EContactDate date;
if (e_date_edit_get_date (E_DATE_EDIT (widget),
- (int *)&date.year,
- (int *)&date.month,
- (int *)&date.day))
+ (gint *)&date.year,
+ (gint *)&date.month,
+ (gint *)&date.day))
e_contact_set (contact, field_id, &date);
else
e_contact_set (contact, field_id, NULL);
@@ -2280,14 +2280,14 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
GdkPixbuf *pixbuf, *new;
GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- photo.data.inlined.data = (unsigned char *)img_buff;
+ photo.data.inlined.data = (guchar *)img_buff;
img_buff = NULL;
gdk_pixbuf_loader_write (loader, photo.data.inlined.data, photo.data.inlined.length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf) {
- int width, height, prompt_response;
+ gint width, height, prompt_response;
g_object_ref (pixbuf);
@@ -2314,7 +2314,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
gdk_pixbuf_save_to_buffer (new, &img_buff,
&photo.data.inlined.length,
format_name, NULL, NULL);
- photo.data.inlined.data = (unsigned char *)img_buff;
+ photo.data.inlined.data = (guchar *)img_buff;
img_buff = NULL;
g_free (format_name);
g_object_unref (new);
@@ -2345,7 +2345,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
else if (GTK_IS_TOGGLE_BUTTON (widget)) {
gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- e_contact_set (contact, field_id, val?(void *)1:NULL);
+ e_contact_set (contact, field_id, val?(gpointer)1:NULL);
}
else {
g_warning (G_STRLOC ": Unhandled widget class in mappings!");
@@ -2599,11 +2599,11 @@ source_changed (ESourceComboBox *source_combo_box, EContactEditor *editor)
}
static void
-full_name_response (GtkDialog *dialog, int response, EContactEditor *editor)
+full_name_response (GtkDialog *dialog, gint response, EContactEditor *editor)
{
EContactName *name;
GtkWidget *fname_widget;
- int style = 0;
+ gint style = 0;
gboolean editable = FALSE;
g_object_get (dialog,
@@ -2619,8 +2619,8 @@ full_name_response (GtkDialog *dialog, int response, EContactEditor *editor)
fname_widget = glade_xml_get_widget(editor->gui, "entry-fullname");
if (fname_widget && GTK_IS_ENTRY (fname_widget)) {
- char *full_name = e_contact_name_to_string(name);
- const char *old_full_name = gtk_entry_get_text (GTK_ENTRY(fname_widget));
+ gchar *full_name = e_contact_name_to_string(name);
+ const gchar *old_full_name = gtk_entry_get_text (GTK_ENTRY(fname_widget));
if (strcmp (full_name, old_full_name))
gtk_entry_set_text (GTK_ENTRY (fname_widget), full_name);
@@ -2677,9 +2677,9 @@ full_name_clicked (GtkWidget *button, EContactEditor *editor)
static void
-categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
+categories_response (GtkDialog *dialog, gint response, EContactEditor *editor)
{
- const char *categories;
+ const gchar *categories;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
if (response == GTK_RESPONSE_OK) {
@@ -2687,7 +2687,7 @@ categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
if (entry && GTK_IS_ENTRY(entry))
gtk_entry_set_text (GTK_ENTRY (entry), categories);
else
- e_contact_set (editor->contact, E_CONTACT_CATEGORIES, (char *)categories);
+ e_contact_set (editor->contact, E_CONTACT_CATEGORIES, (gchar *)categories);
}
gtk_widget_destroy(GTK_WIDGET(dialog));
editor->categories_dialog = NULL;
@@ -2706,7 +2706,7 @@ categories_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer
static void
categories_clicked (GtkWidget *button, EContactEditor *editor)
{
- char *categories = NULL;
+ gchar *categories = NULL;
GtkDialog *dialog;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
@@ -2803,7 +2803,7 @@ static void
update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
{
GtkWidget *preview;
- char *filename = NULL;
+ gchar *filename = NULL;
GdkPixbuf *pixbuf;
gtk_file_chooser_set_preview_widget_active (file_chooser, TRUE);
@@ -2905,7 +2905,7 @@ contact_moved_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
}
static void
-contact_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs)
+contact_added_cb (EBook *book, EBookStatus status, const gchar *id, EditorCloseStruct *ecs)
{
EContactEditor *ce = ecs->ce;
gboolean should_close = ecs->should_close;
@@ -2921,7 +2921,7 @@ contact_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseSt
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- e_contact_set (ce->contact, E_CONTACT_UID, (char *) id);
+ e_contact_set (ce->contact, E_CONTACT_UID, (gchar *) id);
eab_editor_contact_added (EAB_EDITOR (ce), status, ce->contact);
@@ -2998,8 +2998,8 @@ real_save_contact (EContactEditor *ce, gboolean should_close)
static void
save_contact (EContactEditor *ce, gboolean should_close)
{
- char *uid;
- const char *name_entry_string, *file_as_entry_string, *company_name_string;
+ gchar *uid;
+ const gchar *name_entry_string, *file_as_entry_string, *company_name_string;
GtkWidget *entry_fullname, *entry_file_as, *company_name;
if (!ce->target_book)
@@ -3088,8 +3088,8 @@ static const EContactField non_string_fields [] = {
static gboolean
is_non_string_field (EContactField id)
{
- int count = sizeof (non_string_fields) / sizeof (EContactField);
- int i;
+ gint count = sizeof (non_string_fields) / sizeof (EContactField);
+ gint i;
for (i = 0; i < count; i++)
if (id == non_string_fields[i])
return TRUE;
@@ -3127,7 +3127,7 @@ e_contact_editor_is_valid (EABEditor *editor)
for (e_iterator_last (iter);
e_iterator_is_valid (iter);
e_iterator_prev (iter)) {
- const char *field_name = e_iterator_get (iter);
+ const gchar *field_name = e_iterator_get (iter);
EContactField field_id = e_contact_field_id (field_name);
if (is_non_string_field (field_id)) {
@@ -3140,7 +3140,7 @@ e_contact_editor_is_valid (EABEditor *editor)
}
} else {
- const char *text = e_contact_get_const (ce->contact, field_id);
+ const gchar *text = e_contact_get_const (ce->contact, field_id);
if (STRING_IS_EMPTY (text)) {
g_string_append_printf (errmsg, _("%s'%s' is empty"),
@@ -3331,7 +3331,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
GladeXML *gui;
GtkWidget *widget, *label;
GtkEntryCompletion *completion;
- char *gladefile;
+ gchar *gladefile;
e_contact_editor->name = e_contact_name_new();
@@ -3495,7 +3495,7 @@ required_fields_cb (EBook *book, EBookStatus status,
static void
-contact_editor_destroy_notify (void *data,
+contact_editor_destroy_notify (gpointer data,
GObject *where_the_object_was)
{
eab_editor_remove (EAB_EDITOR (data));
@@ -3533,7 +3533,7 @@ e_contact_editor_new (EBook *book,
static void
writable_changed (EBook *book, gboolean writable, EContactEditor *ce)
{
- int new_target_editable;
+ gint new_target_editable;
gboolean changed = FALSE;
new_target_editable = e_book_is_writable (ce->target_book);
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index e9f40507ae..c5940d96d0 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -100,7 +100,7 @@ struct _EContactEditor
EBook *load_book;
/* signal ids for "writable_status" */
- int target_editable_id;
+ gint target_editable_id;
GtkWidget *fullname_dialog;
GtkWidget *categories_dialog;
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index e8d7b03e6c..17ef4fb16d 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -586,7 +586,7 @@ e_contact_quick_add_vcard (const gchar *vcard, EContactQuickAddCallback cb, gpoi
if (contact) {
GList *emails;
- char *name;
+ gchar *name;
EContactName *contact_name;
g_object_unref (qa->contact);
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index d052e42fd7..6257e3972b 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -311,11 +311,11 @@ eab_editor_get_all_editors (void)
}
gboolean
-eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name)
+eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, gchar *name)
{
GtkWidget *dialog;
gint result;
- char *msg;
+ gchar *msg;
if (is_list) {
/* contact list(s) */
diff --git a/addressbook/gui/contact-editor/eab-editor.h b/addressbook/gui/contact-editor/eab-editor.h
index 18a11047be..6959d25801 100644
--- a/addressbook/gui/contact-editor/eab-editor.h
+++ b/addressbook/gui/contact-editor/eab-editor.h
@@ -91,7 +91,7 @@ gboolean eab_editor_is_changed (EABEditor *editor);
GtkWindow* eab_editor_get_window (EABEditor *editor);
gboolean eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window);
-gboolean eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name);
+gboolean eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, gchar *name);
/* these four generate EABEditor signals */
void eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact);
diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c
index e624c97987..6c3349eada 100644
--- a/addressbook/gui/contact-editor/test-editor.c
+++ b/addressbook/gui/contact-editor/test-editor.c
@@ -54,12 +54,12 @@
"
"
-static char *
-read_file (char *name)
+static gchar *
+read_file (gchar *name)
{
- int len;
- char buff[65536];
- char line[1024];
+ gint len;
+ gchar buff[65536];
+ gchar line[1024];
FILE *f;
f = fopen (name, "r");
@@ -81,7 +81,7 @@ read_file (char *name)
static void
editor_closed_cb (EContactEditor *ce, gpointer data)
{
- static int count = 2;
+ static gint count = 2;
count--;
g_object_unref (ce);
@@ -90,9 +90,9 @@ editor_closed_cb (EContactEditor *ce, gpointer data)
exit (0);
}
-int main( int argc, char *argv[] )
+gint main( gint argc, gchar *argv[] )
{
- char *cardstr;
+ gchar *cardstr;
EContactEditor *ce;
gtk_init (&argc, &argv);