aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
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 /widgets/e-table
parent3d9889baee9c5c11cd960a43c0f51c449ce35b45 (diff)
downloadgsoc2013-evolution-bbc6d63ef0aa4b2ae1244f1a7de63b0b86f3ce69.tar.gz
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
Diffstat (limited to 'widgets/e-table')
-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
12 files changed, 183 insertions, 83 deletions
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 (