evolution r36849 - in trunk/addressbook: . gui/contact-editor gui/widgets



Author: mcrha
Date: Mon Dec  8 11:01:38 2008
New Revision: 36849
URL: http://svn.gnome.org/viewvc/evolution?rev=36849&view=rev

Log:
2008-12-08  Milan Crha  <mcrha redhat com>

	** Fix for bug #270376

	* gui/contact-editor/e-contact-editor.c: (im_service []),
	(non_string_fields[]):
	* gui/widgets/eab-contact-display.c: (render_contact):
	Support Skype field in a contact.

	* gui/contact-editor/e-contact-editor-im.c:
	Changes here too, but file doesn't seem to be used.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/contact-editor/e-contact-editor-im.c
   trunk/addressbook/gui/contact-editor/e-contact-editor.c
   trunk/addressbook/gui/widgets/eab-contact-display.c

Modified: trunk/addressbook/gui/contact-editor/e-contact-editor-im.c
==============================================================================
--- trunk/addressbook/gui/contact-editor/e-contact-editor-im.c	(original)
+++ trunk/addressbook/gui/contact-editor/e-contact-editor-im.c	Mon Dec  8 11:01:38 2008
@@ -47,8 +47,8 @@
 	PROP_EDITABLE
 };
 
-#define FIRST_IM_TYPE E_CONTACT_IM_AIM
-#define LAST_IM_TYPE  E_CONTACT_IM_ICQ
+/*#define FIRST_IM_TYPE E_CONTACT_IM_AIM
+#define LAST_IM_TYPE  E_CONTACT_IM_ICQ*/
 
 static const char *im_labels[] = {
 	N_("AOL Instant Messenger"),
@@ -57,7 +57,8 @@
 	N_("Yahoo Messenger"),
 	N_("Gadu-Gadu Messenger"),
 	N_("MSN Messenger"),
-	N_("ICQ")
+	N_("ICQ"),
+	N_("Skype")
 };
 
 static const char *im_images[] = {
@@ -67,9 +68,47 @@
 	"im-yahoo",
 	"im-gadugadu",
 	"im-msn",
-	"im-icq"
+	"im-icq",
+	"stock_people"
 };
 
+/**
+ * Decodes from service (E_CONTACT_IM_ value to the index in the above
+ * fields and back, depending on the second parameter.
+ * @param val Value to decode
+ * @param val_is_service TRUE, if val is E_CONTACT_IM_ value, otherwise it's an index number.
+ **/
+static int
+decode_service (int val, gboolean val_is_service)
+{
+	static const int fields[] = {
+		E_CONTACT_IM_AIM,
+		E_CONTACT_IM_GROUPWISE,
+		E_CONTACT_IM_JABBER,
+		E_CONTACT_IM_YAHOO,
+		E_CONTACT_IM_GADUGADU,
+		E_CONTACT_IM_MSN,
+		E_CONTACT_IM_ICQ,
+		E_CONTACT_IM_SKYPE
+	};
+
+	int i, sz = G_N_ELEMENTS (fields);
+	if (val_is_service) {
+		for (i = 0; i < sz; i++) {
+			if (val == fields[i])
+				break;
+		}
+		if (i >= sz)
+			i = 0;
+	} else if (val >= 0 && val < sz) {
+		i = fields [val];
+	} else {
+		i = fields [0];
+	}
+
+	return i;
+}
+
 GType
 e_contact_editor_im_get_type (void)
 {
@@ -111,9 +150,9 @@
 					 g_param_spec_int ("service",
 							   _("Service"),
 							   /*_( */"XXX blurb" /*)*/,
-							   FIRST_IM_TYPE,
-							   LAST_IM_TYPE,
-							   FIRST_IM_TYPE,
+							   E_CONTACT_IM_AIM,
+							   E_CONTACT_IM_SKYPE,
+							   E_CONTACT_IM_AIM,
 							   G_PARAM_READWRITE));
 
 	g_object_class_install_property (object_class, PROP_LOCATION,
@@ -141,7 +180,7 @@
 static void
 service_changed_cb(GtkWidget *optmenu, EContactEditorIm *editor)
 {
-	editor->service = gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)) + FIRST_IM_TYPE;
+	editor->service = decode_service (gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)), FALSE);
 }
 
 static void
@@ -254,7 +293,7 @@
 
 	gtk_window_set_resizable(GTK_WINDOW(e_contact_editor_im), TRUE);
 
-	e_contact_editor_im->service = FIRST_IM_TYPE;
+	e_contact_editor_im->service = decode_service (0, FALSE);
 	e_contact_editor_im->location = g_strdup("HOME");
 	e_contact_editor_im->username = NULL;
 
@@ -440,7 +479,7 @@
 	optmenu = glade_xml_get_widget(editor->gui, "optmenu-service");
 
 	if (optmenu != NULL)
-		gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), editor->service - FIRST_IM_TYPE);
+		gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), decode_service (editor->service, TRUE));
 
 	optmenu = glade_xml_get_widget(editor->gui, "optmenu-location");
 

Modified: trunk/addressbook/gui/contact-editor/e-contact-editor.c
==============================================================================
--- trunk/addressbook/gui/contact-editor/e-contact-editor.c	(original)
+++ trunk/addressbook/gui/contact-editor/e-contact-editor.c	Mon Dec  8 11:01:38 2008
@@ -179,7 +179,8 @@
 	{ E_CONTACT_IM_GADUGADU,  N_ ("Gadu-Gadu") },
 	{ E_CONTACT_IM_MSN,       N_ ("MSN")       },
 	{ E_CONTACT_IM_ICQ,       N_ ("ICQ")       },
-	{ E_CONTACT_IM_GROUPWISE, N_ ("GroupWise") }
+	{ E_CONTACT_IM_GROUPWISE, N_ ("GroupWise") },
+	{ E_CONTACT_IM_SKYPE,     N_ ("Skype") }
 };
 
 /* Defaults from the table above */
@@ -3053,6 +3054,7 @@
 	E_CONTACT_IM_GADUGADU,
 	E_CONTACT_IM_MSN,
 	E_CONTACT_IM_ICQ,
+	E_CONTACT_IM_SKYPE,
 	E_CONTACT_PHOTO,
 	E_CONTACT_LOGO,
 	E_CONTACT_X509_CERT,

Modified: trunk/addressbook/gui/widgets/eab-contact-display.c
==============================================================================
--- trunk/addressbook/gui/widgets/eab-contact-display.c	(original)
+++ trunk/addressbook/gui/widgets/eab-contact-display.c	Mon Dec  8 11:01:38 2008
@@ -72,6 +72,7 @@
 #define MSN_ICON          "im-msn"
 #define YAHOO_ICON        "im-yahoo"
 #define GADUGADU_ICON	    "im-gadugadu"
+#define SKYPE_ICON	    "stock_people"
 #define VIDEOCONF_ICON    "stock_video-conferencing"
 
 #define MAX_COMPACT_IMAGE_DIMENSION 48
@@ -618,6 +619,7 @@
 	accum_multival_attribute (accum, contact, _("MSN"), E_CONTACT_IM_MSN, MSN_ICON, 0);
 	accum_multival_attribute (accum, contact, _("Yahoo"), E_CONTACT_IM_YAHOO, YAHOO_ICON, 0);
 	accum_multival_attribute (accum, contact, _("Gadu-Gadu"), E_CONTACT_IM_GADUGADU, GADUGADU_ICON, 0);
+	accum_multival_attribute (accum, contact, _("Skype"), E_CONTACT_IM_SKYPE, SKYPE_ICON, 0);
 
 	if (accum->len > 0)
 		gtk_html_stream_printf (html_stream, "%s", accum->str);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]