aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-09-28 14:48:49 +0800
committerChris Toshok <toshok@src.gnome.org>2000-09-28 14:48:49 +0800
commitf9a01cf88d9383b8715d49470124e3eb11e1d984 (patch)
treea95a3cd29ef7e5fa5c17126fb8c1ffa90fde8923
parent3e77ddc8564793b40832afd8d464ce24b17e40c3 (diff)
downloadgsoc2013-evolution-f9a01cf88d9383b8715d49470124e3eb11e1d984.tar.gz
gsoc2013-evolution-f9a01cf88d9383b8715d49470124e3eb11e1d984.tar.zst
gsoc2013-evolution-f9a01cf88d9383b8715d49470124e3eb11e1d984.zip
new function.
2000-09-27 Chris Toshok <toshok@helixcode.com> * subscribe-control.c (subscribe_refresh_list): new function. * subscribe-control.h (subscribe_refresh_list): new prototype. * subscribe-control-factory.c (update_pixmaps): add RefreshList pixmap. also, add it to the verbs list. svn path=/trunk/; revision=5612
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/subscribe-control-factory.c10
-rw-r--r--mail/subscribe-control.c74
-rw-r--r--mail/subscribe-control.h1
4 files changed, 86 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0244838e78..87fa08d195 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,14 @@
2000-09-27 Chris Toshok <toshok@helixcode.com>
+ * subscribe-control.c (subscribe_refresh_list): new function.
+
+ * subscribe-control.h (subscribe_refresh_list): new prototype.
+
+ * subscribe-control-factory.c (update_pixmaps): add RefreshList
+ pixmap. also, add it to the verbs list.
+
+2000-09-27 Chris Toshok <toshok@helixcode.com>
+
* mail-types.h: add SubscribeControl typedef.
* Makefile.am (evolution_mail_SOURCES): add the subscribe stuff.
diff --git a/mail/subscribe-control-factory.c b/mail/subscribe-control-factory.c
index c49b6471a8..9d1cbb9caa 100644
--- a/mail/subscribe-control-factory.c
+++ b/mail/subscribe-control-factory.c
@@ -42,7 +42,10 @@ static BonoboUIVerb verbs [] = {
/* Folder Menu */
BONOBO_UI_VERB ("SubscribeFolder", subscribe_folder),
BONOBO_UI_VERB ("UnsubscribeFolder", unsubscribe_folder),
-
+
+ /* Toolbar Specific */
+ BONOBO_UI_VERB ("RefreshList", subscribe_refresh_list),
+
BONOBO_UI_VERB_END
};
@@ -69,8 +72,9 @@ set_pixmap (Bonobo_UIContainer container,
static void
update_pixmaps (Bonobo_UIContainer container)
{
- set_pixmap (container, "/Toolbar/SubscribeFolder", "fetch-mail.png");
- set_pixmap (container, "/Toolbar/UnsubscribeFolder", "compose-message.png");
+ set_pixmap (container, "/Toolbar/SubscribeFolder", "fetch-mail.png"); /* XXX */
+ set_pixmap (container, "/Toolbar/UnsubscribeFolder", "compose-message.png"); /* XXX */
+ set_pixmap (container, "/Toolbar/RefreshList", "forward.png"); /* XXX */
}
static void
diff --git a/mail/subscribe-control.c b/mail/subscribe-control.c
index 6bc674261b..4e1f85eff2 100644
--- a/mail/subscribe-control.c
+++ b/mail/subscribe-control.c
@@ -19,14 +19,15 @@
#include <gal/e-table/e-table-scrolled.h>
#include <gal/e-table/e-tree-simple.h>
+#include "art/empty.xpm"
#include "art/mark.xpm"
#define PARENT_TYPE (gtk_table_get_type ())
#define ETABLE_SPEC "<ETableSpecification> \
<columns-shown> \
- <column> 1 </column> \
<column> 0 </column> \
+ <column> 1 </column> \
<column> 2 </column> \
</columns-shown> \
<grouping></grouping> \
@@ -51,6 +52,12 @@ char *headers [COL_LAST] = {
"Description",
};
+/* per node structure */
+typedef struct {
+ gboolean subscribed;
+} SubscribeData;
+
+
static GtkObjectClass *subscribe_control_parent_class;
void
@@ -65,14 +72,63 @@ subscribe_unselect_all (BonoboUIHandler *uih,
{
}
+static void
+subscribe_folder_foreach (int model_row, gpointer closure)
+{
+ SubscribeControl *sc = SUBSCRIBE_CONTROL (closure);
+ ETreePath *node = e_tree_model_node_at_row (sc->model, model_row);
+ SubscribeData *data = e_tree_model_node_get_data (sc->model, node);
+
+ printf ("subscribe: row %d, node_data %p\n", model_row,
+ e_tree_model_node_get_data (sc->model, node));
+
+ data->subscribed = TRUE;
+
+ e_tree_model_node_changed (sc->model, node);
+}
+
void
subscribe_folder (GtkWidget *widget, gpointer user_data)
{
+ SubscribeControl *sc = SUBSCRIBE_CONTROL (user_data);
+
+ printf ("subscribe_folder called\n");
+
+ e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->table)->table,
+ subscribe_folder_foreach, sc);
}
+static void
+unsubscribe_folder_foreach (int model_row, gpointer closure)
+{
+ SubscribeControl *sc = SUBSCRIBE_CONTROL (closure);
+ ETreePath *node = e_tree_model_node_at_row (sc->model, model_row);
+ SubscribeData *data = e_tree_model_node_get_data (sc->model, node);
+
+ printf ("unsubscribe: row %d, node_data %p\n", model_row,
+ e_tree_model_node_get_data (sc->model, node));
+
+ data->subscribed = FALSE;
+
+ e_tree_model_node_changed (sc->model, node);
+}
+
+
void
unsubscribe_folder (GtkWidget *widget, gpointer user_data)
{
+ SubscribeControl *sc = SUBSCRIBE_CONTROL (user_data);
+
+ printf ("unsubscribe_folder called\n");
+
+ e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->table)->table,
+ unsubscribe_folder_foreach, sc);
+}
+
+void
+subscribe_refresh_list (GtkWidget *widget, gpointer user_data)
+{
+ printf ("subscribe_refresh_list\n");
}
gboolean
@@ -198,12 +254,13 @@ etree_icon_at (ETreeModel *etree, ETreePath *path, void *model_data)
static void*
etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_data)
{
+ SubscribeData *data = e_tree_model_node_get_data (etree, path);
if (col == COL_FOLDER_NAME)
return "Folder Name";
else if (col == COL_FOLDER_DESCRIPTION)
return "Folder Description";
else /* COL_FOLDER_SUBSCRIBED */
- return 1; /* XXX */
+ return GINT_TO_POINTER(data->subscribed);
}
static void
@@ -261,13 +318,16 @@ subscribe_control_gui_init (SubscribeControl *sc)
e_tree_model_root_node_set_visible (sc->model, FALSE);
- for (i = 0; i < 100; i ++)
+ for (i = 0; i < 100; i ++) {
+ SubscribeData *data = g_new (SubscribeData, 1);
+ data->subscribed = FALSE;
e_tree_model_node_insert (sc->model, sc->root,
- 0, NULL);
+ 0, data);
+ }
e_table_header = e_table_header_new ();
- toggles[0] = NULL;
+ toggles[0] = gdk_pixbuf_new_from_xpm_data ((const char **)empty_xpm);
toggles[1] = gdk_pixbuf_new_from_xpm_data ((const char **)mark_xpm);
cells[2] = e_cell_text_new (E_TABLE_MODEL(sc->model), NULL, GTK_JUSTIFY_LEFT);
@@ -296,6 +356,10 @@ subscribe_control_gui_init (SubscribeControl *sc)
sc->table = e_table_scrolled_new (e_table_header, E_TABLE_MODEL(sc->model), ETABLE_SPEC);
+ gtk_object_set (GTK_OBJECT (E_TABLE_SCROLLED (sc->table)->table),
+ "cursor_mode", E_TABLE_CURSOR_LINE,
+ NULL);
+
gtk_table_attach (
GTK_TABLE (sc), sc->table,
0, 1, 1, 3,
diff --git a/mail/subscribe-control.h b/mail/subscribe-control.h
index 5124f3a8b7..164dea57dc 100644
--- a/mail/subscribe-control.h
+++ b/mail/subscribe-control.h
@@ -56,5 +56,6 @@ void subscribe_select_all (BonoboUIHandler *uih, void *user_data, const char *
void subscribe_unselect_all (BonoboUIHandler *uih, void *user_data, const char *path);
void subscribe_folder (GtkWidget *widget, gpointer user_data);
void unsubscribe_folder (GtkWidget *widget, gpointer user_data);
+void subscribe_refresh_list (GtkWidget *widget, gpointer user_data);
#endif /* _SUBSCRIBE_CONTROL_H_ */