The first attached patch adds list type support to libebook, which is needed for IM contact information. The second patch and accompanying tarball (to be patched/extracted in the evolution directory) provide a third tab in the Contact Editor for displaying a contact's IM accounts, and allowing the user to modify them. I was originally told to send it to e-h, but this place is obviously more appropriate, so I'm resending it here. Thank you. Christian -- Christian Hammond <> The GNUpdate Project chipx86 gnupdate org <> http://www.gnupdate.org/ This message was sent to you via e-mail in much the same way that bricks aren't.
Index: addressbook/libebook/e-contact.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-contact.c,v
retrieving revision 1.4
diff -u -r1.4 e-contact.c
--- addressbook/libebook/e-contact.c 26 Nov 2003 00:35:29 -0000 1.4
+++ addressbook/libebook/e-contact.c 26 Nov 2003 15:21:21 -0000
@@ -777,6 +777,28 @@
info->struct_setter (contact, attr, data);
}
+ else if (info->t & E_CONTACT_FIELD_TYPE_LIST) {
+ EVCardAttribute *attr;
+ GList *values, *l;
+
+ values = g_value_get_pointer (value);
+
+ attr = e_contact_get_first_attr (contact, info->vcard_field_name);
+
+ if (attr) {
+ e_vcard_attribute_remove_values (attr);
+
+ if (!values)
+ e_vcard_remove_attribute (E_VCARD (contact), attr);
+ }
+ else if (values) {
+ attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
+ e_vcard_add_attribute (E_VCARD (contact), attr);
+ }
+
+ for (l = values; l != NULL; l = l->next)
+ e_vcard_attribute_add_value (attr, l->data);
+ }
else {
g_warning ("unhandled attribute `%s'", info->vcard_field_name);
}
? .swp
? evolution-im-info-20031123-1452.diff
? evolution-im-info-20031124-1610.diff
? addressbook/gui/contact-editor/.e-contact-editor-im.c.swp
? addressbook/gui/contact-editor/.e-contact-editor.c.swp
? addressbook/gui/contact-editor/e-contact-editor-im.c
? addressbook/gui/contact-editor/e-contact-editor-im.h
? addressbook/gui/contact-editor/fullname.gladep
? addressbook/gui/contact-editor/im.glade
? addressbook/gui/contact-editor/im.gladep
? art/im
? art/im-activebuddy.png
? art/im-admin.png
? art/im-aim.png
? art/im-aol.png
? art/im-away.png
? art/im-dnd.png
? art/im-extendedaway.png
? art/im-freeforchat.png
? art/im-game.png
? art/im-hiptop.png
? art/im-icq.png
? art/im-invisible.png
? art/im-jabber.png
? art/im-login.png
? art/im-logout.png
? art/im-msn.png
? art/im-na.png
? art/im-notauthorized.png
? art/im-occupied.png
? art/im-offline.png
? art/im-secure.png
? art/im-wireless.png
? art/im-yahoo.png
? art/im.png
Index: addressbook/gui/contact-editor/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/Makefile.am,v
retrieving revision 1.53
diff -u -r1.53 Makefile.am
--- addressbook/gui/contact-editor/Makefile.am 7 Nov 2003 09:02:28 -0000 1.53
+++ addressbook/gui/contact-editor/Makefile.am 25 Nov 2003 00:10:23 -0000
@@ -23,6 +23,8 @@
libecontacteditor_la_SOURCES = \
$(MARSHAL_GENERATED) \
+ e-contact-editor-im.c \
+ e-contact-editor-im.h \
e-contact-editor-address.c \
e-contact-editor-address.h \
e-contact-editor-fullname.c \
@@ -36,6 +38,7 @@
@EVO_MARSHAL_RULE@
glade_DATA = \
+ im.glade \
contact-editor.glade \
fulladdr.glade \
fullname.glade
Index: addressbook/gui/contact-editor/contact-editor.glade
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/contact-editor.glade,v
retrieving revision 1.41
diff -u -r1.41 contact-editor.glade
--- addressbook/gui/contact-editor/contact-editor.glade 21 Oct 2003 18:48:44 -0000 1.41
+++ addressbook/gui/contact-editor/contact-editor.glade 25 Nov 2003 00:10:23 -0000
@@ -1153,46 +1153,6 @@
</child>
<child>
- <widget class="Custom" id="custom1">
- <property name="visible">True</property>
- <property name="creation_function">e_create_image_widget</property>
- <property name="string1">malehead.png</property>
- <property name="string2"></property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 18 May 2000 12:19:47 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="custom2">
- <property name="visible">True</property>
- <property name="creation_function">e_create_image_widget</property>
- <property name="string1">cellphone.png</property>
- <property name="string2"></property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 18 May 2000 12:20:02 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
<widget class="Custom" id="custom3">
<property name="visible">True</property>
<property name="creation_function">e_create_image_widget</property>
@@ -1515,8 +1475,48 @@
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="custom2">
+ <property name="visible">True</property>
+ <property name="creation_function">e_create_image_widget</property>
+ <property name="string1">cellphone.png</property>
+ <property name="string2"></property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Thu, 18 May 2000 12:20:02 GMT</property>
+ </widget>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="custom1">
+ <property name="visible">True</property>
+ <property name="creation_function">e_create_image_widget</property>
+ <property name="string1">malehead.png</property>
+ <property name="string2"></property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Thu, 18 May 2000 12:19:47 GMT</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
@@ -2125,6 +2125,219 @@
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="border_width">7</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="Custom" id="custom13">
+ <property name="visible">True</property>
+ <property name="creation_function">e_create_image_widget</property>
+ <property name="string1">globe.png</property>
+ <property name="string2"></property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Thu, 18 May 2000 12:19:47 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Enter the person's instant messenger accounts here.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="treeview-im">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="button-im-add">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button-im-edit">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment22">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-properties</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button-im-remove">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label25">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Instant Messaging</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
Index: addressbook/gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.153
diff -u -r1.153 e-contact-editor.c
--- addressbook/gui/contact-editor/e-contact-editor.c 21 Oct 2003 18:48:45 -0000 1.153
+++ addressbook/gui/contact-editor/e-contact-editor.c 25 Nov 2003 00:10:27 -0000
@@ -35,6 +35,7 @@
#include <gtk/gtklabel.h>
#include <libgnomeui/gnome-popup-menu.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <libgnome/gnome-util.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-ui-container.h>
@@ -58,6 +59,7 @@
#include "eab-contact-merging.h"
#include "e-contact-editor-address.h"
+#include "e-contact-editor-im.h"
#include "e-contact-editor-fullname.h"
#include "e-contact-editor-marshal.h"
@@ -70,6 +72,16 @@
LAST_SIGNAL
};
+/* IM columns */
+enum {
+ COLUMN_IM_ICON,
+ COLUMN_IM_SERVICE,
+ COLUMN_IM_SCREENNAME,
+ COLUMN_IM_SERVICE_FIELD,
+ NUM_IM_COLUMNS
+};
+
+
static void e_contact_editor_init (EContactEditor *editor);
static void e_contact_editor_class_init (EContactEditorClass *klass);
static void e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
@@ -79,6 +91,8 @@
static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
+static void im_selected_cb(GtkTreeSelection *selection, EContactEditor *editor);
+static void set_im_fields(EContactEditor *editor);
static void find_address_mailing (EContactEditor *editor);
static void enable_writable_fields(EContactEditor *editor);
static void set_editable(EContactEditor *editor);
@@ -283,6 +297,54 @@
}
static void
+setup_im_treeview(EContactEditor *editor)
+{
+ GtkWidget *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ treeview = glade_xml_get_widget(editor->gui, "treeview-im");
+
+ if (!treeview || !GTK_IS_TREE_VIEW(treeview))
+ return;
+
+ editor->im_model = gtk_list_store_new(NUM_IM_COLUMNS,
+ GDK_TYPE_PIXBUF, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INT);
+
+ gtk_tree_view_set_model(GTK_TREE_VIEW(treeview),
+ GTK_TREE_MODEL(editor->im_model));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title(column, _("Service"));
+ gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
+ gtk_tree_view_column_add_attribute(column, renderer,
+ "pixbuf", COLUMN_IM_ICON);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(column, renderer,
+ "text", COLUMN_IM_SERVICE);
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title(column, _("Account Name"));
+ gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(column, renderer,
+ "text", COLUMN_IM_SCREENNAME);
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ g_signal_connect(G_OBJECT(selection), "changed",
+ G_CALLBACK(im_selected_cb), editor);
+}
+
+static void
wants_html_changed (GtkWidget *widget, EContactEditor *editor)
{
gboolean wants_html;
@@ -881,6 +943,190 @@
gtk_widget_destroy(GTK_WIDGET(dialog));
}
+static void
+add_im_clicked(GtkWidget *widget, EContactEditor *editor)
+{
+ GtkDialog *dialog;
+ int result;
+
+ dialog = GTK_DIALOG(e_contact_editor_im_new(E_CONTACT_IM_AIM, NULL));
+
+ gtk_widget_show(GTK_WIDGET(dialog));
+ result = gtk_dialog_run(dialog);
+ gtk_widget_hide(GTK_WIDGET(dialog));
+
+ if (result == GTK_RESPONSE_OK) {
+ GList *old_list, *new_list = NULL, *l;
+ EContactField service;
+ const char *screenname;
+
+ g_object_get(dialog,
+ "service", &service,
+ "username", &screenname,
+ NULL);
+
+ old_list = e_contact_get(editor->contact, service);
+
+ for (l = old_list; l != NULL; l = l->next)
+ new_list = g_list_append(new_list, g_strdup(l->data));
+
+ new_list = g_list_append(new_list, g_strdup(screenname));
+
+ e_contact_set(editor->contact, service, new_list);
+
+ for (l = new_list; l != NULL; l = l->next)
+ g_free(l->data);
+
+ g_list_free(new_list);
+
+ set_im_fields(editor);
+
+ editor->changed = TRUE;
+ }
+
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+static void
+edit_im_clicked(GtkWidget *widget, EContactEditor *editor)
+{
+ GtkWidget *treeview;
+ GtkTreeSelection *selection;
+ GtkDialog *dialog;
+ GtkTreeIter iter;
+ EContactField old_service, service;
+ const char *old_screenname, *screenname;
+ int result;
+
+ treeview = glade_xml_get_widget(editor->gui, "treeview-im");
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+
+ gtk_tree_selection_get_selected(selection, NULL, &iter);
+
+ gtk_tree_model_get(GTK_TREE_MODEL(editor->im_model), &iter,
+ COLUMN_IM_SERVICE_FIELD, &old_service,
+ COLUMN_IM_SCREENNAME, &old_screenname,
+ -1);
+
+ dialog = GTK_DIALOG(e_contact_editor_im_new(old_service, old_screenname));
+
+ gtk_widget_show(GTK_WIDGET(dialog));
+ result = gtk_dialog_run(dialog);
+ gtk_widget_hide(GTK_WIDGET(dialog));
+
+ if (result == GTK_RESPONSE_OK) {
+ GList *old_list, *new_list = NULL, *l;
+
+ g_object_get(dialog,
+ "service", &service,
+ "username", &screenname,
+ NULL);
+
+ if (service == old_service && !strcmp(screenname, old_screenname)) {
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ return;
+ }
+
+ /* Remove the old. */
+ old_list = e_contact_get(editor->contact, old_service);
+
+ for (l = old_list; l != NULL; l = l->next) {
+ const char *temp_screenname = (const char *)l->data;
+
+ if (strcmp(temp_screenname, old_screenname))
+ new_list = g_list_append(new_list, g_strdup(temp_screenname));
+ }
+
+ if (service == old_service)
+ new_list = g_list_append(new_list, g_strdup(screenname));
+
+ e_contact_set(editor->contact, old_service, new_list);
+
+ for (l = new_list; l != NULL; l = l->next)
+ g_free(l->data);
+
+ g_list_free(new_list);
+
+ if (old_service != service)
+ {
+ /* We have to add this elsewhere. */
+ new_list = NULL;
+
+ old_list = e_contact_get(editor->contact, service);
+
+ for (l = old_list; l != NULL; l = l->next) {
+ new_list = g_list_append(new_list, g_strdup(l->data));
+ }
+
+ new_list = g_list_append(new_list, g_strdup(screenname));
+
+ e_contact_set(editor->contact, service, new_list);
+
+ for (l = new_list; l != NULL; l = l->next)
+ g_free(l->data);
+
+ g_list_free(new_list);
+ }
+
+ set_im_fields(editor);
+
+ editor->changed = TRUE;
+ }
+
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+static void
+remove_im_clicked(GtkWidget *widget, EContactEditor *editor)
+{
+ GtkWidget *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ EContactField old_service;
+ const char *old_screenname;
+ GList *old_list, *new_list = NULL, *l;
+
+ treeview = glade_xml_get_widget(editor->gui, "treeview-im");
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+
+ gtk_tree_selection_get_selected(selection, NULL, &iter);
+
+ gtk_tree_model_get(GTK_TREE_MODEL(editor->im_model), &iter,
+ COLUMN_IM_SERVICE_FIELD, &old_service,
+ COLUMN_IM_SCREENNAME, &old_screenname,
+ -1);
+
+ old_list = e_contact_get(editor->contact, old_service);
+
+ for (l = old_list; l != NULL; l = l->next) {
+ const char *temp_screenname = (const char *)l->data;
+
+ if (strcmp(temp_screenname, old_screenname))
+ new_list = g_list_append(new_list, g_strdup(temp_screenname));
+ }
+
+ e_contact_set(editor->contact, old_service, new_list);
+
+ for (l = new_list; l != NULL; l = l->next)
+ g_free(l->data);
+
+ if (new_list != NULL)
+ g_list_free(new_list);
+
+ gtk_list_store_remove(editor->im_model, &iter);
+
+ editor->changed = TRUE;
+}
+
+static void
+im_selected_cb(GtkTreeSelection *selection, EContactEditor *editor)
+{
+ gtk_widget_set_sensitive(glade_xml_get_widget(editor->gui, "button-im-remove"), TRUE);
+ gtk_widget_set_sensitive(glade_xml_get_widget(editor->gui, "button-im-edit"), TRUE);
+}
+
typedef struct {
EContactEditor *ce;
gboolean should_close;
@@ -1314,6 +1560,8 @@
connect_arrow_button_signals(e_contact_editor);
set_entry_changed_signals(e_contact_editor);
+ setup_im_treeview(e_contact_editor);
+
wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail");
if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html))
g_signal_connect (wants_html, "toggled",
@@ -1339,6 +1587,22 @@
g_signal_connect (widget, "clicked",
G_CALLBACK (categories_clicked), e_contact_editor);
+ widget = glade_xml_get_widget(e_contact_editor->gui, "button-im-add");
+ if (widget && GTK_IS_BUTTON(widget))
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (add_im_clicked), e_contact_editor);
+
+ widget = glade_xml_get_widget(e_contact_editor->gui, "button-im-edit");
+ if (widget && GTK_IS_BUTTON(widget))
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (edit_im_clicked), e_contact_editor);
+
+ widget = glade_xml_get_widget(e_contact_editor->gui, "button-im-remove");
+ if (widget && GTK_IS_BUTTON(widget))
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (remove_im_clicked), e_contact_editor);
+
+
/* Construct the app */
bonobo_win = bonobo_window_new ("contact-editor-dialog", _("Contact Editor"));
@@ -2006,6 +2270,62 @@
}
static void
+add_im_field(EContactEditor *editor, EContactField field, const char *service,
+ const char *desc)
+{
+ GList *list;
+ GList *l;
+ GtkTreeIter iter;
+ GdkPixbuf *pixbuf;
+ GdkPixbuf *scale = NULL;
+ char *icon_path;
+ char *buf;
+
+ list = e_contact_get(editor->contact, field);
+
+ buf = g_strdup_printf("im-%s.png", service);
+ icon_path = g_concat_dir_and_file(EVOLUTION_IMAGESDIR, buf);
+ pixbuf = gdk_pixbuf_new_from_file(icon_path, NULL);
+ g_free(icon_path);
+ g_free(buf);
+
+ if (pixbuf != NULL)
+ scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
+
+ for (l = list; l != NULL; l = l->next)
+ {
+ const char *account_name = (const char *)l->data;
+
+ gtk_list_store_append(editor->im_model, &iter);
+
+ gtk_list_store_set(editor->im_model, &iter,
+ COLUMN_IM_ICON, scale,
+ COLUMN_IM_SERVICE, desc,
+ COLUMN_IM_SCREENNAME, account_name,
+ COLUMN_IM_SERVICE_FIELD, field,
+ -1);
+ }
+
+ if (scale != NULL)
+ g_object_unref(G_OBJECT(scale));
+
+ if (pixbuf != NULL)
+ g_object_unref(G_OBJECT(pixbuf));
+}
+
+static void
+set_im_fields(EContactEditor *editor)
+{
+ gtk_list_store_clear(editor->im_model);
+
+ add_im_field(editor, E_CONTACT_IM_AIM, "aim", _("AIM"));
+ add_im_field(editor, E_CONTACT_IM_JABBER, "jabber", _("Jabber"));
+ add_im_field(editor, E_CONTACT_IM_YAHOO, "yahoo", _("Yahoo"));
+ add_im_field(editor, E_CONTACT_IM_MSN, "msn", _("MSN"));
+ add_im_field(editor, E_CONTACT_IM_ICQ, "icq", _("ICQ"));
+}
+
+static void
set_address_field(EContactEditor *editor, int result)
{
#if notyet
@@ -2412,6 +2732,8 @@
e_contact_date_free (bday);
set_fields(editor);
+
+ set_im_fields(editor);
}
}
Index: addressbook/gui/contact-editor/e-contact-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.h,v
retrieving revision 1.36
diff -u -r1.36 e-contact-editor.h
--- addressbook/gui/contact-editor/e-contact-editor.h 7 Nov 2003 05:51:33 -0000 1.36
+++ addressbook/gui/contact-editor/e-contact-editor.h 25 Nov 2003 00:10:27 -0000
@@ -28,6 +28,9 @@
#include <libebook/e-book-async.h>
#include <libebook/e-contact.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtkliststore.h>
+
G_BEGIN_DECLS
/* EContactEditor - A dialog displaying information about a contact.
@@ -74,6 +77,8 @@
EContactName *name;
char *company;
+
+ GtkListStore *im_model;
EContactField email_choice;
EContactField phone_choice[4];
Index: art/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/art/Makefile.am,v
retrieving revision 1.108
diff -u -r1.108 Makefile.am
--- art/Makefile.am 12 Nov 2003 21:12:41 -0000 1.108
+++ art/Makefile.am 25 Nov 2003 00:10:27 -0000
@@ -75,6 +75,29 @@
ico-weather.png \
import.png \
import.xpm \
+ im-activebuddy.png \
+ im-admin.png \
+ im-aim.png \
+ im-aol.png \
+ im-away.png \
+ im-dnd.png \
+ im-extendedaway.png \
+ im-freeforchat.png \
+ im-game.png \
+ im-hiptop.png \
+ im-icq.png \
+ im-invisible.png \
+ im-jabber.png \
+ im-login.png \
+ im-logout.png \
+ im-msn.png \
+ im-na.png \
+ im-notauthorized.png \
+ im-occupied.png \
+ im-offline.png \
+ im-secure.png \
+ im-wireless.png \
+ im-yahoo.png \
inbox.png \
inbox-mini.png \
ldap-mini.png \
Attachment:
evolution-im-info-20031124-1610.tar.bz2
Description: BZip2 compressed data