aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-07-02 12:54:22 +0800
committerChris Lahey <clahey@src.gnome.org>2001-07-02 12:54:22 +0800
commit353946a818a6e373773cdfcad543e9d6b65f042d (patch)
tree6121196565997a1abd8a32cde021fd900070c12e /addressbook/gui/contact-editor
parente6191dc02e287a768ac8574499673d157397d079 (diff)
downloadgsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar.gz
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar.bz2
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar.lz
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar.xz
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.tar.zst
gsoc2013-evolution-353946a818a6e373773cdfcad543e9d6b65f042d.zip
Added related_contacts field.
2001-07-02 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-card.c, backend/ebook/e-card.h: Added related_contacts field. * gui/component/select-names/e-select-names-model.c, gui/component/select-names/e-select-names-model.h (e_select_names_model_import_destinationv): Added this function. * gui/contact-editor/contact-editor.glade: Replaced the entry here for related contacts with a table which is filled in in the C code. * gui/contact-editor/e-contact-editor.c, gui/contact-editor/e-contact-editor.h (add_lists): Added a select names entry here for the related contacts field. * gui/widgets/Makefile.am: Removed all the test programs here since there are circular dependencies now. svn path=/trunk/; revision=10666
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade82
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c89
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h3
3 files changed, 122 insertions, 52 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index af5d17d954..eb351d8bcc 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -1334,39 +1334,6 @@
<widget>
<class>GtkAlignment</class>
- <name>alignment14</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>13</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-contacts</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
<name>alignment16</name>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
@@ -1651,6 +1618,39 @@
<yfill>True</yfill>
</child>
</widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment17</name>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>12</top_attach>
+ <bottom_attach>13</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table-contacts</name>
+ <rows>1</rows>
+ <columns>1</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>0</column_spacing>
+ </widget>
+ </widget>
</widget>
<widget>
@@ -2257,16 +2257,16 @@
<widget>
<class>Custom</class>
- <name>dateedit-anniversary</name>
+ <name>dateedit-birthday</name>
<creation_function>e_contact_editor_create_date</creation_function>
<int1>0</int1>
<int2>0</int2>
- <last_modification_time>Tue, 05 Jun 2001 02:36:32 GMT</last_modification_time>
+ <last_modification_time>Tue, 05 Jun 2001 02:36:27 GMT</last_modification_time>
<child>
<left_attach>4</left_attach>
<right_attach>6</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
@@ -2280,16 +2280,16 @@
<widget>
<class>Custom</class>
- <name>dateedit-birthday</name>
+ <name>dateedit-anniversary</name>
<creation_function>e_contact_editor_create_date</creation_function>
<int1>0</int1>
<int2>0</int2>
- <last_modification_time>Tue, 05 Jun 2001 02:36:27 GMT</last_modification_time>
+ <last_modification_time>Tue, 05 Jun 2001 02:36:32 GMT</last_modification_time>
<child>
<left_attach>4</left_attach>
<right_attach>6</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 41a58e0ca4..2b9c22a249 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -37,6 +37,9 @@
#include <gal/widgets/e-categories.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
+#include <gal/e-text/e-entry.h>
+
+#include <e-util/e-categories-master-list-wombat.h>
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/printing/e-contact-print-envelope.h"
@@ -643,10 +646,11 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
static void
categories_clicked(GtkWidget *button, EContactEditor *editor)
{
- char *categories;
+ char *categories = NULL;
GnomeDialog *dialog;
int result;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
+ ECategoriesMasterList *ecml;
if (entry && GTK_IS_ENTRY(entry))
categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry));
else if (editor->card)
@@ -654,9 +658,12 @@ categories_clicked(GtkWidget *button, EContactEditor *editor)
"categories", &categories,
NULL);
dialog = GNOME_DIALOG(e_categories_new(categories));
+ ecml = e_categories_master_list_wombat_new ();
gtk_object_set(GTK_OBJECT(dialog),
"header", _("This contact belongs to these categories:"),
+ "ecml", ecml,
NULL);
+ gtk_object_unref (GTK_OBJECT (ecml));
gtk_widget_show(GTK_WIDGET(dialog));
result = gnome_dialog_run (dialog);
g_free (categories);
@@ -673,12 +680,43 @@ categories_clicked(GtkWidget *button, EContactEditor *editor)
g_free(categories);
}
gtk_object_destroy(GTK_OBJECT(dialog));
-#if 0
- if (!entry)
- g_free(categories);
-#endif
}
+static void
+ensure_select_names_contact (EContactEditor *editor)
+{
+ if (editor->select_names_contacts == NULL) {
+ editor->select_names_contacts = e_select_names_manager_new ();
+ e_select_names_manager_add_section (editor->select_names_contacts,
+ "contacts",
+ "Related Contacts");
+ }
+}
+
+static void
+contacts_clicked (GtkWidget *button, EContactEditor *editor)
+{
+ ensure_select_names_contact (editor);
+ e_select_names_manager_activate_dialog (editor->select_names_contacts,
+ "contacts");
+}
+
+static void
+add_lists (EContactEditor *editor)
+{
+ GtkWidget *table = glade_xml_get_widget (editor->gui, "table-contacts");
+ if (table && GTK_IS_TABLE (table)) {
+ GtkWidget *entry;
+
+ ensure_select_names_contact (editor);
+ entry = e_select_names_manager_create_entry (editor->select_names_contacts,
+ "contacts");
+ gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 1, 0, 1);
+ gtk_widget_show (entry);
+ }
+}
+
+
typedef struct {
EContactEditor *ce;
gboolean should_close;
@@ -1032,6 +1070,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
e_contact_editor);
_replace_buttons(e_contact_editor);
+ add_lists (e_contact_editor);
set_entry_changed_signals(e_contact_editor);
wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail");
@@ -1054,6 +1093,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_signal_connect(GTK_OBJECT(widget), "clicked",
categories_clicked, e_contact_editor);
+ widget = glade_xml_get_widget(e_contact_editor->gui, "button-contacts");
+ if (widget && GTK_IS_BUTTON(widget))
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ contacts_clicked, e_contact_editor);
+
/* Construct the app */
bonobo_win = bonobo_window_new ("contact-editor-dialog", "Contact Editor");
@@ -2080,6 +2124,7 @@ fill_in_info(EContactEditor *editor)
ECard *card = editor->card;
if (card) {
char *file_as;
+ char *related_contacts;
ECardName *name;
const ECardDate *anniversary;
const ECardDate *bday;
@@ -2089,12 +2134,13 @@ fill_in_info(EContactEditor *editor)
gboolean wants_html, wants_html_set;
gtk_object_get(GTK_OBJECT(card),
- "file_as", &file_as,
- "name", &name,
- "anniversary", &anniversary,
- "birth_date", &bday,
- "wants_html_set",&wants_html_set,
- "wants_html", &wants_html,
+ "file_as", &file_as,
+ "related_contacts", &related_contacts,
+ "name", &name,
+ "anniversary", &anniversary,
+ "birth_date", &bday,
+ "wants_html_set", &wants_html_set,
+ "wants_html", &wants_html,
NULL);
for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) {
@@ -2146,6 +2192,12 @@ fill_in_info(EContactEditor *editor)
e_date_edit_set_time (dateedit, -1);
}
+ if (editor->select_names_contacts && related_contacts && *related_contacts) {
+ ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts,
+ "contacts");
+ e_select_names_model_import_destinationv (model, related_contacts);
+ }
+
set_fields(editor);
}
}
@@ -2226,6 +2278,21 @@ extract_info(EContactEditor *editor)
extract_single_field(editor, list->data);
}
+ if (editor->select_names_contacts) {
+ ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts,
+ "contacts");
+ char *string = e_select_names_model_export_destinationv (model);
+ if (string && *string)
+ gtk_object_set (GTK_OBJECT (card),
+ "related_contacts", string,
+ NULL);
+ else
+ gtk_object_set (GTK_OBJECT (card),
+ "related_contacts", NULL,
+ NULL);
+ g_free (string);
+ }
+
if (editor->name)
gtk_object_set(GTK_OBJECT(card),
"name", editor->name,
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index d4ebd7d676..5f9ac77435 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -26,6 +26,7 @@
#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
+#include "addressbook/gui/component/select-names/e-select-names-manager.h"
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
@@ -78,6 +79,8 @@ struct _EContactEditor
GList *phone_list;
GList *address_list;
+ ESelectNamesManager *select_names_contacts;
+
ECardName *name;
char *company;