aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>2000-04-06 14:46:20 +0800
committerMiguel de Icaza <miguel@src.gnome.org>2000-04-06 14:46:20 +0800
commitbbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69 (patch)
tree10b8992cf86eb9aa0221266742d255dfaabcc08d
parent3d9889baee9c5c11cd960a43c0f51c449ce35b45 (diff)
downloadgsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.gz
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.bz2
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.lz
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.xz
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.zst
gsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.zip
Load the icons from the installation path, not form the GNOME-libs
2000-04-06 Miguel de Icaza <miguel@gnu.org> * shell/e-shortcut.c (shell_icon_cb): Load the icons from the installation path, not form the GNOME-libs installation prefix. (shell_icon_cb): Memory leak fix. * shell/Makefile.am (imagesdir): Pass the EVOLUTION_IMAGES installation directory here. * art/Makefile.am (images_DATA): Renamed from pixmaps to images. 2000-04-06 Miguel de Icaza <miguel@gnu.org> * message-list.c: Stick pixmaps here. * mail-display.c (embeddable_destroy_cb): Replaced C++ comments with C comments. * message-list.c (load_internal_images): New function, loads images. (message_list_init_renderers): Load images, fix previous attempt at loading images. * Makefile.am (dist-hook): Added distribution of pixmaps. * pixmaps: New directory, used to hold the XPMs we ship with. * pixmaps/envelope-closed.xpm, pixmaps/envelope-open.xpm: Tigert's envelopes incorporated. 2000-04-06 Miguel de Icaza <miguel@gnu.org> * e-cell-text.c: Killed ARG_EDITABLE. (ect_event): Updated to new editable setup. (e_cell_text_new): Kill editable argument. * e-cell-toggle.c (etog_event): Handle editability here * e-cell-text.h: Removed editable bit field from here, it is now taken care at the e-cell level. * e-cell.c (e_cell_set_editable): New function. (e_cell_init): Set editable to TRUE by default. * test-check.c (check_test): update to new api * test-table.c (table_browser_test): ditto. (do_e_table_demo): ditto. * test-cols.c (multi_cols_test): ditto svn path=/trunk/; revision=2302
-rw-r--r--ChangeLog11
-rw-r--r--art/Makefile.am4
-rw-r--r--mail/ChangeLog22
-rw-r--r--mail/Makefile.am4
-rw-r--r--mail/mail-display.c7
-rw-r--r--mail/message-list.c153
-rw-r--r--mail/pixmaps.h10
-rw-r--r--mail/pixmaps/attachment.xpm22
-rw-r--r--mail/pixmaps/empty.xpm21
-rw-r--r--mail/pixmaps/envelope-closed.xpm65
-rw-r--r--mail/pixmaps/envelope-opened.xpm74
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shortcut.c5
-rw-r--r--widgets/e-table/ChangeLog50
-rw-r--r--widgets/e-table/TODO6
-rw-r--r--widgets/e-table/e-cell-text.c9
-rw-r--r--widgets/e-table/e-cell-text.h3
-rw-r--r--widgets/e-table/e-cell-toggle.c6
-rw-r--r--widgets/e-table/e-cell.c14
-rw-r--r--widgets/e-table/e-cell.h9
-rw-r--r--widgets/e-table/e-table-example-1.c159
-rw-r--r--widgets/e-table/e-table-example-2.c2
-rw-r--r--widgets/e-table/test-check.c2
-rw-r--r--widgets/e-table/test-cols.c2
-rw-r--r--widgets/e-table/test-table.c4
-rw-r--r--widgets/table/e-cell-text.c9
-rw-r--r--widgets/table/e-cell-text.h3
-rw-r--r--widgets/table/e-cell-toggle.c6
-rw-r--r--widgets/table/e-cell.c14
-rw-r--r--widgets/table/e-cell.h9
-rw-r--r--widgets/table/e-table-example-1.c159
-rw-r--r--widgets/table/e-table-example-2.c2
-rw-r--r--widgets/table/test-check.c2
-rw-r--r--widgets/table/test-cols.c2
-rw-r--r--widgets/table/test-table.c4
35 files changed, 653 insertions, 223 deletions
diff --git a/ChangeLog b/ChangeLog
index e7a2863b6c..b6b19218e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-04-06 Miguel de Icaza <miguel@gnu.org>
+
+ * shell/e-shortcut.c (shell_icon_cb): Load the icons from the
+ installation path, not form the GNOME-libs installation prefix.
+ (shell_icon_cb): Memory leak fix.
+
+ * shell/Makefile.am (imagesdir): Pass the EVOLUTION_IMAGES
+ installation directory here.
+
+ * art/Makefile.am (images_DATA): Renamed from pixmaps to images.
+
2000-04-05 Matt Loper <matt@helixcode.com>
* README: Added wombat.
diff --git a/art/Makefile.am b/art/Makefile.am
index 9ae3a7ca90..df8dcdc588 100644
--- a/art/Makefile.am
+++ b/art/Makefile.am
@@ -1,6 +1,6 @@
-pixmapdir = $(datadir)/pixmaps/evolution
+imagesdir = $(datadir)/images/evolution
-pixmap_DATA = \
+images_DATA = \
evolution-calendar.png \
evolution-contacts.png \
evolution-inbox.png \
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 4cea6c6a55..6877b6f8f9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,25 @@
+2000-04-06 Miguel de Icaza <miguel@gnu.org>
+
+ * message-list.c: Stick pixmaps here.
+
+ * mail-display.c (embeddable_destroy_cb): Replaced C++ comments
+ with C comments.
+
+ * message-list.c (load_internal_images): New function, loads images.
+ (message_list_init_renderers): Load images, fix previous attempt
+ at loading images.
+
+ * Makefile.am (dist-hook): Added distribution of pixmaps.
+
+ * pixmaps: New directory, used to hold the XPMs we ship with.
+
+ * pixmaps/envelope-closed.xpm, pixmaps/envelope-open.xpm: Tigert's
+ envelopes incorporated.
+
+2000-03-31 Miguel de Icaza <miguel@gnu.org>
+
+ * message-list.c (ml_value_at): Fix miss-used variable.
+
2000-04-01 Michael Meeks <michael@helixcode.com>
* folder-browser.c (folder_browser_properties_init): update to
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 936312eecd..707d514af3 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -73,3 +73,7 @@ $(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl
orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl
EXTRA_DIST = Mail.idl evolution-mail.gnorba
+
+dist-hook:
+ -mkdir $(distdir)/pixmaps
+ cp $(srcdir)/pixmaps/*.xpm $(distdir)/pixmaps \ No newline at end of file
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 57da4b65f8..fa3d3588eb 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -141,7 +141,6 @@ embeddable_destroy_cb (GtkObject *obj, gpointer user_data)
{
BonoboWidget *be; /* bonobo embeddable */
BonoboViewFrame *vf; /* the embeddable view frame */
- GtkWidget *w; /* the viewframe widget */
BonoboObjectClient* server;
CORBA_Environment ev;
@@ -155,9 +154,9 @@ embeddable_destroy_cb (GtkObject *obj, gpointer user_data)
vf = bonobo_widget_get_view_frame (be);
bonobo_control_frame_control_deactivate (
BONOBO_CONTROL_FRAME (vf));
- //w = bonobo_control_frame_get_widget (BONOBO_CONTROL_FRAME (vf));
+ /* w = bonobo_control_frame_get_widget (BONOBO_CONTROL_FRAME (vf)); */
- //gtk_widget_destroy (w);
+ /* gtk_widget_destroy (w); */
CORBA_exception_init (&ev);
Bonobo_Unknown_unref (
@@ -167,7 +166,7 @@ embeddable_destroy_cb (GtkObject *obj, gpointer user_data)
CORBA_exception_free (&ev);
bonobo_object_destroy (BONOBO_OBJECT (vf));
- //gtk_object_unref (obj);
+ /* gtk_object_unref (obj); */
}
diff --git a/mail/message-list.c b/mail/message-list.c
index f84d0d2797..a5ede2071f 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -20,6 +20,8 @@
#include "widgets/e-table/e-table-header-item.h"
#include "widgets/e-table/e-table-item.h"
+#include "pixmaps.h"
+
/*
* Default sizes for the ETable display
*
@@ -32,8 +34,8 @@
#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(20)
-#define COL_SENT_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)
@@ -133,7 +135,7 @@ ml_value_at (ETableModel *etm, int col, int row, void *data)
static char buffer [10];
MessageList *message_list = data;
CamelFolderSummary *summary;
- GPtrArray *msg_info_array;
+ GPtrArray *msg_info_array = NULL;
CamelMessageInfo *msg_info;
CamelException ex;
void *retval = NULL;
@@ -215,16 +217,17 @@ ml_value_at (ETableModel *etm, int col, int row, void *data)
return retval;
- nothing_to_see :
- /*
- * in the case there is nothing to look at,
- * notify the user.
- */
+ nothing_to_see:
+ /*
+ * in the case there is nothing to look at,
+ * notify the user.
+ */
+ if (msg_info_array)
g_ptr_array_free (msg_info_array, TRUE);
- if (col == COL_SUBJECT)
- return "No item in this view";
- else
- return NULL;
+ if (col == COL_SUBJECT)
+ return "No item in this view";
+ else
+ return NULL;
}
static void
@@ -246,7 +249,7 @@ ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data)
case COL_MESSAGE_STATUS:
case COL_PRIORITY:
case COL_ATTACHMENT:
- return value;
+ return (void *) value;
case COL_FROM:
case COL_SUBJECT:
@@ -254,7 +257,7 @@ ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data)
case COL_RECEIVE:
case COL_TO:
case COL_SIZE:
- return g_strdup(value);
+ return g_strdup (value);
default:
g_assert_not_reached ();
}
@@ -269,7 +272,7 @@ ml_free_value (ETableModel *etm, int col, void *value, void *data)
case COL_MESSAGE_STATUS:
case COL_PRIORITY:
case COL_ATTACHMENT:
- break;
+ break;
case COL_FROM:
case COL_SUBJECT:
@@ -277,8 +280,8 @@ ml_free_value (ETableModel *etm, int col, void *value, void *data)
case COL_RECEIVE:
case COL_TO:
case COL_SIZE:
- g_free(value);
- break;
+ g_free (value);
+ break;
default:
g_assert_not_reached ();
}
@@ -287,36 +290,78 @@ ml_free_value (ETableModel *etm, int col, void *value, void *data)
static void
ml_thaw (ETableModel *etm, void *data)
{
- e_table_model_changed(etm);
+ e_table_model_changed (etm);
}
+static struct {
+ char **image_base;
+ GdkPixbuf *pixbuf;
+} states_pixmaps [] = {
+ { envelope_opened_xpm, NULL },
+ { envelope_closed_xpm, NULL },
+ { empty_xpm, NULL },
+ { attachment_xpm, NULL },
+ { NULL, NULL },
+};
+
static void
-message_list_init_renderers (MessageList *message_list)
+load_internal_images (void)
{
- gchar *attachment_path;
- GdkPixbuf *image;
+ int i;
+ /*
+ * Only load once, and share
+ */
+ if (states_pixmaps [0].pixbuf)
+ return;
+
+ for (i = 0; states_pixmaps [i].image_base; i++){
+ states_pixmaps [i].pixbuf = gdk_pixbuf_new_from_xpm_data (
+ states_pixmaps [i].image_base);
+ }
+}
+
+static void
+message_list_init_renderers (MessageList *message_list)
+{
g_assert (message_list);
g_assert (message_list->table_model);
+
+ load_internal_images ();
message_list->render_text = e_cell_text_new (
message_list->table_model,
- NULL, GTK_JUSTIFY_LEFT, FALSE);
+ NULL, GTK_JUSTIFY_LEFT);
+ e_cell_set_editable (E_CELL (message_list->render_text), FALSE);
message_list->render_online_status = e_cell_checkbox_new ();
- message_list->render_message_status = e_cell_checkbox_new ();
-#if 1
- message_list->render_attachment = e_cell_checkbox_new ();
-#else
+
+ /*
+ * Message status
+ */
+ {
+ GdkPixbuf *images [2];
+
+ images [0] = states_pixmaps [0].pixbuf;
+ images [1] = states_pixmaps [1].pixbuf;
+
+ message_list->render_message_status = e_cell_toggle_new (0, 2, images);
+ }
+ e_cell_set_editable (E_CELL (message_list->render_message_status), FALSE);
+
/*
- * if we want to use a pixmap, use this code
+ * Attachment
*/
- attachment_path = gnome_unconditional_datadir_file ("evolution/e-attchmt.png");
- image = gdk_pixbuf_new_from_file (attachment_path);
- message_list->render_attachment = e_cell_toggle_new (0, 1, &image);
- g_free (attachment_path);
-#endif
+ {
+ GdkPixbuf *images [2];
+ images [0] = states_pixmaps [2].pixbuf;
+ images [1] = states_pixmaps [3].pixbuf;
+
+ message_list->render_attachment = e_cell_toggle_new (0, 2, images);
+ }
+ e_cell_set_editable (E_CELL (message_list->render_attachment), FALSE);
+
/*
* FIXME: We need a real renderer here
*/
@@ -336,8 +381,8 @@ message_list_init_header (MessageList *message_list)
*/
message_list->header_model = e_table_header_new ();
- gtk_object_ref(GTK_OBJECT(message_list->header_model));
- gtk_object_sink(GTK_OBJECT(message_list->header_model));
+ gtk_object_ref (GTK_OBJECT (message_list->header_model));
+ gtk_object_sink (GTK_OBJECT (message_list->header_model));
message_list->table_cols [COL_ONLINE_STATUS] =
e_table_col_new (COL_ONLINE_STATUS, _("Online status"),
@@ -404,15 +449,22 @@ message_list_init_header (MessageList *message_list)
* of this.
*/
for (i = 0; i < COL_LAST; i++) {
- gtk_object_ref(GTK_OBJECT(message_list->table_cols [i]));
+ gtk_object_ref (GTK_OBJECT (message_list->table_cols [i]));
e_table_header_add_column (message_list->header_model,
message_list->table_cols [i], i);
}
}
-
-
-
+static char *
+message_list_get_layout (MessageList *message_list)
+{
+ if (0)
+ return g_strdup ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> <column> 5 </column> <column> 6 </column> <column> 7 </column> <column> 8 </column> <column> 9 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"5\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>");
+ else {
+ /* Message status, From, Sent, Subject */
+ return g_strdup ("<ETableSpecification> <columns-shown> <column> 1 </column> <column> 4 </column> <column> 6 </column> <column> 5 </column> </columns-shown> <grouping> </grouping> </ETableSpecification>");
+ }
+}
/*
* GtkObject::init
@@ -421,7 +473,8 @@ static void
message_list_init (GtkObject *object)
{
MessageList *message_list = MESSAGE_LIST (object);
-
+ char *spec;
+
message_list->table_model = e_table_simple_new (
ml_col_count, ml_row_count, ml_value_at,
ml_set_value_at, ml_is_cell_editable, ml_duplicate_value, ml_free_value,
@@ -433,16 +486,19 @@ message_list_init (GtkObject *object)
/*
* The etable
*/
+
+ spec = message_list_get_layout (message_list);
+ message_list->etable = e_table_new (
+ message_list->header_model, message_list->table_model, spec);
+ g_free (spec);
- message_list->etable = e_table_new (message_list->header_model, message_list->table_model, "<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> <column> 5 </column> <column> 6 </column> <column> 7 </column> <column> 8 </column> <column> 9 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"5\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>");
-
- gtk_signal_connect(GTK_OBJECT(message_list->etable), "row_selection",
- GTK_SIGNAL_FUNC(on_row_selection_cmd), message_list);
+ gtk_signal_connect (GTK_OBJECT (message_list->etable), "row_selection",
+ GTK_SIGNAL_FUNC (on_row_selection_cmd), message_list);
- gtk_widget_show(message_list->etable);
+ gtk_widget_show (message_list->etable);
- gtk_object_ref(message_list->table_model);
- gtk_object_sink(message_list->table_model);
+ gtk_object_ref (GTK_OBJECT (message_list->table_model));
+ gtk_object_sink (GTK_OBJECT (message_list->table_model));
/*
* We do own the Etable, not some widget container
@@ -662,8 +718,6 @@ message_list_get_widget (MessageList *message_list)
E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE);
-
-
static void
on_row_selection_cmd (ETable *table,
int row,
@@ -674,7 +728,8 @@ on_row_selection_cmd (ETable *table,
message_list = MESSAGE_LIST (user_data);
- if ( selected )
+
+ if (selected)
select_msg (message_list, row);
}
diff --git a/mail/pixmaps.h b/mail/pixmaps.h
new file mode 100644
index 0000000000..2d11733bbb
--- /dev/null
+++ b/mail/pixmaps.h
@@ -0,0 +1,10 @@
+#ifndef EVOLUTION_PIXMAPS_H
+#define EVOLUTION_PIXMAPS_H
+
+#include "pixmaps/envelope-opened.xpm"
+#include "pixmaps/envelope-closed.xpm"
+#include "pixmaps/empty.xpm"
+#include "pixmaps/attachment.xpm"
+
+#endif /* EVOLUTION_PIXMAPS_H */
+
diff --git a/mail/pixmaps/attachment.xpm b/mail/pixmaps/attachment.xpm
new file mode 100644
index 0000000000..45e2dfb134
--- /dev/null
+++ b/mail/pixmaps/attachment.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char * attachment_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".......++.......",
+"....+..+.+......",
+"....+.+..++.....",
+"....+.+...+.....",
+"....+.+...+.....",
+"....+.+...+.....",
+"....+.+...+.....",
+"....+.+...+.....",
+"....+.....+.....",
+"....+.....+.....",
+"....++...++.....",
+".....++.++......",
+".......++.......",
+"................",
+"................"};
diff --git a/mail/pixmaps/empty.xpm b/mail/pixmaps/empty.xpm
new file mode 100644
index 0000000000..93b02c0164
--- /dev/null
+++ b/mail/pixmaps/empty.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char * empty_xpm[] = {
+"16 16 2 1",
+" c None",
+". c #FFFFFF",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................"};
diff --git a/mail/pixmaps/envelope-closed.xpm b/mail/pixmaps/envelope-closed.xpm
new file mode 100644
index 0000000000..be3b6e1a34
--- /dev/null
+++ b/mail/pixmaps/envelope-closed.xpm
@@ -0,0 +1,65 @@
+/* XPM */
+static char * envelope_closed_xpm[] = {
+"16 16 46 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"@ c #837D71",
+"# c #4E4B42",
+"$ c #767165",
+"% c #FFFEFE",
+"& c #FFF4DB",
+"* c #FFFEFD",
+"= c #F4E9D1",
+"- c #625D54",
+"; c #D0C7B2",
+"> c #767166",
+", c #FFFDFA",
+"' c #F2E7CF",
+") c #666257",
+"! c #C8BFAB",
+"~ c #736D63",
+"{ c #FFFEFC",
+"] c #F6EBD3",
+"^ c #EEE3CC",
+"/ c #FAEFD6",
+"( c #918A7C",
+"_ c #7E786B",
+": c #E0D6C0",
+"< c #C7BEAA",
+"[ c #FDF2D9",
+"} c #8A8476",
+"| c #746F63",
+"1 c #CEC4B0",
+"2 c #8C8678",
+"3 c #F9EED5",
+"4 c #F1E6CE",
+"5 c #F7ECD3",
+"6 c #EFE4CD",
+"7 c #D1C7B2",
+"8 c #555149",
+"9 c #CDC4B0",
+"0 c #666258",
+"a c #C1B8A5",
+"b c #C2B9A6",
+"c c #C0B7A4",
+"d c #C3BAA7",
+"e c #C4BBA8",
+"f c #CAC1AD",
+"g c #4E4B43",
+" ",
+" ...............",
+" ...............",
+" ...............",
+" ...............",
+" ..+++++++++++..",
+" .+@.........#+.",
+" .+.$%&.&*&=-;+.",
+" .+.&>%&,&')'!+.",
+" .+.&&~{&])&^!+.",
+" .+.&/().)_=:<+.",
+" .+.[}&&)]]|1<+.",
+" .+.2&^3456789+.",
+" .+0abbbcddefg+.",
+" ..+++++++++++..",
+" ..............."};
diff --git a/mail/pixmaps/envelope-opened.xpm b/mail/pixmaps/envelope-opened.xpm
new file mode 100644
index 0000000000..4894e21a78
--- /dev/null
+++ b/mail/pixmaps/envelope-opened.xpm
@@ -0,0 +1,74 @@
+/* XPM */
+static char * envelope_opened_xpm[] = {
+"16 16 55 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"@ c #F4EDDD",
+"# c #F1EBDB",
+"$ c #F1EAD8",
+"% c #EAE3CB",
+"& c #F4EAD5",
+"* c #F1E6CF",
+"= c #DDD4BE",
+"- c #ECE3CD",
+"; c #D3CAB6",
+"> c #C1C1C1",
+", c #BDBDBD",
+"' c #BFBFBF",
+") c #12110F",
+"! c #514D45",
+"~ c #767165",
+"{ c #D0C7B2",
+"] c #FFF4DB",
+"^ c #625D54",
+"/ c #565249",
+"( c #F2E7CF",
+"_ c #C8BFAB",
+": c #3B3732",
+"< c #837D71",
+"[ c #807A6D",
+"} c #45423B",
+"| c #EEE3CC",
+"1 c #FBF0D7",
+"2 c #918A7C",
+"3 c #7E786B",
+"4 c #F4E9D1",
+"5 c #E0D6C0",
+"6 c #C7BEAA",
+"7 c #FDF2D9",
+"8 c #6A665B",
+"9 c #F6EBD3",
+"0 c #656157",
+"a c #CEC4B0",
+"b c #6D675D",
+"c c #F9EED5",
+"d c #F1E6CE",
+"e c #F7ECD3",
+"f c #EFE4CD",
+"g c #D1C7B2",
+"h c #CDC4B0",
+"i c #080707",
+"j c #C1B8A5",
+"k c #C2B9A6",
+"l c #C0B7A4",
+"m c #C3BAA7",
+"n c #C4BBA8",
+"o c #CAC1AD",
+"p c #1E1D1A",
+" ",
+" ...............",
+" .....+++++.....",
+" ....+@#$$%+....",
+" ...+&*****=+...",
+" ..+-*******;+..",
+" .++>,,,,,,,')+.",
+" .+.!.......~{+.",
+" .+.]^...../(_+.",
+" .+.]]:<<[}]|_+.",
+" .+.]12]]]3456+.",
+" .+.78]]]990a6+.",
+" .+.b]|cdefg0h+.",
+" .+ijkkklmmnop+.",
+" ..+++++++++++..",
+" ..............."};
diff --git a/shell/Makefile.am b/shell/Makefile.am
index f7d4476eac..6a5d1cbf7a 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,3 +1,4 @@
+imagesdir = $(datadir)/images/evolution
bin_PROGRAMS = evolution
@@ -5,6 +6,7 @@ INCLUDES = \
-I$(top_srcdir)/widgets \
-I$(top_srcdir) \
$(BONOBO_GNOME_CFLAGS) \
+ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DEVOLUTION_VERSION=\""$(VERSION)"\" \
-DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\"
diff --git a/shell/e-shortcut.c b/shell/e-shortcut.c
index 5386efb182..9d6d17893f 100644
--- a/shell/e-shortcut.c
+++ b/shell/e-shortcut.c
@@ -370,13 +370,14 @@ shell_icon_cb (EShortcutBar *shortcut_bar, gchar *url)
if (!shell_icons[i].image) {
char *pixmap_path;
- pixmap_path = gnome_pixmap_file (shell_icons[i].path);
+ pixmap_path = g_strconcat (EVOLUTION_IMAGES, shell_icons[i].path, NULL);
if (pixmap_path)
shell_icons[i].image = gdk_pixbuf_new_from_file (pixmap_path);
else {
- g_warning ("Couldn't find pixmap: %s",
+ g_warning ("Couldn't find image: %s",
pixmap_path);
}
+ g_free (pixmap_path);
}
return shell_icons[i].image;
}
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index c91bb0040a..0166aeddaa 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,53 @@
+2000-04-06 Miguel de Icaza <miguel@gnu.org>
+
+ * e-cell-text.c: Killed ARG_EDITABLE.
+ (ect_event): Updated to new editable setup.
+ (e_cell_text_new): Kill editable argument.
+
+ * e-cell-toggle.c (etog_event): Handle editability here
+
+ * e-cell-text.h: Removed editable bit field from here, it is now
+ taken care at the e-cell level.
+
+ * e-cell.c (e_cell_set_editable): New function.
+ (e_cell_init): Set editable to TRUE by default.
+
+ * test-check.c (check_test): update to new api
+
+ * test-table.c (table_browser_test): ditto.
+ (do_e_table_demo): ditto.
+
+ * test-cols.c (multi_cols_test): ditto
+
+2000-04-02 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table-sort-info.c (e_table_sort_info_class_init): Kill
+ argument. Do not use XML internally
+ (e_table_sort_info_set_sorting): New function, use this to set the
+ sorting.
+ (e_table_sort_info_set_grouping): This one to do the grouping/.
+
+2000-04-01 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table.c (e_table_build_column_spec): Drop frozen support.
+ (e_table_make_header): Drop frozen support.
+
+ * e-table-header.c (e_table_header_new): Drop frozen support.
+
+ * e-table-header-item.c (ethi_drag_motion): Drop frozen support.
+ (ethi_drag_drop): Drop frozen support.
+ (ethi_start_drag): Drop frozen support.
+
+ * e-table.c (e_table_construct_from_spec_file): Robustify: support
+ the case in which the XML could not be parsed; Propagate errors.
+ (e_table_new): Handle failure.
+ (e_table_new_from_spec_file): ditto.
+ Renamed multiple internal functions whose prefix was et_ to be e_table_
+
+2000-03-31 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table-simple.h: Constify this.
+
2000-04-04 Christopher James Lahey <clahey@helixcode.com>
* e-table-text-model.c: Make this assert a bit more readable.
diff --git a/widgets/e-table/TODO b/widgets/e-table/TODO
index 35ba2eb6b9..65379a25be 100644
--- a/widgets/e-table/TODO
+++ b/widgets/e-table/TODO
@@ -70,8 +70,14 @@ mouse grabbing for scrolling
* Implement ETableDataEntry (a subclass of ETableModel).
* Build GUI for the data entry model. This should be fairly simple.
+* Usability
+
+ * When the widget grows, the columns should resize to occupy all the
+ available space
+
* Draw little arrows for new column position instead of little triangles.
* Make new column position be closest to position instead of rounding to the left.
* Copy gtk_dnd as e_dnd.
* Fix known bug about navigating out of the bottom of the table.
+
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index ac3eb292a9..45eec9cb0f 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -70,7 +70,6 @@ enum {
ARG_FILL_STIPPLE,
ARG_TEXT_WIDTH,
ARG_TEXT_HEIGHT,
- ARG_EDITABLE,
ARG_USE_ELLIPSIS,
ARG_ELLIPSIS
};
@@ -786,7 +785,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
return TRUE;
}
- if ((!edit_display) && ect->editable) {
+ if ((!edit_display) && E_CELL_IS_EDITABLE (ect)) {
e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
ect_edit_select_all (text_view);
edit = text_view->edit;
@@ -817,7 +816,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
event->button.x -= 4;
event->button.y -= 1;
if ((!edit_display)
- && ect->editable
+ && E_CELL_IS_EDITABLE (ect)
&& event->type == GDK_BUTTON_RELEASE
&& event->button.button == 1) {
GdkEventButton button = event->button;
@@ -1092,15 +1091,13 @@ e_cell_text_class_init (GtkObjectClass *object_class)
E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE);
ECell *
-e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify, gboolean editable)
+e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify)
{
ECellText *ect = gtk_type_new (e_cell_text_get_type ());
ect->ellipsis = NULL;
ect->use_ellipsis = TRUE;
- ect->editable = editable;
-
ect->font_name = g_strdup (fontname);
ect->justify = justify;
diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h
index 80afdf46ac..7e42a1d276 100644
--- a/widgets/e-table/e-cell-text.h
+++ b/widgets/e-table/e-cell-text.h
@@ -48,7 +48,6 @@ typedef struct {
char *ellipsis; /* The ellipsis characters. NULL = "...". */
guint use_ellipsis : 1; /* Whether to use the ellipsis. */
- guint editable : 1; /* Item is editable */
} ECellText;
typedef struct {
@@ -56,7 +55,7 @@ typedef struct {
} ECellTextClass;
GtkType e_cell_text_get_type (void);
-ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify, gboolean editable);
+ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify);
#endif /* _E_CELL_TEXT_H_ */
diff --git a/widgets/e-table/e-cell-toggle.c b/widgets/e-table/e-cell-toggle.c
index 676ec44b3a..996d1d72fd 100644
--- a/widgets/e-table/e-cell-toggle.c
+++ b/widgets/e-table/e-cell-toggle.c
@@ -201,10 +201,16 @@ etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
switch (event->type){
case GDK_BUTTON_RELEASE:
+ if (!E_CELL_IS_EDITABLE (ecell_view->ecell))
+ return FALSE;
+
etog_set_value (toggle_view, model_col, view_col, row, value + 1);
return TRUE;
case GDK_KEY_PRESS:
+ if (!E_CELL_IS_EDITABLE (ecell_view->ecell))
+ return FALSE;
+
if (event->key.keyval == GDK_space){
etog_set_value (toggle_view, model_col, view_col, row, value + 1);
return TRUE;
diff --git a/widgets/e-table/e-cell.c b/widgets/e-table/e-cell.c
index b472b6f6ff..d038f80b5c 100644
--- a/widgets/e-table/e-cell.c
+++ b/widgets/e-table/e-cell.c
@@ -109,6 +109,10 @@ e_cell_class_init (GtkObjectClass *object_class)
static void
e_cell_init (GtkObject *object)
{
+ /*
+ * By default we are editable, that is what the old behaviour was
+ */
+ e_cell_set_editable (E_CELL (object), TRUE);
}
E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);
@@ -174,3 +178,13 @@ e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row,
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
ecell_view, model_col, view_col, row, edit_context);
}
+
+void
+e_cell_set_editable (ECell *ecell, gboolean editable)
+{
+ if (editable)
+ GTK_OBJECT (ecell)->flags |= E_CELL_EDITABLE;
+ else
+ GTK_OBJECT (ecell)->flags &= ~E_CELL_EDITABLE;
+}
+
diff --git a/widgets/e-table/e-cell.h b/widgets/e-table/e-cell.h
index 8804d2066f..8098d553f5 100644
--- a/widgets/e-table/e-cell.h
+++ b/widgets/e-table/e-cell.h
@@ -14,6 +14,13 @@
typedef struct _ECell ECell;
typedef struct _ECellView ECellView;
+/* Object flags for ECells */
+enum {
+ E_CELL_EDITABLE = 1 << 4
+};
+
+#define E_CELL_IS_EDITABLE(e) (GTK_OBJECT (e)->flags & E_CELL_EDITABLE)
+
struct _ECell {
GtkObject object;
};
@@ -74,4 +81,6 @@ int e_cell_height (ECellView *ecell_view, int model_col, int view_col,
void *e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row);
void e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context);
+void e_cell_set_editable (ECell *ecell, gboolean editable);
+
#endif /* _E_CELL_H_ */
diff --git a/widgets/e-table/e-table-example-1.c b/widgets/e-table/e-table-example-1.c
index 38059c4a4b..0b3e40e5b7 100644
--- a/widgets/e-table/e-table-example-1.c
+++ b/widgets/e-table/e-table-example-1.c
@@ -17,40 +17,40 @@
#include "table-test.h"
/*
-One way in which we make it simpler to build an ETableModel is through
-the ETableSimple class. Instead of creating your own ETableModel
-class, you simply create a new object of the ETableSimple class. You
-give it a bunch of functions that act as callbacks.
-
-You also get to pass a void * to ETableSimple and it gets passed to
-your callbacks. This would be for having multiple models of the same
-type. This is just an example though, so we statically define all the
-data and ignore the void *data parameter.
-
-In our example we will be creating a table model with 6 columns and 10
-rows. This corresponds to having 6 different types of information and
-10 different sets of data in our database.
-
-The headers will be hard coded, as will be the example data.
-
-*/
+ * One way in which we make it simpler to build an ETableModel is through
+ * the ETableSimple class. Instead of creating your own ETableModel
+ * class, you simply create a new object of the ETableSimple class. You
+ * give it a bunch of functions that act as callbacks.
+ *
+ * You also get to pass a void * to ETableSimple and it gets passed to
+ * your callbacks. This would be for having multiple models of the same
+ * type. This is just an example though, so we statically define all the
+ * data and ignore the void *data parameter.
+ *
+ * In our example we will be creating a table model with 6 columns and 10
+ * rows. This corresponds to having 6 different types of information and
+ * 10 different sets of data in our database.
+ *
+ * The headers will be hard coded, as will be the example data.
+ *
+ */
/*
- There are two different meanings to the word "column". The first is
- the model column. A model column corresponds to a specific type of
- data. This is very much like the usage in a database table where a
- column is a field in the database.
-
- The second type of column is a view column. A view column
- corresponds to a visually displayed column. Each view column
- corresponds to a specific model column, though a model column may
- have any number of view columns associated with it, from zero to
- greater than one.
-
- Also, a view column doesn't necessarily depend on only one model
- column. In some cases, the view column renderer can be given a
- reference to another column to get extra information about its
- display.
+ * There are two different meanings to the word "column". The first is
+ * the model column. A model column corresponds to a specific type of
+ * data. This is very much like the usage in a database table where a
+ * column is a field in the database.
+ *
+ * The second type of column is a view column. A view column
+ * corresponds to a visually displayed column. Each view column
+ * corresponds to a specific model column, though a model column may
+ * have any number of view columns associated with it, from zero to
+ * greater than one.
+ *
+ * Also, a view column doesn't necessarily depend on only one model
+ * column. In some cases, the view column renderer can be given a
+ * reference to another column to get extra information about its
+ * display.
*/
#define ROWS 10
@@ -59,13 +59,16 @@ The headers will be hard coded, as will be the example data.
#define IMPORTANCE_COLUMN 4
#define COLOR_COLUMN 5
-/* Here we define the initial layout of the table. This is an xml
- format that allows you to change the initial ordering of the
- columns or to do sorting or grouping initially. This specification
- shows all 5 columns, but moves the importance column nearer to the
- front. It also sorts by the "Full Name" column (ascending.)
- Sorting and grouping take the model column as their arguments
- (sorting is specified by the "column" argument to the leaf elemnt. */
+/*
+ * Here we define the initial layout of the table. This is an xml
+ * format that allows you to change the initial ordering of the
+ * columns or to do sorting or grouping initially. This specification
+ * shows all 5 columns, but moves the importance column nearer to the
+ * front. It also sorts by the "Full Name" column (ascending.)
+ * Sorting and grouping take the model column as their arguments
+ * (sorting is specified by the "column" argument to the leaf elemnt.
+ */
+
#define INITIAL_SPEC "<ETableSpecification> \
<columns-shown> \
<column> 0 </column> \
@@ -84,12 +87,13 @@ char *headers [COLS] = {
"Phone"
};
-/* Virtual Column list:
- 0 Email
- 1 Full Name
- 2 Address
- 3 Phone
-*/
+/*
+ * Virtual Column list:
+ * 0 Email
+ * 1 Full Name
+ * 2 Address
+ * 3 Phone
+ */
char *table_data [ROWS] [COLS];
@@ -98,8 +102,10 @@ char *table_data [ROWS] [COLS];
* These are the callbacks that define the behavior of our custom model.
*/
-/* Since our model is a constant size, we can just return its size in
- the column and row count fields. */
+/*
+ * Since our model is a constant size, we can just return its size in
+ * the column and row count fields.
+ */
/* This function returns the number of columns in our ETableModel. */
static int
@@ -180,26 +186,31 @@ create_table (void)
my_set_value_at, my_is_cell_editable,
my_duplicate_value, my_free_value, my_thaw, NULL);
/*
- Next we create a header. The ETableHeader is used in two
- different way. The first is the full_header. This is the
- list of possible columns in the view. The second use is
- completely internal. Many of the ETableHeader functions are
- for that purpose. The only functions we really need are
- e_table_header_new and e_table_header_add_col.
-
- First we create the header. */
+ * Next we create a header. The ETableHeader is used in two
+ * different way. The first is the full_header. This is the
+ * list of possible columns in the view. The second use is
+ * completely internal. Many of the ETableHeader functions are
+ * for that purpose. The only functions we really need are
+ * e_table_header_new and e_table_header_add_col.
+ *
+ * First we create the header.
+ */
e_table_header = e_table_header_new ();
- /* Next we have to build renderers for all of the columns.
- Since all our columns are text columns, we can simply use
- the same renderer over and over again. If we had different
- types of columns, we could use a different renderer for
- each column. */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ /*
+ * Next we have to build renderers for all of the columns.
+ * Since all our columns are text columns, we can simply use
+ * the same renderer over and over again. If we had different
+ * types of columns, we could use a different renderer for
+ * each column.
+ */
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
- /* Next we create a column object for each view column and add
- them to the header. We don't create a column object for
- the importance column since it will not be shown. */
+ /*
+ * Next we create a column object for each view column and add
+ * them to the header. We don't create a column object for
+ * the importance column since it will not be shown.
+ */
for (i = 0; i < COLS; i++) {
/* Create the column. */
ETableCol *ecol = e_table_col_new (
@@ -210,15 +221,21 @@ create_table (void)
e_table_header_add_column (e_table_header, ecol, i);
}
- /* Here we create a window for our new table. This window
- will get shown and the person will be able to test their
- item. */
+ /*
+ * Here we create a window for our new table. This window
+ * will get shown and the person will be able to test their
+ * item.
+ */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
/* This frame is simply to get a bevel around our table. */
frame = gtk_frame_new (NULL);
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
+
+ /*
+ * Here we create the table. We give it the three pieces of
+ * the table we've created, the header, the model, and the
+ * initial layout. It does the rest.
+ */
e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC);
/* Build the gtk widget hierarchy. */
@@ -227,6 +244,7 @@ create_table (void)
/* Size the initial window. */
gtk_widget_set_usize (window, 200, 200);
+
/* Show it all. */
gtk_widget_show_all (window);
}
@@ -249,3 +267,4 @@ main (int argc, char *argv [])
e_cursors_shutdown ();
return 0;
}
+
diff --git a/widgets/e-table/e-table-example-2.c b/widgets/e-table/e-table-example-2.c
index 8d7c484580..6db06625a3 100644
--- a/widgets/e-table/e-table-example-2.c
+++ b/widgets/e-table/e-table-example-2.c
@@ -230,7 +230,7 @@ create_table ()
the same renderer over and over again. If we had different
types of columns, we could use a different renderer for
each column. */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
/* Next we create a column object for each view column and add
them to the header. We don't create a column object for
diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c
index 06b26105b1..c05111d1b4 100644
--- a/widgets/e-table/test-check.c
+++ b/widgets/e-table/test-check.c
@@ -135,7 +135,7 @@ check_test (void)
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
cell_image_check = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c
index 66ea35d1ce..15e07d94da 100644
--- a/widgets/e-table/test-cols.c
+++ b/widgets/e-table/test-cols.c
@@ -134,7 +134,7 @@ multi_cols_test (void)
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
{
GdkPixbuf **images = g_new (GdkPixbuf *, 3);
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
index 00ff6089c9..0fd086681c 100644
--- a/widgets/e-table/test-table.c
+++ b/widgets/e-table/test-table.c
@@ -225,7 +225,7 @@ table_browser_test (void)
* Header
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
@@ -309,7 +309,7 @@ do_e_table_demo (const char *spec)
thaw, NULL);
full_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index ac3eb292a9..45eec9cb0f 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -70,7 +70,6 @@ enum {
ARG_FILL_STIPPLE,
ARG_TEXT_WIDTH,
ARG_TEXT_HEIGHT,
- ARG_EDITABLE,
ARG_USE_ELLIPSIS,
ARG_ELLIPSIS
};
@@ -786,7 +785,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
return TRUE;
}
- if ((!edit_display) && ect->editable) {
+ if ((!edit_display) && E_CELL_IS_EDITABLE (ect)) {
e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
ect_edit_select_all (text_view);
edit = text_view->edit;
@@ -817,7 +816,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
event->button.x -= 4;
event->button.y -= 1;
if ((!edit_display)
- && ect->editable
+ && E_CELL_IS_EDITABLE (ect)
&& event->type == GDK_BUTTON_RELEASE
&& event->button.button == 1) {
GdkEventButton button = event->button;
@@ -1092,15 +1091,13 @@ e_cell_text_class_init (GtkObjectClass *object_class)
E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE);
ECell *
-e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify, gboolean editable)
+e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify)
{
ECellText *ect = gtk_type_new (e_cell_text_get_type ());
ect->ellipsis = NULL;
ect->use_ellipsis = TRUE;
- ect->editable = editable;
-
ect->font_name = g_strdup (fontname);
ect->justify = justify;
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
index 80afdf46ac..7e42a1d276 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/table/e-cell-text.h
@@ -48,7 +48,6 @@ typedef struct {
char *ellipsis; /* The ellipsis characters. NULL = "...". */
guint use_ellipsis : 1; /* Whether to use the ellipsis. */
- guint editable : 1; /* Item is editable */
} ECellText;
typedef struct {
@@ -56,7 +55,7 @@ typedef struct {
} ECellTextClass;
GtkType e_cell_text_get_type (void);
-ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify, gboolean editable);
+ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify);
#endif /* _E_CELL_TEXT_H_ */
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 676ec44b3a..996d1d72fd 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -201,10 +201,16 @@ etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col,
switch (event->type){
case GDK_BUTTON_RELEASE:
+ if (!E_CELL_IS_EDITABLE (ecell_view->ecell))
+ return FALSE;
+
etog_set_value (toggle_view, model_col, view_col, row, value + 1);
return TRUE;
case GDK_KEY_PRESS:
+ if (!E_CELL_IS_EDITABLE (ecell_view->ecell))
+ return FALSE;
+
if (event->key.keyval == GDK_space){
etog_set_value (toggle_view, model_col, view_col, row, value + 1);
return TRUE;
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index b472b6f6ff..d038f80b5c 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -109,6 +109,10 @@ e_cell_class_init (GtkObjectClass *object_class)
static void
e_cell_init (GtkObject *object)
{
+ /*
+ * By default we are editable, that is what the old behaviour was
+ */
+ e_cell_set_editable (E_CELL (object), TRUE);
}
E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);
@@ -174,3 +178,13 @@ e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row,
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
ecell_view, model_col, view_col, row, edit_context);
}
+
+void
+e_cell_set_editable (ECell *ecell, gboolean editable)
+{
+ if (editable)
+ GTK_OBJECT (ecell)->flags |= E_CELL_EDITABLE;
+ else
+ GTK_OBJECT (ecell)->flags &= ~E_CELL_EDITABLE;
+}
+
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
index 8804d2066f..8098d553f5 100644
--- a/widgets/table/e-cell.h
+++ b/widgets/table/e-cell.h
@@ -14,6 +14,13 @@
typedef struct _ECell ECell;
typedef struct _ECellView ECellView;
+/* Object flags for ECells */
+enum {
+ E_CELL_EDITABLE = 1 << 4
+};
+
+#define E_CELL_IS_EDITABLE(e) (GTK_OBJECT (e)->flags & E_CELL_EDITABLE)
+
struct _ECell {
GtkObject object;
};
@@ -74,4 +81,6 @@ int e_cell_height (ECellView *ecell_view, int model_col, int view_col,
void *e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row);
void e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context);
+void e_cell_set_editable (ECell *ecell, gboolean editable);
+
#endif /* _E_CELL_H_ */
diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c
index 38059c4a4b..0b3e40e5b7 100644
--- a/widgets/table/e-table-example-1.c
+++ b/widgets/table/e-table-example-1.c
@@ -17,40 +17,40 @@
#include "table-test.h"
/*
-One way in which we make it simpler to build an ETableModel is through
-the ETableSimple class. Instead of creating your own ETableModel
-class, you simply create a new object of the ETableSimple class. You
-give it a bunch of functions that act as callbacks.
-
-You also get to pass a void * to ETableSimple and it gets passed to
-your callbacks. This would be for having multiple models of the same
-type. This is just an example though, so we statically define all the
-data and ignore the void *data parameter.
-
-In our example we will be creating a table model with 6 columns and 10
-rows. This corresponds to having 6 different types of information and
-10 different sets of data in our database.
-
-The headers will be hard coded, as will be the example data.
-
-*/
+ * One way in which we make it simpler to build an ETableModel is through
+ * the ETableSimple class. Instead of creating your own ETableModel
+ * class, you simply create a new object of the ETableSimple class. You
+ * give it a bunch of functions that act as callbacks.
+ *
+ * You also get to pass a void * to ETableSimple and it gets passed to
+ * your callbacks. This would be for having multiple models of the same
+ * type. This is just an example though, so we statically define all the
+ * data and ignore the void *data parameter.
+ *
+ * In our example we will be creating a table model with 6 columns and 10
+ * rows. This corresponds to having 6 different types of information and
+ * 10 different sets of data in our database.
+ *
+ * The headers will be hard coded, as will be the example data.
+ *
+ */
/*
- There are two different meanings to the word "column". The first is
- the model column. A model column corresponds to a specific type of
- data. This is very much like the usage in a database table where a
- column is a field in the database.
-
- The second type of column is a view column. A view column
- corresponds to a visually displayed column. Each view column
- corresponds to a specific model column, though a model column may
- have any number of view columns associated with it, from zero to
- greater than one.
-
- Also, a view column doesn't necessarily depend on only one model
- column. In some cases, the view column renderer can be given a
- reference to another column to get extra information about its
- display.
+ * There are two different meanings to the word "column". The first is
+ * the model column. A model column corresponds to a specific type of
+ * data. This is very much like the usage in a database table where a
+ * column is a field in the database.
+ *
+ * The second type of column is a view column. A view column
+ * corresponds to a visually displayed column. Each view column
+ * corresponds to a specific model column, though a model column may
+ * have any number of view columns associated with it, from zero to
+ * greater than one.
+ *
+ * Also, a view column doesn't necessarily depend on only one model
+ * column. In some cases, the view column renderer can be given a
+ * reference to another column to get extra information about its
+ * display.
*/
#define ROWS 10
@@ -59,13 +59,16 @@ The headers will be hard coded, as will be the example data.
#define IMPORTANCE_COLUMN 4
#define COLOR_COLUMN 5
-/* Here we define the initial layout of the table. This is an xml
- format that allows you to change the initial ordering of the
- columns or to do sorting or grouping initially. This specification
- shows all 5 columns, but moves the importance column nearer to the
- front. It also sorts by the "Full Name" column (ascending.)
- Sorting and grouping take the model column as their arguments
- (sorting is specified by the "column" argument to the leaf elemnt. */
+/*
+ * Here we define the initial layout of the table. This is an xml
+ * format that allows you to change the initial ordering of the
+ * columns or to do sorting or grouping initially. This specification
+ * shows all 5 columns, but moves the importance column nearer to the
+ * front. It also sorts by the "Full Name" column (ascending.)
+ * Sorting and grouping take the model column as their arguments
+ * (sorting is specified by the "column" argument to the leaf elemnt.
+ */
+
#define INITIAL_SPEC "<ETableSpecification> \
<columns-shown> \
<column> 0 </column> \
@@ -84,12 +87,13 @@ char *headers [COLS] = {
"Phone"
};
-/* Virtual Column list:
- 0 Email
- 1 Full Name
- 2 Address
- 3 Phone
-*/
+/*
+ * Virtual Column list:
+ * 0 Email
+ * 1 Full Name
+ * 2 Address
+ * 3 Phone
+ */
char *table_data [ROWS] [COLS];
@@ -98,8 +102,10 @@ char *table_data [ROWS] [COLS];
* These are the callbacks that define the behavior of our custom model.
*/
-/* Since our model is a constant size, we can just return its size in
- the column and row count fields. */
+/*
+ * Since our model is a constant size, we can just return its size in
+ * the column and row count fields.
+ */
/* This function returns the number of columns in our ETableModel. */
static int
@@ -180,26 +186,31 @@ create_table (void)
my_set_value_at, my_is_cell_editable,
my_duplicate_value, my_free_value, my_thaw, NULL);
/*
- Next we create a header. The ETableHeader is used in two
- different way. The first is the full_header. This is the
- list of possible columns in the view. The second use is
- completely internal. Many of the ETableHeader functions are
- for that purpose. The only functions we really need are
- e_table_header_new and e_table_header_add_col.
-
- First we create the header. */
+ * Next we create a header. The ETableHeader is used in two
+ * different way. The first is the full_header. This is the
+ * list of possible columns in the view. The second use is
+ * completely internal. Many of the ETableHeader functions are
+ * for that purpose. The only functions we really need are
+ * e_table_header_new and e_table_header_add_col.
+ *
+ * First we create the header.
+ */
e_table_header = e_table_header_new ();
- /* Next we have to build renderers for all of the columns.
- Since all our columns are text columns, we can simply use
- the same renderer over and over again. If we had different
- types of columns, we could use a different renderer for
- each column. */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ /*
+ * Next we have to build renderers for all of the columns.
+ * Since all our columns are text columns, we can simply use
+ * the same renderer over and over again. If we had different
+ * types of columns, we could use a different renderer for
+ * each column.
+ */
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
- /* Next we create a column object for each view column and add
- them to the header. We don't create a column object for
- the importance column since it will not be shown. */
+ /*
+ * Next we create a column object for each view column and add
+ * them to the header. We don't create a column object for
+ * the importance column since it will not be shown.
+ */
for (i = 0; i < COLS; i++) {
/* Create the column. */
ETableCol *ecol = e_table_col_new (
@@ -210,15 +221,21 @@ create_table (void)
e_table_header_add_column (e_table_header, ecol, i);
}
- /* Here we create a window for our new table. This window
- will get shown and the person will be able to test their
- item. */
+ /*
+ * Here we create a window for our new table. This window
+ * will get shown and the person will be able to test their
+ * item.
+ */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
/* This frame is simply to get a bevel around our table. */
frame = gtk_frame_new (NULL);
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
+
+ /*
+ * Here we create the table. We give it the three pieces of
+ * the table we've created, the header, the model, and the
+ * initial layout. It does the rest.
+ */
e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC);
/* Build the gtk widget hierarchy. */
@@ -227,6 +244,7 @@ create_table (void)
/* Size the initial window. */
gtk_widget_set_usize (window, 200, 200);
+
/* Show it all. */
gtk_widget_show_all (window);
}
@@ -249,3 +267,4 @@ main (int argc, char *argv [])
e_cursors_shutdown ();
return 0;
}
+
diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c
index 8d7c484580..6db06625a3 100644
--- a/widgets/table/e-table-example-2.c
+++ b/widgets/table/e-table-example-2.c
@@ -230,7 +230,7 @@ create_table ()
the same renderer over and over again. If we had different
types of columns, we could use a different renderer for
each column. */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
/* Next we create a column object for each view column and add
them to the header. We don't create a column object for
diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c
index 06b26105b1..c05111d1b4 100644
--- a/widgets/table/test-check.c
+++ b/widgets/table/test-check.c
@@ -135,7 +135,7 @@ check_test (void)
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
cell_image_check = e_cell_checkbox_new ();
pixbuf = gdk_pixbuf_new_from_file ("clip.png");
diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c
index 66ea35d1ce..15e07d94da 100644
--- a/widgets/table/test-cols.c
+++ b/widgets/table/test-cols.c
@@ -134,7 +134,7 @@ multi_cols_test (void)
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
{
GdkPixbuf **images = g_new (GdkPixbuf *, 3);
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
index 00ff6089c9..0fd086681c 100644
--- a/widgets/table/test-table.c
+++ b/widgets/table/test-table.c
@@ -225,7 +225,7 @@ table_browser_test (void)
* Header
*/
e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
@@ -309,7 +309,7 @@ do_e_table_demo (const char *spec)
thaw, NULL);
full_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE);
+ cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (