aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-view.c21
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c147
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c3
-rw-r--r--addressbook/gui/contact-editor/fullname.glade10
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c59
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c285
6 files changed, 127 insertions, 398 deletions
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
index d6da6a09cc..82c4c50f2b 100644
--- a/addressbook/gui/component/addressbook-view.c
+++ b/addressbook/gui/component/addressbook-view.c
@@ -622,10 +622,7 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactsCopy", "stock_copy", E_ICON_SIZE_MENU),
E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactsPaste", "stock_paste", E_ICON_SIZE_MENU),
E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactDelete", "stock_delete", E_ICON_SIZE_MENU),
-
- E_PIXMAP ("/menu/ActionsPlaceholder/Actions/ContactsSendContactToOther", "stock_mail-forward", E_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/ActionsPlaceholder/Actions/ContactsSendMessageToContact", "stock_mail-send", E_ICON_SIZE_MENU),
-
+
E_PIXMAP ("/Toolbar/ContactsPrint", "stock_print", E_ICON_SIZE_LARGE_TOOLBAR),
E_PIXMAP ("/Toolbar/ContactDelete", "stock_delete", E_ICON_SIZE_LARGE_TOOLBAR),
@@ -633,7 +630,7 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/FolderPlaceholder/Folder/FolderMove", "stock_folder-move", E_ICON_SIZE_MENU),
E_PIXMAP ("/menu/FolderPlaceholder/Folder/ChangeFolderProperties", "stock_folder-properties", E_ICON_SIZE_MENU),
E_PIXMAP ("/menu/FolderPlaceholder/Folder/FolderSave", "stock_save-as", E_ICON_SIZE_MENU),
-
+
E_PIXMAP_END
};
@@ -1193,9 +1190,15 @@ selector_tree_drag_data_received (GtkWidget *widget,
eab_book_and_contact_list_from_string (data->data, &source_book, &contactlist);
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- g_object_get (v->model, "book",&source_book, NULL);
+ if (source_book) {
+ if (!e_book_open (source_book, FALSE, NULL)) {
+ g_warning (G_STRLOC ": Couldn't open source EBook.");
+ g_object_unref (source_book);
+ source_book = NULL;
+ }
+ } else {
+ g_warning (G_STRLOC ": No source EBook provided.");
+ }
/* Set up merge context */
@@ -1207,7 +1210,7 @@ selector_tree_drag_data_received (GtkWidget *widget,
merge_context->current_contact = contactlist->data;
merge_context->remaining_contacts = g_list_delete_link (contactlist, contactlist);
- merge_context->remove_from_source = context->suggested_action == GDK_ACTION_MOVE ? FALSE : TRUE;
+ merge_context->remove_from_source = context->suggested_action == GDK_ACTION_MOVE ? TRUE : FALSE;
/* Start merge */
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index b40f780564..5e12cecaee 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -186,7 +186,6 @@ im_service [] =
{ E_CONTACT_IM_AIM, N_ ("AIM") },
{ E_CONTACT_IM_JABBER, N_ ("Jabber") },
{ E_CONTACT_IM_YAHOO, N_ ("Yahoo") },
- { 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") }
@@ -608,23 +607,15 @@ sensitize_ok (EContactEditor *ce)
gboolean allow_save;
GtkWidget *entry_fullname;
GtkWidget *entry_file_as;
- GtkWidget *company_name;
entry_fullname = glade_xml_get_widget (ce->gui, "entry-fullname" );
entry_file_as = glade_xml_get_widget (ce->gui, "entry-file-as");
- 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));
allow_save = ce->target_editable && ce->changed ? TRUE : FALSE;
- if (!strcmp (name_entry_string, "") || !strcmp (file_as_entry_string, "")) {
- if (strcmp (company_name_string , "")) {
- allow_save = TRUE;
- }
- else
- allow_save = FALSE;
- }
+ if (!strcmp (name_entry_string, "") || !strcmp (file_as_entry_string, ""))
+ allow_save = FALSE;
widget = glade_xml_get_widget (ce->gui, "button-ok");
gtk_widget_set_sensitive (widget, allow_save);
}
@@ -2193,10 +2184,10 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
}
else if (E_IS_IMAGE_CHOOSER (widget)) {
EContactPhoto *photo = e_contact_get (contact, field_id);
- if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
+ if (photo) {
e_image_chooser_set_image_data (E_IMAGE_CHOOSER (widget),
- photo->data.inlined.data,
- photo->data.inlined.length);
+ photo->data,
+ photo->length);
editor->image_set = TRUE;
}
else {
@@ -2260,16 +2251,15 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
}
else if (E_IS_IMAGE_CHOOSER (widget)) {
EContactPhoto photo;
- photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
if (editor->image_changed)
{
if (editor->image_set &&
e_image_chooser_get_image_data (E_IMAGE_CHOOSER (widget),
- &photo.data.inlined.data, &photo.data.inlined.length)) {
+ &photo.data, &photo.length)) {
GdkPixbuf *pixbuf, *new;
GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_write (loader, photo.data.inlined.data, photo.data.inlined.length, NULL);
+ gdk_pixbuf_loader_write (loader, photo.data, photo.length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
@@ -2293,8 +2283,8 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
new = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
if (new) {
- g_free(photo.data.inlined.data);
- gdk_pixbuf_save_to_buffer (new, &photo.data.inlined.data, &photo.data.inlined.length, "jpeg", NULL, "quality", "100", NULL);
+ g_free(photo.data);
+ gdk_pixbuf_save_to_buffer (new, &photo.data, &photo.length, "jpeg", NULL, "quality", "100", NULL);
g_object_unref (new);
}
@@ -2307,7 +2297,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
e_contact_set (contact, field_id, &photo);
- g_free (photo.data.inlined.data);
+ g_free (photo.data);
}
else {
@@ -2566,19 +2556,40 @@ source_selected (GtkWidget *source_option_menu, ESource *source, EContactEditor
(EBookCallback) new_target_cb, editor);
}
+static gboolean
+full_name_key_press_event( GtkWidget *widget, GdkEventKey *event, EContactEditor *editor)
+{
+ if (event->keyval == GDK_Return) {
+ gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_OK);
+ return TRUE;
+ }
+ return FALSE;
+}
+
static void
-full_name_response (GtkDialog *dialog, int response, EContactEditor *editor)
+full_name_clicked (GtkWidget *button, EContactEditor *editor)
{
- EContactName *name;
- GtkWidget *fname_widget;
- int style = 0;
- gboolean editable = FALSE;
+ GtkDialog *dialog = GTK_DIALOG (e_contact_editor_fullname_new (editor->name));
+ gboolean fullname_supported;
+ int result;
- g_object_get (dialog,
- "editable", &editable,
+ fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME);
+
+ g_object_set (dialog,
+ "editable", fullname_supported & editor->target_editable,
NULL);
- if (editable && response == GTK_RESPONSE_OK) {
+ g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (full_name_key_press_event), editor);
+
+ gtk_widget_show (GTK_WIDGET(dialog));
+ result = gtk_dialog_run (dialog);
+ gtk_widget_hide (GTK_WIDGET (dialog));
+
+ if (fullname_supported && editor->target_editable && result == GTK_RESPONSE_OK) {
+ EContactName *name;
+ GtkWidget *fname_widget;
+ int style = 0;
+
g_object_get (dialog,
"name", &name,
NULL);
@@ -2600,45 +2611,11 @@ full_name_response (GtkDialog *dialog, int response, EContactEditor *editor)
file_as_set_style(editor, style);
}
- gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-static gint
-full_name_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
-{
- if (widget) {
- if (GTK_IS_WIDGET (widget))
- gtk_widget_destroy(widget);
- }
- return TRUE;
-}
-
-static void
-full_name_clicked (GtkWidget *button, EContactEditor *editor)
-{
- GtkDialog *dialog = GTK_DIALOG (e_contact_editor_fullname_new (editor->name));
- gboolean fullname_supported;
-
-
- fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME);
-
- g_object_set (dialog,
- "editable", fullname_supported & editor->target_editable,
- NULL);
-
- g_signal_connect(dialog, "response",
- G_CALLBACK (full_name_response), editor);
-
- /* Close the fullname dialog if the editor is closed */
- g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed",
- G_CALLBACK (full_name_editor_delete_event_cb), GTK_WIDGET (dialog));
-
- gtk_widget_show (GTK_WIDGET(dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
-
static void
-categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
+response (GtkDialog *dialog, int response, EContactEditor *editor)
{
const char *categories;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
@@ -2653,13 +2630,22 @@ categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
gtk_widget_hide(GTK_WIDGET(dialog));
}
+static gboolean
+categories_key_press_event( GtkWidget *widget, GdkEventKey *event, EContactEditor *editor)
+{
+ if (event->keyval == GDK_Return) {
+ gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_OK);
+ return TRUE;
+ }
+ return FALSE;
+}
+
static gint
-categories_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
{
- if (widget) {
+ if (widget)
if (GTK_IS_WIDGET (widget))
gtk_widget_destroy(widget);
- }
return TRUE;
}
@@ -2681,12 +2667,14 @@ categories_clicked (GtkWidget *button, EContactEditor *editor)
return;
}
+ g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (categories_key_press_event), editor);
+
g_signal_connect(dialog, "response",
- G_CALLBACK (categories_response), editor);
+ G_CALLBACK (response), editor);
/* Close the category dialog if the editor is closed*/
g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed",
- G_CALLBACK (categories_editor_delete_event_cb), GTK_WIDGET (dialog));
+ G_CALLBACK (editor_delete_event_cb), GTK_WIDGET (dialog));
gtk_widget_show(GTK_WIDGET(dialog));
g_free (categories);
@@ -2790,7 +2778,7 @@ static void
image_clicked (GtkWidget *button, EContactEditor *editor)
{
const gchar *title = _("Please select an image for this contact");
- const gchar *no_image = _("_No image");
+ const gchar *no_image = _("No image");
GtkImage *preview;
if (!editor->file_selector) {
@@ -2996,24 +2984,6 @@ save_contact (EContactEditor *ce, gboolean should_close)
if (e_error_run (GTK_WINDOW (ce->app), "addressbook:prompt-move", NULL) == GTK_RESPONSE_NO)
return;
}
-
- GtkWidget *entry_fullname;
- GtkWidget *entry_file_as;
- GtkWidget *company_name;
- entry_fullname = glade_xml_get_widget (ce->gui, "entry-fullname" );
- entry_file_as = glade_xml_get_widget (ce->gui, "entry-file-as");
- 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));
-
- if (strcmp (company_name_string , "")) {
- if (!strcmp (name_entry_string, ""))
- gtk_entry_set_text (GTK_ENTRY (entry_fullname), company_name_string);
- if (!strcmp (file_as_entry_string, ""))
- gtk_entry_set_text (GTK_ENTRY (entry_file_as), company_name_string);
- }
-
extract_all (ce);
if (!e_contact_editor_is_valid (EAB_EDITOR (ce))) {
@@ -3060,7 +3030,6 @@ static const EContactField non_string_fields [] = {
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_PHOTO,
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 07be81fd1d..e6c3c6b777 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -345,7 +345,7 @@ build_quick_add_dialog (QuickAdd *qa)
1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
- label = gtk_label_new_with_mnemonic (_("E_mail"));
+ label = gtk_label_new_with_mnemonic (_("E-_mail"));
gtk_label_set_mnemonic_widget ((GtkLabel *)label, qa->email_entry);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -373,6 +373,7 @@ build_quick_add_dialog (QuickAdd *qa)
GTK_WIDGET (table),
FALSE, FALSE, 0);
gtk_widget_show_all (GTK_WIDGET (table));
+
return dialog;
}
diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade
index 2271304017..ae6bc76ef6 100644
--- a/addressbook/gui/contact-editor/fullname.glade
+++ b/addressbook/gui/contact-editor/fullname.glade
@@ -93,7 +93,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
@@ -289,7 +289,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
@@ -495,7 +495,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -516,7 +516,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -537,7 +537,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 66df83b9eb..bf541bb05c 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -166,9 +166,10 @@ enum {
};
static ESearchBarItem addressbook_search_option_items[] = {
- { N_("Name begins with"), ESB_FULL_NAME, ESB_ITEMTYPE_RADIO },
- { N_("Email begins with"), ESB_EMAIL, ESB_ITEMTYPE_RADIO },
- { N_("Any field contains"), ESB_ANY, ESB_ITEMTYPE_RADIO },
+ { N_("Name begins with"), ESB_FULL_NAME, NULL },
+ { N_("Email begins with"), ESB_EMAIL, NULL },
+ { N_("Category is"), ESB_CATEGORY, NULL }, /* We attach subitems below */
+ { N_("Any field contains"), ESB_ANY, NULL },
{ NULL, -1, NULL }
};
@@ -1389,7 +1390,6 @@ create_treeview_view (EABView *view)
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
treeview = gtk_tree_view_new_with_model (adapter);
- g_object_unref (adapter);
gtk_widget_show (treeview);
@@ -1483,17 +1483,19 @@ static void
search_activated (ESearchBar *esb, EABView *v)
{
GList *master_list;
- char *search_word, *search_query, *view_sexp;
+ char *search_word, *search_query;
const char *category_name;
int search_type, subid;
+ g_message ("in search_activated");
+
g_object_get(esb,
"text", &search_word,
"item_id", &search_type,
NULL);
if (search_type == E_FILTERBAR_ADVANCED_ID) {
- // gtk_widget_show(eab_search_dialog_new(v));
+ //gtk_widget_show(eab_search_dialog_new(v));
}
else {
if ((search_word && strlen (search_word)) || search_type == ESB_CATEGORY) {
@@ -1512,26 +1514,26 @@ search_activated (ESearchBar *esb, EABView *v)
search_query = g_strdup_printf ("(beginswith \"email\" %s)",
s->str);
break;
+ case ESB_CATEGORY:
+ subid = e_search_bar_get_subitem_id (esb);
+
+ if (subid < 0 || subid == G_MAXINT) {
+ /* match everything */
+ search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")");
+ } else {
+ master_list = get_master_list ();
+ category_name = g_list_nth_data (master_list, subid);
+ search_query = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
+ }
+ break;
default:
search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")");
break;
}
g_string_free (s, TRUE);
-
- } else
+ } else
search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")");
- /* Merge view and sexp */
- subid = e_search_bar_get_viewitem_id (esb);
-
- if (subid) {
- master_list = get_master_list ();
- category_name = g_list_nth_data (master_list, subid-1);
- view_sexp = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
- search_query = g_strconcat ("(and ", view_sexp, search_query, ")", NULL);
- g_free (view_sexp);
- }
-
if (search_query)
g_object_set (v,
"query", search_query,
@@ -1570,8 +1572,8 @@ query_changed (ESearchBar *esb, EABView *view)
static int
compare_subitems (const void *a, const void *b)
{
- const ESearchBarItem *subitem_a = a;
- const ESearchBarItem *subitem_b = b;
+ const ESearchBarSubitem *subitem_a = a;
+ const ESearchBarSubitem *subitem_b = b;
char *collate_a, *collate_b;
int ret;
@@ -1587,32 +1589,33 @@ compare_subitems (const void *a, const void *b)
}
static void
-
make_suboptions (EABView *view)
{
- ESearchBarItem *subitems, *s;
+ ESearchBarSubitem *subitems, *s;
GList *master_list;
gint i, N;
master_list = get_master_list ();
N = g_list_length (master_list);
- subitems = g_new (ESearchBarItem, N+2);
+ subitems = g_new (ESearchBarSubitem, N+2);
- subitems[0].id = 0;
+ subitems[0].id = G_MAXINT;
subitems[0].text = g_strdup (_("Any Category"));
+ subitems[0].translate = FALSE;
for (i=0; i<N; ++i) {
const char *category = g_list_nth_data (master_list, i);
- subitems[i+1].id = i+1;
+
+ subitems[i+1].id = i;
subitems[i+1].text = g_strdup (category);
+ subitems[i+1].translate = FALSE;
}
-
subitems[N+1].id = -1;
subitems[N+1].text = NULL;
qsort (subitems + 1, N, sizeof (subitems[0]), compare_subitems);
- e_search_bar_set_viewoption ( (ESearchBar *) view->search, ESB_CATEGORY, subitems);
+ e_search_bar_set_suboption ( (ESearchBar *) view->search, ESB_CATEGORY, subitems);
for (s = subitems; s->id != -1; s++) {
if (s->text)
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 9729b97eb4..d20318648a 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -25,7 +25,6 @@
#endif
#include "eab-contact-display.h"
-#include "eab-popup.h"
#include "eab-gui-util.h"
#include "e-util/e-html-utils.h"
@@ -43,21 +42,8 @@
struct _EABContactDisplayPrivate {
EContact *contact;
-
- GtkWidget *invisible;
- char *selection_uri;
};
-static struct {
- gchar *name;
- gchar *pretty_name;
-}
-common_location [] =
-{
- { "WORK", N_ ("Work") },
- { "HOME", N_ ("Home") },
- { "OTHER", N_ ("Other") }
-};
#define HTML_HEADER "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n" \
"<head>\n<meta name=\"generator\" content=\"Evolution Addressbook Component\">\n</head>\n"
@@ -71,163 +57,11 @@ common_location [] =
#define JABBER_ICON "im-jabber"
#define MSN_ICON "im-msn"
#define YAHOO_ICON "im-yahoo"
-#define GADUGADU_ICON "im-gadugadu"
#define VIDEOCONF_ICON "stock_video-conferencing"
#define MAX_COMPACT_IMAGE_DIMENSION 48
static void
-eab_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
-{
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
- GError *err = NULL;
-
- gnome_url_show(t->uri, &err);
- if (err) {
- g_warning("gnome_url_show: %s", err->message);
- g_error_free(err);
- }
-}
-
-static void
-eab_uri_popup_email_address_copy(EPopup *ep, EPopupItem *item, void *data)
-{
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
- const char *url;
- char *html=NULL;
- int i=0;
- GList *email_list, *l;
- url = t->uri;
- int email_num = atoi (url + strlen ("internal-mailto:"));
-
- email_list = e_contact_get (p->contact, E_CONTACT_EMAIL);
- for (l = email_list; l; l=l->next) {
- if(i==email_num)
- html = e_text_to_html (l->data, 0);
- i++;
- }
-
- g_free(p->selection_uri);
- p->selection_uri = g_strdup(html);
- g_free (html);
-
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
-}
-
-static void
-eab_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
-
- g_free(p->selection_uri);
- p->selection_uri = g_strdup(pitem->user_data);
-
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
-}
-
-static void
-eab_uri_popup_address_send(EPopup *ep, EPopupItem *item, void *data)
-{
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
- const char *url;
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
-
- url = t->uri;
- int mail_num = atoi (url + strlen ("internal-mailto:"));
-
- if (mail_num == -1)
- return;
-
- eab_send_contact (p->contact, mail_num, EAB_DISPOSITION_AS_TO);
-
-}
-
-static void
-eab_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EABContactDisplay *display)
-{
- struct _EABContactDisplayPrivate *p = display->priv;
-
- if (p->selection_uri == NULL)
- return;
-
- gtk_selection_data_set(data, data->target, 8, p->selection_uri, strlen(p->selection_uri));
-}
-
-static void
-eab_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EABContactDisplay *display)
-{
-#if 0
- struct _EABContactDisplayPrivate *p = display->priv;
-
- g_free(p->selection_uri);
- p->selection_uri = NULL;
-#endif
-}
-
-static EPopupItem eab_uri_popups[] = {
- { E_POPUP_ITEM, "05.open", N_("_Open Link in Browser"), eab_uri_popup_link_open, NULL, NULL, EAB_POPUP_URI_NOT_MAILTO },
- { E_POPUP_ITEM, "10.copy", N_("_Copy Link Location"), eab_uri_popup_link_copy, NULL, NULL, EAB_POPUP_URI_NOT_MAILTO },
- { E_POPUP_ITEM, "15.send", N_("_Send New Message To ..."), eab_uri_popup_address_send, NULL, NULL, EAB_POPUP_URI_MAILTO},
- { E_POPUP_ITEM, "20.copy", N_("Copy _Email Address"), eab_uri_popup_email_address_copy, NULL, "gtk-copy", EAB_POPUP_URI_MAILTO},
- };
-
-
-static void
-eab_uri_popup_free(EPopup *ep, GSList *list, void *data)
-{
- while (list){
- GSList *n = list->next;
- struct _EPopupItem *item = list->data;
-
- g_free(item->user_data);
- item->user_data = NULL;
- g_slist_free_1(list);
-
- list = n;
- }
-}
-
-static int
-eab_uri_popup_event(EABContactDisplay *display, GdkEvent *event, const char *uri)
-{
- EABPopup *emp;
- EABPopupTargetURI *t ;
- GtkMenu *menu;
-
-
- emp = eab_popup_new("org.gnome.evolution.addressbook.contactdisplay.popup");
-
- GSList *menus = NULL;
- int i;
-
- t = eab_popup_target_new_uri(emp, uri);
- t->target.widget = (GtkWidget *)display;
-
- for (i=0;i<sizeof(eab_uri_popups)/sizeof(eab_uri_popups[0]);i++) {
- eab_uri_popups[i].user_data = g_strdup(t->uri);
- menus = g_slist_prepend(menus, &eab_uri_popups[i]);
- }
- e_popup_add_items((EPopup *)emp, menus, NULL, eab_uri_popup_free, display);
-
-
- menu = e_popup_create_menu_once((EPopup *)emp,(EPopupTarget*)t, 0);
-
- if (event == NULL) {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
- } else {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
- }
-
- return TRUE;
-}
-
-static void
on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
EABContactDisplay *display)
{
@@ -238,7 +72,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
if (!photo)
photo = e_contact_get (display->priv->contact, E_CONTACT_LOGO);
- gtk_html_stream_write (handle, photo->data.inlined.data, photo->data.inlined.length);
+ gtk_html_stream_write (handle, photo->data, photo->length);
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
@@ -272,7 +106,7 @@ on_link_clicked (GtkHTML *html, const char *url, EABContactDisplay *display)
if (mail_num == -1)
return;
-
+
eab_send_contact (display->priv->contact, mail_num, EAB_DISPOSITION_AS_TO);
return;
@@ -300,7 +134,7 @@ render_address (GtkHTMLStream *html_stream, EContact *contact, const char *html_
gtk_html_stream_printf (html_stream, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\">%s</a></td><td valign=\"top\">%s</td></tr>", html_label, _("(map)"), html);
-This shoul g_free (html);
+ g_free (html);
return;
}
@@ -417,26 +251,6 @@ accum_attribute (GString *gstr, EContact *contact, const char *html_label, ECont
}
static void
-accum_time_attribute (GString *gstr, EContact *contact, const char *html_label, EContactField field, const char *icon, unsigned int html_flags)
-{
- EContactDate *date;
- struct tm tdate;
- char sdate[100];
-
- date = e_contact_get (contact, field);
- memset (&tdate, 0, sizeof (struct tm));
-
- if (date) {
- tdate.tm_year = date->year-1900;
- tdate.tm_mday = date->day;
- tdate.tm_mon = date->month-1;
- strftime (sdate, 100, "%x", &tdate);
- accum_name_value (gstr, html_label, sdate, icon, html_flags);
- e_contact_date_free (date);
- }
-}
-
-static void
accum_multival_attribute (GString *gstr, EContact *contact, const char *html_label, EContactField field, const char *icon, unsigned int html_flags)
{
GList *val_list, *l;
@@ -482,28 +296,15 @@ end_block (GtkHTMLStream *html_stream)
gtk_html_stream_printf (html_stream, "<tr><td height=\"20\">&nbsp;</td></tr>");
}
-static const char *
-get_email_location (EVCardAttribute *attr)
-{
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (common_location); i++) {
- if (e_vcard_attribute_has_type (attr, common_location [i].name))
- return common_location [i].pretty_name;
- }
-
- return NULL;
-}
-
static void
render_contact (GtkHTMLStream *html_stream, EContact *contact)
{
GString *accum;
- GList *email_list, *l, *email_attr_list, *al;
+ GList *email_list, *l;
#ifdef HANDLE_MAILTO_INTERNALLY
int email_num = 0;
#endif
- char *nl, *nick=NULL;
+ char *nl;
gtk_html_stream_printf (html_stream, "<table border=\"0\">");
@@ -513,18 +314,16 @@ render_contact (GtkHTMLStream *html_stream, EContact *contact)
start_block (html_stream, "");
email_list = e_contact_get (contact, E_CONTACT_EMAIL);
- email_attr_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
-
- for (l = email_list, al=email_attr_list; l && al; l = l->next, al = al->next) {
+ for (l = email_list; l; l = l->next) {
#ifdef HANDLE_MAILTO_INTERNALLY
char *html = e_text_to_html (l->data, 0);
- g_string_append_printf (accum, "%s<a href=\"internal-mailto:%d\">%s</a> <font color=" HEADER_COLOR ">(%s)</font>", nl, email_num, html, get_email_location ((EVCardAttribute *) al->data));
+ g_string_append_printf (accum, "%s<a href=\"internal-mailto:%d\">%s</a>", nl, email_num, html);
email_num ++;
g_free (html);
nl = "<br>";
#else
- g_string_append_printf (accum, "%s%s <font color=" HEADER_COLOR ">(%s)</font>", nl, (char*)l->data, get_email_location ((EVCardAttribute *) al->data));
+ g_string_append_printf (accum, "%s%s", nl, (char*)l->data);
nl = "\n";
#endif
}
@@ -545,21 +344,13 @@ render_contact (GtkHTMLStream *html_stream, EContact *contact)
}
g_string_assign (accum, "");
- nick = e_contact_get (contact, E_CONTACT_NICKNAME);
- if (nick && *nick) {
- accum_name_value (accum, _("Nickname"), nick, NULL, 0);
- if (accum->len > 0)
- gtk_html_stream_printf (html_stream, "%s", accum->str);
- }
-
- g_string_assign (accum, "");
+
accum_multival_attribute (accum, contact, _("AIM"), E_CONTACT_IM_AIM, AIM_ICON, 0);
accum_multival_attribute (accum, contact, _("GroupWise"), E_CONTACT_IM_GROUPWISE, GROUPWISE_ICON, 0);
accum_multival_attribute (accum, contact, _("ICQ"), E_CONTACT_IM_ICQ, ICQ_ICON, 0);
accum_multival_attribute (accum, contact, _("Jabber"), E_CONTACT_IM_JABBER, JABBER_ICON, 0);
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);
if (accum->len > 0)
gtk_html_stream_printf (html_stream, "%s", accum->str);
@@ -569,37 +360,29 @@ render_contact (GtkHTMLStream *html_stream, EContact *contact)
g_string_assign (accum, "");
accum_attribute (accum, contact, _("Organization"), E_CONTACT_ORG, NULL, 0);
- accum_attribute (accum, contact, _("Department"), E_CONTACT_ORG_UNIT, NULL, 0);
- accum_attribute (accum, contact, _("Profession"), E_CONTACT_ROLE, NULL, 0);
accum_attribute (accum, contact, _("Position"), E_CONTACT_TITLE, NULL, 0);
- accum_attribute (accum, contact, _("Manager"), E_CONTACT_MANAGER, NULL, 0);
- accum_attribute (accum, contact, _("Assistant"), E_CONTACT_ASSISTANT, NULL, 0);
- accum_attribute (accum, contact, _("Video Chat"), E_CONTACT_VIDEO_URL, VIDEOCONF_ICON, E_TEXT_TO_HTML_CONVERT_URLS);
- accum_attribute (accum, contact, _("Calendar"), E_CONTACT_CALENDAR_URI, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
- accum_attribute (accum, contact, _("Free/Busy"), E_CONTACT_FREEBUSY_URL, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
+ accum_attribute (accum, contact, _("Video Conferencing"), E_CONTACT_VIDEO_URL, VIDEOCONF_ICON, E_TEXT_TO_HTML_CONVERT_URLS);
accum_attribute (accum, contact, _("Phone"), E_CONTACT_PHONE_BUSINESS, NULL, 0);
accum_attribute (accum, contact, _("Fax"), E_CONTACT_PHONE_BUSINESS_FAX, NULL, 0);
accum_address (accum, contact, _("Address"), E_CONTACT_ADDRESS_WORK, E_CONTACT_ADDRESS_LABEL_WORK);
if (accum->len > 0) {
- start_block (html_stream, _("Work"));
+ start_block (html_stream, _("work"));
gtk_html_stream_printf (html_stream, "%s", accum->str);
end_block (html_stream);
}
g_string_assign (accum, "");
- accum_attribute (accum, contact, _("Home Page"), E_CONTACT_HOMEPAGE_URL, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
- accum_attribute (accum, contact, _("Web Log"), E_CONTACT_BLOG_URL, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
+ accum_attribute (accum, contact, _("WWW"), E_CONTACT_HOMEPAGE_URL, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
+ accum_attribute (accum, contact, _("Blog"), E_CONTACT_BLOG_URL, NULL, E_TEXT_TO_HTML_CONVERT_URLS);
accum_attribute (accum, contact, _("Phone"), E_CONTACT_PHONE_HOME, NULL, 0);
accum_attribute (accum, contact, _("Mobile Phone"), E_CONTACT_PHONE_MOBILE, NULL, 0);
accum_address (accum, contact, _("Address"), E_CONTACT_ADDRESS_HOME, E_CONTACT_ADDRESS_LABEL_HOME);
- accum_time_attribute (accum, contact, _("Birthday"), E_CONTACT_BIRTH_DATE, NULL, 0);
- accum_time_attribute (accum, contact, _("Anniversary"), E_CONTACT_ANNIVERSARY, NULL, 0);
- accum_attribute (accum, contact, _("Spouse"), E_CONTACT_SPOUSE, NULL, 0);
+
if (accum->len > 0) {
- start_block (html_stream, _("Personal"));
+ start_block (html_stream, _("personal"));
gtk_html_stream_printf (html_stream, "%s", accum->str);
end_block (html_stream);
}
@@ -637,8 +420,7 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
photo = e_contact_get (contact, E_CONTACT_PHOTO);
if (!photo)
photo = e_contact_get (contact, E_CONTACT_LOGO);
- /* Only handle inlined photos for now */
- if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
+ if (photo) {
gtk_html_stream_printf (html_stream, "<img border=\"1\" src=\"internal-contact-photo:\">");
e_contact_photo_free (photo);
}
@@ -708,7 +490,7 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac
image here. we don't scale the pixbuf
itself, just insert width/height tags in
the html */
- gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL);
+ gdk_pixbuf_loader_write (loader, photo->data, photo->length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
@@ -842,26 +624,6 @@ eab_contact_display_render (EABContactDisplay *display, EContact *contact,
}
}
-static int
-eab_html_press_event (GtkWidget *widget, GdkEvent *event,EABContactDisplay *display)
-{
- char *uri;
- gboolean res = FALSE;
-
-
- if (event->button.button!= 3 )
- return FALSE;
-
- uri = gtk_html_get_url_at (GTK_HTML (widget), event->button.x, event->button.y);
- if (uri){
- eab_uri_popup_event(display,event,uri);
- }
-
- g_free(uri);
-
- return res;
-}
-
GtkWidget*
eab_contact_display_new (void)
{
@@ -869,8 +631,7 @@ eab_contact_display_new (void)
display = g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
- struct _EABContactDisplayPrivate *p;
- p=display->priv = g_new0 (EABContactDisplayPrivate, 1);
+ display->priv = g_new0 (EABContactDisplayPrivate, 1);
gtk_html_set_default_content_type (GTK_HTML (display), "text/html; charset=utf-8");
@@ -882,15 +643,6 @@ eab_contact_display_new (void)
g_signal_connect (display, "link_clicked",
G_CALLBACK (on_link_clicked),
display);
- g_signal_connect(display, "button_press_event",
- G_CALLBACK(eab_html_press_event),
- display);
- p->invisible = gtk_invisible_new();
- g_signal_connect(p->invisible, "selection_get", G_CALLBACK(eab_selection_get), display);
- g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(eab_selection_clear_event), display);
- gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
- gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
-
#if 0
g_signal_connect (display, "object_requested",
G_CALLBACK (on_object_requested),
@@ -910,6 +662,7 @@ eab_contact_display_new (void)
return GTK_WIDGET (display);
}
+
static void
eab_contact_display_init (GObject *object)
{