aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-07-07 05:49:20 +0800
committerIain Holmes <iain@src.gnome.org>2001-07-07 05:49:20 +0800
commit3dc641a7bf4d435e32ee89ad7748c639574a32e0 (patch)
tree719bbdf545625dc1d2ce9e50bf605bc672c950a7 /my-evolution
parent214d03a44a266edbba2e82ab776b950a2bacbaf3 (diff)
downloadgsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.tar.gz
gsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.tar.zst
gsoc2013-evolution-3dc641a7bf4d435e32ee89ad7748c639574a32e0.zip
Mail stuff added
svn path=/trunk/; revision=10867
Diffstat (limited to 'my-evolution')
-rw-r--r--my-evolution/ChangeLog12
-rw-r--r--my-evolution/e-summary-mail.c84
-rw-r--r--my-evolution/e-summary-mail.h8
-rw-r--r--my-evolution/e-summary-preferences.c71
-rw-r--r--my-evolution/my-evolution.glade8
5 files changed, 171 insertions, 12 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 787d5df475..43f4942464 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,5 +1,17 @@
2001-07-06 Iain Holmes <iain@ximian.com>
+ * e-summary-preferences.c (str_list_from_vector): Change the delimiter
+ (vector_from_str_list): Change the delimiter.
+ (fill_mail_all_clist): Fill the mail folder clist.
+ (fill_mail_shown_clist): Use nicer names.
+ (mail_add_clicked_cb): Add folders to the shown list.
+
+ * e-summary-mail.c (e_summary_mail_fill_list): Flatten the hashtable
+ into the CList.
+ (e_summary_mail_uri_to_name): Get the pretty name for a uri.
+
+2001-07-06 Iain Holmes <iain@ximian.com>
+
* e-summary-preferences.c (fill_rdf_shown_list): Attach data
(rdf_add_clicked_cb): Allow multiple rows to be removed.
(rdf_remove_clicked_cb): Use the data.
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c
index 4ce4fd90c9..bf00686f1e 100644
--- a/my-evolution/e-summary-mail.c
+++ b/my-evolution/e-summary-mail.c
@@ -356,3 +356,87 @@ e_summary_mail_reconfigure (ESummary *summary)
e_summary_draw (summary);
}
+
+static void
+free_row_data (gpointer data)
+{
+ ESummaryMailRowData *rd = data;
+
+ g_free (rd->name);
+ g_free (rd->uri);
+ g_free (rd);
+}
+
+static void
+hash_to_list (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ ESummaryMailRowData *rd;
+ ESummaryMailFolder *folder;
+ GList **p;
+
+ p = (GList **) data;
+ folder = (ESummaryMailFolder *) value;
+
+ rd = g_new (ESummaryMailRowData, 1);
+ rd->name = g_strdup (folder->name);
+ rd->uri = g_strdup (key);
+
+ *p = g_list_prepend (*p, rd);
+}
+
+static int
+str_compare (gconstpointer a,
+ gconstpointer b)
+{
+ ESummaryMailRowData *rda, *rdb;
+
+ rda = a;
+ rdb = b;
+ return strcmp (rda->name, rdb->name);
+}
+
+void
+e_summary_mail_fill_list (GtkCList *clist,
+ ESummary *summary)
+{
+ ESummaryMail *mail;
+ GList *names = NULL, *p;
+
+ mail = summary->mail;
+ if (mail == NULL) {
+ return;
+ }
+
+ g_hash_table_foreach (mail->folders, hash_to_list, &names);
+
+ names = g_list_sort (names, str_compare);
+ for (p = names; p; p = p->next) {
+ ESummaryMailRowData *rd;
+ char *text[1];
+ int row;
+
+ rd = p->data;
+ text[0] = rd->name + 1;
+ row = gtk_clist_append (clist, text);
+ gtk_clist_set_row_data_full (clist, row, rd, free_row_data);
+ }
+
+ g_list_free (names);
+}
+
+const char *
+e_summary_mail_uri_to_name (ESummary *summary,
+ const char *uri)
+{
+ ESummaryMailFolder *folder;
+
+ folder = g_hash_table_lookup (summary->mail->folders, uri);
+ if (folder == NULL) {
+ return NULL;
+ } else {
+ return folder->name;
+ }
+}
+
diff --git a/my-evolution/e-summary-mail.h b/my-evolution/e-summary-mail.h
index 67090b4271..09a79ec1f3 100644
--- a/my-evolution/e-summary-mail.h
+++ b/my-evolution/e-summary-mail.h
@@ -17,9 +17,15 @@ enum _ESummaryMailMode {
E_SUMMARY_MAIL_MODE_ONLY,
E_SUMMARY_MAIL_MODE_EXCLUDING
};
-
+
+typedef struct _ESummaryMailRowData ESummaryMailRowData;
typedef struct _ESummaryMail ESummaryMail;
+struct _ESummaryMailRowData {
+ char *name;
+ char *uri;
+};
+
const char *e_summary_mail_get_html (ESummary *summary);
void e_summary_mail_init (ESummary *summary,
GNOME_Evolution_Shell corba_shell);
diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c
index 0b66b231de..1e8c899150 100644
--- a/my-evolution/e-summary-preferences.c
+++ b/my-evolution/e-summary-preferences.c
@@ -79,7 +79,7 @@ vector_from_str_list (GList *strlist)
/* No space at end */
if (strlist->next) {
- g_string_append (str, " ");
+ g_string_append (str, " !<-->! ");
}
}
@@ -95,7 +95,7 @@ str_list_from_vector (const char *vector)
GList *strlist = NULL;
char **tokens, **t;
- t = tokens = g_strsplit (vector, " ", 8196);
+ t = tokens = g_strsplit (vector, " !<-->! ", 8196);
if (tokens == NULL) {
return NULL;
@@ -600,6 +600,13 @@ fill_weather_shown_clist (GtkCList *clist,
}
static void
+fill_mail_all_clist (GtkCList *clist,
+ PropertyData *pd)
+{
+ e_summary_mail_fill_list (clist, pd->summary);
+}
+
+static void
fill_mail_shown_clist (GtkCList *clist,
PropertyData *pd)
{
@@ -607,9 +614,41 @@ fill_mail_shown_clist (GtkCList *clist,
for (p = pd->summary->preferences->display_folders; p; p = p->next) {
char *text[1];
+ char *name, *uri;
+ int row;
- text[0] = p->data;
- gtk_clist_append (clist, text);
+ uri = g_strconcat ("file://", p->data, NULL);
+ name = e_summary_mail_uri_to_name (pd->summary, uri);
+ g_free (uri);
+ if (name == NULL) {
+ text[0] = p->data;
+ } else {
+ text[0] = name + 1;
+ }
+ row = gtk_clist_append (clist, text);
+ gtk_clist_set_row_data (clist, row, p);
+ }
+}
+
+static void
+mail_all_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ gtk_widget_set_sensitive (pd->mail->add, TRUE);
+}
+
+static void
+mail_all_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ if (clist->selection == NULL) {
+ gtk_widget_set_sensitive (pd->mail->add, FALSE);
}
}
@@ -639,7 +678,20 @@ static void
mail_add_clicked_cb (GtkButton *button,
PropertyData *pd)
{
+ int row;
+ ESummaryMailRowData *rd;
+ char *text[1];
+ char *uri;
+ row = GPOINTER_TO_INT (GTK_CLIST (pd->mail->all)->selection->data);
+ rd = gtk_clist_get_row_data (GTK_CLIST (pd->mail->all), row);
+ g_return_if_fail (rd != NULL);
+
+ text[0] = rd->name + 1;
+ row = gtk_clist_append (GTK_CLIST (pd->mail->shown), text);
+ pd->summary->preferences->display_folders = g_list_prepend (pd->summary->preferences->display_folders,
+ g_strdup (rd->uri + 7));
+ gtk_clist_set_row_data (GTK_CLIST (pd->mail->shown), row, pd->summary->preferences->display_folders);
}
static void
@@ -650,7 +702,7 @@ mail_remove_clicked_cb (GtkButton *button,
GList *p;
row = GPOINTER_TO_INT (GTK_CLIST (pd->mail->shown)->selection->data);
- p = g_list_nth (pd->summary->preferences->display_folders, row);
+ p = gtk_clist_get_row_data (GTK_CLIST (pd->mail->shown), row);
gtk_clist_remove (GTK_CLIST (pd->mail->shown), row);
pd->summary->preferences->display_folders = g_list_remove_link (pd->summary->preferences->display_folders, p);
@@ -728,7 +780,7 @@ rdf_add_clicked_cb (GtkButton *button,
GList *p, *rows;
char *text[1];
int row;
-
+
for (rows = GTK_CLIST (pd->rdf->all)->selection; rows; rows = rows->next) {
row = GPOINTER_TO_INT (rows->data);
info = gtk_clist_get_row_data (GTK_CLIST (pd->rdf->all), row);
@@ -1063,8 +1115,13 @@ make_property_dialog (PropertyData *pd)
mail = pd->mail = g_new (struct _MailPage, 1);
/* I think this should be a fancy bonobo thingy */
- mail->all = glade_xml_get_widget (pd->xml, "clist2");
+ mail->all = glade_xml_get_widget (pd->xml, "clist7");
g_return_val_if_fail (mail->all != NULL, FALSE);
+ fill_mail_all_clist (GTK_CLIST (mail->all), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->all), "select-row",
+ GTK_SIGNAL_FUNC (mail_all_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->all), "unselect-row",
+ GTK_SIGNAL_FUNC (mail_all_unselect_row_cb), pd);
mail->shown = glade_xml_get_widget (pd->xml, "clist1");
g_return_val_if_fail (mail->shown != NULL, FALSE);
diff --git a/my-evolution/my-evolution.glade b/my-evolution/my-evolution.glade
index cf2b8416bc..b3d07300cc 100644
--- a/my-evolution/my-evolution.glade
+++ b/my-evolution/my-evolution.glade
@@ -273,19 +273,19 @@
<widget>
<class>GtkCList</class>
- <name>clist2</name>
+ <name>clist7</name>
<can_focus>True</can_focus>
<columns>1</columns>
<column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_EXTENDED</selection_mode>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>False</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
- <name>label13</name>
- <label>label26</label>
+ <name>label40</name>
+ <label>label40</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>