From 97d578613baab00205b157c2cd87baed41dbcf5f Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 20 May 2002 18:05:55 +0000 Subject: Pass NULL for @has_checkbox_func and @has_checkbox_func_data. * e-shell-config-offline.c (e_shell_config_offline_create_control): Pass NULL for @has_checkbox_func and @has_checkbox_func_data. * evolution-storage-set-view.c (impl_StorageSetView__set_showCheckboxes): Pass NULL for @has_checkbox_func and @has_checkbox_func_data. * e-storage-set-view.c: New member has_checkbox_func and has_checkbox_func_data in EStorageSetViewPrivate. (init): Init to NULL. (e_storage_set_view_set_show_checkboxes): New args @has_checkbox_func and @func_data. (has_checkbox): Always return FALSE for the toplevels. For the other ones return TRUE unless ->has_checkbox_func is not-NULL; in which case, we use that function to determine whether the folder is actually checkable. * Evolution-ShellComponent.idl (requestQuit): Remove exception. svn path=/trunk/; revision=16945 --- shell/e-storage-set-view.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'shell/e-storage-set-view.c') diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index d7ec5be1c6..f059e06493 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -107,6 +107,11 @@ struct _EStorageSetViewPrivate { GNOME_Evolution_ShellComponentDnd_Data *drag_corba_data; GHashTable *checkboxes; + + /* Callback to determine whether the row should have a checkbox or + not, when show_checkboxes is TRUE. */ + EStorageSetViewHasCheckBoxFunc has_checkbox_func; + void *has_checkbox_func_data; }; @@ -1155,6 +1160,25 @@ etree_get_node_by_id (ETreeModel *etm, static gboolean has_checkbox (EStorageSetView *storage_set_view, ETreePath tree_path) { + EStorageSetViewPrivate *priv; + const char *folder_path; + + priv = storage_set_view->priv; + + folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY(storage_set_view->priv->etree_model), + tree_path); + g_assert (folder_path != NULL); + + if (strchr (folder_path + 1, '/') == NULL) { + /* If it's a toplevel, never allow checking it. */ + return FALSE; + } + + if (priv->has_checkbox_func) + return (* priv->has_checkbox_func) (priv->storage_set, + folder_path, + priv->has_checkbox_func_data); + return TRUE; } @@ -1636,6 +1660,9 @@ init (EStorageSetView *storage_set_view) priv->checkboxes = NULL; + priv->has_checkbox_func = NULL; + priv->has_checkbox_func_data = NULL; + storage_set_view->priv = priv; } @@ -1990,7 +2017,9 @@ e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view) void e_storage_set_view_set_show_checkboxes (EStorageSetView *storage_set_view, - gboolean show) + gboolean show, + EStorageSetViewHasCheckBoxFunc has_checkbox_func, + void *func_data) { EStorageSetViewPrivate *priv; @@ -2010,6 +2039,9 @@ e_storage_set_view_set_show_checkboxes (EStorageSetView *storage_set_view, e_tree_load_state (E_TREE (storage_set_view), EVOLUTION_ETSPECDIR "/e-storage-set-view-checkboxes.etstate"); else e_tree_load_state (E_TREE (storage_set_view), EVOLUTION_ETSPECDIR "/e-storage-set-view-no-checkboxes.etstate"); + + priv->has_checkbox_func = has_checkbox_func; + priv->has_checkbox_func_data = func_data; } gboolean -- cgit