aboutsummaryrefslogtreecommitdiffstats
path: root/mail/subscribe-dialog.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-10-12 07:09:06 +0800
committerChris Toshok <toshok@src.gnome.org>2000-10-12 07:09:06 +0800
commit6a5f7cd5df189fd15ab359d4e771bdf3bf3aa442 (patch)
tree4491582feb99f25e3dbcc726c8503646f18819cc /mail/subscribe-dialog.c
parent73f34050a143f01dd6ec004018ca514b37852343 (diff)
downloadgsoc2013-evolution-6a5f7cd5df189fd15ab359d4e771bdf3bf3aa442.tar.gz
gsoc2013-evolution-6a5f7cd5df189fd15ab359d4e771bdf3bf3aa442.tar.zst
gsoc2013-evolution-6a5f7cd5df189fd15ab359d4e771bdf3bf3aa442.zip
set expansion to 0.0, minimum-width to 16, and resizable to false for the
2000-10-11 Chris Toshok <toshok@helixcode.com> * subscribe-dialog.c (FOLDER_ETABLE_SPEC): set expansion to 0.0, minimum-width to 16, and resizable to false for the subscribed column. (folder_info_subscribed): new function so we can do the correct path munging. (subscribe_folder_info): only add the folder to the storage if there wasn't an exception subscribing it. (unsubscribe_folder_info): same, but unsubscribing. (folder_etree_value_at): use folder_info_subscribed. (folder_toggle_cb): same. (unsubscribe_folder_foreach): same. (subscribe_folder_foreach): same. (subscribe_dialog_gui_init): set the bold column on the text cell, and add the subscribed pixbuf. svn path=/trunk/; revision=5869
Diffstat (limited to 'mail/subscribe-dialog.c')
-rw-r--r--mail/subscribe-dialog.c65
1 files changed, 44 insertions, 21 deletions
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index 7d850adb26..fc8b6b7282 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -42,7 +42,7 @@
#define PARENT_TYPE (gtk_object_get_type ())
#define FOLDER_ETABLE_SPEC "<ETableSpecification cursor-mode=\"line\"> \
- <ETableColumn model_col=\"0\" pixbuf=\"subscribed-image\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"cell_toggle\" compare=\"string\"/> \
+ <ETableColumn model_col=\"0\" pixbuf=\"subscribed-image\" expansion=\"0.0\" minimum_width=\"16\" resizable=\"false\" cell=\"cell_toggle\" compare=\"integer\"/> \
<ETableColumn model_col=\"1\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"cell_tree\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
@@ -125,21 +125,40 @@ make_folder_search_widget (GtkSignalFunc start_search_func,
+static gboolean
+folder_info_subscribed (SubscribeDialog *sc, CamelFolderInfo *info)
+{
+ char *path;
+ gboolean retval;
+
+ path = g_strdup_printf ("/%s", info->full_name);
+
+ retval = camel_store_folder_subscribed (sc->store, path);
+
+ g_free (path);
+
+ return retval;
+}
+
static void
subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info)
{
char *path;
+ CamelException *ex = camel_exception_new ();
- path = g_strdup_printf ("/%s", info->full_name); /* XXX */
+ path = g_strdup_printf ("/%s", info->full_name);
- camel_store_subscribe_folder (sc->store, info->name, NULL);
+ camel_store_subscribe_folder (sc->store, path, ex);
- evolution_storage_new_folder (sc->storage,
- path,
- info->name, "mail",
- info->url,
- _("(No description)") /* XXX */);
+ if (!camel_exception_is_set (ex)) {
+ evolution_storage_new_folder (sc->storage,
+ path,
+ info->name, "mail",
+ info->url,
+ _("(No description)") /* XXX */);
+ }
+ camel_exception_free (ex);
g_free (path);
}
@@ -147,13 +166,17 @@ static void
unsubscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info)
{
char *path;
+ CamelException *ex = camel_exception_new ();
- path = g_strdup_printf ("/%s", info->full_name); /* XXX */
+ path = g_strdup_printf ("/%s", info->full_name);
- camel_store_unsubscribe_folder (sc->store, info->name, NULL);
+ camel_store_unsubscribe_folder (sc->store, path, ex);
- evolution_storage_removed_folder (sc->storage, path);
+ if (!camel_exception_is_set (ex)) {
+ evolution_storage_removed_folder (sc->storage, path);
+ }
+ camel_exception_free (ex);
g_free (path);
}
@@ -185,10 +208,7 @@ subscribe_folder_foreach (int model_row, gpointer closure)
ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row);
CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node);
- printf ("subscribe: row %d, node_data %p\n", model_row,
- e_tree_model_node_get_data (sc->folder_model, node));
-
- if (!camel_store_folder_subscribed (sc->store, info->name)) {
+ if (!folder_info_subscribed (sc, info)) {
subscribe_folder_info (sc, info);
e_tree_model_node_changed (sc->folder_model, node);
}
@@ -210,10 +230,7 @@ unsubscribe_folder_foreach (int model_row, gpointer closure)
ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row);
CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node);
- printf ("unsubscribe: row %d, node_data %p\n", model_row,
- e_tree_model_node_get_data (sc->folder_model, node));
-
- if (camel_store_folder_subscribed (sc->store, info->name)) {
+ if (folder_info_subscribed(sc, info)) {
unsubscribe_folder_info (sc, info);
e_tree_model_node_changed (sc->folder_model, node);
}
@@ -367,7 +384,7 @@ folder_etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_
if (col == FOLDER_COL_NAME)
return info->name;
else /* FOLDER_COL_SUBSCRIBED */
- return GINT_TO_POINTER(camel_store_folder_subscribed (dialog->store, info->name));
+ return GINT_TO_POINTER(folder_info_subscribed(dialog, info));
}
static void
@@ -512,7 +529,7 @@ folder_toggle_cb (ETable *table,
ETreePath *node = e_tree_model_node_at_row (sc->folder_model, row);
CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node);
- if (camel_store_folder_subscribed (sc->store, info->name))
+ if (folder_info_subscribed(sc, info))
unsubscribe_folder_info (sc, info);
else
subscribe_folder_info (sc, info);
@@ -696,6 +713,12 @@ subscribe_dialog_gui_init (SubscribeDialog *sc)
e_table_extras_add_cell (extras, "cell_toggle", e_cell_toggle_new (0, 2, toggles));
e_table_extras_add_cell (extras, "cell_tree", e_cell_tree_new(NULL, NULL, TRUE, cell));
+ gtk_object_set (GTK_OBJECT (cell),
+ "bold_column", FOLDER_COL_SUBSCRIBED,
+ NULL);
+
+ e_table_extras_add_pixbuf (extras, "subscribed-image", toggles[1]);
+
sc->folder_etable = e_table_scrolled_new (E_TABLE_MODEL(sc->folder_model),
extras, FOLDER_ETABLE_SPEC, NULL);