aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--addressbook/ChangeLog37
-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
-rw-r--r--addressbook/contact-editor/Makefile.am12
-rw-r--r--addressbook/contact-editor/categories-strings.h9
-rw-r--r--addressbook/contact-editor/categories.glade190
-rw-r--r--addressbook/contact-editor/contact-editor.glade882
-rw-r--r--addressbook/contact-editor/e-contact-editor-categories.c435
-rw-r--r--addressbook/contact-editor/e-contact-editor-categories.h83
-rw-r--r--addressbook/contact-editor/e-contact-editor-strings.h29
-rw-r--r--addressbook/contact-editor/e-contact-editor.c74
-rw-r--r--addressbook/gui/component/Makefile.am9
-rw-r--r--addressbook/gui/component/addressbook.c7
-rw-r--r--addressbook/gui/contact-editor/Makefile.am12
-rw-r--r--addressbook/gui/contact-editor/categories-strings.h9
-rw-r--r--addressbook/gui/contact-editor/categories.glade190
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade882
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-categories.c435
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-categories.h83
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-strings.h29
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c74
-rw-r--r--addressbook/gui/minicard/Makefile.am12
-rw-r--r--addressbook/gui/minicard/e-minicard.c2
-rw-r--r--addressbook/gui/widgets/Makefile.am12
-rw-r--r--addressbook/gui/widgets/e-minicard.c2
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/message-list.c49
-rw-r--r--widgets/e-table/ChangeLog38
-rw-r--r--widgets/e-table/e-cell-text.c1
-rw-r--r--widgets/e-table/e-cell-text.h1
-rw-r--r--widgets/e-table/e-table-col.c22
-rw-r--r--widgets/e-table/e-table-col.h9
-rw-r--r--widgets/e-table/e-table-defines.h3
-rw-r--r--widgets/e-table/e-table-example-1.c2
-rw-r--r--widgets/e-table/e-table-example-2.c4
-rw-r--r--widgets/e-table/e-table-group-container.c385
-rw-r--r--widgets/e-table/e-table-group-container.h4
-rw-r--r--widgets/e-table/e-table-group-leaf.c130
-rw-r--r--widgets/e-table/e-table-group-leaf.h4
-rw-r--r--widgets/e-table/e-table-group.c79
-rw-r--r--widgets/e-table/e-table-group.h4
-rw-r--r--widgets/e-table/e-table-header-item.c58
-rw-r--r--widgets/e-table/e-table-header-item.h1
-rw-r--r--widgets/e-table/e-table-header.c393
-rw-r--r--widgets/e-table/e-table-header.h34
-rw-r--r--widgets/e-table/e-table-item.c104
-rw-r--r--widgets/e-table/e-table-item.h3
-rw-r--r--widgets/e-table/e-table-size-test.c2
-rw-r--r--widgets/e-table/e-table.c74
-rw-r--r--widgets/e-table/test-check.c4
-rw-r--r--widgets/e-table/test-cols.c4
-rw-r--r--widgets/e-table/test-table.c4
-rw-r--r--widgets/table/e-cell-text.c1
-rw-r--r--widgets/table/e-cell-text.h1
-rw-r--r--widgets/table/e-table-col.c22
-rw-r--r--widgets/table/e-table-col.h9
-rw-r--r--widgets/table/e-table-defines.h3
-rw-r--r--widgets/table/e-table-example-1.c2
-rw-r--r--widgets/table/e-table-example-2.c4
-rw-r--r--widgets/table/e-table-group-container.c385
-rw-r--r--widgets/table/e-table-group-container.h4
-rw-r--r--widgets/table/e-table-group-leaf.c130
-rw-r--r--widgets/table/e-table-group-leaf.h4
-rw-r--r--widgets/table/e-table-group.c79
-rw-r--r--widgets/table/e-table-group.h4
-rw-r--r--widgets/table/e-table-header-item.c58
-rw-r--r--widgets/table/e-table-header-item.h1
-rw-r--r--widgets/table/e-table-header.c393
-rw-r--r--widgets/table/e-table-header.h34
-rw-r--r--widgets/table/e-table-item.c104
-rw-r--r--widgets/table/e-table-item.h3
-rw-r--r--widgets/table/e-table-size-test.c2
-rw-r--r--widgets/table/e-table.c74
-rw-r--r--widgets/table/test-check.c4
-rw-r--r--widgets/table/test-cols.c4
-rw-r--r--widgets/table/test-table.c4
79 files changed, 3952 insertions, 2478 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 969ae0ace3..79c0e9da41 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,40 @@
+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.
+
2000-05-12 Miguel de Icaza <miguel@gnu.org>
* contact-editor/fulname.glade: Use accelerators here.
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. */
diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am
index 3998e4fccb..5133ffa30f 100644
--- a/addressbook/contact-editor/Makefile.am
+++ b/addressbook/contact-editor/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/ \
-I$(top_srcdir)/addressbook/backend \
+ -I$(top_srcdir)/widgets/e-table \
-DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DG_LOG_DOMAIN=\"contact-editor\"
@@ -20,6 +21,8 @@ noinst_LIBRARIES = \
libecontacteditor.a
libecontacteditor_a_SOURCES = \
+ e-contact-editor-categories.c \
+ e-contact-editor-categories.h \
e-contact-editor-fullname.c \
e-contact-editor-fullname.h \
e-contact-editor.c \
@@ -39,14 +42,19 @@ contact_editor_test_LDADD = \
-lbonobo \
$(top_builddir)/e-util/libeutil.la \
libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/e-text/libetext.a \
$(EXTRA_GNOME_LIBS)
gladedir = $(datadir)/evolution/glade
glade_DATA = \
contact-editor.glade \
- fullname.glade
+ fullname.glade \
+ categories.glade
EXTRA_DIST = $(glade_DATA) \
e-contact-editor-strings.h \
- fullname-strings.h
+ fullname-strings.h \
+ categories-strings.h
diff --git a/addressbook/contact-editor/categories-strings.h b/addressbook/contact-editor/categories-strings.h
new file mode 100644
index 0000000000..813018a00e
--- /dev/null
+++ b/addressbook/contact-editor/categories-strings.h
@@ -0,0 +1,9 @@
+/*
+ * Translatable strings file generated by Glade.
+ * Add this file to your project's POTFILES.in.
+ * DO NOT compile it as part of your application.
+ */
+
+gchar *s = N_("categories");
+gchar *s = N_("Item(s) belong to these categories:");
+gchar *s = N_("Available Categories:");
diff --git a/addressbook/contact-editor/categories.glade b/addressbook/contact-editor/categories.glade
new file mode 100644
index 0000000000..bf78008940
--- /dev/null
+++ b/addressbook/contact-editor/categories.glade
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>categories</name>
+ <program_name>categories</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>False</gettext_support>
+ <use_widget_names>False</use_widget_names>
+ <output_main_file>False</output_main_file>
+ <output_support_files>False</output_support_files>
+ <output_build_files>False</output_build_files>
+ <backup_source_files>False</backup_source_files>
+ <main_source_file>interface.c</main_source_file>
+ <main_header_file>interface.h</main_header_file>
+ <handler_source_file>callbacks.c</handler_source_file>
+ <handler_header_file>callbacks.h</handler_header_file>
+ <support_source_file>support.c</support_source_file>
+ <support_header_file>support.h</support_header_file>
+ <output_translatable_strings>True</output_translatable_strings>
+ <translatable_strings_file>categories-strings.h</translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <visible>False</visible>
+ <title>categories</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <rows>4</rows>
+ <columns>1</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>0</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Item(s) belong to these categories:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Available Categories:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade
index 976508d41c..a450743ff8 100644
--- a/addressbook/contact-editor/contact-editor.glade
+++ b/addressbook/contact-editor/contact-editor.glade
@@ -56,7 +56,7 @@
<name>table-contact-editor-general</name>
<border_width>7</border_width>
<cxx_use_heap>True</cxx_use_heap>
- <rows>11</rows>
+ <rows>13</rows>
<columns>8</columns>
<homogeneous>False</homogeneous>
<row_spacing>4</row_spacing>
@@ -163,114 +163,6 @@
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label-phone3</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Business Fax</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone2</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Home</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Business</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone4</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Mobile</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkText</class>
<name>text-address</name>
<width>1</width>
@@ -296,38 +188,11 @@
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label-email1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Primary Email</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkButton</class>
<name>button-fullname</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
- <label> Full Name...</label>
+ <label>_Full Name...</label>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
@@ -346,33 +211,6 @@
<widget>
<class>GtkAccelLabel</class>
- <name>accellabel-jobtitle</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Job Title:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAccelLabel</class>
<name>accellabel-company</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Company:</label>
@@ -454,40 +292,6 @@
<widget>
<class>GtkAlignment</class>
- <name>alignment2</name>
- <cxx_use_heap>True</cxx_use_heap>
- <xalign>0</xalign>
- <yalign>0</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>9</top_attach>
- <bottom_attach>10</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>GtkCheckButton</class>
- <name>checkbutton-mailingaddress</name>
- <cxx_use_heap>True</cxx_use_heap>
- <visible>False</visible>
- <label>This is the mailing address</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
<name>alignment3</name>
<cxx_use_heap>True</cxx_use_heap>
<xalign>1</xalign>
@@ -880,60 +684,6 @@
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox5</name>
- <cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>8</right_attach>
- <top_attach>10</top_attach>
- <bottom_attach>11</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkText</class>
- <name>text-comments</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkVScrollbar</class>
- <name>vscrollbar-comments</name>
- <cxx_use_heap>True</cxx_use_heap>
- <policy>GTK_UPDATE_CONTINUOUS</policy>
- <value>0</value>
- <lower>0</lower>
- <upper>0</upper>
- <step>0</step>
- <page>0</page>
- <page_size>0</page_size>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
<class>GtkAlignment</class>
<name>alignment10</name>
<cxx_use_heap>True</cxx_use_heap>
@@ -960,27 +710,217 @@
<class>GtkCheckButton</class>
<name>checkbutton-htmlmail</name>
<cxx_use_heap>True</cxx_use_heap>
- <visible>False</visible>
- <label>Wants HTML mail</label>
+ <label>Wants _HTML mail</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
</widget>
</widget>
<widget>
+ <class>GtkAlignment</class>
+ <name>alignment4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>0</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>6</left_attach>
+ <right_attach>7</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button-address1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
<class>GtkLabel</class>
- <name>label-address1</name>
+ <name>address-label</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Business</label>
+ <label>Address:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>text-address</focus_target>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>7</right_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox1</name>
+ <cxx_use_heap>True</cxx_use_heap>
<child>
<left_attach>5</left_attach>
<right_attach>6</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Business</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone1</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Home</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone2</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Business _Fax</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone3</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Mobile</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone4</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox5</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
@@ -992,21 +932,142 @@
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-email1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Primary Email</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-email1</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox-business</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-address1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Business</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>text-address</focus_target>
+ </widget>
</widget>
<widget>
<class>GtkAlignment</class>
- <name>alignment4</name>
+ <name>alignment2</name>
<cxx_use_heap>True</cxx_use_heap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
+ <xalign>0</xalign>
+ <yalign>0</yalign>
<xscale>0</xscale>
<yscale>0</yscale>
<child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
+ <left_attach>7</left_attach>
+ <right_attach>8</right_attach>
+ <top_attach>9</top_attach>
+ <bottom_attach>10</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>GtkCheckButton</class>
+ <name>checkbutton-mailingaddress</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>This is the _mailing address</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator9</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>11</top_attach>
+ <bottom_attach>12</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>2</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator10</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>4</left_attach>
+ <right_attach>8</right_attach>
+ <top_attach>11</top_attach>
+ <bottom_attach>12</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>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment12</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>12</top_attach>
+ <bottom_attach>13</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -1019,31 +1080,124 @@
<widget>
<class>GtkButton</class>
- <name>button-address1</name>
+ <name>button-contacts</name>
<cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <label>_Contacts...</label>
+ </widget>
+ </widget>
- <widget>
- <class>Placeholder</class>
- </widget>
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment15</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>7</left_attach>
+ <right_attach>8</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-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <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>GtkLabel</class>
- <name>address-label</name>
+ <class>GtkAlignment</class>
+ <name>alignment14</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Address:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
+ <xalign>0.5</xalign>
<yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <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>
+ <cxx_use_heap>True</cxx_use_heap>
+ <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>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
<child>
<left_attach>5</left_attach>
<right_attach>7</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
+ <top_attach>12</top_attach>
+ <bottom_attach>13</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <label>Ca_tegories...</label>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox7</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -1053,6 +1207,19 @@
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel-jobtitle</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Job Title</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
</widget>
</widget>
@@ -1193,7 +1360,7 @@
<class>GtkLabel</class>
<name>label25</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Spouse's name:</label>
+ <label>Spouse:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
@@ -1218,33 +1385,6 @@
<widget>
<class>GtkLabel</class>
- <name>label28</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Address:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
<name>label31</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Birthday:</label>
@@ -1301,7 +1441,7 @@
<class>GtkLabel</class>
<name>label29</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Manager's name:</label>
+ <label>Manager's Name:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
@@ -1477,31 +1617,6 @@
</widget>
<widget>
- <class>GtkEntry</class>
- <name>entry-fburl</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>6</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GnomeDateEdit</class>
<name>dateedit-anniversary</name>
<cxx_use_heap>True</cxx_use_heap>
@@ -1602,68 +1717,119 @@
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox7</name>
+ <class>GtkHSeparator</class>
+ <name>hseparator7</name>
<cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
<child>
<left_attach>0</left_attach>
<right_attach>6</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>2</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label33</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Notes:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>7</top_attach>
+ <bottom_attach>8</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox5</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>8</top_attach>
+ <bottom_attach>9</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
<widget>
- <class>GtkLabel</class>
- <name>label33</name>
+ <class>GtkText</class>
+ <name>text-comments</name>
+ <height>50</height>
<cxx_use_heap>True</cxx_use_heap>
- <label>Internet Free-Busy</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>2</ypad>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text></text>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkHSeparator</class>
- <name>hseparator8</name>
+ <class>GtkVScrollbar</class>
+ <name>vscrollbar-comments</name>
<cxx_use_heap>True</cxx_use_heap>
+ <policy>GTK_UPDATE_CONTINUOUS</policy>
+ <value>0</value>
+ <lower>0</lower>
+ <upper>0</upper>
+ <step>0</step>
+ <page>0</page>
+ <page_size>0</page_size>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkHSeparator</class>
- <name>hseparator7</name>
+ <name>hseparator8</name>
<cxx_use_heap>True</cxx_use_heap>
<child>
<left_attach>0</left_attach>
<right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
<xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>False</xexpand>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
diff --git a/addressbook/contact-editor/e-contact-editor-categories.c b/addressbook/contact-editor/e-contact-editor-categories.c
new file mode 100644
index 0000000000..14b10d21c8
--- /dev/null
+++ b/addressbook/contact-editor/e-contact-editor-categories.c
@@ -0,0 +1,435 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * e-contact-editor-categories.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <e-contact-editor-categories.h>
+#include <e-table.h>
+#include <e-table-simple.h>
+#include <e-cell-text.h>
+#include <e-cell-checkbox.h>
+
+static void e_contact_editor_categories_init (EContactEditorCategories *card);
+static void e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass);
+static void e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_contact_editor_categories_destroy (GtkObject *object);
+static int e_contact_editor_categories_col_count (ETableModel *etc, gpointer data);
+static int e_contact_editor_categories_row_count (ETableModel *etc, gpointer data);
+static void *e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data);
+static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data);
+static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data);
+static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data);
+static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data);
+static void e_contact_editor_categories_thaw (ETableModel *etc, gpointer data);
+
+static GnomeDialogClass *parent_class = NULL;
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_CATEGORIES
+};
+
+GtkType
+e_contact_editor_categories_get_type (void)
+{
+ static GtkType contact_editor_categories_type = 0;
+
+ if (!contact_editor_categories_type)
+ {
+ static const GtkTypeInfo contact_editor_categories_info =
+ {
+ "EContactEditorCategories",
+ sizeof (EContactEditorCategories),
+ sizeof (EContactEditorCategoriesClass),
+ (GtkClassInitFunc) e_contact_editor_categories_class_init,
+ (GtkObjectInitFunc) e_contact_editor_categories_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ contact_editor_categories_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_categories_info);
+ }
+
+ return contact_editor_categories_type;
+}
+
+static void
+e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass)
+{
+ GtkObjectClass *object_class;
+ GnomeDialogClass *dialog_class;
+
+ object_class = (GtkObjectClass*) klass;
+ dialog_class = (GnomeDialogClass *) klass;
+
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
+
+ gtk_object_add_arg_type ("EContactEditorCategories::categories", GTK_TYPE_STRING,
+ GTK_ARG_READWRITE, ARG_CATEGORIES);
+
+ object_class->set_arg = e_contact_editor_categories_set_arg;
+ object_class->get_arg = e_contact_editor_categories_get_arg;
+ object_class->destroy = e_contact_editor_categories_destroy;
+}
+
+gchar *builtin_categories[] = {
+ "Business",
+ "Competition",
+ "Favorites",
+ "Gifts",
+ "Goals/Objectives",
+ "Holiday",
+ "Holiday Cards",
+ "Hot Contacts",
+ "Ideas",
+ "International",
+ "Key Customer",
+ "Miscellaneous",
+ "Personal",
+ "Phone Calls",
+ "Status",
+ "Strategies",
+ "Suppliers",
+ "Time & Expenses",
+ "VIP",
+ "Waiting",
+};
+
+#define BUILTIN_CATEGORY_COUNT (sizeof(builtin_categories) / sizeof(builtin_categories[0]))
+
+static void
+add_list_unique(EContactEditorCategories *categories, char *string)
+{
+ int k;
+ char *temp = e_strdup_strip(string);
+ char **list = categories->category_list;
+
+ if (!*temp) {
+ g_free(temp);
+ return;
+ }
+ for (k = 0; k < categories->list_length; k++) {
+ if (!strcmp(list[k], temp)) {
+ categories->selected_list[k] = TRUE;
+ g_free(temp);
+ break;
+ }
+ }
+ if (k == categories->list_length) {
+ categories->selected_list[categories->list_length] = TRUE;
+ list[categories->list_length++] = temp;
+ }
+}
+
+static void
+do_parse_categories(EContactEditorCategories *categories)
+{
+ char *str = categories->categories;
+ int length = strlen(str);
+ char *copy = g_new(char, length + 1);
+ int i, j;
+ char **list;
+ int count = 1;
+ for (i = 0; str[i]; i++) {
+ switch (str[i]) {
+ case '\\':
+ i++;
+ if (!str[i])
+ i--;
+ break;
+ case ',':
+ count ++;
+ break;
+ }
+ }
+
+ for (i = 0; i < categories->list_length; i++)
+ g_free(categories->category_list[i]);
+ g_free(categories->category_list);
+ list = g_new(char *, count + 1 + BUILTIN_CATEGORY_COUNT);
+ categories->category_list = list;
+
+ g_free(categories->selected_list);
+ categories->selected_list = g_new(gboolean, count + 1 + BUILTIN_CATEGORY_COUNT);
+
+ for (count = 0; count < BUILTIN_CATEGORY_COUNT; count++) {
+ list[count] = g_strdup(builtin_categories[count]);
+ categories->selected_list[count] = 0;
+ }
+ categories->list_length = count;
+
+ 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(categories, copy);
+ j = -1;
+ break;
+ default:
+ copy[j] = str[i];
+ break;
+ }
+ }
+ copy[j] = 0;
+ add_list_unique(categories, copy);
+ g_free(copy);
+ e_table_model_changed(categories->model);
+}
+
+static void
+e_contact_editor_categories_entry_change (GtkWidget *entry,
+ EContactEditorCategories *categories)
+{
+ if (categories->categories)
+ g_free(categories->categories);
+ categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+ do_parse_categories(categories);
+}
+
+
+#define INITIAL_SPEC "<ETableSpecification no-header=\"1\"> \
+ <columns-shown> \
+ <column> 0 </column> \
+ <column> 1 </column> \
+ </columns-shown> \
+ <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \
+</ETableSpecification>"
+
+static void
+e_contact_editor_categories_init (EContactEditorCategories *categories)
+{
+ GladeXML *gui;
+ GtkWidget *table;
+ ECell *cell_left_just;
+ ECell *cell_checkbox;
+ ETableHeader *header;
+ ETableCol *col;
+ GtkWidget *e_table;
+
+ categories->list_length = 0;
+ categories->category_list = NULL;
+ categories->selected_list = NULL;
+
+ gnome_dialog_append_button ( GNOME_DIALOG(categories),
+ GNOME_STOCK_BUTTON_OK);
+
+ gnome_dialog_append_button ( GNOME_DIALOG(categories),
+ GNOME_STOCK_BUTTON_CANCEL);
+
+ gtk_window_set_policy(GTK_WINDOW(categories), TRUE, TRUE, FALSE);
+
+ categories->categories = NULL;
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/categories.glade", NULL);
+ categories->gui = gui;
+
+ table = glade_xml_get_widget(gui, "table-categories");
+ gtk_widget_ref(table);
+ gtk_container_remove(GTK_CONTAINER(table->parent), table);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (categories)->vbox), table, TRUE, TRUE, 0);
+ gtk_widget_unref(table);
+
+ categories->entry = glade_xml_get_widget(gui, "entry-categories");
+
+ gtk_signal_connect(GTK_OBJECT(categories->entry), "changed",
+ GTK_SIGNAL_FUNC(e_contact_editor_categories_entry_change), categories);
+
+ categories->model = e_table_simple_new(e_contact_editor_categories_col_count,
+ e_contact_editor_categories_row_count,
+ e_contact_editor_categories_value_at,
+ e_contact_editor_categories_set_value_at,
+ e_contact_editor_categories_is_cell_editable,
+ e_contact_editor_categories_duplicate_value,
+ e_contact_editor_categories_free_value,
+ e_contact_editor_categories_thaw,
+ categories);
+
+ header = e_table_header_new();
+
+ cell_checkbox = e_cell_checkbox_new();
+ col = e_table_col_new (0, "",
+ 0, 20, cell_checkbox,
+ g_int_compare, TRUE);
+ e_table_header_add_column (header, col, 0);
+
+ cell_left_just = e_cell_text_new (categories->model, NULL, GTK_JUSTIFY_LEFT);
+ col = e_table_col_new (1, "Category",
+ 1.0, 20, cell_left_just,
+ g_str_compare, TRUE);
+ e_table_header_add_column (header, col, 1);
+
+ e_table = e_table_new (header, categories->model, INITIAL_SPEC);
+
+ gtk_widget_show(e_table);
+
+ gtk_table_attach_defaults(GTK_TABLE(table),
+ e_table,
+ 0, 1,
+ 3, 4);
+}
+
+void
+e_contact_editor_categories_destroy (GtkObject *object)
+{
+ EContactEditorCategories *e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES(object);
+
+ if (e_contact_editor_categories->gui)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor_categories->gui));
+ g_free(e_contact_editor_categories->categories);
+}
+
+GtkWidget*
+e_contact_editor_categories_new (char *categories)
+{
+ GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_categories_get_type ()));
+ gtk_object_set (GTK_OBJECT(widget),
+ "categories", categories,
+ NULL);
+ return widget;
+}
+
+static void
+e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+{
+ EContactEditorCategories *e_contact_editor_categories;
+
+ e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (o);
+
+ switch (arg_id){
+ case ARG_CATEGORIES:
+ gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
+ break;
+ }
+}
+
+static void
+e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ EContactEditorCategories *e_contact_editor_categories;
+
+ e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (object);
+
+ switch (arg_id) {
+ case ARG_CATEGORIES:
+ GTK_VALUE_STRING (*arg) = g_strdup(e_contact_editor_categories->categories);
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+/* This function returns the number of columns in our ETableModel. */
+static int
+e_contact_editor_categories_col_count (ETableModel *etc, gpointer data)
+{
+ return 2;
+}
+
+/* This function returns the number of rows in our ETableModel. */
+static int
+e_contact_editor_categories_row_count (ETableModel *etc, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ return categories->list_length;
+}
+
+/* This function returns the value at a particular point in our ETableModel. */
+static void *
+e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ if (col == 0)
+ return (void *) categories->selected_list[row];
+ else
+ return categories->category_list[row];
+}
+
+/* This function sets the value at a particular point in our ETableModel. */
+static void
+e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ if ( col == 0 ) {
+ char **strs;
+ int i, j;
+ char *string;
+ categories->selected_list[row] = (gboolean) val;
+ strs = g_new(char *, categories->list_length + 1);
+ for (i = 0, j = 0; i < categories->list_length; i++) {
+ if (categories->selected_list[i])
+ strs[j++] = categories->category_list[i];
+ }
+ strs[j] = 0;
+ string = g_strjoinv(", ", strs);
+ gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
+ g_free(string);
+ g_free(strs);
+ }
+ if ( col == 1 )
+ return;
+}
+
+/* This function returns whether a particular cell is editable. */
+static gboolean
+e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data)
+{
+ return col == 0;
+}
+
+/* This function duplicates the value passed to it. */
+static void *
+e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data)
+{
+ if (col == 0)
+ return (void *)value;
+ else
+ return g_strdup(value);
+}
+
+/* This function frees the value passed to it. */
+static void
+e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data)
+{
+ if (col == 0)
+ return;
+ else
+ g_free(value);
+}
+
+/* This function is for when the model is unfrozen. This can mostly
+ be ignored for simple models. */
+static void
+e_contact_editor_categories_thaw (ETableModel *etc, gpointer data)
+{
+ e_table_model_changed(etc);
+}
+
diff --git a/addressbook/contact-editor/e-contact-editor-categories.h b/addressbook/contact-editor/e-contact-editor-categories.h
new file mode 100644
index 0000000000..529ef71b68
--- /dev/null
+++ b/addressbook/contact-editor/e-contact-editor-categories.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-contact-editor-categories.h
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __E_CONTACT_EDITOR_CATEGORIES_H__
+#define __E_CONTACT_EDITOR_CATEGORIES_H__
+
+#include <gnome.h>
+#include <glade/glade.h>
+#include <ebook/e-card.h>
+#include <widgets/e-table/e-table-model.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+/* EContactEditorCategories - A dialog displaying information about a contact.
+ *
+ * The following arguments are available:
+ *
+ * name type read/write description
+ * --------------------------------------------------------------------------------
+ * name ECardName * RW The card currently being edited. Returns a copy.
+ */
+
+#define E_CONTACT_EDITOR_CATEGORIES_TYPE (e_contact_editor_categories_get_type ())
+#define E_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategories))
+#define E_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategoriesClass))
+#define E_IS_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE))
+#define E_IS_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE))
+
+
+typedef struct _EContactEditorCategories EContactEditorCategories;
+typedef struct _EContactEditorCategoriesClass EContactEditorCategoriesClass;
+
+struct _EContactEditorCategories
+{
+ GnomeDialog parent;
+
+ /* item specific fields */
+ char *categories;
+ GtkWidget *entry;
+ ETableModel *model;
+
+ int list_length;
+ char **category_list;
+ gboolean *selected_list;
+
+ GladeXML *gui;
+};
+
+struct _EContactEditorCategoriesClass
+{
+ GnomeDialogClass parent_class;
+};
+
+
+GtkWidget *e_contact_editor_categories_new(char *categories);
+GtkType e_contact_editor_categories_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __E_CONTACT_EDITOR_CATEGORIES_H__ */
diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h
index 07aff370ad..b718d53500 100644
--- a/addressbook/contact-editor/e-contact-editor-strings.h
+++ b/addressbook/contact-editor/e-contact-editor-strings.h
@@ -5,32 +5,33 @@
*/
gchar *s = N_("Contact Editor");
-gchar *s = N_("Business Fax");
-gchar *s = N_("Home");
-gchar *s = N_("Business");
-gchar *s = N_("Mobile");
-gchar *s = N_("Primary Email");
-gchar *s = N_("\tFull Name...");
-gchar *s = N_("Job Title:");
+gchar *s = N_("_Full Name...");
gchar *s = N_("Company:");
gchar *s = N_("File As:");
gchar *s = N_("Web page address:");
-gchar *s = N_("This is the mailing address");
-gchar *s = N_("Wants HTML mail");
-gchar *s = N_("Business");
+gchar *s = N_("Wants _HTML mail");
gchar *s = N_("Address:");
+gchar *s = N_("_Business");
+gchar *s = N_("_Home");
+gchar *s = N_("Business _Fax");
+gchar *s = N_("_Mobile");
+gchar *s = N_("Primary Email");
+gchar *s = N_("Business");
+gchar *s = N_("This is the _mailing address");
+gchar *s = N_("_Contacts...");
+gchar *s = N_("Ca_tegories...");
+gchar *s = N_("Job Title");
gchar *s = N_("General");
gchar *s = N_("Department:");
gchar *s = N_("Office:");
gchar *s = N_("Profession:");
gchar *s = N_("Nickname:");
-gchar *s = N_("Spouse's name:");
-gchar *s = N_("Address:");
+gchar *s = N_("Spouse:");
gchar *s = N_("Birthday:");
gchar *s = N_("Assistant's name:");
-gchar *s = N_("Manager's name:");
+gchar *s = N_("Manager's Name:");
gchar *s = N_("Anniversary:");
-gchar *s = N_("Internet Free-Busy");
+gchar *s = N_("Notes:");
gchar *s = N_("Details");
gchar *s = N_("Add");
gchar *s = N_("Delete");
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index 58f6af1475..e898b6eedd 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -24,6 +24,7 @@
#include <gnome.h>
#include "e-contact-editor.h"
#include <e-contact-editor-fullname.h>
+#include <e-contact-editor-categories.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
@@ -159,6 +160,8 @@ _add_images(GtkTable *table)
_add_image(table, EVOLUTION_IMAGES "/globe.png",
0, 1, 8, 10);
_add_image(table, EVOLUTION_IMAGES "/house.png", 4, 5, 5, 10);
+ _add_image(table, EVOLUTION_IMAGES "/evolution-contacts.png", 0, 1, 12, 14);
+ _add_image(table, EVOLUTION_IMAGES "/briefcase.png", 4, 5, 12, 14);
}
static void
@@ -166,7 +169,7 @@ _add_details_images(GtkTable *table)
{
_add_image(table, EVOLUTION_IMAGES "/briefcase.png", 0, 1, 0, 2);
_add_image(table, EVOLUTION_IMAGES "/malehead.png", 0, 1, 4, 6);
- _add_image(table, EVOLUTION_IMAGES "/globe.png", 0, 1, 7, 9);
+ _add_image(table, EVOLUTION_IMAGES "/globe.png", 0, 1, 8, 10);
}
static void
@@ -456,7 +459,6 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name));
int result;
gtk_widget_show(GTK_WIDGET(dialog));
- gnome_dialog_close_hides (dialog, TRUE);
result = gnome_dialog_run_and_close (dialog);
if (result == 0) {
ECardName *name;
@@ -474,6 +476,27 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
}
static void
+categories_clicked(GtkWidget *button, EContactEditor *editor)
+{
+ char *categories;
+ GnomeDialog *dialog;
+ int result;
+ GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-categories"));
+ categories = gtk_entry_get_text(entry);
+ dialog = GNOME_DIALOG(e_contact_editor_categories_new(categories));
+ gtk_widget_show(GTK_WIDGET(dialog));
+ result = gnome_dialog_run (dialog);
+ if (result == 0) {
+ gtk_object_get(GTK_OBJECT(dialog),
+ "categories", &categories,
+ NULL);
+ gtk_entry_set_text(entry, categories);
+ g_free(categories);
+ }
+ gtk_object_destroy(GTK_OBJECT(dialog));
+}
+
+static void
e_contact_editor_init (EContactEditor *e_contact_editor)
{
GladeXML *gui;
@@ -493,6 +516,9 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_signal_connect(GTK_OBJECT(glade_xml_get_widget(e_contact_editor->gui, "button-fullname")), "clicked",
full_name_clicked, e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(glade_xml_get_widget(e_contact_editor->gui, "button-categories")), "clicked",
+ categories_clicked, e_contact_editor);
+
gtk_object_get(GTK_OBJECT(glade_xml_get_widget(gui, "text-comments")),
"vadjustment", &adjustment,
NULL);
@@ -739,7 +765,7 @@ e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *la
GtkWidget *dialog = gnome_dialog_new(title,
NULL);
-
+
gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
gtk_widget_new (gtk_frame_get_type(),
"border_width", 4,
@@ -1022,9 +1048,9 @@ fill_in_info(EContactEditor *editor)
char *nickname;
char *spouse;
const ECardDate *anniversary;
- char *fburl;
char *note;
const ECardDate *bday;
+ char *categories;
GtkEditable *editable;
int position = 0;
@@ -1043,9 +1069,9 @@ fill_in_info(EContactEditor *editor)
"nickname", &nickname,
"spouse", &spouse,
"anniversary", &anniversary,
- "fburl", &fburl,
"note", &note,
"birth_date", &bday,
+ "categories", &categories,
NULL);
position = 0;
@@ -1121,12 +1147,6 @@ fill_in_info(EContactEditor *editor)
}
position = 0;
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-fburl"));
- gtk_editable_delete_text(editable, 0, -1);
- if (fburl)
- gtk_editable_insert_text(editable, fburl, strlen(fburl), &position);
-
- position = 0;
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-profession"));
gtk_editable_delete_text(editable, 0, -1);
if (role)
@@ -1149,6 +1169,12 @@ fill_in_info(EContactEditor *editor)
dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday"));
gnome_date_edit_set_time(dateedit, time_val);
}
+
+ position = 0;
+ editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-categories"));
+ gtk_editable_delete_text(editable, 0, -1);
+ if (categories)
+ gtk_editable_insert_text(editable, categories, strlen(categories), &position);
/* File as has to come after company and name or else it'll get messed up when setting them. */
position = 0;
@@ -1179,8 +1205,8 @@ extract_info(EContactEditor *editor)
char *nickname;
char *spouse;
ECardDate *anniversary;
- char *fburl;
char *note;
+ char *categories;
ECardDate *bday;
GtkEditable *editable;
GnomeDateEdit *dateedit;
@@ -1351,18 +1377,6 @@ extract_info(EContactEditor *editor)
"anniversary", anniversary,
NULL);
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-fburl"));
- fburl = gtk_editable_get_chars(editable, 0, -1);
- if (fburl && *fburl)
- gtk_object_set(GTK_OBJECT(card),
- "fburl", fburl,
- NULL);
- else
- gtk_object_set(GTK_OBJECT(card),
- "fburl", NULL,
- NULL);
- g_free(fburl);
-
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-comments"));
note = gtk_editable_get_chars(editable, 0, -1);
if (note && *note)
@@ -1375,6 +1389,18 @@ extract_info(EContactEditor *editor)
NULL);
g_free(note);
+ editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-categories"));
+ categories = gtk_editable_get_chars(editable, 0, -1);
+ if (categories && *categories)
+ gtk_object_set(GTK_OBJECT(card),
+ "categories", categories,
+ NULL);
+ else
+ gtk_object_set(GTK_OBJECT(card),
+ "categories", NULL,
+ NULL);
+ g_free(categories);
+
dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday"));
time_val = gnome_date_edit_get_date(dateedit);
gmtime_r(&time_val,
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 69a834722b..9df1ad065d 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -35,13 +35,13 @@ evolution_addressbook_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_HTML_GNOME_LIBS) \
$(top_builddir)/addressbook/gui/minicard/libeminicard.a \
- $(top_builddir)/widgets/e-text/libetext.a \
- $(top_builddir)/widgets/e-table/libetable.a \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
- $(top_builddir)/libversit/libversit.la
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/widgets/e-text/libetext.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la
evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf`
@@ -72,3 +72,4 @@ evolution-addressbook.pure: evolution-addressbook
endif
+
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 1807213798..5830eb95f8 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -101,6 +101,8 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
GtkObject *object;
GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
+
if (view->view)
object = GTK_OBJECT(view->view);
else
@@ -113,7 +115,8 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
contact_editor, TRUE, TRUE, 0);
- gtk_widget_show_all (dlg);
+ gtk_widget_show (contact_editor);
+ gtk_widget_show (dlg);
gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE);
result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
@@ -731,7 +734,7 @@ create_table_view (AddressbookView *view, char *initial_query)
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, e_card_simple_get_name(view->simple, i+1),
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am
index 3998e4fccb..5133ffa30f 100644
--- a/addressbook/gui/contact-editor/Makefile.am
+++ b/addressbook/gui/contact-editor/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/ \
-I$(top_srcdir)/addressbook/backend \
+ -I$(top_srcdir)/widgets/e-table \
-DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DG_LOG_DOMAIN=\"contact-editor\"
@@ -20,6 +21,8 @@ noinst_LIBRARIES = \
libecontacteditor.a
libecontacteditor_a_SOURCES = \
+ e-contact-editor-categories.c \
+ e-contact-editor-categories.h \
e-contact-editor-fullname.c \
e-contact-editor-fullname.h \
e-contact-editor.c \
@@ -39,14 +42,19 @@ contact_editor_test_LDADD = \
-lbonobo \
$(top_builddir)/e-util/libeutil.la \
libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/e-text/libetext.a \
$(EXTRA_GNOME_LIBS)
gladedir = $(datadir)/evolution/glade
glade_DATA = \
contact-editor.glade \
- fullname.glade
+ fullname.glade \
+ categories.glade
EXTRA_DIST = $(glade_DATA) \
e-contact-editor-strings.h \
- fullname-strings.h
+ fullname-strings.h \
+ categories-strings.h
diff --git a/addressbook/gui/contact-editor/categories-strings.h b/addressbook/gui/contact-editor/categories-strings.h
new file mode 100644
index 0000000000..813018a00e
--- /dev/null
+++ b/addressbook/gui/contact-editor/categories-strings.h
@@ -0,0 +1,9 @@
+/*
+ * Translatable strings file generated by Glade.
+ * Add this file to your project's POTFILES.in.
+ * DO NOT compile it as part of your application.
+ */
+
+gchar *s = N_("categories");
+gchar *s = N_("Item(s) belong to these categories:");
+gchar *s = N_("Available Categories:");
diff --git a/addressbook/gui/contact-editor/categories.glade b/addressbook/gui/contact-editor/categories.glade
new file mode 100644
index 0000000000..bf78008940
--- /dev/null
+++ b/addressbook/gui/contact-editor/categories.glade
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>categories</name>
+ <program_name>categories</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>False</gettext_support>
+ <use_widget_names>False</use_widget_names>
+ <output_main_file>False</output_main_file>
+ <output_support_files>False</output_support_files>
+ <output_build_files>False</output_build_files>
+ <backup_source_files>False</backup_source_files>
+ <main_source_file>interface.c</main_source_file>
+ <main_header_file>interface.h</main_header_file>
+ <handler_source_file>callbacks.c</handler_source_file>
+ <handler_header_file>callbacks.h</handler_header_file>
+ <support_source_file>support.c</support_source_file>
+ <support_header_file>support.h</support_header_file>
+ <output_translatable_strings>True</output_translatable_strings>
+ <translatable_strings_file>categories-strings.h</translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <visible>False</visible>
+ <title>categories</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <rows>4</rows>
+ <columns>1</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>0</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Item(s) belong to these categories:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Available Categories:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index 976508d41c..a450743ff8 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -56,7 +56,7 @@
<name>table-contact-editor-general</name>
<border_width>7</border_width>
<cxx_use_heap>True</cxx_use_heap>
- <rows>11</rows>
+ <rows>13</rows>
<columns>8</columns>
<homogeneous>False</homogeneous>
<row_spacing>4</row_spacing>
@@ -163,114 +163,6 @@
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label-phone3</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Business Fax</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone2</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Home</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Business</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone4</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Mobile</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkText</class>
<name>text-address</name>
<width>1</width>
@@ -296,38 +188,11 @@
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label-email1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Primary Email</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkButton</class>
<name>button-fullname</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
- <label> Full Name...</label>
+ <label>_Full Name...</label>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
@@ -346,33 +211,6 @@
<widget>
<class>GtkAccelLabel</class>
- <name>accellabel-jobtitle</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Job Title:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAccelLabel</class>
<name>accellabel-company</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Company:</label>
@@ -454,40 +292,6 @@
<widget>
<class>GtkAlignment</class>
- <name>alignment2</name>
- <cxx_use_heap>True</cxx_use_heap>
- <xalign>0</xalign>
- <yalign>0</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>9</top_attach>
- <bottom_attach>10</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>GtkCheckButton</class>
- <name>checkbutton-mailingaddress</name>
- <cxx_use_heap>True</cxx_use_heap>
- <visible>False</visible>
- <label>This is the mailing address</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
<name>alignment3</name>
<cxx_use_heap>True</cxx_use_heap>
<xalign>1</xalign>
@@ -880,60 +684,6 @@
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox5</name>
- <cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>8</right_attach>
- <top_attach>10</top_attach>
- <bottom_attach>11</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkText</class>
- <name>text-comments</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkVScrollbar</class>
- <name>vscrollbar-comments</name>
- <cxx_use_heap>True</cxx_use_heap>
- <policy>GTK_UPDATE_CONTINUOUS</policy>
- <value>0</value>
- <lower>0</lower>
- <upper>0</upper>
- <step>0</step>
- <page>0</page>
- <page_size>0</page_size>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
<class>GtkAlignment</class>
<name>alignment10</name>
<cxx_use_heap>True</cxx_use_heap>
@@ -960,27 +710,217 @@
<class>GtkCheckButton</class>
<name>checkbutton-htmlmail</name>
<cxx_use_heap>True</cxx_use_heap>
- <visible>False</visible>
- <label>Wants HTML mail</label>
+ <label>Wants _HTML mail</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
</widget>
</widget>
<widget>
+ <class>GtkAlignment</class>
+ <name>alignment4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>0</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>6</left_attach>
+ <right_attach>7</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button-address1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
<class>GtkLabel</class>
- <name>label-address1</name>
+ <name>address-label</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Business</label>
+ <label>Address:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>text-address</focus_target>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>7</right_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox1</name>
+ <cxx_use_heap>True</cxx_use_heap>
<child>
<left_attach>5</left_attach>
<right_attach>6</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Business</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone1</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone2</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Home</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone2</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone3</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Business _Fax</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone3</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-phone4</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>_Mobile</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-phone4</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox5</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
@@ -992,21 +932,142 @@
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-email1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Primary Email</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-email1</focus_target>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox-business</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>5</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-address1</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Business</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>text-address</focus_target>
+ </widget>
</widget>
<widget>
<class>GtkAlignment</class>
- <name>alignment4</name>
+ <name>alignment2</name>
<cxx_use_heap>True</cxx_use_heap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
+ <xalign>0</xalign>
+ <yalign>0</yalign>
<xscale>0</xscale>
<yscale>0</yscale>
<child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
+ <left_attach>7</left_attach>
+ <right_attach>8</right_attach>
+ <top_attach>9</top_attach>
+ <bottom_attach>10</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>GtkCheckButton</class>
+ <name>checkbutton-mailingaddress</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>This is the _mailing address</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator9</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>11</top_attach>
+ <bottom_attach>12</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>2</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator10</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>4</left_attach>
+ <right_attach>8</right_attach>
+ <top_attach>11</top_attach>
+ <bottom_attach>12</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>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment12</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>12</top_attach>
+ <bottom_attach>13</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -1019,31 +1080,124 @@
<widget>
<class>GtkButton</class>
- <name>button-address1</name>
+ <name>button-contacts</name>
<cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <label>_Contacts...</label>
+ </widget>
+ </widget>
- <widget>
- <class>Placeholder</class>
- </widget>
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment15</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>7</left_attach>
+ <right_attach>8</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-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <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>GtkLabel</class>
- <name>address-label</name>
+ <class>GtkAlignment</class>
+ <name>alignment14</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Address:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
+ <xalign>0.5</xalign>
<yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <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>
+ <cxx_use_heap>True</cxx_use_heap>
+ <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>
+ <cxx_use_heap>True</cxx_use_heap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>0</yscale>
<child>
<left_attach>5</left_attach>
<right_attach>7</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
+ <top_attach>12</top_attach>
+ <bottom_attach>13</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button-categories</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <can_focus>True</can_focus>
+ <label>Ca_tegories...</label>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEventBox</class>
+ <name>eventbox7</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -1053,6 +1207,19 @@
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkAccelLabel</class>
+ <name>accellabel-jobtitle</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Job Title</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
</widget>
</widget>
@@ -1193,7 +1360,7 @@
<class>GtkLabel</class>
<name>label25</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Spouse's name:</label>
+ <label>Spouse:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
@@ -1218,33 +1385,6 @@
<widget>
<class>GtkLabel</class>
- <name>label28</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Address:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
<name>label31</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Birthday:</label>
@@ -1301,7 +1441,7 @@
<class>GtkLabel</class>
<name>label29</name>
<cxx_use_heap>True</cxx_use_heap>
- <label>Manager's name:</label>
+ <label>Manager's Name:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
@@ -1477,31 +1617,6 @@
</widget>
<widget>
- <class>GtkEntry</class>
- <name>entry-fburl</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>6</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GnomeDateEdit</class>
<name>dateedit-anniversary</name>
<cxx_use_heap>True</cxx_use_heap>
@@ -1602,68 +1717,119 @@
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox7</name>
+ <class>GtkHSeparator</class>
+ <name>hseparator7</name>
<cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
<child>
<left_attach>0</left_attach>
<right_attach>6</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>2</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label33</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <label>Notes:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>7</top_attach>
+ <bottom_attach>8</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox5</name>
+ <cxx_use_heap>True</cxx_use_heap>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>6</right_attach>
+ <top_attach>8</top_attach>
+ <bottom_attach>9</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
<widget>
- <class>GtkLabel</class>
- <name>label33</name>
+ <class>GtkText</class>
+ <name>text-comments</name>
+ <height>50</height>
<cxx_use_heap>True</cxx_use_heap>
- <label>Internet Free-Busy</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>2</ypad>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text></text>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkHSeparator</class>
- <name>hseparator8</name>
+ <class>GtkVScrollbar</class>
+ <name>vscrollbar-comments</name>
<cxx_use_heap>True</cxx_use_heap>
+ <policy>GTK_UPDATE_CONTINUOUS</policy>
+ <value>0</value>
+ <lower>0</lower>
+ <upper>0</upper>
+ <step>0</step>
+ <page>0</page>
+ <page_size>0</page_size>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkHSeparator</class>
- <name>hseparator7</name>
+ <name>hseparator8</name>
<cxx_use_heap>True</cxx_use_heap>
<child>
<left_attach>0</left_attach>
<right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
<xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>False</xexpand>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c
new file mode 100644
index 0000000000..14b10d21c8
--- /dev/null
+++ b/addressbook/gui/contact-editor/e-contact-editor-categories.c
@@ -0,0 +1,435 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * e-contact-editor-categories.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <e-contact-editor-categories.h>
+#include <e-table.h>
+#include <e-table-simple.h>
+#include <e-cell-text.h>
+#include <e-cell-checkbox.h>
+
+static void e_contact_editor_categories_init (EContactEditorCategories *card);
+static void e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass);
+static void e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_contact_editor_categories_destroy (GtkObject *object);
+static int e_contact_editor_categories_col_count (ETableModel *etc, gpointer data);
+static int e_contact_editor_categories_row_count (ETableModel *etc, gpointer data);
+static void *e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data);
+static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data);
+static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data);
+static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data);
+static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data);
+static void e_contact_editor_categories_thaw (ETableModel *etc, gpointer data);
+
+static GnomeDialogClass *parent_class = NULL;
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_CATEGORIES
+};
+
+GtkType
+e_contact_editor_categories_get_type (void)
+{
+ static GtkType contact_editor_categories_type = 0;
+
+ if (!contact_editor_categories_type)
+ {
+ static const GtkTypeInfo contact_editor_categories_info =
+ {
+ "EContactEditorCategories",
+ sizeof (EContactEditorCategories),
+ sizeof (EContactEditorCategoriesClass),
+ (GtkClassInitFunc) e_contact_editor_categories_class_init,
+ (GtkObjectInitFunc) e_contact_editor_categories_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ contact_editor_categories_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_categories_info);
+ }
+
+ return contact_editor_categories_type;
+}
+
+static void
+e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass)
+{
+ GtkObjectClass *object_class;
+ GnomeDialogClass *dialog_class;
+
+ object_class = (GtkObjectClass*) klass;
+ dialog_class = (GnomeDialogClass *) klass;
+
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
+
+ gtk_object_add_arg_type ("EContactEditorCategories::categories", GTK_TYPE_STRING,
+ GTK_ARG_READWRITE, ARG_CATEGORIES);
+
+ object_class->set_arg = e_contact_editor_categories_set_arg;
+ object_class->get_arg = e_contact_editor_categories_get_arg;
+ object_class->destroy = e_contact_editor_categories_destroy;
+}
+
+gchar *builtin_categories[] = {
+ "Business",
+ "Competition",
+ "Favorites",
+ "Gifts",
+ "Goals/Objectives",
+ "Holiday",
+ "Holiday Cards",
+ "Hot Contacts",
+ "Ideas",
+ "International",
+ "Key Customer",
+ "Miscellaneous",
+ "Personal",
+ "Phone Calls",
+ "Status",
+ "Strategies",
+ "Suppliers",
+ "Time & Expenses",
+ "VIP",
+ "Waiting",
+};
+
+#define BUILTIN_CATEGORY_COUNT (sizeof(builtin_categories) / sizeof(builtin_categories[0]))
+
+static void
+add_list_unique(EContactEditorCategories *categories, char *string)
+{
+ int k;
+ char *temp = e_strdup_strip(string);
+ char **list = categories->category_list;
+
+ if (!*temp) {
+ g_free(temp);
+ return;
+ }
+ for (k = 0; k < categories->list_length; k++) {
+ if (!strcmp(list[k], temp)) {
+ categories->selected_list[k] = TRUE;
+ g_free(temp);
+ break;
+ }
+ }
+ if (k == categories->list_length) {
+ categories->selected_list[categories->list_length] = TRUE;
+ list[categories->list_length++] = temp;
+ }
+}
+
+static void
+do_parse_categories(EContactEditorCategories *categories)
+{
+ char *str = categories->categories;
+ int length = strlen(str);
+ char *copy = g_new(char, length + 1);
+ int i, j;
+ char **list;
+ int count = 1;
+ for (i = 0; str[i]; i++) {
+ switch (str[i]) {
+ case '\\':
+ i++;
+ if (!str[i])
+ i--;
+ break;
+ case ',':
+ count ++;
+ break;
+ }
+ }
+
+ for (i = 0; i < categories->list_length; i++)
+ g_free(categories->category_list[i]);
+ g_free(categories->category_list);
+ list = g_new(char *, count + 1 + BUILTIN_CATEGORY_COUNT);
+ categories->category_list = list;
+
+ g_free(categories->selected_list);
+ categories->selected_list = g_new(gboolean, count + 1 + BUILTIN_CATEGORY_COUNT);
+
+ for (count = 0; count < BUILTIN_CATEGORY_COUNT; count++) {
+ list[count] = g_strdup(builtin_categories[count]);
+ categories->selected_list[count] = 0;
+ }
+ categories->list_length = count;
+
+ 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(categories, copy);
+ j = -1;
+ break;
+ default:
+ copy[j] = str[i];
+ break;
+ }
+ }
+ copy[j] = 0;
+ add_list_unique(categories, copy);
+ g_free(copy);
+ e_table_model_changed(categories->model);
+}
+
+static void
+e_contact_editor_categories_entry_change (GtkWidget *entry,
+ EContactEditorCategories *categories)
+{
+ if (categories->categories)
+ g_free(categories->categories);
+ categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+ do_parse_categories(categories);
+}
+
+
+#define INITIAL_SPEC "<ETableSpecification no-header=\"1\"> \
+ <columns-shown> \
+ <column> 0 </column> \
+ <column> 1 </column> \
+ </columns-shown> \
+ <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \
+</ETableSpecification>"
+
+static void
+e_contact_editor_categories_init (EContactEditorCategories *categories)
+{
+ GladeXML *gui;
+ GtkWidget *table;
+ ECell *cell_left_just;
+ ECell *cell_checkbox;
+ ETableHeader *header;
+ ETableCol *col;
+ GtkWidget *e_table;
+
+ categories->list_length = 0;
+ categories->category_list = NULL;
+ categories->selected_list = NULL;
+
+ gnome_dialog_append_button ( GNOME_DIALOG(categories),
+ GNOME_STOCK_BUTTON_OK);
+
+ gnome_dialog_append_button ( GNOME_DIALOG(categories),
+ GNOME_STOCK_BUTTON_CANCEL);
+
+ gtk_window_set_policy(GTK_WINDOW(categories), TRUE, TRUE, FALSE);
+
+ categories->categories = NULL;
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/categories.glade", NULL);
+ categories->gui = gui;
+
+ table = glade_xml_get_widget(gui, "table-categories");
+ gtk_widget_ref(table);
+ gtk_container_remove(GTK_CONTAINER(table->parent), table);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (categories)->vbox), table, TRUE, TRUE, 0);
+ gtk_widget_unref(table);
+
+ categories->entry = glade_xml_get_widget(gui, "entry-categories");
+
+ gtk_signal_connect(GTK_OBJECT(categories->entry), "changed",
+ GTK_SIGNAL_FUNC(e_contact_editor_categories_entry_change), categories);
+
+ categories->model = e_table_simple_new(e_contact_editor_categories_col_count,
+ e_contact_editor_categories_row_count,
+ e_contact_editor_categories_value_at,
+ e_contact_editor_categories_set_value_at,
+ e_contact_editor_categories_is_cell_editable,
+ e_contact_editor_categories_duplicate_value,
+ e_contact_editor_categories_free_value,
+ e_contact_editor_categories_thaw,
+ categories);
+
+ header = e_table_header_new();
+
+ cell_checkbox = e_cell_checkbox_new();
+ col = e_table_col_new (0, "",
+ 0, 20, cell_checkbox,
+ g_int_compare, TRUE);
+ e_table_header_add_column (header, col, 0);
+
+ cell_left_just = e_cell_text_new (categories->model, NULL, GTK_JUSTIFY_LEFT);
+ col = e_table_col_new (1, "Category",
+ 1.0, 20, cell_left_just,
+ g_str_compare, TRUE);
+ e_table_header_add_column (header, col, 1);
+
+ e_table = e_table_new (header, categories->model, INITIAL_SPEC);
+
+ gtk_widget_show(e_table);
+
+ gtk_table_attach_defaults(GTK_TABLE(table),
+ e_table,
+ 0, 1,
+ 3, 4);
+}
+
+void
+e_contact_editor_categories_destroy (GtkObject *object)
+{
+ EContactEditorCategories *e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES(object);
+
+ if (e_contact_editor_categories->gui)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor_categories->gui));
+ g_free(e_contact_editor_categories->categories);
+}
+
+GtkWidget*
+e_contact_editor_categories_new (char *categories)
+{
+ GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_categories_get_type ()));
+ gtk_object_set (GTK_OBJECT(widget),
+ "categories", categories,
+ NULL);
+ return widget;
+}
+
+static void
+e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+{
+ EContactEditorCategories *e_contact_editor_categories;
+
+ e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (o);
+
+ switch (arg_id){
+ case ARG_CATEGORIES:
+ gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
+ break;
+ }
+}
+
+static void
+e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ EContactEditorCategories *e_contact_editor_categories;
+
+ e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (object);
+
+ switch (arg_id) {
+ case ARG_CATEGORIES:
+ GTK_VALUE_STRING (*arg) = g_strdup(e_contact_editor_categories->categories);
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+/* This function returns the number of columns in our ETableModel. */
+static int
+e_contact_editor_categories_col_count (ETableModel *etc, gpointer data)
+{
+ return 2;
+}
+
+/* This function returns the number of rows in our ETableModel. */
+static int
+e_contact_editor_categories_row_count (ETableModel *etc, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ return categories->list_length;
+}
+
+/* This function returns the value at a particular point in our ETableModel. */
+static void *
+e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ if (col == 0)
+ return (void *) categories->selected_list[row];
+ else
+ return categories->category_list[row];
+}
+
+/* This function sets the value at a particular point in our ETableModel. */
+static void
+e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data)
+{
+ EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data);
+ if ( col == 0 ) {
+ char **strs;
+ int i, j;
+ char *string;
+ categories->selected_list[row] = (gboolean) val;
+ strs = g_new(char *, categories->list_length + 1);
+ for (i = 0, j = 0; i < categories->list_length; i++) {
+ if (categories->selected_list[i])
+ strs[j++] = categories->category_list[i];
+ }
+ strs[j] = 0;
+ string = g_strjoinv(", ", strs);
+ gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
+ g_free(string);
+ g_free(strs);
+ }
+ if ( col == 1 )
+ return;
+}
+
+/* This function returns whether a particular cell is editable. */
+static gboolean
+e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data)
+{
+ return col == 0;
+}
+
+/* This function duplicates the value passed to it. */
+static void *
+e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data)
+{
+ if (col == 0)
+ return (void *)value;
+ else
+ return g_strdup(value);
+}
+
+/* This function frees the value passed to it. */
+static void
+e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data)
+{
+ if (col == 0)
+ return;
+ else
+ g_free(value);
+}
+
+/* This function is for when the model is unfrozen. This can mostly
+ be ignored for simple models. */
+static void
+e_contact_editor_categories_thaw (ETableModel *etc, gpointer data)
+{
+ e_table_model_changed(etc);
+}
+
diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.h b/addressbook/gui/contact-editor/e-contact-editor-categories.h
new file mode 100644
index 0000000000..529ef71b68
--- /dev/null
+++ b/addressbook/gui/contact-editor/e-contact-editor-categories.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-contact-editor-categories.h
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __E_CONTACT_EDITOR_CATEGORIES_H__
+#define __E_CONTACT_EDITOR_CATEGORIES_H__
+
+#include <gnome.h>
+#include <glade/glade.h>
+#include <ebook/e-card.h>
+#include <widgets/e-table/e-table-model.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+/* EContactEditorCategories - A dialog displaying information about a contact.
+ *
+ * The following arguments are available:
+ *
+ * name type read/write description
+ * --------------------------------------------------------------------------------
+ * name ECardName * RW The card currently being edited. Returns a copy.
+ */
+
+#define E_CONTACT_EDITOR_CATEGORIES_TYPE (e_contact_editor_categories_get_type ())
+#define E_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategories))
+#define E_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategoriesClass))
+#define E_IS_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE))
+#define E_IS_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE))
+
+
+typedef struct _EContactEditorCategories EContactEditorCategories;
+typedef struct _EContactEditorCategoriesClass EContactEditorCategoriesClass;
+
+struct _EContactEditorCategories
+{
+ GnomeDialog parent;
+
+ /* item specific fields */
+ char *categories;
+ GtkWidget *entry;
+ ETableModel *model;
+
+ int list_length;
+ char **category_list;
+ gboolean *selected_list;
+
+ GladeXML *gui;
+};
+
+struct _EContactEditorCategoriesClass
+{
+ GnomeDialogClass parent_class;
+};
+
+
+GtkWidget *e_contact_editor_categories_new(char *categories);
+GtkType e_contact_editor_categories_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __E_CONTACT_EDITOR_CATEGORIES_H__ */
diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h
index 07aff370ad..b718d53500 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-strings.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-strings.h
@@ -5,32 +5,33 @@
*/
gchar *s = N_("Contact Editor");
-gchar *s = N_("Business Fax");
-gchar *s = N_("Home");
-gchar *s = N_("Business");
-gchar *s = N_("Mobile");
-gchar *s = N_("Primary Email");
-gchar *s = N_("\tFull Name...");
-gchar *s = N_("Job Title:");
+gchar *s = N_("_Full Name...");
gchar *s = N_("Company:");
gchar *s = N_("File As:");
gchar *s = N_("Web page address:");
-gchar *s = N_("This is the mailing address");
-gchar *s = N_("Wants HTML mail");
-gchar *s = N_("Business");
+gchar *s = N_("Wants _HTML mail");
gchar *s = N_("Address:");
+gchar *s = N_("_Business");
+gchar *s = N_("_Home");
+gchar *s = N_("Business _Fax");
+gchar *s = N_("_Mobile");
+gchar *s = N_("Primary Email");
+gchar *s = N_("Business");
+gchar *s = N_("This is the _mailing address");
+gchar *s = N_("_Contacts...");
+gchar *s = N_("Ca_tegories...");
+gchar *s = N_("Job Title");
gchar *s = N_("General");
gchar *s = N_("Department:");
gchar *s = N_("Office:");
gchar *s = N_("Profession:");
gchar *s = N_("Nickname:");
-gchar *s = N_("Spouse's name:");
-gchar *s = N_("Address:");
+gchar *s = N_("Spouse:");
gchar *s = N_("Birthday:");
gchar *s = N_("Assistant's name:");
-gchar *s = N_("Manager's name:");
+gchar *s = N_("Manager's Name:");
gchar *s = N_("Anniversary:");
-gchar *s = N_("Internet Free-Busy");
+gchar *s = N_("Notes:");
gchar *s = N_("Details");
gchar *s = N_("Add");
gchar *s = N_("Delete");
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 58f6af1475..e898b6eedd 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -24,6 +24,7 @@
#include <gnome.h>
#include "e-contact-editor.h"
#include <e-contact-editor-fullname.h>
+#include <e-contact-editor-categories.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
@@ -159,6 +160,8 @@ _add_images(GtkTable *table)
_add_image(table, EVOLUTION_IMAGES "/globe.png",
0, 1, 8, 10);
_add_image(table, EVOLUTION_IMAGES "/house.png", 4, 5, 5, 10);
+ _add_image(table, EVOLUTION_IMAGES "/evolution-contacts.png", 0, 1, 12, 14);
+ _add_image(table, EVOLUTION_IMAGES "/briefcase.png", 4, 5, 12, 14);
}
static void
@@ -166,7 +169,7 @@ _add_details_images(GtkTable *table)
{
_add_image(table, EVOLUTION_IMAGES "/briefcase.png", 0, 1, 0, 2);
_add_image(table, EVOLUTION_IMAGES "/malehead.png", 0, 1, 4, 6);
- _add_image(table, EVOLUTION_IMAGES "/globe.png", 0, 1, 7, 9);
+ _add_image(table, EVOLUTION_IMAGES "/globe.png", 0, 1, 8, 10);
}
static void
@@ -456,7 +459,6 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name));
int result;
gtk_widget_show(GTK_WIDGET(dialog));
- gnome_dialog_close_hides (dialog, TRUE);
result = gnome_dialog_run_and_close (dialog);
if (result == 0) {
ECardName *name;
@@ -474,6 +476,27 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
}
static void
+categories_clicked(GtkWidget *button, EContactEditor *editor)
+{
+ char *categories;
+ GnomeDialog *dialog;
+ int result;
+ GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-categories"));
+ categories = gtk_entry_get_text(entry);
+ dialog = GNOME_DIALOG(e_contact_editor_categories_new(categories));
+ gtk_widget_show(GTK_WIDGET(dialog));
+ result = gnome_dialog_run (dialog);
+ if (result == 0) {
+ gtk_object_get(GTK_OBJECT(dialog),
+ "categories", &categories,
+ NULL);
+ gtk_entry_set_text(entry, categories);
+ g_free(categories);
+ }
+ gtk_object_destroy(GTK_OBJECT(dialog));
+}
+
+static void
e_contact_editor_init (EContactEditor *e_contact_editor)
{
GladeXML *gui;
@@ -493,6 +516,9 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_signal_connect(GTK_OBJECT(glade_xml_get_widget(e_contact_editor->gui, "button-fullname")), "clicked",
full_name_clicked, e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(glade_xml_get_widget(e_contact_editor->gui, "button-categories")), "clicked",
+ categories_clicked, e_contact_editor);
+
gtk_object_get(GTK_OBJECT(glade_xml_get_widget(gui, "text-comments")),
"vadjustment", &adjustment,
NULL);
@@ -739,7 +765,7 @@ e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *la
GtkWidget *dialog = gnome_dialog_new(title,
NULL);
-
+
gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
gtk_widget_new (gtk_frame_get_type(),
"border_width", 4,
@@ -1022,9 +1048,9 @@ fill_in_info(EContactEditor *editor)
char *nickname;
char *spouse;
const ECardDate *anniversary;
- char *fburl;
char *note;
const ECardDate *bday;
+ char *categories;
GtkEditable *editable;
int position = 0;
@@ -1043,9 +1069,9 @@ fill_in_info(EContactEditor *editor)
"nickname", &nickname,
"spouse", &spouse,
"anniversary", &anniversary,
- "fburl", &fburl,
"note", &note,
"birth_date", &bday,
+ "categories", &categories,
NULL);
position = 0;
@@ -1121,12 +1147,6 @@ fill_in_info(EContactEditor *editor)
}
position = 0;
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-fburl"));
- gtk_editable_delete_text(editable, 0, -1);
- if (fburl)
- gtk_editable_insert_text(editable, fburl, strlen(fburl), &position);
-
- position = 0;
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-profession"));
gtk_editable_delete_text(editable, 0, -1);
if (role)
@@ -1149,6 +1169,12 @@ fill_in_info(EContactEditor *editor)
dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday"));
gnome_date_edit_set_time(dateedit, time_val);
}
+
+ position = 0;
+ editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-categories"));
+ gtk_editable_delete_text(editable, 0, -1);
+ if (categories)
+ gtk_editable_insert_text(editable, categories, strlen(categories), &position);
/* File as has to come after company and name or else it'll get messed up when setting them. */
position = 0;
@@ -1179,8 +1205,8 @@ extract_info(EContactEditor *editor)
char *nickname;
char *spouse;
ECardDate *anniversary;
- char *fburl;
char *note;
+ char *categories;
ECardDate *bday;
GtkEditable *editable;
GnomeDateEdit *dateedit;
@@ -1351,18 +1377,6 @@ extract_info(EContactEditor *editor)
"anniversary", anniversary,
NULL);
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-fburl"));
- fburl = gtk_editable_get_chars(editable, 0, -1);
- if (fburl && *fburl)
- gtk_object_set(GTK_OBJECT(card),
- "fburl", fburl,
- NULL);
- else
- gtk_object_set(GTK_OBJECT(card),
- "fburl", NULL,
- NULL);
- g_free(fburl);
-
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-comments"));
note = gtk_editable_get_chars(editable, 0, -1);
if (note && *note)
@@ -1375,6 +1389,18 @@ extract_info(EContactEditor *editor)
NULL);
g_free(note);
+ editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-categories"));
+ categories = gtk_editable_get_chars(editable, 0, -1);
+ if (categories && *categories)
+ gtk_object_set(GTK_OBJECT(card),
+ "categories", categories,
+ NULL);
+ else
+ gtk_object_set(GTK_OBJECT(card),
+ "categories", NULL,
+ NULL);
+ g_free(categories);
+
dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday"));
time_val = gnome_date_edit_get_date(dateedit);
gmtime_r(&time_val,
diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am
index 83cf28c2af..cc96918a77 100644
--- a/addressbook/gui/minicard/Makefile.am
+++ b/addressbook/gui/minicard/Makefile.am
@@ -47,11 +47,13 @@ minicard_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
reflow_test_SOURCES = \
@@ -62,11 +64,13 @@ reflow_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
minicard_view_test_SOURCES = \
@@ -77,9 +81,11 @@ minicard_view_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c
index 7b7b1bcbe5..ed8034926b 100644
--- a/addressbook/gui/minicard/e-minicard.c
+++ b/addressbook/gui/minicard/e-minicard.c
@@ -381,6 +381,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
NULL);
dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
g_assert (E_IS_BOOK (book));
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index 83cf28c2af..cc96918a77 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -47,11 +47,13 @@ minicard_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
reflow_test_SOURCES = \
@@ -62,11 +64,13 @@ reflow_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
minicard_view_test_SOURCES = \
@@ -77,9 +81,11 @@ minicard_view_test_LDADD = \
$(GNOMEGNORBA_LIBS) \
libeminicard.a \
-lbonobo \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 7b7b1bcbe5..ed8034926b 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -381,6 +381,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
NULL);
dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
g_assert (E_IS_BOOK (book));
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2817bf6bc6..dc3a51f8fc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,7 @@
+2000-05-14 Christopher James Lahey <clahey@helixcode.com>
+
+ * message-list.c: Updated to work with new ETable resizing.
+
2000-05-12 NotZed <NotZed@HelixCode.com>
* mail-ops.c (fetch_mail): Use 6 X's to mkstemp, as required by
diff --git a/mail/message-list.c b/mail/message-list.c
index 3380851c7a..8c28e51957 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -28,20 +28,20 @@
*/
#define N_CHARS(x) (CHAR_WIDTH * (x))
-#define COL_ICON_WIDTH 16
-#define COL_CHECK_BOX_WIDTH 16
-#define COL_FROM_WIDTH N_CHARS(24)
-#define COL_FROM_WIDTH_MIN 32
-#define COL_SUBJECT_WIDTH N_CHARS(30)
-#define COL_SUBJECT_WIDTH_MIN 32
-#define COL_SENT_WIDTH N_CHARS(4)
-#define COL_SENT_WIDTH_MIN 1
-#define COL_RECEIVE_WIDTH N_CHARS(20)
-#define COL_RECEIVE_WIDTH_MIN 32
-#define COL_TO_WIDTH N_CHARS(24)
-#define COL_TO_WIDTH_MIN 32
-#define COL_SIZE_WIDTH N_CHARS(6)
-#define COL_SIZE_WIDTH_MIN 32
+#define COL_ICON_WIDTH (16)
+#define COL_CHECK_BOX_WIDTH (16)
+#define COL_FROM_EXPANSION (24.0)
+#define COL_FROM_WIDTH_MIN (32)
+#define COL_SUBJECT_EXPANSION (30.0)
+#define COL_SUBJECT_WIDTH_MIN (32)
+#define COL_SENT_EXPANSION (4.0)
+#define COL_SENT_WIDTH_MIN (1)
+#define COL_RECEIVE_EXPANSION (20.0)
+#define COL_RECEIVE_WIDTH_MIN (32)
+#define COL_TO_EXPANSION (24.0)
+#define COL_TO_WIDTH_MIN (32)
+#define COL_SIZE_EXPANSION (6.0)
+#define COL_SIZE_WIDTH_MIN (32)
#define PARENT_TYPE (bonobo_object_get_type ())
@@ -386,7 +386,6 @@ message_list_init_renderers (MessageList *message_list)
message_list->render_priority = e_cell_checkbox_new ();
}
-#define CHAR_WIDTH 10
static void
message_list_init_header (MessageList *message_list)
{
@@ -405,70 +404,70 @@ message_list_init_header (MessageList *message_list)
message_list->table_cols [COL_ONLINE_STATUS] =
e_table_col_new_with_pixbuf (
COL_ONLINE_STATUS, states_pixmaps [5].pixbuf,
- COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH,
+ 0.0, COL_CHECK_BOX_WIDTH,
message_list->render_online_status,
g_int_compare, FALSE);
message_list->table_cols [COL_MESSAGE_STATUS] =
e_table_col_new_with_pixbuf (
COL_MESSAGE_STATUS, states_pixmaps [0].pixbuf,
- COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH,
+ 0.0, COL_CHECK_BOX_WIDTH,
message_list->render_message_status,
g_int_compare, FALSE);
message_list->table_cols [COL_PRIORITY] =
e_table_col_new (
COL_PRIORITY, _("Priority"),
- COL_CHECK_BOX_WIDTH, COL_CHECK_BOX_WIDTH,
+ 0.0, COL_CHECK_BOX_WIDTH,
message_list->render_priority,
g_int_compare, FALSE);
message_list->table_cols [COL_ATTACHMENT] =
e_table_col_new_with_pixbuf (
COL_ATTACHMENT, states_pixmaps [4].pixbuf,
- COL_ICON_WIDTH, COL_ICON_WIDTH,
+ 0.0, COL_ICON_WIDTH,
message_list->render_attachment,
g_int_compare, FALSE);
message_list->table_cols [COL_FROM] =
e_table_col_new (
COL_FROM, _("From"),
- COL_FROM_WIDTH, COL_FROM_WIDTH_MIN,
+ COL_FROM_EXPANSION, COL_FROM_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
message_list->table_cols [COL_SUBJECT] =
e_table_col_new (
COL_SUBJECT, _("Subject"),
- COL_SUBJECT_WIDTH, COL_SUBJECT_WIDTH_MIN,
+ COL_SUBJECT_EXPANSION, COL_SUBJECT_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
message_list->table_cols [COL_SENT] =
e_table_col_new (
COL_SENT, _("Sent"),
- COL_SENT_WIDTH, COL_SENT_WIDTH_MIN,
+ COL_SENT_EXPANSION, COL_SENT_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
message_list->table_cols [COL_RECEIVE] =
e_table_col_new (
COL_RECEIVE, _("Receive"),
- COL_RECEIVE_WIDTH, COL_RECEIVE_WIDTH_MIN,
+ COL_RECEIVE_EXPANSION, COL_RECEIVE_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
message_list->table_cols [COL_TO] =
e_table_col_new (
COL_TO, _("To"),
- COL_TO_WIDTH, COL_TO_WIDTH_MIN,
+ COL_TO_EXPANSION, COL_TO_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
message_list->table_cols [COL_SIZE] =
e_table_col_new (
COL_SIZE, _("Size"),
- COL_SIZE_WIDTH, COL_SIZE_WIDTH_MIN,
+ COL_SIZE_EXPANSION, COL_SIZE_WIDTH_MIN,
message_list->render_text,
g_str_compare, TRUE);
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 4237a13bd4..71799c21b1 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,41 @@
+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.
+
2000-05-11 Miguel de Icaza <miguel@gnu.org>
* e-table.c: Removed dead code.
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index bf8b3d115a..68d70b2fed 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -30,6 +30,7 @@
#include "e-cell-text.h"
#include "e-util/e-util.h"
#include "e-table-item.h"
+#include "e-text-event-processor.h"
#include "e-text-event-processor-emacs-like.h"
#include <gdk/gdkx.h> /* for BlackPixel */
diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h
index 997723b0d6..ae80235cb6 100644
--- a/widgets/e-table/e-cell-text.h
+++ b/widgets/e-table/e-cell-text.h
@@ -26,7 +26,6 @@
#include <libgnomeui/gnome-canvas.h>
#include "e-cell.h"
-#include "e-text-event-processor.h"
#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
diff --git a/widgets/e-table/e-table-col.c b/widgets/e-table/e-table-col.c
index 7bac1c4899..5a167a8940 100644
--- a/widgets/e-table/e-table-col.c
+++ b/widgets/e-table/e-table-col.c
@@ -39,17 +39,22 @@ e_table_col_class_init (GtkObjectClass *object_class)
object_class->destroy = etc_destroy;
}
-E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
+static void
+e_table_col_init (ETableCol *etc)
+{
+ etc->width = 0;
+}
+
+E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, PARENT_TYPE);
ETableCol *
-e_table_col_new (int col_idx, const char *text, int width, int min_width,
+e_table_col_new (int col_idx, const char *text, double expansion, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (expansion >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
g_return_val_if_fail (compare != NULL, NULL);
etc = gtk_type_new (E_TABLE_COL_TYPE);
@@ -59,7 +64,7 @@ e_table_col_new (int col_idx, const char *text, int width, int min_width,
etc->col_idx = col_idx;
etc->text = g_strdup (text);
etc->pixbuf = NULL;
- etc->width = width;
+ etc->expansion = expansion;
etc->min_width = min_width;
etc->ecell = ecell;
etc->compare = compare;
@@ -75,14 +80,13 @@ e_table_col_new (int col_idx, const char *text, int width, int min_width,
}
ETableCol *
-e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, int width, int min_width,
+e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, double expansion, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (expansion >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
g_return_val_if_fail (compare != NULL, NULL);
etc = gtk_type_new (E_TABLE_COL_TYPE);
@@ -92,7 +96,7 @@ e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, int width, int min_
etc->col_idx = col_idx;
etc->text = NULL;
etc->pixbuf = pixbuf;
- etc->width = width;
+ etc->expansion = expansion;
etc->min_width = min_width;
etc->ecell = ecell;
etc->compare = compare;
diff --git a/widgets/e-table/e-table-col.h b/widgets/e-table/e-table-col.h
index 816879792e..a7878fe4d7 100644
--- a/widgets/e-table/e-table-col.h
+++ b/widgets/e-table/e-table-col.h
@@ -28,8 +28,9 @@ struct _ETableCol {
GtkObject base;
char *text;
GdkPixbuf *pixbuf;
- short width;
- short min_width;
+ int min_width;
+ int width;
+ double expansion;
short x;
GCompareFunc compare;
unsigned int is_pixbuf:1;
@@ -48,11 +49,11 @@ struct _ETableColClass {
GtkType e_table_col_get_type (void);
ETableCol *e_table_col_new (int col_idx, const char *text,
- int width, int min_width,
+ double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
ETableCol *e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf,
- int width, int min_width,
+ double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
void e_table_col_destroy (ETableCol *etc);
diff --git a/widgets/e-table/e-table-defines.h b/widgets/e-table/e-table-defines.h
new file mode 100644
index 0000000000..02f1d19b77
--- /dev/null
+++ b/widgets/e-table/e-table-defines.h
@@ -0,0 +1,3 @@
+#define BUTTON_HEIGHT 10
+#define BUTTON_PADDING 2
+#define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2))
diff --git a/widgets/e-table/e-table-example-1.c b/widgets/e-table/e-table-example-1.c
index 0b3e40e5b7..70689c2953 100644
--- a/widgets/e-table/e-table-example-1.c
+++ b/widgets/e-table/e-table-example-1.c
@@ -215,7 +215,7 @@ create_table (void)
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
diff --git a/widgets/e-table/e-table-example-2.c b/widgets/e-table/e-table-example-2.c
index 6db06625a3..5bc6910437 100644
--- a/widgets/e-table/e-table-example-2.c
+++ b/widgets/e-table/e-table-example-2.c
@@ -239,7 +239,7 @@ create_table ()
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
@@ -249,7 +249,7 @@ create_table ()
cell_checkbox = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- ecol = e_table_col_new_with_pixbuf (i, pixbuf, 18, 18, cell_checkbox, g_int_compare, TRUE);
+ ecol = e_table_col_new_with_pixbuf (i, pixbuf, 0.0, 18, cell_checkbox, g_int_compare, TRUE);
e_table_header_add_column (e_table_header, ecol, i);
/*
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index dd463b7ec0..4c5dfa38a6 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -19,12 +19,9 @@
#include "e-util/e-canvas.h"
#include "e-util/e-canvas-utils.h"
#include "widgets/e-text/e-text.h"
+#include "e-table-defines.h"
#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define BUTTON_HEIGHT 10
-#define BUTTON_PADDING 2
#define PARENT_TYPE e_table_group_get_type ()
@@ -35,7 +32,8 @@ enum {
ARG_0,
ARG_HEIGHT,
ARG_WIDTH,
- ARG_FROZEN
+ ARG_MINIMUM_WIDTH,
+ ARG_FROZEN,
};
typedef struct {
@@ -66,9 +64,6 @@ e_table_group_container_list_free (ETableGroupContainer *etgc)
ETableGroupContainerChildNode *child_node;
GList *list;
- if (etgc->idle)
- g_source_remove (etgc->idle);
-
for (list = etgc->children; list; list = g_list_next (list)) {
child_node = (ETableGroupContainerChildNode *) list->data;
e_table_group_container_child_node_free (etgc, child_node);
@@ -100,102 +95,6 @@ etgc_destroy (GtkObject *object)
GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object);
}
-#if 0
-void
-e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etg != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etg->children = g_list_append (etg->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GList *l;
- int height = etg->transparent ? 0 : TITLE_HEIGHT;
- int x = etg->transparent ? 0 : GROUP_INDENT;
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- printf ("Height\n");
- if (E_IS_TABLE_ITEM (item)){
- printf (" Item: ");
- } else {
- printf (" Group: ");
- }
- printf ("%d\n", child->y2-child->y1);
- }
-
- e_canvas_item_move_absolute (item, x, height);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "resize",
- GTK_SIGNAL_FUNC (etg_relayout), etg);
- }
- }
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
- GList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags);
-
- if (!etg->transparent){
- int current_width, current_height;
-
- etg_dim (etg, &current_width, &current_height);
-
- if ((current_height != etg->height) || (current_width != etg->width)){
- etg->width = current_width;
- etg->height = current_height;
-
- gnome_canvas_item_set (
- etg->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
- }
- }
-}
-#endif
-
void
e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc,
ETableHeader *full_header,
@@ -226,42 +125,6 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
gdk_font_ref (etgc->font);
}
etgc->open = TRUE;
-#if 0
- etgc->transparent = transparent;
-
- etgc_dim (etgc, &etgc->width, &etgc->height);
-
- if (!etgc->transparent)
- etgc->rect = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (etgc),
- gnome_canvas_rect_get_type (),
- "fill_color", "gray",
- "outline_color", "gray20",
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etgc->width,
- "y2", (double) etgc->height,
- NULL);
-#endif
-
-#if 0
- /*
- * Reparent the child into our space.
- */
- gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etgc));
-
- gnome_canvas_item_set (
- child,
- "x", (double) GROUP_INDENT,
- "y", (double) TITLE_HEIGHT,
- NULL);
-
- /*
- * Force dimension computation
- */
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (
- GNOME_CANVAS_ITEM (etgc), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED);
-#endif
}
ETableGroup *
@@ -280,135 +143,6 @@ e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header
return E_TABLE_GROUP (etgc);
}
-#if 0
-static void
-etgc_relayout (GnomeCanvasItem *eti, ETableGroupContainer *etgc)
-{
- GList *l;
- int height = etgc->transparent ? 0 : GROUP_INDENT;
- gboolean move = FALSE;
-
- printf ("Relaying out\n");
-
- for (l = etgc->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- if (child == eti)
- move = TRUE;
-
- if (move){
- printf ("Moving item %p\n", child);
- gnome_canvas_item_set (child,
- "y", (double) height,
- NULL);
- }
- }
- if (height != etgc->height){
- etgc->height = height;
- gtk_signal_emit (GTK_OBJECT (etgc), etgc_signals [RESIZE]);
- }
-}
-
-void
-e_table_group_container_add (ETableGroupContainer *etgc, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etgc != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etgc));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etgc->children = g_list_append (etgc->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etgc)->klass)->bounds (etgc, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etgc)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GList *l;
- int height = etgc->transparent ? 0 : TITLE_HEIGHT;
- int x = etgc->transparent ? 0 : GROUP_INDENT;
-
- for (l = etgc->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- printf ("Height\n");
- if (E_IS_TABLE_ITEM (item)){
- printf (" Item: ");
- } else {
- printf (" Group: ");
- }
- printf ("%d\n", child->y2-child->y1);
- }
-
- e_canvas_item_move_absolute (item, x, height);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "resize",
- GTK_SIGNAL_FUNC (etgc_relayout), etgc);
- }
- }
-}
-
-static void
-etgc_realize (GnomeCanvasItem *item)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item);
- GList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize (item);
-
- for (l = etgc->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item);
-
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags);
-
- if (etgc->need_resize) {
-
- if (!etgc->transparent) {
- int current_width, current_height;
-
- etgc_dim (etgc, &current_width, &current_height);
-
- if ((current_height != etgc->height) || (current_width != etgc->width)){
- etgc->width = current_width;
- etgc->height = current_height;
-
- gnome_canvas_item_set (
- etgc->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etgc->width,
- "y2", (double) etgc->height,
- NULL);
- }
- }
- etgc->need_resize = FALSE;
- }
-}
-#endif
static int
etgc_event (GnomeCanvasItem *item, GdkEvent *event)
@@ -699,6 +433,8 @@ static void
etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
+ GList *list;
switch (arg_id) {
case ARG_FROZEN:
@@ -709,9 +445,15 @@ etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
etgc_thaw (etg);
}
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width)
- E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
+ case ARG_MINIMUM_WIDTH:
+ etgc->minimum_width = GTK_VALUE_DOUBLE(*arg);
+
+ for (list = etgc->children; list; list = g_list_next (list)) {
+ ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
+ gtk_object_set (GTK_OBJECT(child_node->child),
+ "minimum_width", etgc->minimum_width - GROUP_INDENT,
+ NULL);
+ }
break;
default:
break;
@@ -722,22 +464,20 @@ static void
etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
switch (arg_id) {
case ARG_FROZEN:
GTK_VALUE_BOOL (*arg) = etg->frozen;
break;
case ARG_HEIGHT:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgc->height;
break;
case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgc->width;
+ break;
+ case ARG_MINIMUM_WIDTH:
+ etgc->minimum_width = GTK_VALUE_DOUBLE(*arg);
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -745,38 +485,6 @@ etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
}
-static void etgc_set_width (ETableGroup *etg, gdouble width)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- GList *list = etgc->children;
- etgc->width = width;
-
- for (; list; list = g_list_next (list)){
- gdouble child_width = width - GROUP_INDENT;
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "width", child_width,
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect),
- "x1", (double) 0,
- "x2", (double) etgc->width,
- NULL);
- }
-}
-
-static gdouble etgc_get_width (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- return etgc->width;
-}
-
-static gdouble etgc_get_height (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- return etgc->height;
-}
-
static void
etgc_class_init (GtkObjectClass *object_class)
{
@@ -799,18 +507,15 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->increment = etgc_increment;
e_group_class->set_focus = etgc_set_focus;
e_group_class->get_focus_column = etgc_get_focus_column;
- e_group_class->thaw = etgc_thaw;
-
- e_group_class->get_width = etgc_get_width;
- e_group_class->set_width = etgc_set_width;
- e_group_class->get_height = etgc_get_height;
+ gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_FROZEN);
gtk_object_add_arg_type ("ETableGroupContainer::height", GTK_TYPE_DOUBLE,
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableGroupContainer::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_FROZEN);
+ GTK_ARG_READABLE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableGroupContainer::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
}
static void
@@ -823,23 +528,25 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
"frozen", &frozen,
NULL);
- if (frozen){
- etgc->idle = 0;
+ if (frozen)
return;
- }
+
if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED){
+ gdouble running_height = 0;
+ gdouble running_width = 0;
gdouble old_height;
+ gdouble old_width;
old_height = etgc->height;
+ old_width = etgc->width;
if (etgc->children == NULL){
} else {
GList *list;
- gdouble extra_height;
- gdouble running_height;
+ gdouble extra_height = 0;
gdouble item_height = 0;
+ gdouble item_width = 0;
- extra_height = 0;
if (etgc->font)
extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2;
@@ -847,8 +554,18 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
running_height = extra_height;
- list = etgc->children;
- for (; list; list = g_list_next (list)){
+ for ( list = etgc->children; list; list = g_list_next (list)){
+ ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
+ ETableGroup *child = child_node->child;
+
+ gtk_object_get (GTK_OBJECT(child),
+ "width", &item_width,
+ NULL);
+
+ if (item_width > running_width)
+ running_width = item_width;
+ }
+ for ( list = etgc->children; list; list = g_list_next (list)){
ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
ETableGroup *child = child_node->child;
gtk_object_get (GTK_OBJECT(child),
@@ -865,7 +582,7 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect),
"x1", (double) 0,
- "x2", (double) etgc->width,
+ "x2", (double) running_width,
"y1", (double) running_height - extra_height,
"y2", (double) running_height + item_height,
NULL);
@@ -873,13 +590,13 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
running_height += item_height + extra_height;
}
running_height -= extra_height;
- if (running_height != old_height) {
- etgc->height = running_height;
- e_canvas_item_request_parent_reflow (item);
- }
+ }
+ if (running_height != old_height || running_width != old_width) {
+ etgc->height = running_height;
+ etgc->width = running_width;
+ e_canvas_item_request_parent_reflow (item);
}
}
- etgc->idle = 0;
}
static void
diff --git a/widgets/e-table/e-table-group-container.h b/widgets/e-table/e-table-group-container.h
index 50424009f2..7577a3d70a 100644
--- a/widgets/e-table/e-table-group-container.h
+++ b/widgets/e-table/e-table-group-container.h
@@ -34,13 +34,11 @@ typedef struct {
GdkFont *font;
- gdouble width, height;
+ gdouble width, height, minimum_width;
ETableSortInfo *sort_info;
int n;
- gint idle;
-
/*
* State: the ETableGroup is open or closed
*/
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index e39afa7f88..caa0125a78 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -10,7 +10,6 @@
#include <config.h>
#include <gtk/gtksignal.h>
-#include "e-table-group-container.h"
#include "e-table-group-leaf.h"
#include "e-table-item.h"
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
@@ -29,7 +28,8 @@ enum {
ARG_0,
ARG_HEIGHT,
ARG_WIDTH,
- ARG_FROZEN
+ ARG_MINIMUM_WIDTH,
+ ARG_FROZEN,
};
static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
@@ -48,21 +48,23 @@ etgl_destroy (GtkObject *object)
}
static void
-e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl,
- ETableHeader *full_header,
+e_table_group_leaf_construct (GnomeCanvasGroup *parent,
+ ETableGroupLeaf *etgl,
+ ETableHeader *full_header,
ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info)
+ ETableModel *model,
+ ETableSortInfo *sort_info)
{
etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_sorted_variable_new (model, full_header, sort_info));
e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model);
}
ETableGroup *
-e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
+e_table_group_leaf_new (GnomeCanvasGroup *parent,
+ ETableHeader *full_header,
ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info)
+ ETableModel *model,
+ ETableSortInfo *sort_info)
{
ETableGroupLeaf *etgl;
@@ -85,6 +87,13 @@ etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupL
static void
etgl_reflow (GnomeCanvasItem *item, gint flags)
{
+ ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item);
+ gtk_object_get(GTK_OBJECT(leaf->item),
+ "height", &leaf->height,
+ NULL);
+ gtk_object_get(GTK_OBJECT(leaf->item),
+ "width", &leaf->width,
+ NULL);
e_canvas_item_request_parent_reflow (item);
}
@@ -103,31 +112,13 @@ etgl_realize (GnomeCanvasItem *item)
"drawgrid", TRUE,
"drawfocus", TRUE,
"spreadsheet", TRUE,
- "width", etgl->width,
+ "minimum_width", etgl->minimum_width,
"length_threshold", 200,
NULL));
-
+
gtk_signal_connect (GTK_OBJECT(etgl->item), "row_selection",
- GTK_SIGNAL_FUNC(etgl_row_selection), etgl);
- e_canvas_item_request_parent_reflow (item);
-}
-
-static int
-etgl_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- gboolean return_val = TRUE;
-
- switch (event->type) {
-
- default:
- return_val = FALSE;
- }
- if (return_val == FALSE){
- if (GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event (item, event);
- }
- return return_val;
-
+ GTK_SIGNAL_FUNC(etgl_row_selection), etgl);
+ e_canvas_item_request_reflow(item);
}
static void
@@ -177,47 +168,10 @@ etgl_get_focus_column (ETableGroup *etg)
}
static void
-etgl_set_width (ETableGroup *etg, gdouble width)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- etgl->width = width;
-#if 0
- if (etgl->item){
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "width", width,
- NULL);
- }
-#endif
-}
-
-static gdouble
-etgl_get_width (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- gtk_object_get (GTK_OBJECT(etgl->item),
- "width", &etgl->width,
- NULL);
- return etgl->width;
-}
-
-static gdouble
-etgl_get_height (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- gdouble height;
- if (etgl->item)
- gtk_object_get (GTK_OBJECT(etgl->item),
- "height", &height,
- NULL);
- else
- height = 1;
- return height;
-}
-
-static void
etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
switch (arg_id) {
case ARG_FROZEN:
@@ -227,9 +181,13 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
etg->frozen = FALSE;
}
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width)
- E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
+ case ARG_MINIMUM_WIDTH:
+ etgl->minimum_width = GTK_VALUE_DOUBLE(*arg);
+ if (etgl->item) {
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
+ "minimum_width", etgl->minimum_width,
+ NULL);
+ }
break;
default:
break;
@@ -240,22 +198,20 @@ static void
etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
switch (arg_id) {
case ARG_FROZEN:
GTK_VALUE_BOOL (*arg) = etg->frozen;
break;
case ARG_HEIGHT:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgl->height;
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ case ARG_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = etgl->width;
+ break;
+ case ARG_MINIMUM_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = etgl->minimum_width;
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -274,7 +230,6 @@ etgl_class_init (GtkObjectClass *object_class)
object_class->get_arg = etgl_get_arg;
item_class->realize = etgl_realize;
- item_class->event = etgl_event;
etgl_parent_class = gtk_type_class (PARENT_TYPE);
@@ -285,14 +240,12 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->set_focus = etgl_set_focus;
e_group_class->get_focus_column = etgl_get_focus_column;
- e_group_class->get_width = etgl_get_width;
- e_group_class->set_width = etgl_set_width;
- e_group_class->get_height = etgl_get_height;
-
gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE,
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
+ GTK_ARG_READABLE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableGroupLeaf::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_FROZEN);
}
@@ -303,6 +256,9 @@ etgl_init (GtkObject *object)
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
etgl->width = 1;
+ etgl->height = 1;
+ etgl->minimum_width = 0;
+
etgl->subset = NULL;
etgl->item = NULL;
diff --git a/widgets/e-table/e-table-group-leaf.h b/widgets/e-table/e-table-group-leaf.h
index 3f39fe95dd..bffeb798e0 100644
--- a/widgets/e-table/e-table-group-leaf.h
+++ b/widgets/e-table/e-table-group-leaf.h
@@ -21,8 +21,10 @@ typedef struct {
*/
ETableItem *item;
+ gdouble height;
gdouble width;
-
+ gdouble minimum_width;
+
ETableSubsetVariable *subset;
} ETableGroupLeaf;
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
index e47986472b..9544059a0c 100644
--- a/widgets/e-table/e-table-group.c
+++ b/widgets/e-table/e-table-group.c
@@ -34,16 +34,6 @@ enum {
static gint etg_signals [LAST_SIGNAL] = { 0, };
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_HEIGHT,
- ARG_WIDTH,
- ARG_FROZEN
-};
-
-static void etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static gboolean etg_get_focus (ETableGroup *etg);
static void etg_destroy (GtkObject *object);
#if 0
@@ -261,66 +251,6 @@ etg_event (GnomeCanvasItem *item, GdkEvent *event)
}
-static void
-etg_thaw (ETableGroup *etg)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- if (ETG_CLASS (etg)->thaw)
- ETG_CLASS (etg)->thaw (etg);
-}
-
-static void
-etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- if (GTK_VALUE_BOOL (*arg))
- etg->frozen = TRUE;
- else {
- etg->frozen = FALSE;
- etg_thaw (etg);
- }
- break;
- case ARG_WIDTH:
- if (ETG_CLASS(etg)->set_width)
- ETG_CLASS(etg)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
- break;
- default:
- break;
- }
-}
-
-static void
-etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- GTK_VALUE_BOOL (*arg) = etg->frozen;
- break;
- case ARG_HEIGHT:
- if (ETG_CLASS(etg)->get_height)
- GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
- break;
- case ARG_WIDTH:
- if (ETG_CLASS(etg)->get_width)
- GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
static gboolean
etg_get_focus (ETableGroup *etg)
{
@@ -332,9 +262,7 @@ etg_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
ETableGroupClass *klass = (ETableGroupClass *) object_class;
-
- object_class->set_arg = etg_set_arg;
- object_class->get_arg = etg_get_arg;
+
object_class->destroy = etg_destroy;
item_class->event = etg_event;
@@ -350,11 +278,6 @@ etg_class_init (GtkObjectClass *object_class)
klass->get_focus = etg_get_focus;
klass->get_ecol = NULL;
- klass->thaw = NULL;
- klass->get_height = NULL;
- klass->get_width = NULL;
- klass->set_width = NULL;
-
etg_parent_class = gtk_type_class (PARENT_TYPE);
etg_signals [ROW_SELECTION] =
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
index 573a4f9547..dd0771745b 100644
--- a/widgets/e-table/e-table-group.h
+++ b/widgets/e-table/e-table-group.h
@@ -53,10 +53,6 @@ typedef struct {
gint (*get_focus_column) (ETableGroup *etg);
ETableCol *(*get_ecol) (ETableGroup *etg);
- void (*thaw) (ETableGroup *etg);
- gdouble (*get_height) (ETableGroup *etg);
- gdouble (*get_width) (ETableGroup *etg);
- void (*set_width) (ETableGroup *etg, gdouble width);
} ETableGroupClass;
void e_table_group_add (ETableGroup *etg,
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
index 6923fffd0a..89d901b4be 100644
--- a/widgets/e-table/e-table-header-item.c
+++ b/widgets/e-table/e-table-header-item.c
@@ -21,6 +21,7 @@
#include "e-table-header.h"
#include "e-table-header-item.h"
#include "e-table-col-dnd.h"
+#include "e-table-defines.h"
#include "add-col.xpm"
#include "remove-col.xpm"
@@ -42,10 +43,8 @@ static guint ethi_signals [LAST_SIGNAL] = { 0, };
#define MIN_ARROW_SIZE 10
-#define GROUP_INDENT 10
-
/* Defines the tolerance for proximity of the column division to the cursor position */
-#define TOLERANCE 3
+#define TOLERANCE 4
#define ETHI_RESIZING(x) ((x)->resize_col != -1)
@@ -114,6 +113,13 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
+ if (ethi->sort_info)
+ ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT;
+ else
+ ethi->group_indent_width = 0;
+
+ ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
+
if (item->x1 != ethi->x1 ||
item->y1 != ethi->y1 ||
item->x2 != ethi->x1 + ethi->width ||
@@ -165,17 +171,13 @@ ethi_drop_table_header (ETableHeaderItem *ethi)
static void
structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
@@ -183,7 +185,6 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
{
ethi->eth = header;
gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi->structure_change_id = gtk_signal_connect (
GTK_OBJECT (header), "structure_change",
@@ -191,6 +192,7 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
ethi->dimension_change_id = gtk_signal_connect (
GTK_OBJECT (header), "dimension_change",
GTK_SIGNAL_FUNC(dimension_changed), ethi);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
@@ -706,7 +708,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int x1, x2;
int col;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
- gint group_indent = 0;
if (ethi->sort_info) {
@@ -714,7 +715,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int i;
for (i = 0; i < length; i++) {
ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
- group_indent ++;
g_hash_table_insert (arrows,
(gpointer) column.column,
(gpointer) (column.ascending ?
@@ -732,7 +732,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
}
}
- ethi->group_indent_width = group_indent * GROUP_INDENT;
ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
x1 = x2 = ethi->x1;
x2 += ethi->group_indent_width;
@@ -740,10 +739,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
int col_width;
- if (col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
+ col_width = ecol->width;
x2 += col_width;
@@ -839,14 +835,12 @@ ethi_request_redraw (ETableHeaderItem *ethi)
}
static void
-ethi_end_resize (ETableHeaderItem *ethi, int new_size)
+ethi_end_resize (ETableHeaderItem *ethi)
{
- e_table_header_set_size (ethi->eth, ethi->resize_col, new_size);
-
ethi->resize_col = -1;
ethi->resize_guide = GINT_TO_POINTER (0);
-
- ethi_request_redraw (ethi);
+
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
}
static gboolean
@@ -910,10 +904,7 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
- if (ethi->drag_col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
+ col_width = ecol->width;
pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
gc = widget->style->bg_gc [GTK_STATE_ACTIVE];
draw_button (ethi, ecol, pixmap, gc,
@@ -998,17 +989,9 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
new_width = x - ethi->resize_start_pos;
- if (new_width <= 0)
- new_width = 1;
+ e_table_header_set_size (ethi->eth, ethi->resize_col, new_width);
- if (new_width < ethi->resize_min_width)
- new_width = ethi->resize_min_width;
- ethi_request_redraw (ethi);
-
- ethi->resize_width = new_width;
- e_table_header_set_size (ethi->eth, ethi->resize_col, ethi->resize_width);
-
- ethi_request_redraw (ethi);
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
} else if (ethi_maybe_start_drag (ethi, &e->motion)){
ethi_start_drag (ethi, e);
} else
@@ -1033,7 +1016,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
if (!ecol->resizeable)
break;
ethi->resize_col = col;
- ethi->resize_width = ecol->width;
ethi->resize_start_pos = start - ecol->width;
ethi->resize_min_width = ecol->min_width;
} else {
@@ -1065,7 +1047,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
if (ethi->resize_col != -1){
needs_ungrab = (ethi->resize_guide != NULL);
- ethi_end_resize (ethi, ethi->resize_width);
+ ethi_end_resize (ethi);
} else if (was_maybe_drag && ethi->sort_info) {
ETableCol *col;
int model_col;
diff --git a/widgets/e-table/e-table-header-item.h b/widgets/e-table/e-table-header-item.h
index 2b3f2e8f74..300a7c81fb 100644
--- a/widgets/e-table/e-table-header-item.h
+++ b/widgets/e-table/e-table-header-item.h
@@ -27,7 +27,6 @@ typedef struct {
* Used during resizing; Could be shorts
*/
int resize_col;
- int resize_width;
int resize_start_pos;
int resize_min_width;
diff --git a/widgets/e-table/e-table-header.c b/widgets/e-table/e-table-header.c
index 4e9bf278ee..61e1f9a9da 100644
--- a/widgets/e-table/e-table-header.c
+++ b/widgets/e-table/e-table-header.c
@@ -12,6 +12,14 @@
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
#include "e-table-header.h"
+#include "e-table-defines.h"
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_SORT_INFO,
+ ARG_WIDTH,
+};
enum {
STRUCTURE_CHANGE,
@@ -19,22 +27,33 @@ enum {
LAST_SIGNAL
};
+static void eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref);
+
static guint eth_signals [LAST_SIGNAL] = { 0, };
static GtkObjectClass *e_table_header_parent_class;
static void
-e_table_header_destroy (GtkObject *object)
+eth_destroy (GtkObject *object)
{
ETableHeader *eth = E_TABLE_HEADER (object);
const int cols = eth->col_count;
int i;
+ if (eth->sort_info) {
+ if (eth->sort_info_group_change_id)
+ gtk_signal_disconnect(GTK_OBJECT(eth->sort_info),
+ eth->sort_info_group_change_id);
+ gtk_object_unref(GTK_OBJECT(eth->sort_info));
+ }
+
/*
* Destroy columns
*/
for (i = cols - 1; i >= 0; i--){
- e_table_header_remove (eth, i);
+ eth_do_remove (eth, i, TRUE);
}
if (e_table_header_parent_class->destroy)
@@ -44,10 +63,18 @@ e_table_header_destroy (GtkObject *object)
static void
e_table_header_class_init (GtkObjectClass *object_class)
{
- object_class->destroy = e_table_header_destroy;
+ object_class->destroy = eth_destroy;
+ object_class->set_arg = eth_set_arg;
+ object_class->get_arg = eth_get_arg;
+
e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ()));
+ gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_SORT_INFO);
+
eth_signals [STRUCTURE_CHANGE] =
gtk_signal_new ("structure_change",
GTK_RUN_LAST,
@@ -66,6 +93,19 @@ e_table_header_class_init (GtkObjectClass *object_class)
gtk_object_class_add_signals (object_class, eth_signals, LAST_SIGNAL);
}
+static void
+e_table_header_init (ETableHeader *eth)
+{
+ eth->col_count = 0;
+ eth->width = 0;
+
+ eth->sort_info = NULL;
+ eth->sort_info_group_change_id = 0;
+
+ eth->columns = NULL;
+ eth->selectable = FALSE;
+}
+
GtkType
e_table_header_get_type (void)
{
@@ -77,7 +117,7 @@ e_table_header_get_type (void)
sizeof (ETableHeader),
sizeof (ETableHeaderClass),
(GtkClassInitFunc) e_table_header_class_init,
- (GtkObjectInitFunc) NULL,
+ (GtkObjectInitFunc) e_table_header_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
@@ -100,12 +140,57 @@ e_table_header_new (void)
}
static void
-eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
+eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth)
{
- memmove (&eth->columns [pos+1], &eth->columns [pos],
- sizeof (ETableCol *) * (eth->col_count - pos));
- eth->columns [pos] = val;
- eth->col_count ++;
+ e_table_header_calc_widths(eth);
+}
+
+static void
+eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ETableHeader *eth = E_TABLE_HEADER (object);
+
+ switch (arg_id) {
+ case ARG_WIDTH:
+ eth->width = GTK_VALUE_DOUBLE (*arg);
+ e_table_header_calc_widths(eth);
+ break;
+ case ARG_SORT_INFO:
+ if (eth->sort_info) {
+ if (eth->sort_info_group_change_id)
+ gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id);
+ gtk_object_unref(GTK_OBJECT(eth->sort_info));
+ }
+ eth->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
+ if (eth->sort_info) {
+ gtk_object_ref(GTK_OBJECT(eth->sort_info));
+ eth->sort_info_group_change_id
+ = gtk_signal_connect(GTK_OBJECT(eth->sort_info), "group_info_changed",
+ GTK_SIGNAL_FUNC(eth_group_info_changed), eth);
+ }
+ e_table_header_calc_widths(eth);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ETableHeader *eth = E_TABLE_HEADER (object);
+
+ switch (arg_id) {
+ case ARG_SORT_INFO:
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eth->sort_info);
+ break;
+ case ARG_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = eth->width;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
}
static void
@@ -122,6 +207,15 @@ eth_update_offsets (ETableHeader *eth)
}
}
+static void
+eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
+{
+ memmove (&eth->columns [pos+1], &eth->columns [pos],
+ sizeof (ETableCol *) * (eth->col_count - pos));
+ eth->columns [pos] = val;
+ eth->col_count ++;
+}
+
void
e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
{
@@ -142,10 +236,9 @@ e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
gtk_object_sink (GTK_OBJECT (tc));
eth_do_insert (eth, pos, tc);
- eth_update_offsets (eth);
+ e_table_header_calc_widths(eth);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
ETableCol *
@@ -285,8 +378,8 @@ e_table_header_move (ETableHeader *eth, int source_index, int target_index)
eth_do_insert (eth, target_index, old);
eth_update_offsets (eth);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
+ gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
}
void
@@ -298,8 +391,8 @@ e_table_header_remove (ETableHeader *eth, int idx)
g_return_if_fail (idx < eth->col_count);
eth_do_remove (eth, idx, TRUE);
+ e_table_header_calc_widths(eth);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
void
@@ -310,14 +403,129 @@ e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
void
e_table_header_set_size (ETableHeader *eth, int idx, int size)
{
+ double expansion;
+ double old_expansion;
+ int min_width;
+ int left_width;
+ int total_extra;
+ int expandable_count;
+ int usable_width;
+ int i;
g_return_if_fail (eth != NULL);
g_return_if_fail (E_IS_TABLE_HEADER (eth));
g_return_if_fail (idx >= 0);
g_return_if_fail (idx < eth->col_count);
- g_return_if_fail (size > 0);
+
+ /* If this column is not resizable, don't do anything. */
+ if (!eth->columns[idx]->resizeable)
+ return;
+
+ expansion = 0;
+ min_width = 0;
+ left_width = 0;
+ expandable_count = -1;
+
+ /* Calculate usable area. */
+ for (i = 0; i < idx; i++) {
+ left_width += eth->columns[i]->width;
+ }
+ usable_width = eth->width - left_width;
+
+ if (eth->sort_info)
+ usable_width -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
+
+ /* Calculate minimum_width of stuff on the right as well as
+ * total usable expansion on the right.
+ */
+ for (; i < eth->col_count; i++) {
+ min_width += eth->columns[i]->min_width;
+ if (eth->columns[i]->resizeable) {
+ printf ("Expansion[%d] = %f\n", i, eth->columns[i]->expansion);
+ expansion += eth->columns[i]->expansion;
+ expandable_count ++;
+ }
+ }
+ /* If there's no room for anything, don't change. */
+ if (expansion == 0)
+ return;
+
+ /* (1) If none of the columns to the right are expandable, use
+ * all the expansion space in this column.
+ */
+ if(expandable_count == 0) {
+ eth->columns[idx]->expansion = expansion;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ total_extra = usable_width - min_width;
+ /* If there's no extra space, set all expansions to 0. */
+ if (total_extra <= 0) {
+ for (i = idx; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ /* If you try to resize smaller than the minimum width, it
+ * uses the minimum. */
+ if (size < eth->columns[idx]->min_width)
+ size = eth->columns[idx]->min_width;
+
+ printf ("size = %d, eth->columns[idx]->min_width = %d, total_extra = %d, expansion = %f\n", size, eth->columns[idx]->min_width, total_extra, expansion);
+
+ /* If all the extra space will be used up in this column, use
+ * all the expansion and set all others to 0.
+ */
+ if (size >= total_extra + eth->columns[idx]->min_width) {
+ eth->columns[idx]->expansion = expansion;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ /* The old_expansion used by columns to the right. */
+ old_expansion = expansion;
+ old_expansion -= eth->columns[idx]->expansion;
+ /* Set the new expansion so that it will generate the desired size. */
+ eth->columns[idx]->expansion = expansion * (((double)(size - eth->columns[idx]->min_width))/((double)total_extra));
+ /* The expansion left for the columns on the right. */
+ expansion -= eth->columns[idx]->expansion;
+
+ printf ("eth->columns[idx]->expansion = %f\n", eth->columns[idx]->expansion);
+
+ printf ("At (2) old_expansion = %f, expansion = %f\n", old_expansion, expansion);
+
+ /* (2) If the old columns to the right didn't have any
+ * expansion before, expand them evenly. old_expansion > 0 by
+ * expansion = SUM(i=idx to col_count -1,
+ * columns[i]->min_width) - columns[idx]->min_width) =
+ * SUM(non-negatives).
+ */
+ if (old_expansion == 0) {
+ for (i = idx + 1; i < eth->col_count; i++) {
+ if (eth->columns[idx]->resizeable) {
+ /* expandable_count != 0 by (1) */
+ eth->columns[i]->expansion = expansion / expandable_count;
+ }
+ }
+ goto end;
+ }
- eth->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], idx);
+ /* Remove from total_extra the amount used for this column. */
+ total_extra -= size - eth->columns[idx]->min_width;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ if (eth->columns[idx]->resizeable) {
+ /* old_expansion != 0 by (2) */
+ eth->columns[i]->expansion *= expansion / old_expansion;
+ }
+ }
+
+ end:
+ e_table_header_calc_widths(eth);
}
int
@@ -344,133 +552,38 @@ e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col)
return total;
}
-/* Forget model-view here. Really, this information belongs in the view anyway. */
-#if 0
-static void
-set_arrows (ETableHeader *eth, ETableHeaderSortInfo info)
-{
- ETableCol *col;
- for (col = eth->columns, i = 0; i < eth->col_count; i++, col++) {
- if (col->col_idx == info.model_col)
- e_table_column_set_arrow (col, info.ascending ? E_TABLE_COL_ARROW_DOWN : E_TABLE_COL_ARROW_UP);
- }
-}
-
-static void
-unset_arrows (ETableHeader *eth, ETableHeaderSortInfo info)
-{
- ETableCol *col;
- for (col = eth->columns, i = 0; i < eth->col_count; i++, col++) {
- if (col->col_idx == info.model_col)
- e_table_column_set_arrow (col, E_TABLE_COL_ARROW_NONE);
- }
-}
-
-ETableHeaderSortInfo
-e_table_header_get_sort_info (ETableHeader *eth)
-{
- ETableHeaderSortInfo dummy_info = {0, 1};
- g_return_val_if_fail (eth != NULL, dummy_info);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), dummy_info);
-
- return eth->sort_info;
-}
-
void
-e_table_header_set_sort_info (ETableHeader *eth, ETableHeaderSortInfo info)
+e_table_header_calc_widths (ETableHeader *eth)
{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- unset_arrows (eth, eth->sort_info);
- eth->sort_info = info;
- set_arrows (eth, eth->sort_info);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-
-int
-e_table_header_get_group_count (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- return eth->grouping_count;
-}
-
-ETableHeaderSortInfo *
-e_table_header_get_groups (ETableHeader *eth)
-{
- ETableHeaderSortInfo *ret;
- g_return_val_if_fail (eth != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL);
-
- ret = g_new (ETableHeaderSortInfo, eth->grouping_count);
- memcpy (ret, eth->grouping, sizeof (ETableHeaderSortInfo) * eth->grouping_count);
- return eth->grouping;
-}
-
-ETableHeaderSortInfo
-e_table_header_get_group (ETableHeader *eth, gint index)
-{
- ETableHeaderSortInfo dummy_info = {0, 1};
- g_return_val_if_fail (eth != NULL, dummy_info);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), dummy_info);
- g_return_val_if_fail (index >= 0, dummy_info);
- g_return_val_if_fail (index < eth->grouping_count, dummy_info);
-
- return eth->grouping[index];
-}
-
-void
-e_table_header_grouping_insert (ETableHeader *eth, gint index, ETableHeaderSortInfo info)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- eth->grouping = g_realloc (eth->grouping, sizeof(ETableHeaderSortInfo) * (eth->grouping_count + 1));
- memmove (eth->grouping + index + 1, eth->grouping + index, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - index));
- eth->grouping[index] = info;
-
- eth->grouping_count ++;
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_header_grouping_delete (ETableHeader *eth, gint index)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- memmove (eth->grouping + index, eth->grouping + index + 1, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - index));
- eth->grouping = g_realloc (eth->grouping, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - 1));
-
- eth->grouping_count --;
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_header_grouping_move (ETableHeader *eth, gint old_idx, gint new_idx)
-{
- ETableHeaderSortInfo info;
-
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- if (old_idx == new_idx)
+ int i;
+ int extra, extra_left;
+ double expansion;
+ int last_resizeable = -1;
+ extra = eth->width;
+ expansion = 0;
+ for (i = 0; i < eth->col_count; i++) {
+ extra -= eth->columns[i]->min_width;
+ if (eth->columns[i]->resizeable) {
+ expansion += eth->columns[i]->expansion;
+ last_resizeable = i;
+ }
+ eth->columns[i]->width = eth->columns[i]->min_width;
+ }
+ if (eth->sort_info)
+ extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
+ if (expansion == 0 || extra < 0)
return;
-
- info = eth->grouping[old_idx];
- if (old_idx < new_idx){
- memmove (eth->grouping + old_idx, eth->grouping + old_idx + 1, sizeof(ETableHeaderSortInfo) * (new_idx - old_idx));
- } else {
- memmove (eth->grouping + new_idx + 1, eth->grouping + new_idx, sizeof(ETableHeaderSortInfo) * (old_idx - new_idx));
+ extra_left = extra;
+ for (i = 0; i < last_resizeable; i++) {
+ if (eth->columns[i]->resizeable) {
+ int this_extra = MIN(extra_left, extra * (eth->columns[i]->expansion / expansion));
+ eth->columns[i]->width += this_extra;
+ extra_left -= this_extra;
+ }
}
- eth->grouping[new_idx] = info;
+ if (i >= 0 && i < eth->col_count && eth->columns[i]->resizeable)
+ eth->columns[i]->width += extra_left;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
+ eth_update_offsets (eth);
+ gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
-#endif
diff --git a/widgets/e-table/e-table-header.h b/widgets/e-table/e-table-header.h
index 244de59982..6ff4874f6f 100644
--- a/widgets/e-table/e-table-header.h
+++ b/widgets/e-table/e-table-header.h
@@ -4,6 +4,7 @@
#include <gtk/gtkobject.h>
#include <gdk/gdk.h>
+#include "e-table-sort-info.h"
#include "e-table-col.h"
typedef struct _ETableHeader ETableHeader;
@@ -14,13 +15,6 @@ typedef struct _ETableHeader ETableHeader;
#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE))
#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE))
-#if 0
-typedef struct {
- int model_col;
- int ascending;
-} ETableHeaderSortInfo;
-#endif
-
/*
* A Columnar header.
*/
@@ -28,14 +22,13 @@ struct _ETableHeader {
GtkObject base;
int col_count;
+ int width;
+
+ ETableSortInfo *sort_info;
+ int sort_info_group_change_id;
+
ETableCol **columns;
gboolean selectable;
-
-#if 0
- ETableHeaderSortInfo sort_info;
- ETableHeaderSortInfo *grouping;
- gint grouping_count;
-#endif
};
typedef struct {
@@ -59,18 +52,6 @@ int e_table_header_get_index_at (ETableHeader *eth,
int x_offset);
ETableCol **e_table_header_get_columns (ETableHeader *eth);
-#if 0
-ETableHeaderSortInfo e_table_header_get_sort_info (ETableHeader *eth);
-void e_table_header_set_sort_info (ETableHeader *eth, ETableHeaderSortInfo info);
-
-int e_table_header_get_group_count (ETableHeader *eth);
-ETableHeaderSortInfo *e_table_header_get_groups (ETableHeader *eth);
-ETableHeaderSortInfo e_table_header_get_group (ETableHeader *eth, gint index);
-void e_table_header_grouping_insert (ETableHeader *eth, gint index, ETableHeaderSortInfo info);
-void e_table_header_grouping_delete (ETableHeader *eth, gint index);
-void e_table_header_grouping_move (ETableHeader *eth, gint old_idx, gint new_idx);
-#endif
-
gboolean e_table_header_selection_ok (ETableHeader *eth);
int e_table_header_get_selected (ETableHeader *eth);
int e_table_header_total_width (ETableHeader *eth);
@@ -78,6 +59,7 @@ void e_table_header_move (ETableHeader *eth,
int source_index,
int target_index);
void e_table_header_remove (ETableHeader *eth, int idx);
+void e_table_header_set_width (ETableHeader *eth, int width);
void e_table_header_set_size (ETableHeader *eth, int idx, int size);
void e_table_header_set_selection (ETableHeader *eth,
gboolean allow_selection);
@@ -85,6 +67,8 @@ void e_table_header_set_selection (ETableHeader *eth,
int e_table_header_col_diff (ETableHeader *eth,
int start_col, int end_col);
+void e_table_header_calc_widths (ETableHeader *eth);
+
GList *e_table_header_get_selected_indexes (ETableHeader *eth);
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 13699e1d91..560cb4affe 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -42,12 +42,14 @@ enum {
ARG_MODE_SPREADSHEET,
ARG_LENGTH_THRESHOLD,
+ ARG_MINIMUM_WIDTH,
ARG_WIDTH,
ARG_HEIGHT,
ARG_HAS_FOCUS,
};
static int eti_get_height (ETableItem *eti);
+static int eti_get_minimum_width (ETableItem *eti);
static int eti_row_height (ETableItem *eti, int row);
#define ETI_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
@@ -141,18 +143,10 @@ eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y
{
double i2c [6];
ArtPoint c1, c2, i1, i2;
- int col, width = 0;
ETableItem *eti = E_TABLE_ITEM (item);
/* Wrong BBox's are the source of redraw nightmares */
- for (col = 0; col < eti->cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- width += ecol->width;
- }
- eti->width = width;
-
gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c);
i1.x = eti->x1;
@@ -184,6 +178,17 @@ eti_reflow (GnomeCanvasItem *item, gint flags)
}
eti->needs_compute_height = 0;
}
+ if (eti->needs_compute_width) {
+ int new_width = eti_get_minimum_width (eti);
+ new_width = MAX(new_width, eti->minimum_width);
+ if (new_width != eti->width) {
+ eti->width = new_width;
+ e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->needs_redraw = 1;
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ }
+ eti->needs_compute_width = 0;
+ }
}
/*
@@ -363,7 +368,6 @@ calculate_height_cache (ETableItem *eti)
static int
eti_row_height (ETableItem *eti, int row)
{
-#if 1
if (!eti->height_cache) {
calculate_height_cache (eti);
}
@@ -378,9 +382,6 @@ eti_row_height (ETableItem *eti, int row)
}
}
return eti->height_cache[row];
-#else
- return eti_row_height_real(eti, row);
-#endif
}
/*
@@ -435,6 +436,19 @@ eti_get_height (ETableItem *eti)
return height;
}
+static int
+eti_get_minimum_width (ETableItem *eti)
+{
+ int width = 0;
+ int col;
+ for (col = 0; col < eti->cols; col++){
+ ETableCol *ecol = e_table_header_get_column (eti->header, col);
+
+ width += ecol->min_width;
+ }
+ return width;
+}
+
static void
eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
{
@@ -472,20 +486,6 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
-/* Unused. */
-#if 0
-/*
- * eti_request_redraw:
- *
- * Queues a canvas redraw for the entire ETableItem.
- */
-static void
-eti_request_redraw (ETableItem *eti)
-{
- eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1);
-}
-#endif
-
/*
* Computes the distance between @start_row and @end_row in pixels
*/
@@ -624,8 +624,8 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
static void
eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
{
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ eti->needs_compute_width = 1;
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -650,8 +650,8 @@ eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
eti_attach_cell_views (eti);
}
}
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ eti->needs_compute_width = 1;
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -728,7 +728,13 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_MODE_SPREADSHEET:
eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg);
break;
-
+ case ARG_MINIMUM_WIDTH:
+ if (eti->minimum_width == eti->width && GTK_VALUE_DOUBLE (*arg) > eti->width)
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->minimum_width = GTK_VALUE_DOUBLE (*arg);
+ if (eti->minimum_width < eti->width)
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
+ break;
}
eti->needs_redraw = 1;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(eti));
@@ -750,6 +756,9 @@ eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_HEIGHT:
GTK_VALUE_DOUBLE (*arg) = eti->height;
break;
+ case ARG_MINIMUM_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = eti->minimum_width;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
}
@@ -765,6 +774,8 @@ eti_init (GnomeCanvasItem *item)
eti->editing_col = -1;
eti->editing_row = -1;
eti->height = 0;
+ eti->width = 0;
+ eti->minimum_width = 0;
eti->height_cache = NULL;
eti->height_cache_idle_id = 0;
@@ -1042,7 +1053,7 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
y -= eti->y1;
x1 = 0;
- for (col = 0; col < cols; col++, x1 = x2){
+ for (col = 0; col < cols - 1; col++, x1 = x2){
ETableCol *ecol = e_table_header_get_column (eti->header, col);
if (x < x1)
@@ -1050,31 +1061,26 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
x2 = x1 + ecol->width;
- if (x > x2)
- continue;
-
- *col_res = col;
- if (x1_res)
- *x1_res = x - x1;
- break;
+ if (x <= x2)
+ break;
}
y1 = y2 = 0;
- for (row = 0; row < rows; row++, y1 = y2){
+ for (row = 0; row < rows - 1; row++, y1 = y2){
if (y < y1)
return FALSE;
y2 += ETI_ROW_HEIGHT (eti, row) + 1;
- if (y > y2)
- continue;
-
- *row_res = row;
- if (y1_res)
- *y1_res = y - y1;
- break;
+ if (y <= y2)
+ break;
}
-
+ *col_res = col;
+ if (x1_res)
+ *x1_res = x - x1;
+ *row_res = row;
+ if (y1_res)
+ *y1_res = y - y1;
return TRUE;
}
@@ -1324,6 +1330,8 @@ eti_class_init (GtkObjectClass *object_class)
gtk_object_add_arg_type ("ETableItem::length_threshold", GTK_TYPE_INT,
GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
+ gtk_object_add_arg_type ("ETableItem::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("ETableItem::height", GTK_TYPE_DOUBLE,
diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h
index daa436db88..9cdb04c2ff 100644
--- a/widgets/e-table/e-table-item.h
+++ b/widgets/e-table/e-table-item.h
@@ -18,7 +18,7 @@ typedef struct {
ETableHeader *header;
int x1, y1;
- int width, height;
+ int minimum_width, width, height;
int cols, rows;
@@ -73,6 +73,7 @@ typedef struct {
guint needs_redraw : 1;
guint needs_compute_height : 1;
+ guint needs_compute_width : 1;
} ETableItem;
typedef struct {
diff --git a/widgets/e-table/e-table-size-test.c b/widgets/e-table/e-table-size-test.c
index 0271b03697..d12a57fbbb 100644
--- a/widgets/e-table/e-table-size-test.c
+++ b/widgets/e-table/e-table-size-test.c
@@ -210,7 +210,7 @@ create_table (void)
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index 51b03f4f65..e306abf35f 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -134,8 +134,6 @@ e_table_setup_header (ETable *e_table)
gnome_canvas_root (e_table->header_canvas),
e_table_header_item_get_type (),
"ETableHeader", e_table->header,
- "x", 0,
- "y", 0,
"sort_info", e_table->sort_info,
NULL);
@@ -150,27 +148,31 @@ static void
table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
ETable *e_table)
{
- gdouble height;
gdouble width;
-
- gtk_object_get (GTK_OBJECT (e_table->group),
- "height", &height,
- NULL);
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->table_canvas),
- 0, 0, alloc->width, MAX (height, alloc->height));
width = alloc->width;
+
gtk_object_set (GTK_OBJECT (e_table->group),
+ "minimum_width", width,
+ NULL);
+ gtk_object_set (GTK_OBJECT (e_table->header),
"width", width,
NULL);
+
}
static void
table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
{
- table_canvas_size_allocate (GTK_WIDGET (canvas),
- &(GTK_WIDGET (canvas)->allocation),
- e_table);
+ gdouble height, width;
+ GtkAllocation *alloc = &(GTK_WIDGET (canvas)->allocation);
+
+ gtk_object_get (GTK_OBJECT (e_table->group),
+ "height", &height,
+ "width", &width,
+ NULL);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_table->table_canvas),
+ 0, 0, MAX(width, alloc->width), MAX (height, alloc->height));
}
static void
@@ -199,7 +201,7 @@ changed_idle (gpointer data)
e_table_fill_table (et, et->model);
gtk_object_set (GTK_OBJECT (et->group),
- "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
+ "minimum_width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
NULL);
}
@@ -295,16 +297,6 @@ static void
e_table_fill_table (ETable *e_table, ETableModel *model)
{
e_table_group_add_all (e_table->group);
-#if 0
- count = e_table_model_row_count (model);
- gtk_object_set (GTK_OBJECT (e_table->group),
- "frozen", TRUE, NULL);
- for (i = 0; i < count; i++)
- e_table_group_add (e_table->group, i);
-
- gtk_object_set (GTK_OBJECT (e_table->group),
- "frozen", FALSE, NULL);
-#endif
}
static ETableHeader *
@@ -372,6 +364,8 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
xmlNode *xmlRoot;
xmlNode *xmlColumns;
xmlNode *xmlGrouping;
+ int no_header;
+ int row = 0;
GtkWidget *scrolledwindow;
@@ -381,6 +375,8 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
if ((xmlColumns == NULL) || (xmlGrouping == NULL))
return NULL;
+
+ no_header = e_xml_get_integer_prop_by_name(xmlRoot, "no-header");
e_table->full_header = full_header;
gtk_object_ref (GTK_OBJECT (full_header));
@@ -393,8 +389,14 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table->header = et_xml_to_header (e_table, full_header, xmlColumns);
et_grouping_xml_to_sort_info (e_table, xmlGrouping);
+
+ gtk_object_set(GTK_OBJECT(e_table->header),
+ "sort_info", e_table->sort_info,
+ NULL);
- e_table_setup_header (e_table);
+ if (!no_header) {
+ e_table_setup_header (e_table);
+ }
e_table_setup_table (e_table, full_header, e_table->header, etm);
e_table_fill_table (e_table, etm);
@@ -412,21 +414,23 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
GTK_WIDGET (e_table->table_canvas));
gtk_widget_show (scrolledwindow);
- /*
- * The header
- */
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
- 1, 2, 1, 2,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
-
+ if (!no_header) {
+ /*
+ * The header
+ */
+ gtk_table_attach (
+ GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
+ 0, 1, 0, 1,
+ GTK_FILL | GTK_EXPAND,
+ GTK_FILL, 0, 0);
+ row ++;
+ }
/*
* The body
*/
gtk_table_attach (
GTK_TABLE (e_table), GTK_WIDGET (scrolledwindow),
- 1, 2, 2, 3,
+ 0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
GTK_FILL | GTK_EXPAND, 0, 0);
diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c
index c05111d1b4..3a32098245 100644
--- a/widgets/e-table/test-check.c
+++ b/widgets/e-table/test-check.c
@@ -139,11 +139,11 @@ check_test (void)
cell_image_check = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_compare, TRUE);
+ col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 0.0, 18, cell_image_check, g_int_compare, TRUE);
gdk_pixbuf_unref (pixbuf);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_compare, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
e_table_col_set_arrow (col_1, E_TABLE_COL_ARROW_DOWN);
diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c
index f60d22d915..6756511fb4 100644
--- a/widgets/e-table/test-cols.c
+++ b/widgets/e-table/test-cols.c
@@ -153,10 +153,10 @@ multi_cols_test (void)
g_free (images);
}
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_compare, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE);
e_table_header_add_column (e_table_header, col_1, 0);
- col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_compare, TRUE);
+ col_0 = e_table_col_new (0, "A", 0.0, 48, cell_image_toggle, g_int_compare, TRUE);
e_table_header_add_column (e_table_header, col_0, 1);
/*
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
index 38f690ec43..a882b8dbdf 100644
--- a/widgets/e-table/test-table.c
+++ b/widgets/e-table/test-table.c
@@ -231,7 +231,7 @@ table_browser_test (void)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
i, column_labels [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
e_table_header_add_column (e_table_header, ecol, i);
@@ -324,7 +324,7 @@ do_e_table_demo (const char *spec)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
i, column_labels [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
e_table_header_add_column (full_header, ecol, i);
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index bf8b3d115a..68d70b2fed 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -30,6 +30,7 @@
#include "e-cell-text.h"
#include "e-util/e-util.h"
#include "e-table-item.h"
+#include "e-text-event-processor.h"
#include "e-text-event-processor-emacs-like.h"
#include <gdk/gdkx.h> /* for BlackPixel */
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
index 997723b0d6..ae80235cb6 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/table/e-cell-text.h
@@ -26,7 +26,6 @@
#include <libgnomeui/gnome-canvas.h>
#include "e-cell.h"
-#include "e-text-event-processor.h"
#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c
index 7bac1c4899..5a167a8940 100644
--- a/widgets/table/e-table-col.c
+++ b/widgets/table/e-table-col.c
@@ -39,17 +39,22 @@ e_table_col_class_init (GtkObjectClass *object_class)
object_class->destroy = etc_destroy;
}
-E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
+static void
+e_table_col_init (ETableCol *etc)
+{
+ etc->width = 0;
+}
+
+E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, PARENT_TYPE);
ETableCol *
-e_table_col_new (int col_idx, const char *text, int width, int min_width,
+e_table_col_new (int col_idx, const char *text, double expansion, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (expansion >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
g_return_val_if_fail (compare != NULL, NULL);
etc = gtk_type_new (E_TABLE_COL_TYPE);
@@ -59,7 +64,7 @@ e_table_col_new (int col_idx, const char *text, int width, int min_width,
etc->col_idx = col_idx;
etc->text = g_strdup (text);
etc->pixbuf = NULL;
- etc->width = width;
+ etc->expansion = expansion;
etc->min_width = min_width;
etc->ecell = ecell;
etc->compare = compare;
@@ -75,14 +80,13 @@ e_table_col_new (int col_idx, const char *text, int width, int min_width,
}
ETableCol *
-e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, int width, int min_width,
+e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, double expansion, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (expansion >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
g_return_val_if_fail (compare != NULL, NULL);
etc = gtk_type_new (E_TABLE_COL_TYPE);
@@ -92,7 +96,7 @@ e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, int width, int min_
etc->col_idx = col_idx;
etc->text = NULL;
etc->pixbuf = pixbuf;
- etc->width = width;
+ etc->expansion = expansion;
etc->min_width = min_width;
etc->ecell = ecell;
etc->compare = compare;
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
index 816879792e..a7878fe4d7 100644
--- a/widgets/table/e-table-col.h
+++ b/widgets/table/e-table-col.h
@@ -28,8 +28,9 @@ struct _ETableCol {
GtkObject base;
char *text;
GdkPixbuf *pixbuf;
- short width;
- short min_width;
+ int min_width;
+ int width;
+ double expansion;
short x;
GCompareFunc compare;
unsigned int is_pixbuf:1;
@@ -48,11 +49,11 @@ struct _ETableColClass {
GtkType e_table_col_get_type (void);
ETableCol *e_table_col_new (int col_idx, const char *text,
- int width, int min_width,
+ double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
ETableCol *e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf,
- int width, int min_width,
+ double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
void e_table_col_destroy (ETableCol *etc);
diff --git a/widgets/table/e-table-defines.h b/widgets/table/e-table-defines.h
new file mode 100644
index 0000000000..02f1d19b77
--- /dev/null
+++ b/widgets/table/e-table-defines.h
@@ -0,0 +1,3 @@
+#define BUTTON_HEIGHT 10
+#define BUTTON_PADDING 2
+#define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2))
diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c
index 0b3e40e5b7..70689c2953 100644
--- a/widgets/table/e-table-example-1.c
+++ b/widgets/table/e-table-example-1.c
@@ -215,7 +215,7 @@ create_table (void)
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c
index 6db06625a3..5bc6910437 100644
--- a/widgets/table/e-table-example-2.c
+++ b/widgets/table/e-table-example-2.c
@@ -239,7 +239,7 @@ create_table ()
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
@@ -249,7 +249,7 @@ create_table ()
cell_checkbox = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- ecol = e_table_col_new_with_pixbuf (i, pixbuf, 18, 18, cell_checkbox, g_int_compare, TRUE);
+ ecol = e_table_col_new_with_pixbuf (i, pixbuf, 0.0, 18, cell_checkbox, g_int_compare, TRUE);
e_table_header_add_column (e_table_header, ecol, i);
/*
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index dd463b7ec0..4c5dfa38a6 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -19,12 +19,9 @@
#include "e-util/e-canvas.h"
#include "e-util/e-canvas-utils.h"
#include "widgets/e-text/e-text.h"
+#include "e-table-defines.h"
#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define BUTTON_HEIGHT 10
-#define BUTTON_PADDING 2
#define PARENT_TYPE e_table_group_get_type ()
@@ -35,7 +32,8 @@ enum {
ARG_0,
ARG_HEIGHT,
ARG_WIDTH,
- ARG_FROZEN
+ ARG_MINIMUM_WIDTH,
+ ARG_FROZEN,
};
typedef struct {
@@ -66,9 +64,6 @@ e_table_group_container_list_free (ETableGroupContainer *etgc)
ETableGroupContainerChildNode *child_node;
GList *list;
- if (etgc->idle)
- g_source_remove (etgc->idle);
-
for (list = etgc->children; list; list = g_list_next (list)) {
child_node = (ETableGroupContainerChildNode *) list->data;
e_table_group_container_child_node_free (etgc, child_node);
@@ -100,102 +95,6 @@ etgc_destroy (GtkObject *object)
GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object);
}
-#if 0
-void
-e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etg != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etg->children = g_list_append (etg->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GList *l;
- int height = etg->transparent ? 0 : TITLE_HEIGHT;
- int x = etg->transparent ? 0 : GROUP_INDENT;
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- printf ("Height\n");
- if (E_IS_TABLE_ITEM (item)){
- printf (" Item: ");
- } else {
- printf (" Group: ");
- }
- printf ("%d\n", child->y2-child->y1);
- }
-
- e_canvas_item_move_absolute (item, x, height);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "resize",
- GTK_SIGNAL_FUNC (etg_relayout), etg);
- }
- }
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
- GList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags);
-
- if (!etg->transparent){
- int current_width, current_height;
-
- etg_dim (etg, &current_width, &current_height);
-
- if ((current_height != etg->height) || (current_width != etg->width)){
- etg->width = current_width;
- etg->height = current_height;
-
- gnome_canvas_item_set (
- etg->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
- }
- }
-}
-#endif
-
void
e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc,
ETableHeader *full_header,
@@ -226,42 +125,6 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
gdk_font_ref (etgc->font);
}
etgc->open = TRUE;
-#if 0
- etgc->transparent = transparent;
-
- etgc_dim (etgc, &etgc->width, &etgc->height);
-
- if (!etgc->transparent)
- etgc->rect = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (etgc),
- gnome_canvas_rect_get_type (),
- "fill_color", "gray",
- "outline_color", "gray20",
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etgc->width,
- "y2", (double) etgc->height,
- NULL);
-#endif
-
-#if 0
- /*
- * Reparent the child into our space.
- */
- gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etgc));
-
- gnome_canvas_item_set (
- child,
- "x", (double) GROUP_INDENT,
- "y", (double) TITLE_HEIGHT,
- NULL);
-
- /*
- * Force dimension computation
- */
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (
- GNOME_CANVAS_ITEM (etgc), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED);
-#endif
}
ETableGroup *
@@ -280,135 +143,6 @@ e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header
return E_TABLE_GROUP (etgc);
}
-#if 0
-static void
-etgc_relayout (GnomeCanvasItem *eti, ETableGroupContainer *etgc)
-{
- GList *l;
- int height = etgc->transparent ? 0 : GROUP_INDENT;
- gboolean move = FALSE;
-
- printf ("Relaying out\n");
-
- for (l = etgc->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- if (child == eti)
- move = TRUE;
-
- if (move){
- printf ("Moving item %p\n", child);
- gnome_canvas_item_set (child,
- "y", (double) height,
- NULL);
- }
- }
- if (height != etgc->height){
- etgc->height = height;
- gtk_signal_emit (GTK_OBJECT (etgc), etgc_signals [RESIZE]);
- }
-}
-
-void
-e_table_group_container_add (ETableGroupContainer *etgc, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etgc != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etgc));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etgc->children = g_list_append (etgc->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etgc)->klass)->bounds (etgc, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etgc)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GList *l;
- int height = etgc->transparent ? 0 : TITLE_HEIGHT;
- int x = etgc->transparent ? 0 : GROUP_INDENT;
-
- for (l = etgc->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- printf ("Height\n");
- if (E_IS_TABLE_ITEM (item)){
- printf (" Item: ");
- } else {
- printf (" Group: ");
- }
- printf ("%d\n", child->y2-child->y1);
- }
-
- e_canvas_item_move_absolute (item, x, height);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "resize",
- GTK_SIGNAL_FUNC (etgc_relayout), etgc);
- }
- }
-}
-
-static void
-etgc_realize (GnomeCanvasItem *item)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item);
- GList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize (item);
-
- for (l = etgc->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item);
-
- GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags);
-
- if (etgc->need_resize) {
-
- if (!etgc->transparent) {
- int current_width, current_height;
-
- etgc_dim (etgc, &current_width, &current_height);
-
- if ((current_height != etgc->height) || (current_width != etgc->width)){
- etgc->width = current_width;
- etgc->height = current_height;
-
- gnome_canvas_item_set (
- etgc->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etgc->width,
- "y2", (double) etgc->height,
- NULL);
- }
- }
- etgc->need_resize = FALSE;
- }
-}
-#endif
static int
etgc_event (GnomeCanvasItem *item, GdkEvent *event)
@@ -699,6 +433,8 @@ static void
etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
+ GList *list;
switch (arg_id) {
case ARG_FROZEN:
@@ -709,9 +445,15 @@ etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
etgc_thaw (etg);
}
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width)
- E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
+ case ARG_MINIMUM_WIDTH:
+ etgc->minimum_width = GTK_VALUE_DOUBLE(*arg);
+
+ for (list = etgc->children; list; list = g_list_next (list)) {
+ ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
+ gtk_object_set (GTK_OBJECT(child_node->child),
+ "minimum_width", etgc->minimum_width - GROUP_INDENT,
+ NULL);
+ }
break;
default:
break;
@@ -722,22 +464,20 @@ static void
etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
switch (arg_id) {
case ARG_FROZEN:
GTK_VALUE_BOOL (*arg) = etg->frozen;
break;
case ARG_HEIGHT:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgc->height;
break;
case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgc->width;
+ break;
+ case ARG_MINIMUM_WIDTH:
+ etgc->minimum_width = GTK_VALUE_DOUBLE(*arg);
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -745,38 +485,6 @@ etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
}
-static void etgc_set_width (ETableGroup *etg, gdouble width)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- GList *list = etgc->children;
- etgc->width = width;
-
- for (; list; list = g_list_next (list)){
- gdouble child_width = width - GROUP_INDENT;
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "width", child_width,
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect),
- "x1", (double) 0,
- "x2", (double) etgc->width,
- NULL);
- }
-}
-
-static gdouble etgc_get_width (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- return etgc->width;
-}
-
-static gdouble etgc_get_height (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- return etgc->height;
-}
-
static void
etgc_class_init (GtkObjectClass *object_class)
{
@@ -799,18 +507,15 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->increment = etgc_increment;
e_group_class->set_focus = etgc_set_focus;
e_group_class->get_focus_column = etgc_get_focus_column;
- e_group_class->thaw = etgc_thaw;
-
- e_group_class->get_width = etgc_get_width;
- e_group_class->set_width = etgc_set_width;
- e_group_class->get_height = etgc_get_height;
+ gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_FROZEN);
gtk_object_add_arg_type ("ETableGroupContainer::height", GTK_TYPE_DOUBLE,
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableGroupContainer::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_FROZEN);
+ GTK_ARG_READABLE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableGroupContainer::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
}
static void
@@ -823,23 +528,25 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
"frozen", &frozen,
NULL);
- if (frozen){
- etgc->idle = 0;
+ if (frozen)
return;
- }
+
if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED){
+ gdouble running_height = 0;
+ gdouble running_width = 0;
gdouble old_height;
+ gdouble old_width;
old_height = etgc->height;
+ old_width = etgc->width;
if (etgc->children == NULL){
} else {
GList *list;
- gdouble extra_height;
- gdouble running_height;
+ gdouble extra_height = 0;
gdouble item_height = 0;
+ gdouble item_width = 0;
- extra_height = 0;
if (etgc->font)
extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2;
@@ -847,8 +554,18 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
running_height = extra_height;
- list = etgc->children;
- for (; list; list = g_list_next (list)){
+ for ( list = etgc->children; list; list = g_list_next (list)){
+ ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
+ ETableGroup *child = child_node->child;
+
+ gtk_object_get (GTK_OBJECT(child),
+ "width", &item_width,
+ NULL);
+
+ if (item_width > running_width)
+ running_width = item_width;
+ }
+ for ( list = etgc->children; list; list = g_list_next (list)){
ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
ETableGroup *child = child_node->child;
gtk_object_get (GTK_OBJECT(child),
@@ -865,7 +582,7 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect),
"x1", (double) 0,
- "x2", (double) etgc->width,
+ "x2", (double) running_width,
"y1", (double) running_height - extra_height,
"y2", (double) running_height + item_height,
NULL);
@@ -873,13 +590,13 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
running_height += item_height + extra_height;
}
running_height -= extra_height;
- if (running_height != old_height) {
- etgc->height = running_height;
- e_canvas_item_request_parent_reflow (item);
- }
+ }
+ if (running_height != old_height || running_width != old_width) {
+ etgc->height = running_height;
+ etgc->width = running_width;
+ e_canvas_item_request_parent_reflow (item);
}
}
- etgc->idle = 0;
}
static void
diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h
index 50424009f2..7577a3d70a 100644
--- a/widgets/table/e-table-group-container.h
+++ b/widgets/table/e-table-group-container.h
@@ -34,13 +34,11 @@ typedef struct {
GdkFont *font;
- gdouble width, height;
+ gdouble width, height, minimum_width;
ETableSortInfo *sort_info;
int n;
- gint idle;
-
/*
* State: the ETableGroup is open or closed
*/
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index e39afa7f88..caa0125a78 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -10,7 +10,6 @@
#include <config.h>
#include <gtk/gtksignal.h>
-#include "e-table-group-container.h"
#include "e-table-group-leaf.h"
#include "e-table-item.h"
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
@@ -29,7 +28,8 @@ enum {
ARG_0,
ARG_HEIGHT,
ARG_WIDTH,
- ARG_FROZEN
+ ARG_MINIMUM_WIDTH,
+ ARG_FROZEN,
};
static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
@@ -48,21 +48,23 @@ etgl_destroy (GtkObject *object)
}
static void
-e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl,
- ETableHeader *full_header,
+e_table_group_leaf_construct (GnomeCanvasGroup *parent,
+ ETableGroupLeaf *etgl,
+ ETableHeader *full_header,
ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info)
+ ETableModel *model,
+ ETableSortInfo *sort_info)
{
etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_sorted_variable_new (model, full_header, sort_info));
e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model);
}
ETableGroup *
-e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
+e_table_group_leaf_new (GnomeCanvasGroup *parent,
+ ETableHeader *full_header,
ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info)
+ ETableModel *model,
+ ETableSortInfo *sort_info)
{
ETableGroupLeaf *etgl;
@@ -85,6 +87,13 @@ etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupL
static void
etgl_reflow (GnomeCanvasItem *item, gint flags)
{
+ ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item);
+ gtk_object_get(GTK_OBJECT(leaf->item),
+ "height", &leaf->height,
+ NULL);
+ gtk_object_get(GTK_OBJECT(leaf->item),
+ "width", &leaf->width,
+ NULL);
e_canvas_item_request_parent_reflow (item);
}
@@ -103,31 +112,13 @@ etgl_realize (GnomeCanvasItem *item)
"drawgrid", TRUE,
"drawfocus", TRUE,
"spreadsheet", TRUE,
- "width", etgl->width,
+ "minimum_width", etgl->minimum_width,
"length_threshold", 200,
NULL));
-
+
gtk_signal_connect (GTK_OBJECT(etgl->item), "row_selection",
- GTK_SIGNAL_FUNC(etgl_row_selection), etgl);
- e_canvas_item_request_parent_reflow (item);
-}
-
-static int
-etgl_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- gboolean return_val = TRUE;
-
- switch (event->type) {
-
- default:
- return_val = FALSE;
- }
- if (return_val == FALSE){
- if (GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event (item, event);
- }
- return return_val;
-
+ GTK_SIGNAL_FUNC(etgl_row_selection), etgl);
+ e_canvas_item_request_reflow(item);
}
static void
@@ -177,47 +168,10 @@ etgl_get_focus_column (ETableGroup *etg)
}
static void
-etgl_set_width (ETableGroup *etg, gdouble width)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- etgl->width = width;
-#if 0
- if (etgl->item){
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "width", width,
- NULL);
- }
-#endif
-}
-
-static gdouble
-etgl_get_width (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- gtk_object_get (GTK_OBJECT(etgl->item),
- "width", &etgl->width,
- NULL);
- return etgl->width;
-}
-
-static gdouble
-etgl_get_height (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- gdouble height;
- if (etgl->item)
- gtk_object_get (GTK_OBJECT(etgl->item),
- "height", &height,
- NULL);
- else
- height = 1;
- return height;
-}
-
-static void
etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
switch (arg_id) {
case ARG_FROZEN:
@@ -227,9 +181,13 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
etg->frozen = FALSE;
}
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width)
- E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
+ case ARG_MINIMUM_WIDTH:
+ etgl->minimum_width = GTK_VALUE_DOUBLE(*arg);
+ if (etgl->item) {
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
+ "minimum_width", etgl->minimum_width,
+ NULL);
+ }
break;
default:
break;
@@ -240,22 +198,20 @@ static void
etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
switch (arg_id) {
case ARG_FROZEN:
GTK_VALUE_BOOL (*arg) = etg->frozen;
break;
case ARG_HEIGHT:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ GTK_VALUE_DOUBLE (*arg) = etgl->height;
break;
- case ARG_WIDTH:
- if (E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width)
- GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
+ case ARG_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = etgl->width;
+ break;
+ case ARG_MINIMUM_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = etgl->minimum_width;
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -274,7 +230,6 @@ etgl_class_init (GtkObjectClass *object_class)
object_class->get_arg = etgl_get_arg;
item_class->realize = etgl_realize;
- item_class->event = etgl_event;
etgl_parent_class = gtk_type_class (PARENT_TYPE);
@@ -285,14 +240,12 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->set_focus = etgl_set_focus;
e_group_class->get_focus_column = etgl_get_focus_column;
- e_group_class->get_width = etgl_get_width;
- e_group_class->set_width = etgl_set_width;
- e_group_class->get_height = etgl_get_height;
-
gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE,
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
+ GTK_ARG_READABLE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableGroupLeaf::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_FROZEN);
}
@@ -303,6 +256,9 @@ etgl_init (GtkObject *object)
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
etgl->width = 1;
+ etgl->height = 1;
+ etgl->minimum_width = 0;
+
etgl->subset = NULL;
etgl->item = NULL;
diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h
index 3f39fe95dd..bffeb798e0 100644
--- a/widgets/table/e-table-group-leaf.h
+++ b/widgets/table/e-table-group-leaf.h
@@ -21,8 +21,10 @@ typedef struct {
*/
ETableItem *item;
+ gdouble height;
gdouble width;
-
+ gdouble minimum_width;
+
ETableSubsetVariable *subset;
} ETableGroupLeaf;
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index e47986472b..9544059a0c 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -34,16 +34,6 @@ enum {
static gint etg_signals [LAST_SIGNAL] = { 0, };
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_HEIGHT,
- ARG_WIDTH,
- ARG_FROZEN
-};
-
-static void etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static gboolean etg_get_focus (ETableGroup *etg);
static void etg_destroy (GtkObject *object);
#if 0
@@ -261,66 +251,6 @@ etg_event (GnomeCanvasItem *item, GdkEvent *event)
}
-static void
-etg_thaw (ETableGroup *etg)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- if (ETG_CLASS (etg)->thaw)
- ETG_CLASS (etg)->thaw (etg);
-}
-
-static void
-etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- if (GTK_VALUE_BOOL (*arg))
- etg->frozen = TRUE;
- else {
- etg->frozen = FALSE;
- etg_thaw (etg);
- }
- break;
- case ARG_WIDTH:
- if (ETG_CLASS(etg)->set_width)
- ETG_CLASS(etg)->set_width (etg, GTK_VALUE_DOUBLE (*arg));
- break;
- default:
- break;
- }
-}
-
-static void
-etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- GTK_VALUE_BOOL (*arg) = etg->frozen;
- break;
- case ARG_HEIGHT:
- if (ETG_CLASS(etg)->get_height)
- GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_height (etg);
- else
- arg->type = GTK_TYPE_INVALID;
- break;
- case ARG_WIDTH:
- if (ETG_CLASS(etg)->get_width)
- GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_width (etg);
- else
- arg->type = GTK_TYPE_INVALID;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
static gboolean
etg_get_focus (ETableGroup *etg)
{
@@ -332,9 +262,7 @@ etg_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
ETableGroupClass *klass = (ETableGroupClass *) object_class;
-
- object_class->set_arg = etg_set_arg;
- object_class->get_arg = etg_get_arg;
+
object_class->destroy = etg_destroy;
item_class->event = etg_event;
@@ -350,11 +278,6 @@ etg_class_init (GtkObjectClass *object_class)
klass->get_focus = etg_get_focus;
klass->get_ecol = NULL;
- klass->thaw = NULL;
- klass->get_height = NULL;
- klass->get_width = NULL;
- klass->set_width = NULL;
-
etg_parent_class = gtk_type_class (PARENT_TYPE);
etg_signals [ROW_SELECTION] =
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
index 573a4f9547..dd0771745b 100644
--- a/widgets/table/e-table-group.h
+++ b/widgets/table/e-table-group.h
@@ -53,10 +53,6 @@ typedef struct {
gint (*get_focus_column) (ETableGroup *etg);
ETableCol *(*get_ecol) (ETableGroup *etg);
- void (*thaw) (ETableGroup *etg);
- gdouble (*get_height) (ETableGroup *etg);
- gdouble (*get_width) (ETableGroup *etg);
- void (*set_width) (ETableGroup *etg, gdouble width);
} ETableGroupClass;
void e_table_group_add (ETableGroup *etg,
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 6923fffd0a..89d901b4be 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -21,6 +21,7 @@
#include "e-table-header.h"
#include "e-table-header-item.h"
#include "e-table-col-dnd.h"
+#include "e-table-defines.h"
#include "add-col.xpm"
#include "remove-col.xpm"
@@ -42,10 +43,8 @@ static guint ethi_signals [LAST_SIGNAL] = { 0, };
#define MIN_ARROW_SIZE 10
-#define GROUP_INDENT 10
-
/* Defines the tolerance for proximity of the column division to the cursor position */
-#define TOLERANCE 3
+#define TOLERANCE 4
#define ETHI_RESIZING(x) ((x)->resize_col != -1)
@@ -114,6 +113,13 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
+ if (ethi->sort_info)
+ ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT;
+ else
+ ethi->group_indent_width = 0;
+
+ ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
+
if (item->x1 != ethi->x1 ||
item->y1 != ethi->y1 ||
item->x2 != ethi->x1 + ethi->width ||
@@ -165,17 +171,13 @@ ethi_drop_table_header (ETableHeaderItem *ethi)
static void
structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
@@ -183,7 +185,6 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
{
ethi->eth = header;
gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi->structure_change_id = gtk_signal_connect (
GTK_OBJECT (header), "structure_change",
@@ -191,6 +192,7 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
ethi->dimension_change_id = gtk_signal_connect (
GTK_OBJECT (header), "dimension_change",
GTK_SIGNAL_FUNC(dimension_changed), ethi);
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
}
static void
@@ -706,7 +708,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int x1, x2;
int col;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
- gint group_indent = 0;
if (ethi->sort_info) {
@@ -714,7 +715,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int i;
for (i = 0; i < length; i++) {
ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
- group_indent ++;
g_hash_table_insert (arrows,
(gpointer) column.column,
(gpointer) (column.ascending ?
@@ -732,7 +732,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
}
}
- ethi->group_indent_width = group_indent * GROUP_INDENT;
ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
x1 = x2 = ethi->x1;
x2 += ethi->group_indent_width;
@@ -740,10 +739,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
int col_width;
- if (col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
+ col_width = ecol->width;
x2 += col_width;
@@ -839,14 +835,12 @@ ethi_request_redraw (ETableHeaderItem *ethi)
}
static void
-ethi_end_resize (ETableHeaderItem *ethi, int new_size)
+ethi_end_resize (ETableHeaderItem *ethi)
{
- e_table_header_set_size (ethi->eth, ethi->resize_col, new_size);
-
ethi->resize_col = -1;
ethi->resize_guide = GINT_TO_POINTER (0);
-
- ethi_request_redraw (ethi);
+
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
}
static gboolean
@@ -910,10 +904,7 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
- if (ethi->drag_col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
+ col_width = ecol->width;
pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
gc = widget->style->bg_gc [GTK_STATE_ACTIVE];
draw_button (ethi, ecol, pixmap, gc,
@@ -998,17 +989,9 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
new_width = x - ethi->resize_start_pos;
- if (new_width <= 0)
- new_width = 1;
+ e_table_header_set_size (ethi->eth, ethi->resize_col, new_width);
- if (new_width < ethi->resize_min_width)
- new_width = ethi->resize_min_width;
- ethi_request_redraw (ethi);
-
- ethi->resize_width = new_width;
- e_table_header_set_size (ethi->eth, ethi->resize_col, ethi->resize_width);
-
- ethi_request_redraw (ethi);
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
} else if (ethi_maybe_start_drag (ethi, &e->motion)){
ethi_start_drag (ethi, e);
} else
@@ -1033,7 +1016,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
if (!ecol->resizeable)
break;
ethi->resize_col = col;
- ethi->resize_width = ecol->width;
ethi->resize_start_pos = start - ecol->width;
ethi->resize_min_width = ecol->min_width;
} else {
@@ -1065,7 +1047,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
if (ethi->resize_col != -1){
needs_ungrab = (ethi->resize_guide != NULL);
- ethi_end_resize (ethi, ethi->resize_width);
+ ethi_end_resize (ethi);
} else if (was_maybe_drag && ethi->sort_info) {
ETableCol *col;
int model_col;
diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h
index 2b3f2e8f74..300a7c81fb 100644
--- a/widgets/table/e-table-header-item.h
+++ b/widgets/table/e-table-header-item.h
@@ -27,7 +27,6 @@ typedef struct {
* Used during resizing; Could be shorts
*/
int resize_col;
- int resize_width;
int resize_start_pos;
int resize_min_width;
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index 4e9bf278ee..61e1f9a9da 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -12,6 +12,14 @@
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
#include "e-table-header.h"
+#include "e-table-defines.h"
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_SORT_INFO,
+ ARG_WIDTH,
+};
enum {
STRUCTURE_CHANGE,
@@ -19,22 +27,33 @@ enum {
LAST_SIGNAL
};
+static void eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref);
+
static guint eth_signals [LAST_SIGNAL] = { 0, };
static GtkObjectClass *e_table_header_parent_class;
static void
-e_table_header_destroy (GtkObject *object)
+eth_destroy (GtkObject *object)
{
ETableHeader *eth = E_TABLE_HEADER (object);
const int cols = eth->col_count;
int i;
+ if (eth->sort_info) {
+ if (eth->sort_info_group_change_id)
+ gtk_signal_disconnect(GTK_OBJECT(eth->sort_info),
+ eth->sort_info_group_change_id);
+ gtk_object_unref(GTK_OBJECT(eth->sort_info));
+ }
+
/*
* Destroy columns
*/
for (i = cols - 1; i >= 0; i--){
- e_table_header_remove (eth, i);
+ eth_do_remove (eth, i, TRUE);
}
if (e_table_header_parent_class->destroy)
@@ -44,10 +63,18 @@ e_table_header_destroy (GtkObject *object)
static void
e_table_header_class_init (GtkObjectClass *object_class)
{
- object_class->destroy = e_table_header_destroy;
+ object_class->destroy = eth_destroy;
+ object_class->set_arg = eth_set_arg;
+ object_class->get_arg = eth_get_arg;
+
e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ()));
+ gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_WIDTH);
+ gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_SORT_INFO);
+
eth_signals [STRUCTURE_CHANGE] =
gtk_signal_new ("structure_change",
GTK_RUN_LAST,
@@ -66,6 +93,19 @@ e_table_header_class_init (GtkObjectClass *object_class)
gtk_object_class_add_signals (object_class, eth_signals, LAST_SIGNAL);
}
+static void
+e_table_header_init (ETableHeader *eth)
+{
+ eth->col_count = 0;
+ eth->width = 0;
+
+ eth->sort_info = NULL;
+ eth->sort_info_group_change_id = 0;
+
+ eth->columns = NULL;
+ eth->selectable = FALSE;
+}
+
GtkType
e_table_header_get_type (void)
{
@@ -77,7 +117,7 @@ e_table_header_get_type (void)
sizeof (ETableHeader),
sizeof (ETableHeaderClass),
(GtkClassInitFunc) e_table_header_class_init,
- (GtkObjectInitFunc) NULL,
+ (GtkObjectInitFunc) e_table_header_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
@@ -100,12 +140,57 @@ e_table_header_new (void)
}
static void
-eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
+eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth)
{
- memmove (&eth->columns [pos+1], &eth->columns [pos],
- sizeof (ETableCol *) * (eth->col_count - pos));
- eth->columns [pos] = val;
- eth->col_count ++;
+ e_table_header_calc_widths(eth);
+}
+
+static void
+eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ETableHeader *eth = E_TABLE_HEADER (object);
+
+ switch (arg_id) {
+ case ARG_WIDTH:
+ eth->width = GTK_VALUE_DOUBLE (*arg);
+ e_table_header_calc_widths(eth);
+ break;
+ case ARG_SORT_INFO:
+ if (eth->sort_info) {
+ if (eth->sort_info_group_change_id)
+ gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id);
+ gtk_object_unref(GTK_OBJECT(eth->sort_info));
+ }
+ eth->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
+ if (eth->sort_info) {
+ gtk_object_ref(GTK_OBJECT(eth->sort_info));
+ eth->sort_info_group_change_id
+ = gtk_signal_connect(GTK_OBJECT(eth->sort_info), "group_info_changed",
+ GTK_SIGNAL_FUNC(eth_group_info_changed), eth);
+ }
+ e_table_header_calc_widths(eth);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ETableHeader *eth = E_TABLE_HEADER (object);
+
+ switch (arg_id) {
+ case ARG_SORT_INFO:
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eth->sort_info);
+ break;
+ case ARG_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = eth->width;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
}
static void
@@ -122,6 +207,15 @@ eth_update_offsets (ETableHeader *eth)
}
}
+static void
+eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
+{
+ memmove (&eth->columns [pos+1], &eth->columns [pos],
+ sizeof (ETableCol *) * (eth->col_count - pos));
+ eth->columns [pos] = val;
+ eth->col_count ++;
+}
+
void
e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
{
@@ -142,10 +236,9 @@ e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
gtk_object_sink (GTK_OBJECT (tc));
eth_do_insert (eth, pos, tc);
- eth_update_offsets (eth);
+ e_table_header_calc_widths(eth);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
ETableCol *
@@ -285,8 +378,8 @@ e_table_header_move (ETableHeader *eth, int source_index, int target_index)
eth_do_insert (eth, target_index, old);
eth_update_offsets (eth);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
+ gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
}
void
@@ -298,8 +391,8 @@ e_table_header_remove (ETableHeader *eth, int idx)
g_return_if_fail (idx < eth->col_count);
eth_do_remove (eth, idx, TRUE);
+ e_table_header_calc_widths(eth);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
void
@@ -310,14 +403,129 @@ e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
void
e_table_header_set_size (ETableHeader *eth, int idx, int size)
{
+ double expansion;
+ double old_expansion;
+ int min_width;
+ int left_width;
+ int total_extra;
+ int expandable_count;
+ int usable_width;
+ int i;
g_return_if_fail (eth != NULL);
g_return_if_fail (E_IS_TABLE_HEADER (eth));
g_return_if_fail (idx >= 0);
g_return_if_fail (idx < eth->col_count);
- g_return_if_fail (size > 0);
+
+ /* If this column is not resizable, don't do anything. */
+ if (!eth->columns[idx]->resizeable)
+ return;
+
+ expansion = 0;
+ min_width = 0;
+ left_width = 0;
+ expandable_count = -1;
+
+ /* Calculate usable area. */
+ for (i = 0; i < idx; i++) {
+ left_width += eth->columns[i]->width;
+ }
+ usable_width = eth->width - left_width;
+
+ if (eth->sort_info)
+ usable_width -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
+
+ /* Calculate minimum_width of stuff on the right as well as
+ * total usable expansion on the right.
+ */
+ for (; i < eth->col_count; i++) {
+ min_width += eth->columns[i]->min_width;
+ if (eth->columns[i]->resizeable) {
+ printf ("Expansion[%d] = %f\n", i, eth->columns[i]->expansion);
+ expansion += eth->columns[i]->expansion;
+ expandable_count ++;
+ }
+ }
+ /* If there's no room for anything, don't change. */
+ if (expansion == 0)
+ return;
+
+ /* (1) If none of the columns to the right are expandable, use
+ * all the expansion space in this column.
+ */
+ if(expandable_count == 0) {
+ eth->columns[idx]->expansion = expansion;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ total_extra = usable_width - min_width;
+ /* If there's no extra space, set all expansions to 0. */
+ if (total_extra <= 0) {
+ for (i = idx; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ /* If you try to resize smaller than the minimum width, it
+ * uses the minimum. */
+ if (size < eth->columns[idx]->min_width)
+ size = eth->columns[idx]->min_width;
+
+ printf ("size = %d, eth->columns[idx]->min_width = %d, total_extra = %d, expansion = %f\n", size, eth->columns[idx]->min_width, total_extra, expansion);
+
+ /* If all the extra space will be used up in this column, use
+ * all the expansion and set all others to 0.
+ */
+ if (size >= total_extra + eth->columns[idx]->min_width) {
+ eth->columns[idx]->expansion = expansion;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ eth->columns[i]->expansion = 0;
+ }
+ goto end;
+ }
+
+ /* The old_expansion used by columns to the right. */
+ old_expansion = expansion;
+ old_expansion -= eth->columns[idx]->expansion;
+ /* Set the new expansion so that it will generate the desired size. */
+ eth->columns[idx]->expansion = expansion * (((double)(size - eth->columns[idx]->min_width))/((double)total_extra));
+ /* The expansion left for the columns on the right. */
+ expansion -= eth->columns[idx]->expansion;
+
+ printf ("eth->columns[idx]->expansion = %f\n", eth->columns[idx]->expansion);
+
+ printf ("At (2) old_expansion = %f, expansion = %f\n", old_expansion, expansion);
+
+ /* (2) If the old columns to the right didn't have any
+ * expansion before, expand them evenly. old_expansion > 0 by
+ * expansion = SUM(i=idx to col_count -1,
+ * columns[i]->min_width) - columns[idx]->min_width) =
+ * SUM(non-negatives).
+ */
+ if (old_expansion == 0) {
+ for (i = idx + 1; i < eth->col_count; i++) {
+ if (eth->columns[idx]->resizeable) {
+ /* expandable_count != 0 by (1) */
+ eth->columns[i]->expansion = expansion / expandable_count;
+ }
+ }
+ goto end;
+ }
- eth->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], idx);
+ /* Remove from total_extra the amount used for this column. */
+ total_extra -= size - eth->columns[idx]->min_width;
+ for (i = idx + 1; i < eth->col_count; i++) {
+ if (eth->columns[idx]->resizeable) {
+ /* old_expansion != 0 by (2) */
+ eth->columns[i]->expansion *= expansion / old_expansion;
+ }
+ }
+
+ end:
+ e_table_header_calc_widths(eth);
}
int
@@ -344,133 +552,38 @@ e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col)
return total;
}
-/* Forget model-view here. Really, this information belongs in the view anyway. */
-#if 0
-static void
-set_arrows (ETableHeader *eth, ETableHeaderSortInfo info)
-{
- ETableCol *col;
- for (col = eth->columns, i = 0; i < eth->col_count; i++, col++) {
- if (col->col_idx == info.model_col)
- e_table_column_set_arrow (col, info.ascending ? E_TABLE_COL_ARROW_DOWN : E_TABLE_COL_ARROW_UP);
- }
-}
-
-static void
-unset_arrows (ETableHeader *eth, ETableHeaderSortInfo info)
-{
- ETableCol *col;
- for (col = eth->columns, i = 0; i < eth->col_count; i++, col++) {
- if (col->col_idx == info.model_col)
- e_table_column_set_arrow (col, E_TABLE_COL_ARROW_NONE);
- }
-}
-
-ETableHeaderSortInfo
-e_table_header_get_sort_info (ETableHeader *eth)
-{
- ETableHeaderSortInfo dummy_info = {0, 1};
- g_return_val_if_fail (eth != NULL, dummy_info);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), dummy_info);
-
- return eth->sort_info;
-}
-
void
-e_table_header_set_sort_info (ETableHeader *eth, ETableHeaderSortInfo info)
+e_table_header_calc_widths (ETableHeader *eth)
{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- unset_arrows (eth, eth->sort_info);
- eth->sort_info = info;
- set_arrows (eth, eth->sort_info);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-
-int
-e_table_header_get_group_count (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- return eth->grouping_count;
-}
-
-ETableHeaderSortInfo *
-e_table_header_get_groups (ETableHeader *eth)
-{
- ETableHeaderSortInfo *ret;
- g_return_val_if_fail (eth != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL);
-
- ret = g_new (ETableHeaderSortInfo, eth->grouping_count);
- memcpy (ret, eth->grouping, sizeof (ETableHeaderSortInfo) * eth->grouping_count);
- return eth->grouping;
-}
-
-ETableHeaderSortInfo
-e_table_header_get_group (ETableHeader *eth, gint index)
-{
- ETableHeaderSortInfo dummy_info = {0, 1};
- g_return_val_if_fail (eth != NULL, dummy_info);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), dummy_info);
- g_return_val_if_fail (index >= 0, dummy_info);
- g_return_val_if_fail (index < eth->grouping_count, dummy_info);
-
- return eth->grouping[index];
-}
-
-void
-e_table_header_grouping_insert (ETableHeader *eth, gint index, ETableHeaderSortInfo info)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- eth->grouping = g_realloc (eth->grouping, sizeof(ETableHeaderSortInfo) * (eth->grouping_count + 1));
- memmove (eth->grouping + index + 1, eth->grouping + index, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - index));
- eth->grouping[index] = info;
-
- eth->grouping_count ++;
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_header_grouping_delete (ETableHeader *eth, gint index)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- memmove (eth->grouping + index, eth->grouping + index + 1, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - index));
- eth->grouping = g_realloc (eth->grouping, sizeof(ETableHeaderSortInfo) * (eth->grouping_count - 1));
-
- eth->grouping_count --;
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_header_grouping_move (ETableHeader *eth, gint old_idx, gint new_idx)
-{
- ETableHeaderSortInfo info;
-
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-
- if (old_idx == new_idx)
+ int i;
+ int extra, extra_left;
+ double expansion;
+ int last_resizeable = -1;
+ extra = eth->width;
+ expansion = 0;
+ for (i = 0; i < eth->col_count; i++) {
+ extra -= eth->columns[i]->min_width;
+ if (eth->columns[i]->resizeable) {
+ expansion += eth->columns[i]->expansion;
+ last_resizeable = i;
+ }
+ eth->columns[i]->width = eth->columns[i]->min_width;
+ }
+ if (eth->sort_info)
+ extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
+ if (expansion == 0 || extra < 0)
return;
-
- info = eth->grouping[old_idx];
- if (old_idx < new_idx){
- memmove (eth->grouping + old_idx, eth->grouping + old_idx + 1, sizeof(ETableHeaderSortInfo) * (new_idx - old_idx));
- } else {
- memmove (eth->grouping + new_idx + 1, eth->grouping + new_idx, sizeof(ETableHeaderSortInfo) * (old_idx - new_idx));
+ extra_left = extra;
+ for (i = 0; i < last_resizeable; i++) {
+ if (eth->columns[i]->resizeable) {
+ int this_extra = MIN(extra_left, extra * (eth->columns[i]->expansion / expansion));
+ eth->columns[i]->width += this_extra;
+ extra_left -= this_extra;
+ }
}
- eth->grouping[new_idx] = info;
+ if (i >= 0 && i < eth->col_count && eth->columns[i]->resizeable)
+ eth->columns[i]->width += extra_left;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
+ eth_update_offsets (eth);
+ gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
}
-#endif
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
index 244de59982..6ff4874f6f 100644
--- a/widgets/table/e-table-header.h
+++ b/widgets/table/e-table-header.h
@@ -4,6 +4,7 @@
#include <gtk/gtkobject.h>
#include <gdk/gdk.h>
+#include "e-table-sort-info.h"
#include "e-table-col.h"
typedef struct _ETableHeader ETableHeader;
@@ -14,13 +15,6 @@ typedef struct _ETableHeader ETableHeader;
#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE))
#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE))
-#if 0
-typedef struct {
- int model_col;
- int ascending;
-} ETableHeaderSortInfo;
-#endif
-
/*
* A Columnar header.
*/
@@ -28,14 +22,13 @@ struct _ETableHeader {
GtkObject base;
int col_count;
+ int width;
+
+ ETableSortInfo *sort_info;
+ int sort_info_group_change_id;
+
ETableCol **columns;
gboolean selectable;
-
-#if 0
- ETableHeaderSortInfo sort_info;
- ETableHeaderSortInfo *grouping;
- gint grouping_count;
-#endif
};
typedef struct {
@@ -59,18 +52,6 @@ int e_table_header_get_index_at (ETableHeader *eth,
int x_offset);
ETableCol **e_table_header_get_columns (ETableHeader *eth);
-#if 0
-ETableHeaderSortInfo e_table_header_get_sort_info (ETableHeader *eth);
-void e_table_header_set_sort_info (ETableHeader *eth, ETableHeaderSortInfo info);
-
-int e_table_header_get_group_count (ETableHeader *eth);
-ETableHeaderSortInfo *e_table_header_get_groups (ETableHeader *eth);
-ETableHeaderSortInfo e_table_header_get_group (ETableHeader *eth, gint index);
-void e_table_header_grouping_insert (ETableHeader *eth, gint index, ETableHeaderSortInfo info);
-void e_table_header_grouping_delete (ETableHeader *eth, gint index);
-void e_table_header_grouping_move (ETableHeader *eth, gint old_idx, gint new_idx);
-#endif
-
gboolean e_table_header_selection_ok (ETableHeader *eth);
int e_table_header_get_selected (ETableHeader *eth);
int e_table_header_total_width (ETableHeader *eth);
@@ -78,6 +59,7 @@ void e_table_header_move (ETableHeader *eth,
int source_index,
int target_index);
void e_table_header_remove (ETableHeader *eth, int idx);
+void e_table_header_set_width (ETableHeader *eth, int width);
void e_table_header_set_size (ETableHeader *eth, int idx, int size);
void e_table_header_set_selection (ETableHeader *eth,
gboolean allow_selection);
@@ -85,6 +67,8 @@ void e_table_header_set_selection (ETableHeader *eth,
int e_table_header_col_diff (ETableHeader *eth,
int start_col, int end_col);
+void e_table_header_calc_widths (ETableHeader *eth);
+
GList *e_table_header_get_selected_indexes (ETableHeader *eth);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 13699e1d91..560cb4affe 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -42,12 +42,14 @@ enum {
ARG_MODE_SPREADSHEET,
ARG_LENGTH_THRESHOLD,
+ ARG_MINIMUM_WIDTH,
ARG_WIDTH,
ARG_HEIGHT,
ARG_HAS_FOCUS,
};
static int eti_get_height (ETableItem *eti);
+static int eti_get_minimum_width (ETableItem *eti);
static int eti_row_height (ETableItem *eti, int row);
#define ETI_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
@@ -141,18 +143,10 @@ eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y
{
double i2c [6];
ArtPoint c1, c2, i1, i2;
- int col, width = 0;
ETableItem *eti = E_TABLE_ITEM (item);
/* Wrong BBox's are the source of redraw nightmares */
- for (col = 0; col < eti->cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- width += ecol->width;
- }
- eti->width = width;
-
gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c);
i1.x = eti->x1;
@@ -184,6 +178,17 @@ eti_reflow (GnomeCanvasItem *item, gint flags)
}
eti->needs_compute_height = 0;
}
+ if (eti->needs_compute_width) {
+ int new_width = eti_get_minimum_width (eti);
+ new_width = MAX(new_width, eti->minimum_width);
+ if (new_width != eti->width) {
+ eti->width = new_width;
+ e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->needs_redraw = 1;
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ }
+ eti->needs_compute_width = 0;
+ }
}
/*
@@ -363,7 +368,6 @@ calculate_height_cache (ETableItem *eti)
static int
eti_row_height (ETableItem *eti, int row)
{
-#if 1
if (!eti->height_cache) {
calculate_height_cache (eti);
}
@@ -378,9 +382,6 @@ eti_row_height (ETableItem *eti, int row)
}
}
return eti->height_cache[row];
-#else
- return eti_row_height_real(eti, row);
-#endif
}
/*
@@ -435,6 +436,19 @@ eti_get_height (ETableItem *eti)
return height;
}
+static int
+eti_get_minimum_width (ETableItem *eti)
+{
+ int width = 0;
+ int col;
+ for (col = 0; col < eti->cols; col++){
+ ETableCol *ecol = e_table_header_get_column (eti->header, col);
+
+ width += ecol->min_width;
+ }
+ return width;
+}
+
static void
eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
{
@@ -472,20 +486,6 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
-/* Unused. */
-#if 0
-/*
- * eti_request_redraw:
- *
- * Queues a canvas redraw for the entire ETableItem.
- */
-static void
-eti_request_redraw (ETableItem *eti)
-{
- eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1);
-}
-#endif
-
/*
* Computes the distance between @start_row and @end_row in pixels
*/
@@ -624,8 +624,8 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
static void
eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
{
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ eti->needs_compute_width = 1;
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -650,8 +650,8 @@ eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
eti_attach_cell_views (eti);
}
}
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ eti->needs_compute_width = 1;
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -728,7 +728,13 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_MODE_SPREADSHEET:
eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg);
break;
-
+ case ARG_MINIMUM_WIDTH:
+ if (eti->minimum_width == eti->width && GTK_VALUE_DOUBLE (*arg) > eti->width)
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->minimum_width = GTK_VALUE_DOUBLE (*arg);
+ if (eti->minimum_width < eti->width)
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
+ break;
}
eti->needs_redraw = 1;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(eti));
@@ -750,6 +756,9 @@ eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_HEIGHT:
GTK_VALUE_DOUBLE (*arg) = eti->height;
break;
+ case ARG_MINIMUM_WIDTH:
+ GTK_VALUE_DOUBLE (*arg) = eti->minimum_width;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
}
@@ -765,6 +774,8 @@ eti_init (GnomeCanvasItem *item)
eti->editing_col = -1;
eti->editing_row = -1;
eti->height = 0;
+ eti->width = 0;
+ eti->minimum_width = 0;
eti->height_cache = NULL;
eti->height_cache_idle_id = 0;
@@ -1042,7 +1053,7 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
y -= eti->y1;
x1 = 0;
- for (col = 0; col < cols; col++, x1 = x2){
+ for (col = 0; col < cols - 1; col++, x1 = x2){
ETableCol *ecol = e_table_header_get_column (eti->header, col);
if (x < x1)
@@ -1050,31 +1061,26 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
x2 = x1 + ecol->width;
- if (x > x2)
- continue;
-
- *col_res = col;
- if (x1_res)
- *x1_res = x - x1;
- break;
+ if (x <= x2)
+ break;
}
y1 = y2 = 0;
- for (row = 0; row < rows; row++, y1 = y2){
+ for (row = 0; row < rows - 1; row++, y1 = y2){
if (y < y1)
return FALSE;
y2 += ETI_ROW_HEIGHT (eti, row) + 1;
- if (y > y2)
- continue;
-
- *row_res = row;
- if (y1_res)
- *y1_res = y - y1;
- break;
+ if (y <= y2)
+ break;
}
-
+ *col_res = col;
+ if (x1_res)
+ *x1_res = x - x1;
+ *row_res = row;
+ if (y1_res)
+ *y1_res = y - y1;
return TRUE;
}
@@ -1324,6 +1330,8 @@ eti_class_init (GtkObjectClass *object_class)
gtk_object_add_arg_type ("ETableItem::length_threshold", GTK_TYPE_INT,
GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
+ gtk_object_add_arg_type ("ETableItem::minimum_width", GTK_TYPE_DOUBLE,
+ GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("ETableItem::height", GTK_TYPE_DOUBLE,
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
index daa436db88..9cdb04c2ff 100644
--- a/widgets/table/e-table-item.h
+++ b/widgets/table/e-table-item.h
@@ -18,7 +18,7 @@ typedef struct {
ETableHeader *header;
int x1, y1;
- int width, height;
+ int minimum_width, width, height;
int cols, rows;
@@ -73,6 +73,7 @@ typedef struct {
guint needs_redraw : 1;
guint needs_compute_height : 1;
+ guint needs_compute_width : 1;
} ETableItem;
typedef struct {
diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c
index 0271b03697..d12a57fbbb 100644
--- a/widgets/table/e-table-size-test.c
+++ b/widgets/table/e-table-size-test.c
@@ -210,7 +210,7 @@ create_table (void)
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
/* Add it to the header. */
e_table_header_add_column (e_table_header, ecol, i);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 51b03f4f65..e306abf35f 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -134,8 +134,6 @@ e_table_setup_header (ETable *e_table)
gnome_canvas_root (e_table->header_canvas),
e_table_header_item_get_type (),
"ETableHeader", e_table->header,
- "x", 0,
- "y", 0,
"sort_info", e_table->sort_info,
NULL);
@@ -150,27 +148,31 @@ static void
table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
ETable *e_table)
{
- gdouble height;
gdouble width;
-
- gtk_object_get (GTK_OBJECT (e_table->group),
- "height", &height,
- NULL);
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->table_canvas),
- 0, 0, alloc->width, MAX (height, alloc->height));
width = alloc->width;
+
gtk_object_set (GTK_OBJECT (e_table->group),
+ "minimum_width", width,
+ NULL);
+ gtk_object_set (GTK_OBJECT (e_table->header),
"width", width,
NULL);
+
}
static void
table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
{
- table_canvas_size_allocate (GTK_WIDGET (canvas),
- &(GTK_WIDGET (canvas)->allocation),
- e_table);
+ gdouble height, width;
+ GtkAllocation *alloc = &(GTK_WIDGET (canvas)->allocation);
+
+ gtk_object_get (GTK_OBJECT (e_table->group),
+ "height", &height,
+ "width", &width,
+ NULL);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_table->table_canvas),
+ 0, 0, MAX(width, alloc->width), MAX (height, alloc->height));
}
static void
@@ -199,7 +201,7 @@ changed_idle (gpointer data)
e_table_fill_table (et, et->model);
gtk_object_set (GTK_OBJECT (et->group),
- "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
+ "minimum_width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
NULL);
}
@@ -295,16 +297,6 @@ static void
e_table_fill_table (ETable *e_table, ETableModel *model)
{
e_table_group_add_all (e_table->group);
-#if 0
- count = e_table_model_row_count (model);
- gtk_object_set (GTK_OBJECT (e_table->group),
- "frozen", TRUE, NULL);
- for (i = 0; i < count; i++)
- e_table_group_add (e_table->group, i);
-
- gtk_object_set (GTK_OBJECT (e_table->group),
- "frozen", FALSE, NULL);
-#endif
}
static ETableHeader *
@@ -372,6 +364,8 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
xmlNode *xmlRoot;
xmlNode *xmlColumns;
xmlNode *xmlGrouping;
+ int no_header;
+ int row = 0;
GtkWidget *scrolledwindow;
@@ -381,6 +375,8 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
if ((xmlColumns == NULL) || (xmlGrouping == NULL))
return NULL;
+
+ no_header = e_xml_get_integer_prop_by_name(xmlRoot, "no-header");
e_table->full_header = full_header;
gtk_object_ref (GTK_OBJECT (full_header));
@@ -393,8 +389,14 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table->header = et_xml_to_header (e_table, full_header, xmlColumns);
et_grouping_xml_to_sort_info (e_table, xmlGrouping);
+
+ gtk_object_set(GTK_OBJECT(e_table->header),
+ "sort_info", e_table->sort_info,
+ NULL);
- e_table_setup_header (e_table);
+ if (!no_header) {
+ e_table_setup_header (e_table);
+ }
e_table_setup_table (e_table, full_header, e_table->header, etm);
e_table_fill_table (e_table, etm);
@@ -412,21 +414,23 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
GTK_WIDGET (e_table->table_canvas));
gtk_widget_show (scrolledwindow);
- /*
- * The header
- */
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
- 1, 2, 1, 2,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
-
+ if (!no_header) {
+ /*
+ * The header
+ */
+ gtk_table_attach (
+ GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
+ 0, 1, 0, 1,
+ GTK_FILL | GTK_EXPAND,
+ GTK_FILL, 0, 0);
+ row ++;
+ }
/*
* The body
*/
gtk_table_attach (
GTK_TABLE (e_table), GTK_WIDGET (scrolledwindow),
- 1, 2, 2, 3,
+ 0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
GTK_FILL | GTK_EXPAND, 0, 0);
diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c
index c05111d1b4..3a32098245 100644
--- a/widgets/table/test-check.c
+++ b/widgets/table/test-check.c
@@ -139,11 +139,11 @@ check_test (void)
cell_image_check = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_compare, TRUE);
+ col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 0.0, 18, cell_image_check, g_int_compare, TRUE);
gdk_pixbuf_unref (pixbuf);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_compare, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
e_table_col_set_arrow (col_1, E_TABLE_COL_ARROW_DOWN);
diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c
index f60d22d915..6756511fb4 100644
--- a/widgets/table/test-cols.c
+++ b/widgets/table/test-cols.c
@@ -153,10 +153,10 @@ multi_cols_test (void)
g_free (images);
}
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_compare, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE);
e_table_header_add_column (e_table_header, col_1, 0);
- col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_compare, TRUE);
+ col_0 = e_table_col_new (0, "A", 0.0, 48, cell_image_toggle, g_int_compare, TRUE);
e_table_header_add_column (e_table_header, col_0, 1);
/*
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
index 38f690ec43..a882b8dbdf 100644
--- a/widgets/table/test-table.c
+++ b/widgets/table/test-table.c
@@ -231,7 +231,7 @@ table_browser_test (void)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
i, column_labels [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
e_table_header_add_column (e_table_header, ecol, i);
@@ -324,7 +324,7 @@ do_e_table_demo (const char *spec)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
i, column_labels [i],
- 80, 20, cell_left_just,
+ 1.0, 20, cell_left_just,
g_str_compare, TRUE);
e_table_header_add_column (full_header, ecol, i);