aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2002-06-26 23:42:01 +0800
committerIain Holmes <iain@src.gnome.org>2002-06-26 23:42:01 +0800
commit9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3 (patch)
tree2719aa6b6bfa5eb78537dc384051687640cd7ac7 /my-evolution
parent6f679c6c889771b0ca773cf90d2bfde4afd164ee (diff)
downloadgsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar.gz
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar.bz2
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar.lz
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar.xz
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.tar.zst
gsoc2013-evolution-9a210db24ffc2e0d806c5afda8cf3b471aa4d5c3.zip
Fix bugs, make the folder list be a storage set view and add a delete url button
svn path=/trunk/; revision=17290
Diffstat (limited to 'my-evolution')
-rw-r--r--my-evolution/ChangeLog43
-rw-r--r--my-evolution/component-factory.c2
-rw-r--r--my-evolution/e-summary-mail.c20
-rw-r--r--my-evolution/e-summary-preferences.c398
-rw-r--r--my-evolution/e-summary-preferences.h4
-rw-r--r--my-evolution/e-summary-shown.c53
-rw-r--r--my-evolution/e-summary-shown.h6
-rw-r--r--my-evolution/e-summary.h9
-rw-r--r--my-evolution/main.c82
-rw-r--r--my-evolution/my-evolution.glade22
10 files changed, 573 insertions, 66 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 0210e822b7..29c95028d4 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,3 +1,46 @@
+2002-06-26 Iain <iain@ximian.com>
+
+ * component-factory.c (owner_set_cb): Pass the shell.
+
+ * e-summary-mail.c (new_folder_cb): Use the ESummaryPrefsFolder stuff.
+ Remove some debugging spew.
+
+ * e-summary-preferences.c (make_initial_mail_list): Make a mail list
+ using the ESummaryPrefsFolder stuff.
+ (folder_list_from_vector): Given a vector make ESummaryPrefsFolders.
+ (vector_from_folder_list): Given ESummaryPrefsFolders, make a vector.
+ (e_summary_preferences_restore): Use a new ident.
+ (free_folder_list): Free a list of ESummaryPrefsFolders.
+ (copy_folder_list): Copy a list of ESummaryPrefsFolders.
+ (fill_rdf_etable): Store the RDFInfo struct in the model.
+ (fill_mail_etable): Remove.
+ (add_dialog_clicked_cb): Cast some stuff and add a new entry.
+ (rdf_delete_url_cb): Delete the selected urls.
+ (rdf_etable_selection_cb): Change the Delete button depending on what
+ rdfs are selected.
+ (storage_set_changed): Pass the changed signal to the control.
+ (make_property_data): Use the StorageSetView and hook up the new
+ button.
+ (set_selected_folders): Set the checkboxes inthe StorageSetView.
+ (e_summary_preferences_make_mail_table): Get the StorageSetView
+ widget and hook it up.
+ (get_folders_from_view): Get the list of checked folders and make
+ ESummaryPrefsFolders for them.
+
+ * e-summary-shown.c: Add a selection_changed signal.
+ (real_selected_count): Add the path to the selected list.
+ (make_list): Make a list from the selection.
+ (e_summary_shown_get_selection): Get the selection as a list.
+
+ * my-evolution.glade: Add a Delete New Feed button.
+
+2002-06-21 Iain Holmes <iain@ximian.com>
+
+ * main.c (main): Init GConf, and set the proxy.
+ (set_proxy): Get all the proxy stuff and set Soup to use it.
+ (proxy_setting_changed): Listen to GConf stuff being changed.
+ (init_soup_proxy): Set up GConf to listen to changes in gnome-vfs
+
2002-06-05 Christopher James Lahey <clahey@ximian.com>
* e-summary-shown.c (maybe_move_to_shown, add_clicked,
diff --git a/my-evolution/component-factory.c b/my-evolution/component-factory.c
index 7e033f8dce..2b4af1afb2 100644
--- a/my-evolution/component-factory.c
+++ b/my-evolution/component-factory.c
@@ -102,7 +102,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
e_summary_folder_init_folder_store (corba_shell);
- e_summary_preferences_register_config_control_factory ();
+ e_summary_preferences_register_config_control_factory (corba_shell);
}
static void
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c
index 92a264df90..50b06901b8 100644
--- a/my-evolution/e-summary-mail.c
+++ b/my-evolution/e-summary-mail.c
@@ -236,8 +236,9 @@ new_folder_cb (EvolutionStorageListener *listener,
global_preferences = e_summary_preferences_get_global ();
for (p = global_preferences->display_folders; p; p = p->next) {
- if (strcmp (p->data, folder->physicalUri) == 0) {
-/* g_print ("Showing: %s\n", folder->physicalUri); */
+ ESummaryPrefsFolder *f = p->data;
+
+ if (strcmp (f->physical_uri, folder->physicalUri) == 0) {
folder_store->shown = g_list_append (folder_store->shown, mail_folder);
e_summary_mail_get_info (mail_folder->path,
folder_store->listener);
@@ -255,7 +256,6 @@ update_folder_cb (EvolutionStorageListener *listener,
char *proto;
char *uri;
- /* Make this static, saves having to recompute it each time */
if (strcmp (si->name, _("VFolders")) == 0) {
evolution_dir = gnome_util_prepend_user_home ("evolution/vfolder");
uri = g_strdup_printf ("vfolder:%s#%s", evolution_dir,
@@ -268,10 +268,9 @@ update_folder_cb (EvolutionStorageListener *listener,
uri = e_path_to_physical (proto, path);
} else {
uri = g_strconcat (si->name, path, NULL);
+ g_print ("uri: %s\n", uri);
}
- g_print ("path: %s\n", path);
- g_print ("uri: %s\n", uri);
e_summary_mail_get_info (uri, folder_store->listener);
g_free (uri);
@@ -332,9 +331,8 @@ mail_change_notify (BonoboListener *listener,
/* Are we displaying this folder? */
global_preferences = e_summary_preferences_get_global ();
for (p = global_preferences->display_folders; p; p = p->next) {
- g_print ("folder: %s\n", folder->path);
- if (strcmp (p->data, folder->path) == 0) {
- g_print ("Received info for shown folder %s\n", folder->path);
+ ESummaryPrefsFolder *f = p->data;
+ if (strcmp (f->physical_uri, folder->path) == 0) {
e_summary_redraw_all (); /* All summaries should be redrawn, not just this one */
return;
}
@@ -524,6 +522,7 @@ e_summary_mail_reconfigure (void)
preferences = e_summary_preferences_get_global ();
for (p = g_list_last (preferences->display_folders); p; p = p->prev) {
ESummaryMailFolder *folder;
+ ESummaryPrefsFolder *f = p->data;
char *uri;
#if 0
@@ -534,7 +533,7 @@ e_summary_mail_reconfigure (void)
uri = g_strconcat ("file://", p->data, NULL);
}
#endif
- uri = g_strdup (p->data);
+ uri = g_strdup (f->physical_uri);
folder = g_hash_table_lookup (folder_store->folders, uri);
if (folder != NULL) {
if (folder->init == FALSE) {
@@ -553,6 +552,7 @@ e_summary_mail_reconfigure (void)
/* e_summary_redraw_all (); */
}
+#if 0
static int
str_compare (gconstpointer a,
gconstpointer b)
@@ -762,7 +762,7 @@ e_summary_mail_fill_list (ESummaryTable *est)
add_storage_to_table (est, si);
}
}
-
+#endif
const char *
e_summary_mail_uri_to_name (const char *uri)
{
diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c
index d37f8b6c44..61b4932e71 100644
--- a/my-evolution/e-summary-preferences.c
+++ b/my-evolution/e-summary-preferences.c
@@ -41,9 +41,13 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-shlib-factory.h>
+#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-widget.h>
#include <bonobo-conf/bonobo-config-database.h>
+#include <shell/evolution-storage-set-view-listener.h>
+
#include "e-summary.h"
#include "e-summary-preferences.h"
#include "e-summary-table.h"
@@ -54,17 +58,29 @@
#define FACTORY_ID "OAFIID:GNOME_Evolution_Summary_ConfigControlFactory"
static ESummaryPrefs *global_preferences = NULL;
+static GNOME_Evolution_Shell global_shell = NULL;
+
+static char *default_folders[2] = {
+ "/local/Inbox", "/local/Outbox"
+};
static void
make_initial_mail_list (ESummaryPrefs *prefs)
{
char *evolution_dir;
- GList *folders;
-
- evolution_dir = gnome_util_prepend_user_home ("evolution/local");
+ GList *folders = NULL;
+ int i;
+
+ evolution_dir = gnome_util_prepend_user_home ("evolution");
+ for (i = 0; i < 2; i++) {
+ ESummaryPrefsFolder *folder;
- folders = g_list_append (NULL, g_strconcat (evolution_dir, "/Inbox", NULL));
- folders = g_list_append (folders, g_strconcat (evolution_dir, "/Outbox", NULL));
+ folder = g_new (ESummaryPrefsFolder, 1);
+ folder->evolution_uri = g_strconcat ("evolution:", default_folders[i], NULL);
+ folder->physical_uri = g_strconcat ("file://", evolution_dir, default_folders[i], NULL);
+
+ folders = g_list_append (folders, folder);
+ }
g_free (evolution_dir);
prefs->display_folders = folders;
@@ -152,6 +168,65 @@ str_list_from_vector (const char *vector)
return strlist;
}
+static GList *
+folder_list_from_vector (const char *vector)
+{
+ GList *flist = NULL;
+ char **tokens, **t;
+
+ t = tokens = g_strsplit (vector, " !<-->! ", 8196);
+ if (tokens == NULL) {
+ return NULL;
+ }
+
+ for (tokens = t; *tokens; tokens += 2) {
+ ESummaryPrefsFolder *folder;
+
+ folder = g_new (ESummaryPrefsFolder, 1);
+ g_print ("%s - %s\n", *tokens, *(tokens + 1));
+ folder->evolution_uri = g_strdup (*tokens);
+ folder->physical_uri = g_strdup (*(tokens + 1));
+
+ flist = g_list_prepend (flist, folder);
+ }
+
+ g_strfreev (t);
+
+ flist = g_list_reverse (flist);
+ return flist;
+}
+
+static char *
+vector_from_folder_list (GList *flist)
+{
+ char *vector;
+ GString *string;
+
+ if (flist == NULL) {
+ return g_strdup ("");
+ }
+
+ string = g_string_new ("");
+ for (; flist; flist = flist->next) {
+ ESummaryPrefsFolder *folder;
+
+ folder = flist->data;
+ string = g_string_append (string, folder->evolution_uri);
+ string = g_string_append (string, " !<-->! ");
+ string = g_string_append (string, folder->physical_uri);
+
+ if (flist->next != NULL) {
+ string = g_string_append (string, " !<-->! ");
+ }
+ }
+
+ vector = string->str;
+ g_string_free (string, FALSE);
+ g_print ("vector: %s\n", vector);
+
+ return vector;
+}
+
gboolean
e_summary_preferences_restore (ESummaryPrefs *prefs)
{
@@ -170,15 +245,15 @@ e_summary_preferences_restore (ESummaryPrefs *prefs)
}
CORBA_exception_free (&ev);
- vector = bonobo_config_get_string (db, "My-Evolution/Mail/display_folders", &ev);
+ vector = bonobo_config_get_string (db, "My-Evolution/Mail/display_folders-1.2", &ev);
if (BONOBO_EX (&ev)) {
- g_warning ("Error getting Mail/display_folders");
+ g_warning ("Error getting Mail/display_folders. Using defaults");
CORBA_exception_free (&ev);
- bonobo_object_release_unref (db, NULL);
- return FALSE;
+ make_initial_mail_list (prefs);
+ } else {
+ prefs->display_folders = folder_list_from_vector (vector);
+ g_free (vector);
}
- prefs->display_folders = str_list_from_vector (vector);
- g_free (vector);
prefs->show_full_path = bonobo_config_get_boolean (db, "My-Evolution/Mail/show_full_path", &ev);
if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
@@ -269,8 +344,8 @@ e_summary_preferences_save (ESummaryPrefs *prefs)
}
CORBA_exception_free (&ev);
- vector = vector_from_str_list (prefs->display_folders);
- bonobo_config_set_string (db, "My-Evolution/Mail/display_folders", vector, NULL);
+ vector = vector_from_folder_list (prefs->display_folders);
+ bonobo_config_set_string (db, "My-Evolution/Mail/display_folders-1.2", vector, NULL);
g_free (vector);
bonobo_config_set_boolean (db, "My-Evolution/Mail/show_full_path", prefs->show_full_path, NULL);
@@ -307,11 +382,23 @@ free_str_list (GList *list)
}
}
+static void
+free_folder_list (GList *list)
+{
+ for (; list; list = list->next) {
+ ESummaryPrefsFolder *f = list->data;
+
+ g_free (f->evolution_uri);
+ g_free (f->physical_uri);
+ g_free (f);
+ }
+}
+
void
e_summary_preferences_free (ESummaryPrefs *prefs)
{
if (prefs->display_folders) {
- free_str_list (prefs->display_folders);
+ free_folder_list (prefs->display_folders);
g_list_free (prefs->display_folders);
}
@@ -341,6 +428,26 @@ copy_str_list (GList *list)
return list_copy;
}
+static GList *
+copy_folder_list (GList *list)
+{
+ GList *list_copy = NULL;
+
+ for (; list; list = list->next) {
+ ESummaryPrefsFolder *f1, *f2;
+
+ f1 = list->data;
+ f2 = g_new (ESummaryPrefsFolder, 1);
+ f2->evolution_uri = g_strdup (f1->evolution_uri);
+ f2->physical_uri = g_strdup (f1->physical_uri);
+
+ list_copy = g_list_prepend (list_copy, f2);
+ }
+
+ list_copy = g_list_reverse (list_copy);
+ return list_copy;
+}
+
ESummaryPrefs *
e_summary_preferences_copy (ESummaryPrefs *prefs)
{
@@ -348,7 +455,7 @@ e_summary_preferences_copy (ESummaryPrefs *prefs)
prefs_copy = g_new (ESummaryPrefs, 1);
- prefs_copy->display_folders = copy_str_list (prefs->display_folders);
+ prefs_copy->display_folders = copy_folder_list (prefs->display_folders);
prefs_copy->show_full_path = prefs->show_full_path;
prefs_copy->rdf_urls = copy_str_list (prefs->rdf_urls);
@@ -409,7 +516,7 @@ e_summary_preferences_get_global (void)
}
struct _MailPage {
- GtkWidget *etable;
+ GtkWidget *storage_set_view;
GtkWidget *all, *shown;
GtkWidget *fullpath;
GtkWidget *add, *remove;
@@ -598,7 +705,8 @@ fill_rdf_etable (GtkWidget *widget,
entry->location = g_strdup (rdfs[i].url);
entry->name = g_strdup (rdfs[i].name);
entry->showable = TRUE;
-
+ entry->data = &rdfs[i];
+
e_summary_shown_add_node (ess, TRUE, entry, NULL, TRUE, NULL);
if (rdf_is_shown (pd, rdfs[i].url) == TRUE) {
@@ -606,6 +714,7 @@ fill_rdf_etable (GtkWidget *widget,
entry->location = g_strdup (rdfs[i].url);
entry->name = g_strdup (rdfs[i].name);
entry->showable = TRUE;
+ entry->data = &rdfs[i];
e_summary_shown_add_node (ess, FALSE, entry, NULL, TRUE, NULL);
}
@@ -662,7 +771,8 @@ fill_rdf_etable (GtkWidget *widget,
entry->location = g_strdup (info->url);
entry->name = g_strdup (info->name);
entry->showable = TRUE;
-
+ entry->data = info;
+
e_summary_shown_add_node (ess, TRUE, entry, NULL, TRUE, NULL);
if (rdf_is_shown (pd, tokens[0]) == TRUE) {
@@ -670,6 +780,7 @@ fill_rdf_etable (GtkWidget *widget,
entry->location = g_strdup (info->url);
entry->name = g_strdup (info->name);
entry->showable = TRUE;
+ entry->data = info;
e_summary_shown_add_node (ess, FALSE, entry, NULL, TRUE, NULL);
}
@@ -688,13 +799,6 @@ fill_weather_etable (ESummaryShown *ess,
}
static void
-fill_mail_etable (ESummaryTable *est,
- PropertyData *pd)
-{
- e_summary_mail_fill_list (est);
-}
-
-static void
mail_show_full_path_toggled_cb (GtkToggleButton *tb,
PropertyData *pd)
{
@@ -712,8 +816,8 @@ add_dialog_clicked_cb (GtkWidget *widget,
char *url;
char *name;
- name = gtk_entry_get_text (pd->new_name_entry);
- url = gtk_entry_get_text (pd->new_url_entry);
+ name = gtk_entry_get_text (GTK_ENTRY (pd->new_name_entry));
+ url = gtk_entry_get_text (GTK_ENTRY (pd->new_url_entry));
if (name != NULL && *name != 0 &&
url != NULL && *url != 0) {
@@ -731,8 +835,9 @@ add_dialog_clicked_cb (GtkWidget *widget,
entry->location = g_strdup (info->url);
entry->name = g_strdup (info->name);
entry->showable = TRUE;
-
- e_summary_shown_add_node (pd->rdf->etable, TRUE,
+ entry->data = info;
+
+ e_summary_shown_add_node (E_SUMMARY_SHOWN (pd->rdf->etable), TRUE,
entry, NULL, TRUE, NULL);
/* Should we add to shown? */
@@ -789,6 +894,33 @@ rdf_new_url_clicked_cb (GtkButton *button,
}
static void
+rdf_delete_url_cb (GtkButton *button,
+ PropertyData *pd)
+{
+ GList *selection;
+
+ selection = e_summary_shown_get_selection (E_SUMMARY_SHOWN (pd->rdf->etable), TRUE);
+
+ for (; selection; selection = selection->next) {
+ ETreePath path = selection->data;
+ ESummaryShownModelEntry *entry;
+
+ entry = g_hash_table_lookup (E_SUMMARY_SHOWN (pd->rdf->etable)->all_model, path);
+
+ if (entry == NULL) {
+ continue;
+ }
+
+ e_summary_shown_remove_node (E_SUMMARY_SHOWN (pd->rdf->etable), TRUE, entry);
+ pd->rdf->known = g_list_remove (pd->rdf->known, entry->data);
+
+ /* FIXME: Remove from shown side as well */
+ }
+
+ save_known_rdfs (pd->rdf->known);
+}
+
+static void
rdf_refresh_value_changed_cb (GtkAdjustment *adj,
PropertyData *pd)
{
@@ -824,6 +956,39 @@ rdf_etable_item_changed_cb (ESummaryShown *ess,
}
static void
+rdf_etable_selection_cb (ESummaryShown *ess,
+ GList *selection,
+ PropertyData *pd)
+{
+ if (pd->rdf->delete_url == NULL) {
+ return;
+ }
+
+ if (selection != NULL) {
+ GList *p;
+
+ for (p = selection; p; p = p->next) {
+ ESummaryShownModelEntry *entry;
+ struct _RDFInfo *info;
+
+ entry = g_hash_table_lookup (E_SUMMARY_SHOWN (pd->rdf->etable)->all_model, p->data);
+ if (entry == NULL) {
+ g_warning ("Hmmm\n");
+ continue;
+ }
+
+ info = entry->data;
+ if (info->custom == TRUE) {
+ gtk_widget_set_sensitive (pd->rdf->delete_url, TRUE);
+ return;
+ }
+ }
+ }
+
+ gtk_widget_set_sensitive (pd->rdf->delete_url, FALSE);
+}
+
+static void
weather_etable_item_changed_cb (ESummaryShown *ess,
PropertyData *pd)
{
@@ -937,6 +1102,13 @@ calendar_today_toggled_cb (GtkToggleButton *tb,
evolution_config_control_changed (pd->config_control);
}
+static void
+storage_set_changed (EvolutionStorageSetViewListener *listener,
+ PropertyData *pd)
+{
+ evolution_config_control_changed (pd->config_control);
+}
+
static gboolean
make_property_dialog (PropertyData *pd)
{
@@ -944,38 +1116,37 @@ make_property_dialog (PropertyData *pd)
struct _RDFPage *rdf;
struct _WeatherPage *weather;
struct _CalendarPage *calendar;
-
+ GtkWidget *listener;
+
/* Mail */
mail = pd->mail = g_new (struct _MailPage, 1);
mail->tmp_list = NULL;
-
- mail->etable = glade_xml_get_widget (pd->xml, "mail-custom");
- g_return_val_if_fail (mail->etable != NULL, FALSE);
- fill_mail_etable (E_SUMMARY_TABLE (mail->etable), pd);
-
- gtk_signal_connect (GTK_OBJECT (mail->etable), "item-changed",
- GTK_SIGNAL_FUNC (mail_etable_item_changed_cb), pd);
- mail->model = E_SUMMARY_TABLE (mail->etable)->model;
+ mail->storage_set_view = glade_xml_get_widget (pd->xml, "mail-custom");
+ g_return_val_if_fail (mail->storage_set_view != NULL, FALSE);
+
+ listener = gtk_object_get_data (GTK_OBJECT (mail->storage_set_view),
+ "listener");
+ gtk_signal_connect (GTK_OBJECT (listener), "folder-toggled",
+ GTK_SIGNAL_FUNC (storage_set_changed), pd);
+
mail->fullpath = glade_xml_get_widget (pd->xml, "checkbutton1");
g_return_val_if_fail (mail->fullpath != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mail->fullpath),
global_preferences->show_full_path);
gtk_signal_connect (GTK_OBJECT (mail->fullpath), "toggled",
GTK_SIGNAL_FUNC (mail_show_full_path_toggled_cb), pd);
-
- /* RDF */
- rdf = pd->rdf = g_new (struct _RDFPage, 1);
- rdf->known = NULL;
- rdf->tmp_list = NULL;
- rdf->default_hash = NULL;
+ /* RDF */
+ rdf = pd->rdf = g_new0 (struct _RDFPage, 1);
rdf->etable = glade_xml_get_widget (pd->xml, "rdf-custom");
g_return_val_if_fail (rdf->etable != NULL, FALSE);
gtk_signal_connect (GTK_OBJECT (rdf->etable), "item-changed",
GTK_SIGNAL_FUNC (rdf_etable_item_changed_cb), pd);
-
+ gtk_signal_connect (GTK_OBJECT (rdf->etable), "selection-changed",
+ GTK_SIGNAL_FUNC (rdf_etable_selection_cb), pd);
+
fill_rdf_etable (rdf->etable, pd);
rdf->refresh = glade_xml_get_widget (pd->xml, "spinbutton1");
g_return_val_if_fail (rdf->refresh != NULL, FALSE);
@@ -996,6 +1167,11 @@ make_property_dialog (PropertyData *pd)
gtk_signal_connect (GTK_OBJECT (rdf->new_button), "clicked",
GTK_SIGNAL_FUNC (rdf_new_url_clicked_cb), pd);
+ rdf->delete_url = glade_xml_get_widget (pd->xml, "delete-button");
+ g_return_val_if_fail (rdf->delete_url != NULL, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->delete_url), "clicked",
+ GTK_SIGNAL_FUNC (rdf_delete_url_cb), pd);
+
/* Weather */
weather = pd->weather = g_new (struct _WeatherPage, 1);
weather->tmp_list = NULL;
@@ -1132,10 +1308,96 @@ GtkWidget *e_summary_preferences_make_mail_table (PropertyData *pd);
GtkWidget *e_summary_preferences_make_rdf_table (PropertyData *pd);
GtkWidget *e_summary_preferences_make_weather_table (PropertyData *pd);
+static void
+set_selected_folders (GNOME_Evolution_StorageSetView view)
+{
+ GNOME_Evolution_FolderList *list;
+ CORBA_Environment ev;
+ GList *l;
+ int i, count;
+
+ for (count = 0, l = global_preferences->display_folders; l;
+ l = l->next, count++)
+ ;
+
+ list = GNOME_Evolution_FolderList__alloc ();
+ list->_length = count;
+ list->_maximum = count;
+ list->_buffer = CORBA_sequence_GNOME_Evolution_Folder_allocbuf (count);
+
+ for (i = 0, l = global_preferences->display_folders; l; i++, l = l->next) {
+ ESummaryPrefsFolder *folder = l->data;
+
+ /* Set duff values execpt for physicalUri & evolutionUri*/
+ list->_buffer[i].type = CORBA_string_dup ("");
+ list->_buffer[i].description = CORBA_string_dup ("");
+ list->_buffer[i].displayName = CORBA_string_dup ("");
+ if (strncmp (folder->evolution_uri, "evolution:", 10) == 0) {
+ list->_buffer[i].evolutionUri = CORBA_string_dup (folder->evolution_uri + 10);
+ } else {
+ list->_buffer[i].evolutionUri = CORBA_string_dup (folder->evolution_uri);
+ }
+ list->_buffer[i].physicalUri = CORBA_string_dup (folder->physical_uri);
+ list->_buffer[i].unreadCount = 0;
+ list->_buffer[i].canSyncOffline = TRUE;
+ }
+
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_StorageSetView__set_checkedFolders (view, list, &ev);
+ CORBA_exception_free (&ev);
+}
+
GtkWidget *
e_summary_preferences_make_mail_table (PropertyData *pd)
{
- return e_summary_table_new (g_hash_table_new (NULL, NULL));
+ CORBA_Environment ev;
+ Bonobo_Control control;
+ GNOME_Evolution_StorageSetView view;
+ EvolutionStorageSetViewListener *listener;
+ GNOME_Evolution_StorageSetViewListener corba_listener;
+ GtkWidget *widget;
+
+ g_assert (global_shell != NULL);
+
+ CORBA_exception_init (&ev);
+ control = GNOME_Evolution_Shell_createStorageSetView (global_shell, &ev);
+ if (BONOBO_EX (&ev) || control == CORBA_OBJECT_NIL) {
+ g_warning ("Error getting StorageSetView");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ view = Bonobo_Unknown_queryInterface (control,
+ "IDL:GNOME/Evolution/StorageSetView:1.0", &ev);
+ if (BONOBO_EX (&ev) || view == CORBA_OBJECT_NIL) {
+ g_warning ("Error querying %s",
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ GNOME_Evolution_StorageSetView__set_showCheckboxes (view, TRUE, &ev);
+
+ listener = evolution_storage_set_view_listener_new ();
+
+ corba_listener = evolution_storage_set_view_listener_corba_objref (listener);
+
+ GNOME_Evolution_StorageSetView_addListener (view, corba_listener, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Error adding listener %s",
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ widget = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL);
+ gtk_object_set_data (GTK_OBJECT (widget), "listener", listener);
+ gtk_object_set_data (GTK_OBJECT (widget), "corba_view", view);
+
+ set_selected_folders (view);
+ return widget;
}
GtkWidget *
@@ -1167,6 +1429,43 @@ add_shown_to_list (gpointer key,
*list = g_list_prepend (*list, g_strdup (item->location));
}
+static GList *
+get_folders_from_view (GtkWidget *view)
+{
+ GNOME_Evolution_StorageSetView set_view;
+ GNOME_Evolution_FolderList *list;
+ CORBA_Environment ev;
+ GList *out_list = NULL;
+ int i;
+
+ set_view = gtk_object_get_data (GTK_OBJECT (view), "corba_view");
+ CORBA_exception_init (&ev);
+
+ list = GNOME_Evolution_StorageSetView__get_checkedFolders (set_view, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Error getting checkedFolders\n%s",
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ for (i = 0; i < list->_length; i++) {
+ GNOME_Evolution_Folder folder = list->_buffer[i];
+ ESummaryPrefsFolder *f;
+
+ f = g_new (ESummaryPrefsFolder, 1);
+ f->evolution_uri = g_strdup (folder.evolutionUri);
+ f->physical_uri = g_strdup (folder.physicalUri);
+ g_print ("Physical: %s\n", folder.physicalUri);
+ g_print ("Evolution: %s\n----\n", folder.evolutionUri);
+ out_list = g_list_append (out_list, f);
+ }
+
+ return out_list;
+}
+
static void
config_control_apply_cb (EvolutionConfigControl *control,
void *data)
@@ -1213,7 +1512,10 @@ config_control_apply_cb (EvolutionConfigControl *control,
g_list_free (pd->mail->tmp_list);
pd->mail->tmp_list = NULL;
}
+#if 0
g_hash_table_foreach (pd->mail->model, maybe_add_to_shown, &pd->mail->tmp_list);
+#endif
+ pd->mail->tmp_list = get_folders_from_view (pd->mail->storage_set_view);
if (global_preferences->display_folders) {
free_str_list (global_preferences->display_folders);
@@ -1272,10 +1574,12 @@ factory_fn (BonoboGenericFactory *generic_factory,
}
gboolean
-e_summary_preferences_register_config_control_factory (void)
+e_summary_preferences_register_config_control_factory (GNOME_Evolution_Shell corba_shell)
{
if (bonobo_generic_factory_new (FACTORY_ID, factory_fn, NULL) == NULL)
return FALSE;
+ global_shell = corba_shell;
+
return TRUE;
}
diff --git a/my-evolution/e-summary-preferences.h b/my-evolution/e-summary-preferences.h
index 867380bd7f..6b473fecab 100644
--- a/my-evolution/e-summary-preferences.h
+++ b/my-evolution/e-summary-preferences.h
@@ -24,7 +24,7 @@
#define __E_SUMMARY_PREFERENCES_H__
#include <bonobo/bonobo-ui-component.h>
-
+#include <Evolution.h>
gboolean e_summary_preferences_restore (ESummaryPrefs *prefs);
void e_summary_preferences_save (ESummaryPrefs *prefs);
@@ -33,7 +33,7 @@ ESummaryPrefs *e_summary_preferences_copy (ESummaryPrefs *prefs);
ESummaryPrefs *e_summary_preferences_init (void);
ESummaryPrefs *e_summary_preferences_get_global (void);
-gboolean e_summary_preferences_register_config_control_factory (void);
+gboolean e_summary_preferences_register_config_control_factory (GNOME_Evolution_Shell shell);
#endif
diff --git a/my-evolution/e-summary-shown.c b/my-evolution/e-summary-shown.c
index 1cbe382cfb..92c2d3102e 100644
--- a/my-evolution/e-summary-shown.c
+++ b/my-evolution/e-summary-shown.c
@@ -69,6 +69,7 @@ static GtkObjectClass *e_summary_shown_parent_class;
enum {
ITEM_CHANGED,
+ SELECTION_CHANGED,
LAST_SIGNAL
};
static guint32 shown_signals[LAST_SIGNAL] = { 0 };
@@ -207,6 +208,13 @@ e_summary_shown_class_init (GtkObjectClass *object_class)
GTK_SIGNAL_OFFSET (ESummaryShownClass, item_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ shown_signals[SELECTION_CHANGED] = gtk_signal_new ("selection-changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ESummaryShownClass, selection_changed),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, shown_signals, LAST_SIGNAL);
}
@@ -253,6 +261,7 @@ find_entry_from_location (ESummaryShown *shown,
struct _CountData {
ESummaryShown *shown;
+ GList *selected_list;
int count;
};
@@ -265,7 +274,8 @@ real_selected_count (ETreePath path,
entry = g_hash_table_lookup (cd->shown->all_model, path);
g_return_if_fail (entry != NULL);
-
+
+ cd->selected_list = g_list_prepend (cd->selected_list, path);
if (entry->showable == FALSE) {
return;
}
@@ -289,11 +299,14 @@ all_selection_changed (ETree *et,
count = e_selection_model_selected_count (esm);
if (count == 0) {
gtk_widget_set_sensitive (shown->priv->add, FALSE);
+
+ gtk_signal_emit (GTK_OBJECT (shown), shown_signals[SELECTION_CHANGED], 0, NULL);
} else {
struct _CountData *cd;
cd = g_new (struct _CountData, 1);
cd->shown = shown;
+ cd->selected_list = NULL;
cd->count = 0;
e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
@@ -303,6 +316,11 @@ all_selection_changed (ETree *et,
} else {
gtk_widget_set_sensitive (shown->priv->add, FALSE);
}
+
+ gtk_signal_emit (GTK_OBJECT (shown), shown_signals[SELECTION_CHANGED], cd->selected_list);
+
+ g_list_free (cd->selected_list);
+ g_free (cd);
}
}
@@ -651,3 +669,36 @@ e_summary_shown_remove_node (ESummaryShown *shown,
}
}
+
+static void
+make_list (ETreePath path,
+ gpointer data)
+{
+ GList **list = data;
+
+ *list = g_list_prepend (*list, path);
+}
+
+GList *
+e_summary_shown_get_selection (ESummaryShown *shown,
+ gboolean all)
+{
+ ETree *et;
+ ESelectionModel *esm;
+ GList *list = NULL;
+
+ if (all) {
+ et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->all->etable));
+ } else {
+ et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->shown->etable));
+ }
+
+ esm = e_tree_get_selection_model (et);
+
+ e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
+ make_list, &list);
+
+ return list;
+}
+
+
diff --git a/my-evolution/e-summary-shown.h b/my-evolution/e-summary-shown.h
index af9684c671..739e773a0f 100644
--- a/my-evolution/e-summary-shown.h
+++ b/my-evolution/e-summary-shown.h
@@ -44,6 +44,8 @@ typedef struct _ESummaryShownModelEntry {
gboolean showable;
int ref_count;
+
+ gpointer data;
} ESummaryShownModelEntry;
struct _ESummaryShown {
@@ -58,6 +60,8 @@ struct _ESummaryShownClass {
GtkHBoxClass parent_class;
void (* item_changed) (ESummaryShown *shown);
+ void (* selection_changed) (ESummaryShown *shown,
+ GList *rows);
};
GtkType e_summary_shown_get_type (void);
@@ -71,4 +75,6 @@ ETreePath e_summary_shown_add_node (ESummaryShown *shown,
void e_summary_shown_remove_node (ESummaryShown *shown,
gboolean all,
ESummaryShownModelEntry *entry);
+GList *e_summary_shown_get_selection (ESummaryShown *shown,
+ gboolean all);
#endif
diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h
index 4ee9d7f98c..33e70da868 100644
--- a/my-evolution/e-summary.h
+++ b/my-evolution/e-summary.h
@@ -44,6 +44,7 @@
typedef struct _ESummaryPrivate ESummaryPrivate;
typedef struct _ESummaryClass ESummaryClass;
+typedef struct _ESummaryPrefsFolder ESummaryPrefsFolder;
typedef struct _ESummaryPrefs ESummaryPrefs;
typedef struct _ESummaryConnection ESummaryConnection;
typedef struct _ESummaryConnectionData ESummaryConnectionData;
@@ -77,10 +78,15 @@ struct _ESummaryConnectionData {
char *type;
};
+struct _ESummaryPrefsFolder {
+ char *physical_uri;
+ char *evolution_uri;
+};
+
struct _ESummaryPrefs {
/* Mail */
- GList *display_folders;
+ GList *display_folders; /* List of ESummaryPrefsFolder */
gboolean show_full_path;
/* RDF */
@@ -153,6 +159,7 @@ void e_summary_add_protocol_listener (ESummary *summary,
void *closure);
void e_summary_reconfigure (ESummary *summary);
+void e_summary_reconfigure_all (void);
int e_summary_count_connections (ESummary *summary);
GList *e_summary_add_connections (ESummary *summary);
diff --git a/my-evolution/main.c b/my-evolution/main.c
index da9df3c23a..b171462efa 100644
--- a/my-evolution/main.c
+++ b/my-evolution/main.c
@@ -39,14 +39,88 @@
#include <bonobo/bonobo-main.h>
#include <liboaf/liboaf.h>
-#ifdef GTKHTML_HAVE_GCONF
#include <gconf/gconf.h>
-#endif
+#include <gconf/gconf-client.h>
#include <glade/glade.h>
+#include <libsoup/soup.h>
#include "component-factory.h"
+static void
+set_proxy (GConfClient *client)
+{
+ SoupContext *context;
+ char *proxy_server, *proxy_user, *proxy_pw, *uri;
+ gboolean use_auth, use_proxy;
+ int proxy_port;
+
+ use_proxy = gconf_client_get_bool (client, "/system/gnome-vfs/use-http-proxy", NULL);
+ if (use_proxy == FALSE) {
+ return;
+ }
+
+ proxy_server = gconf_client_get_string (client,
+ "/system/gnome-vfs/http-proxy-host", NULL);
+ proxy_port = gconf_client_get_int (client,
+ "/system/gnome-vfs/http-proxy-port",
+ NULL);
+
+ use_auth = gconf_client_get_bool (client,
+ "/system/gnome-vfs/use-http-proxy-authorization", NULL);
+ if (use_auth == TRUE) {
+ proxy_user = gconf_client_get_string (client,
+ "/system/gnome-vfs/http-proxy-authorization-user", NULL);
+ proxy_pw = gconf_client_get_string (client,
+ "/system/gnome-vfs/http-proxy-authorization-password", NULL);
+
+ uri = g_strdup_printf ("http://%s:%s@%s:%d",
+ proxy_user, proxy_pw, proxy_server,
+ proxy_port);
+ } else {
+ uri = g_strdup_printf ("http://%s:%d", proxy_server, proxy_port);
+ }
+
+ g_print ("Using proxy: %s\n", uri);
+ context = soup_context_get (uri);
+ soup_set_proxy (context);
+ soup_context_unref (context);
+ g_free (uri);
+}
+
+static void
+proxy_setting_changed (GConfClient *client,
+ guint32 cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ set_proxy (client);
+}
+
+static void
+init_soup_proxy (void)
+{
+ GConfClient *client;
+
+ /* We get the gnome-vfs proxy keys here
+ set soup up to use the proxy,
+ and listen to any changes */
+
+ client = gconf_client_get_default ();
+ if (client == NULL) {
+ return;
+ }
+
+ /* Listen to the changes in the gnome-vfs path */
+ gconf_client_add_dir (client, "/system/gnome-vfs",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ gconf_client_notify_add (client, "/system/gnome-vfs/",
+ proxy_setting_changed, NULL, NULL, NULL);
+
+ set_proxy (client);
+}
+
int
main (int argc,
char **argv)
@@ -66,13 +140,13 @@ main (int argc,
exit (1);
}
-#ifdef GTKHTML_HAVE_GCONF
gconf_init (argc, argv, NULL);
-#endif
glade_gnome_init ();
e_cursors_init ();
+
+ init_soup_proxy ();
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
diff --git a/my-evolution/my-evolution.glade b/my-evolution/my-evolution.glade
index 2c823e6f39..7fa895f3e8 100644
--- a/my-evolution/my-evolution.glade
+++ b/my-evolution/my-evolution.glade
@@ -267,6 +267,28 @@
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>delete-button</name>
+ <can_focus>True</can_focus>
+ <label>Delete news feed</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>5</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>