diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-07-02 12:54:22 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-07-02 12:54:22 +0800 |
commit | 353946a818a6e373773cdfcad543e9d6b65f042d (patch) | |
tree | 6121196565997a1abd8a32cde021fd900070c12e /addressbook/gui | |
parent | e6191dc02e287a768ac8574499673d157397d079 (diff) | |
download | gsoc2013-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')
6 files changed, 235 insertions, 134 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c index d562b40a64..8c10aa6035 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -202,6 +202,34 @@ e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) } } + +static void +e_select_names_model_changed (ESelectNamesModel *model) +{ + g_free (model->priv->text); + model->priv->text = NULL; + + g_free (model->priv->addr_text); + model->priv->addr_text = NULL; + +#if 0 + { + GList *i = model->priv->data; + gint j = 0; + g_print ("ESelectNamesModel state:\n"); + while (i) { + EDestination *dest = (EDestination *) i->data; + g_print ("%d: %s <%s>\n", j, e_destination_get_string (dest), e_destination_get_email (dest)); + i = g_list_next (i); + ++j; + } + g_print ("\n"); + } +#endif + + gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]); +} + /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ ESelectNamesModel * @@ -342,6 +370,32 @@ e_select_names_model_export_destinationv (ESelectNamesModel *model) return str; } +static +void send_changed (EDestination *dest, ECard *card, gpointer closure) +{ + ESelectNamesModel *model = closure; + e_select_names_model_changed (model); +} + +void +e_select_names_model_import_destinationv (ESelectNamesModel *model, + gchar *destinationv) +{ + EDestination **destv; + gint i; + + g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); + + destv = e_destination_importv (destinationv); + + e_select_names_model_delete_all (model); + for (i = 0; destv[i]; i++) { + e_destination_use_card (destv[i], send_changed, model); + e_select_names_model_append (model, destv[i]); + } + g_free (destv); +} + ECard * e_select_names_model_get_card (ESelectNamesModel *model, gint index) { @@ -370,33 +424,6 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index) return dest ? e_destination_get_string (dest) : ""; } -static void -e_select_names_model_changed (ESelectNamesModel *model) -{ - g_free (model->priv->text); - model->priv->text = NULL; - - g_free (model->priv->addr_text); - model->priv->addr_text = NULL; - -#if 0 - { - GList *i = model->priv->data; - gint j = 0; - g_print ("ESelectNamesModel state:\n"); - while (i) { - EDestination *dest = (EDestination *) i->data; - g_print ("%d: %s <%s>\n", j, e_destination_get_string (dest), e_destination_get_email (dest)); - i = g_list_next (i); - ++j; - } - g_print ("\n"); - } -#endif - - gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]); -} - void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest) { diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h index 417ec7abb1..989a829223 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ b/addressbook/gui/component/select-names/e-select-names-model.h @@ -52,6 +52,8 @@ const gchar *e_select_names_model_get_address_text (ESelectNamesModel *model); gint e_select_names_model_count (ESelectNamesModel *model); const EDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index); gchar *e_select_names_model_export_destinationv (ESelectNamesModel *model); +void e_select_names_model_import_destinationv (ESelectNamesModel *model, + gchar *destinationv); ECard *e_select_names_model_get_card (ESelectNamesModel *model, gint index); const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index); 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; diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am index 8d86b99109..dc84125c39 100644 --- a/addressbook/gui/widgets/Makefile.am +++ b/addressbook/gui/widgets/Makefile.am @@ -42,42 +42,43 @@ libeminicard_a_SOURCES = \ gal-view-minicard.c \ gal-view-minicard.h -noinst_PROGRAMS = \ - minicard-widget-test \ - minicard-label-test \ - minicard-test -# reflow-test -# minicard-view-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - libeminicard.a \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/e-util/libeutil.la - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/ename/libename.la \ - $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(GNOME_PRINT_LIBS) \ - libeminicard.a - +#noinst_PROGRAMS = \ +# minicard-widget-test \ +# minicard-label-test \ +# minicard-test +## reflow-test +## minicard-view-test +# +#minicard_label_test_SOURCES = \ +# test-minicard-label.c +# +#minicard_label_test_LDADD = \ +# libeminicard.a \ +# $(EXTRA_GNOME_LIBS) \ +# $(BONOBO_GNOME_LIBS) \ +# $(top_builddir)/e-util/libeutil.la +# +#minicard_test_SOURCES = \ +# test-minicard.c +# +#minicard_test_LDADD = \ +# libeminicard.a \ +# $(top_builddir)/addressbook/backend/ebook/libebook.la \ +# $(top_builddir)/e-util/libeutil.la \ +# $(top_builddir)/libversit/libversit.la \ +# $(top_builddir)/e-util/ename/libename.la \ +# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ +# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ +# $(top_builddir)/addressbook/printing/libecontactprint.a \ +# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ +# $(top_builddir)/widgets/misc/libemiscwidgets.a \ +# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \ +# $(top_builddir)/e-util/libeutil.la \ +# $(EXTRA_GNOME_LIBS) \ +# $(BONOBO_GNOME_LIBS) \ +# $(GNOME_PRINT_LIBS) \ +# libeminicard.a +# #reflow_test_SOURCES = \ # test-reflow.c # @@ -110,25 +111,26 @@ minicard_test_LDADD = \ # $(top_builddir)/addressbook/printing/libecontactprint.a \ # $(top_builddir)/widgets/misc/libemiscwidgets.a \ # $(top_builddir)/e-util/libeutil.la - -minicard_widget_test_SOURCES = \ - e-minicard-widget-test.c - -minicard_widget_test_LDADD = \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/ename/libename.la \ - $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(GNOME_PRINT_LIBS) +# +#minicard_widget_test_SOURCES = \ +# e-minicard-widget-test.c +# +#minicard_widget_test_LDADD = \ +# libeminicard.a \ +# $(top_builddir)/addressbook/backend/ebook/libebook.la \ +# $(top_builddir)/e-util/libeutil.la \ +# $(top_builddir)/libversit/libversit.la \ +# $(top_builddir)/e-util/ename/libename.la \ +# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ +# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ +# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \ +# $(top_builddir)/addressbook/printing/libecontactprint.a \ +# $(top_builddir)/widgets/misc/libemiscwidgets.a \ +# $(top_builddir)/e-util/libeutil.la \ +# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ +# $(EXTRA_GNOME_LIBS) \ +# $(BONOBO_GNOME_LIBS) \ +# $(GNOME_PRINT_LIBS) gladedir = $(datadir)/evolution/glade glade_DATA = alphabet.glade |