aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-14 22:31:22 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-14 22:31:22 +0800
commit32471accadcf2099f9d3567f51add9fab197ec24 (patch)
tree8b070bcbdbcd962de9016b0fceaa15ec45848310 /addressbook/backend
parent623ba9a279db035339ac8ae5030683c1e79b8618 (diff)
downloadgsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.gz
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.bz2
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.lz
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.xz
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.zst
gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.zip
From widgets/e-table/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com> * Implemented the feature where the ETable columns automatically fill the given space. * e-cell-text.c, e-cell-text.h: Moved #include e-text-event-processor.h from the .h to the .c. * e-table-col.c, e-table-col.h: Added an expansion variable, and made it so that width isn't set by the programmer but instead by the e-table-header. * e-table-example-1.c, e-table-example-2.c, e-table-size-test.c, test-check.c, test-cols.c, test-table.c: Fixed to handle new ETable column resizing. * e-table-group-container.c, e-table-group-container.h, e-table-group-leaf.c, e-table-group-leaf.h, e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h: Fixed these to do a proper canvas reflow/update loop. Changed them to take a minimum width and return a width and a height. * e-table-header-item.c, e-table-header-item.h: Made this so that it depends on e-table-header.c for deciding the actual size of columns during resize (it was making incorrect decisions on its own.) * e-table-header.c, e-table-header.h: Changed this to make sure that the sum of the widths of the columns was always as close as possible to the width of the window. This is done by taking a full width and having each of the columns have an "expansion" field. This field is what makes each column have approximately the same portion of its part of the screen that it used to. * e-table.c: Changed this to set the width on the ETableHeader as well as set the proper minimum width on the ETableGroup and get the width and height it reports. From addressbook/ChangeLog 2000-05-14 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/Makefile.am: Added libeutil for e-card's support for categories. * backend/ebook/e-card-list.c, backend/ebook/e-card-list.h: Added a function to get the length. * backend/ebook/e-card.c, backend/ebook/e-card.h: Added categories support (accessible either as "categories" or "category_list".) * contact-editor/Makefile.am: Added e-table and all of the categories files. * contact-editor/categories.glade, contact-editor/categories-strings.h, contact-editor/e-contact-editor-categories.c, contact-editor/e-contact-editor-categories.h: * contact-editor/contact-editor.glade, contact-editor/e-contact-editor-strings.h: Rearranged this dialog. * contact-editor/e-contact-editor.c: Rearranged dialog a bit. Added opening of categories dialog. * gui/component/Makefile.am: Rearranged libraries so that libetable would be available for the contact editor categories dialog. * gui/component/addressbook.c: Fix for new ETable resizing. Make contact editor dialog resizable. * gui/minicard/Makefile.am: Added libetable contact editor categories dialog. * gui/minicard/e-minicard.c: Make contact editor dialog resizable. From mail/ChangeLog 2000-05-14 Christopher James Lahey <clahey@helixcode.com> * message-list.c: Updated to work with new ETable resizing. svn path=/trunk/; revision=3027
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/Makefile.am14
-rw-r--r--addressbook/backend/ebook/e-card-list.c6
-rw-r--r--addressbook/backend/ebook/e-card-list.h1
-rw-r--r--addressbook/backend/ebook/e-card.c149
-rw-r--r--addressbook/backend/ebook/e-card.h2
5 files changed, 165 insertions, 7 deletions
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
index 42399190ea..c0ab395564 100644
--- a/addressbook/backend/ebook/Makefile.am
+++ b/addressbook/backend/ebook/Makefile.am
@@ -63,7 +63,8 @@ test_client_LDADD = \
libebook.la \
$(BONOBO_GNOME_LIBS) \
$(top_builddir)/libversit/libversit.la \
- $(top_builddir)/addressbook/ename/libename.la
+ $(top_builddir)/addressbook/ename/libename.la \
+ $(top_builddir)/e-util/libeutil.la
test_client_list_SOURCES = \
test-client-list.c
@@ -72,7 +73,8 @@ test_client_list_LDADD = \
libebook.la \
$(BONOBO_GNOME_LIBS) \
$(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/e-util/libeutil.la
test_card_SOURCES = \
test-card.c
@@ -81,7 +83,9 @@ test_card_LDADD = \
libebook.la \
$(BONOBO_GNOME_LIBS) \
$(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/e-util/libeutil.la
+
load_pine_addressbook_SOURCES = \
load-pine-addressbook.c
@@ -90,7 +94,9 @@ load_pine_addressbook_LDADD = \
libebook.la \
$(BONOBO_GNOME_LIBS) \
$(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/e-util/libeutil.la
+
BUILT_SOURCES = $(CORBA_SOURCE)
CLEANFILES += $(BUILT_SOURCES)
diff --git a/addressbook/backend/ebook/e-card-list.c b/addressbook/backend/ebook/e-card-list.c
index 9bec3b7bd5..e912de7b6e 100644
--- a/addressbook/backend/ebook/e-card-list.c
+++ b/addressbook/backend/ebook/e-card-list.c
@@ -95,6 +95,12 @@ e_card_list_get_iterator (ECardList *list)
return iterator;
}
+int
+e_card_list_length (ECardList *list)
+{
+ return g_list_length(list->list);
+}
+
void
e_card_list_append (ECardList *list, const void *data)
{
diff --git a/addressbook/backend/ebook/e-card-list.h b/addressbook/backend/ebook/e-card-list.h
index 18b69b2a3e..0a4a5bf105 100644
--- a/addressbook/backend/ebook/e-card-list.h
+++ b/addressbook/backend/ebook/e-card-list.h
@@ -46,6 +46,7 @@ ECardList *e_card_list_new (ECardListCopyFunc copy,
ECardIterator *e_card_list_get_iterator (ECardList *list);
void e_card_list_append (ECardList *list,
const void *data);
+int e_card_list_length (ECardList *list);
/* For iterators to call. */
void e_card_list_invalidate_iterators (ECardList *list,
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 2eeec38b73..cff4e8d54f 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -19,6 +19,8 @@
#include "e-card-pairs.h"
#include "e-name-western.h"
+#include <e-util/e-util.h>
+
#define is_a_prop_of(obj,prop) (isAPropertyOf ((obj),(prop)))
#define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1))
#define has(obj,prop) (vo = isAPropertyOf ((obj), (prop)))
@@ -47,6 +49,8 @@ enum {
ARG_ANNIVERSARY,
ARG_FBURL,
ARG_NOTE,
+ ARG_CATEGORIES,
+ ARG_CATEGORY_LIST,
ARG_ID
};
@@ -86,6 +90,7 @@ static void parse_spouse(ECard *card, VObject *object);
static void parse_anniversary(ECard *card, VObject *object);
static void parse_fburl(ECard *card, VObject *object);
static void parse_note(ECard *card, VObject *object);
+static void parse_categories(ECard *card, VObject *object);
static void parse_id(ECard *card, VObject *object);
static ECardPhoneFlags get_phone_flags (VObject *vobj);
@@ -120,6 +125,7 @@ struct {
{ "X-EVOLUTION-ANNIVERSARY", parse_anniversary },
{ "FBURL", parse_fburl },
{ VCNoteProp, parse_note },
+ { "CATEGORIES", parse_categories },
{ VCUniqueStringProp, parse_id }
};
@@ -379,6 +385,32 @@ char
if (card->note)
addPropValue(vobj, VCNoteProp, card->note);
+ if (card->categories) {
+ ECardIterator *iterator;
+ int length = 0;
+ char *string;
+ char *stringptr;
+ for (iterator = e_card_list_get_iterator(card->categories); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ length += strlen(e_card_iterator_get(iterator)) + 1;
+ }
+ string = g_new(char, length + 1);
+ stringptr = string;
+ *stringptr = 0;
+ for (e_card_iterator_reset(iterator); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ strcpy(stringptr, e_card_iterator_get(iterator));
+ stringptr += strlen(stringptr);
+ *stringptr = ',';
+ stringptr++;
+ *stringptr = 0;
+ }
+ if (stringptr > string) {
+ stringptr --;
+ *stringptr = 0;
+ }
+ addPropValue (vobj, "CATEGORIES", string);
+ g_free(string);
+ }
+
if (card->id)
addPropValue (vobj, VCUniqueStringProp, card->id);
@@ -432,9 +464,6 @@ char
if (crd->agent)
addVObjectProp (vobj, card_convert_to_vobject (crd->agent));
- add_CardStrProperty (vobj, VCCategoriesProp, &crd->categories);
- add_CardStrProperty (vobj, VCCommentProp, &crd->comment);
-
if (crd->sound.prop.used) {
if (crd->sound.type != SOUND_PHONETIC)
vprop = addPropSizedValue (vobj, VCPronunciationProp,
@@ -684,6 +713,72 @@ parse_note(ECard *card, VObject *vobj)
}
static void
+add_list_unique(ECard *card, ECardList *list, char *string)
+{
+ char *temp = e_strdup_strip(string);
+ ECardIterator *iterator;
+
+ if (!*temp) {
+ g_free(temp);
+ return;
+ }
+ for ( iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ if (!strcmp(e_card_iterator_get(iterator), temp)) {
+ g_free(temp);
+ break;
+ }
+ }
+ if (!e_card_iterator_is_valid(iterator)) {
+ e_card_list_append(list, temp);
+ }
+ gtk_object_unref(GTK_OBJECT(iterator));
+}
+
+static void
+do_parse_categories(ECard *card, char *str)
+{
+ int length = strlen(str);
+ char *copy = g_new(char, length + 1);
+ int i, j;
+ ECardList *list;
+ gtk_object_get(GTK_OBJECT(card),
+ "category_list", &list,
+ NULL);
+ for (i = 0, j = 0; str[i]; i++, j++) {
+ switch (str[i]) {
+ case '\\':
+ i++;
+ if (str[i]) {
+ copy[j] = str[i];
+ } else
+ i--;
+ break;
+ case ',':
+ copy[j] = 0;
+ add_list_unique(card, list, copy);
+ j = -1;
+ break;
+ default:
+ copy[j] = str[i];
+ break;
+ }
+ }
+ copy[j] = 0;
+ add_list_unique(card, list, copy);
+ g_free(copy);
+}
+
+static void
+parse_categories(ECard *card, VObject *vobj)
+{
+ if ( vObjectValueType (vobj) ) {
+ char *str = fakeCString (vObjectUStringZValue (vobj));
+ do_parse_categories(card, str);
+ free(str);
+ }
+}
+
+static void
parse_id(ECard *card, VObject *vobj)
{
if ( card->id )
@@ -786,6 +881,10 @@ e_card_class_init (ECardClass *klass)
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
gtk_object_add_arg_type ("ECard::note",
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE);
+ gtk_object_add_arg_type ("ECard::categories",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES);
+ gtk_object_add_arg_type ("ECard::category_list",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST);
gtk_object_add_arg_type ("ECard::id",
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
@@ -1081,6 +1180,8 @@ e_card_destroy (GtkObject *object)
if (card->note)
g_free(card->note);
+ if (card->categories)
+ gtk_object_unref(GTK_OBJECT(card->categories));
if (card->email)
gtk_object_unref(GTK_OBJECT(card->email));
if (card->phone)
@@ -1116,6 +1217,20 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
e_card_name_free(card->name);
card->name = GTK_VALUE_POINTER(*arg);
break;
+ case ARG_CATEGORIES:
+ if (card->categories)
+ gtk_object_unref(GTK_OBJECT(card->categories));
+ card->categories = NULL;
+ if (GTK_VALUE_STRING(*arg))
+ do_parse_categories(card, GTK_VALUE_STRING(*arg));
+ break;
+ case ARG_CATEGORY_LIST:
+ if (card->categories)
+ gtk_object_unref(GTK_OBJECT(card->categories));
+ card->categories = E_CARD_LIST(GTK_VALUE_OBJECT(*arg));
+ if (card->categories)
+ gtk_object_ref(GTK_OBJECT(card->categories));
+ break;
case ARG_BIRTH_DATE:
if ( card->bday )
g_free(card->bday);
@@ -1242,6 +1357,33 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
NULL);
GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email);
break;
+ case ARG_CATEGORIES:
+ {
+ int i;
+ char ** strs;
+ int length;
+ ECardIterator *iterator;
+ if (!card->categories)
+ card->categories = e_card_list_new((ECardListCopyFunc) g_strdup,
+ (ECardListFreeFunc) g_free,
+ NULL);
+ length = e_card_list_length(card->categories);
+ strs = g_new(char *, length + 1);
+ for (iterator = e_card_list_get_iterator(card->categories), i = 0; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator), i++) {
+ strs[i] = (char *)e_card_iterator_get(iterator);
+ }
+ strs[i] = 0;
+ GTK_VALUE_STRING(*arg) = g_strjoinv(", ", strs);
+ g_free(strs);
+ }
+ break;
+ case ARG_CATEGORY_LIST:
+ if (!card->categories)
+ card->categories = e_card_list_new((ECardListCopyFunc) g_strdup,
+ (ECardListFreeFunc) g_free,
+ NULL);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->categories);
+ break;
case ARG_BIRTH_DATE:
GTK_VALUE_POINTER(*arg) = card->bday;
break;
@@ -1323,6 +1465,7 @@ e_card_init (ECard *card)
card->anniversary = NULL;
card->fburl = NULL;
card->note = NULL;
+ card->categories = NULL;
#if 0
c = g_new0 (ECard, 1);
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index 98fa4a9060..b34ab2cd54 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -63,6 +63,8 @@ struct _ECard {
char *fburl; /* Free Busy URL */
+ ECardList *categories; /* Categories. */
+
#if 0
ECardPhoto *logo; /* This person's org's logo. */