aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog21
-rw-r--r--shell/Makefile.am6
-rw-r--r--shell/check-empty.xpm21
-rw-r--r--shell/check-filled.xpm21
-rw-r--r--shell/check-missing.xpm20
-rw-r--r--shell/e-storage-set-view.c73
-rw-r--r--shell/e-storage-set-view.etspec2
7 files changed, 133 insertions, 31 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b8d0b288cd..14b151ac1e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,26 @@
2002-05-14 Christopher James Lahey <clahey@ximian.com>
+ * Makefile.am: Added check-empty.xpm, check-filled.xpm, and
+ check-missing.xpm.
+
+ * check-empty.xpm, check-filled.xpm, check-missing.xpm: New xpms.
+ Copied from gal. check-missing.xpm is simply a transparent xpm of
+ the correct size.
+
+ * e-storage-set-view.c (etree_value_at): When getting, check if
+ the path doesn't have a check box and return 2 in that case.
+ (etree_set_value_at): Check if the path doesn't have a check box
+ and don't change it in that case. Also, just invert the value
+ here instead of paying attention to the set value passed in.
+ (class_init): Initialize the checks GdkPixbufs.
+ (e_storage_set_view_construct): Create the "optional_checkbox"
+ cell.
+
+ * e-storage-set-view.etspec: Changed the cell for the checkbox
+ column to "optional_checkbox".
+
+2002-05-14 Christopher James Lahey <clahey@ximian.com>
+
* evolution-storage.c (evolution_storage_new_folder): Compute the
evolutionUri here and pass it in.
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 90f6707c3c..8bbdb5eff8 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -252,11 +252,17 @@ etspec_DATA = \
@XML_I18N_MERGE_OAF_RULE@
+icons = \
+ check-empty.xpm \
+ check-filled.xpm \
+ check-missing.xpm
+
EXTRA_DIST = \
$(IDLS) \
$(oaf_in_files) \
$(oaf_DATA) \
$(etspec_DATA) \
+ $(icons) \
GNOME_Evolution_TestComponent.oaf
# Purify support
diff --git a/shell/check-empty.xpm b/shell/check-empty.xpm
new file mode 100644
index 0000000000..746b20234e
--- /dev/null
+++ b/shell/check-empty.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * check_empty_xpm[] = {
+"16 16 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ............ ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" . . ",
+" ............ ",
+" ",
+" "};
diff --git a/shell/check-filled.xpm b/shell/check-filled.xpm
new file mode 100644
index 0000000000..c0468fc25b
--- /dev/null
+++ b/shell/check-filled.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * check_filled_xpm[] = {
+"16 16 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ............ ",
+" . . ",
+" . . . ",
+" . .. . ",
+" . ... . ",
+" . . ... . ",
+" . .. ... . ",
+" . ..... . ",
+" . ... . ",
+" . . . ",
+" . . ",
+" ............ ",
+" ",
+" "};
diff --git a/shell/check-missing.xpm b/shell/check-missing.xpm
new file mode 100644
index 0000000000..72bdb7a782
--- /dev/null
+++ b/shell/check-missing.xpm
@@ -0,0 +1,20 @@
+/* XPM */
+static const char * check_missing_xpm[] = {
+"16 16 1 1",
+" c None",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 6d3557ad36..d7ec5be1c6 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -39,12 +39,20 @@
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/e-table/e-tree-memory-callbacks.h>
-#include <gal/e-table/e-cell-tree.h>
#include <gal/e-table/e-cell-text.h>
+#include <gal/e-table/e-cell-toggle.h>
+#include <gal/e-table/e-cell-tree.h>
#include <gal/unicode/gunicode.h>
#include <libgnome/gnome-util.h>
+#include "check-empty.xpm"
+#include "check-filled.xpm"
+#include "check-missing.xpm"
+
+
+static GdkPixbuf *checks [3];
+
/*#define DEBUG_XML*/
@@ -1144,6 +1152,12 @@ etree_get_node_by_id (ETreeModel *etm,
return g_hash_table_lookup (storage_set_view->priv->path_to_etree_node, save_id);
}
+static gboolean
+has_checkbox (EStorageSetView *storage_set_view, ETreePath tree_path)
+{
+ return TRUE;
+}
+
static void *
etree_value_at (ETreeModel *etree,
ETreePath tree_path,
@@ -1194,10 +1208,12 @@ etree_value_at (ETreeModel *etree,
return GINT_TO_POINTER (FALSE);
return GINT_TO_POINTER (e_folder_get_highlighted (folder));
case 2: /* checkbox */
+ if (!has_checkbox (storage_set_view, tree_path))
+ return GINT_TO_POINTER (2);
if (priv->checkboxes == NULL)
- return GINT_TO_POINTER (FALSE);
- return GINT_TO_POINTER(!!g_hash_table_lookup (priv->checkboxes,
- path));
+ return GINT_TO_POINTER (0);
+ return GINT_TO_POINTER(g_hash_table_lookup (priv->checkboxes,
+ path) ? 1 : 0);
default:
return NULL;
}
@@ -1236,44 +1252,34 @@ etree_set_value_at (ETreeModel *etree,
char *path;
EStorageSetView *storage_set_view;
EStorageSetViewPrivate *priv;
+ char *old_path;
storage_set_view = E_STORAGE_SET_VIEW (model_data);
priv = storage_set_view->priv;
switch (col) {
case 2: /* checkbox */
+ if (!has_checkbox (storage_set_view, tree_path))
+ return;
+
+ e_tree_model_pre_change (etree);
+
value = GPOINTER_TO_INT (val);
path = (char *) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path);
- e_tree_model_pre_change (etree);
- if (value) {
- if (!priv->checkboxes) {
- priv->checkboxes = g_hash_table_new (g_str_hash, g_str_equal);
- } else {
- if (g_hash_table_lookup (priv->checkboxes, path)) {
- e_tree_model_no_change (etree);
- return;
- }
- }
+ if (!priv->checkboxes) {
+ priv->checkboxes = g_hash_table_new (g_str_hash, g_str_equal);
+ }
+
+ old_path = g_hash_table_lookup (priv->checkboxes, path);
+ if (old_path) {
+ g_hash_table_remove (priv->checkboxes, path);
+ g_free (old_path);
+ } else {
path = g_strdup (path);
g_hash_table_insert (priv->checkboxes, path, path);
- } else {
- char *temp;
-
- if (!priv->checkboxes) {
- e_tree_model_no_change (etree);
- return;
- } else {
- if (!g_hash_table_lookup (priv->checkboxes, path)) {
- e_tree_model_no_change (etree);
- return;
- }
- }
-
- temp = g_hash_table_lookup (priv->checkboxes, path);
- g_hash_table_remove (priv->checkboxes, path);
- g_free (temp);
}
+
e_tree_model_node_col_changed (etree, tree_path, col);
gtk_signal_emit (GTK_OBJECT (storage_set_view),
signals[CHECKBOXES_CHANGED]);
@@ -1599,6 +1605,10 @@ class_init (EStorageSetViewClass *klass)
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+
+ checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm);
+ checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm);
+ checks [2] = gdk_pixbuf_new_from_xpm_data (check_missing_xpm);
}
static void
@@ -1820,6 +1830,9 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
e_table_extras_add_cell (extras, "render_tree",
e_cell_tree_new (NULL, NULL, TRUE, cell));
+ e_table_extras_add_cell (extras, "optional_checkbox",
+ e_cell_toggle_new (2, 3, checks));
+
e_tree_construct_from_spec_file (E_TREE (storage_set_view), priv->etree_model, extras,
EVOLUTION_ETSPECDIR "/e-storage-set-view.etspec", NULL);
diff --git a/shell/e-storage-set-view.etspec b/shell/e-storage-set-view.etspec
index fdbf782dad..f0a8bbfc11 100644
--- a/shell/e-storage-set-view.etspec
+++ b/shell/e-storage-set-view.etspec
@@ -1,6 +1,6 @@
<ETableSpecification no-headers="true" selection-mode="single" cursor-mode="line" draw-grid="false" horizontal-scrolling="true">
<ETableColumn model_col="0" _title="Folder" expansion="1.0" minimum_width="20" resizable="true" cell="render_tree" compare="string" search="string"/>
- <ETableColumn model_col="2" _title="Checkbox" expansion="0.0" minimum_width="18" resizable="false" cell="checkbox" compare="integer"/>
+ <ETableColumn model_col="2" _title="Checkbox" expansion="0.0" minimum_width="18" resizable="false" cell="optional_checkbox" compare="integer"/>
<ETableState>
<column source="0"/>
<grouping></grouping>