aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-folder-list.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-05-24 20:36:56 +0800
committerChris Toshok <toshok@src.gnome.org>2002-05-24 20:36:56 +0800
commit9529bae97d33cf727914fdbff77decc8da97cc33 (patch)
tree2575d4907e7c03cd31569b03be67381966784867 /shell/e-folder-list.c
parent5009d8d479665301efdec3beb784e252fa29527d (diff)
downloadgsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar.gz
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar.bz2
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar.lz
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar.xz
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.tar.zst
gsoc2013-evolution-9529bae97d33cf727914fdbff77decc8da97cc33.zip
[ fixes 90% of #25047 ] shamelessly lifted from
2002-05-24 Chris Toshok <toshok@ximian.com> [ fixes 90% of #25047 ] * e-folder-list.c (get_folder_for_uri): shamelessly lifted from evolution-folder-selector-button.c. (create_display_string): modeled again after evolution-folder-selector-button.c, so we can give a little more context (and make the table look like the folder selector buttons.) (SPEC): add a pixbuf column, also remove the sorting behavior. (columns): add a pixbuf column and another string column (for the display string). (add_clicked): create the display string and get the proper pixbuf, and insert both. (edit_clicked): removed. (update_buttons): remove edit button handling from here. (e_folder_list_init): remove the hooking up of button-edit's "clicked" signal. (e_folder_list_construct): get a reference to the storage registry so we can look up folders. (e_folder_list_set_items): analogous change to add_clicked - get the display string and pixbuf and insert them. * glade/e-folder-list.glade: remove the edit button. * glade/e-shell-config-default-folders.glade: remove the frame/vbox, since we embed it in a notebook and the tab has the title already. * e-shell-config.c (config_control_factory_cb): the only config control we deal with here now is the folder settings control. * e-shell-config-default-folders.c (e_shell_config_default_folders_create_widget): rename e_shell_config_default_folders_create_control to this, return the widget, and take the config control to use as an arg. * e-shell-config-offline.c (e_shell_config_offline_create_widget): make an analogous change here as with default_folders_create_widget. * e-shell-config-default-folders.h (e_shell_config_default_folders_create_widget): track change to prototype. * e-shell-config-offline.h (e_shell_config_offline_create_widget): same. * GNOME_Evolution_Shell.oaf.in: remove the DefaultFolders and OfflineFolders controls and add a FolderSettings_Control. * Makefile.am (evolution_SOURCES): add e-shell-config-folder-settings.[ch] and e-shell-config-autocompletion.[ch]. * e-shell-config-folder-settings.[ch]: new files, embed (after a fashion) the default folder, offline, and autocompletion UI's in a notebook. * e-shell-config-autocompletion.[ch]: Basically copy over and shell-ize the addressbook autocompletion config control so it can be embedded more easily with the other folder settings. svn path=/trunk/; revision=17000
Diffstat (limited to 'shell/e-folder-list.c')
-rw-r--r--shell/e-folder-list.c126
1 files changed, 92 insertions, 34 deletions
diff --git a/shell/e-folder-list.c b/shell/e-folder-list.c
index 501523a49c..fcf29bc140 100644
--- a/shell/e-folder-list.c
+++ b/shell/e-folder-list.c
@@ -25,6 +25,7 @@
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include "e-folder-list.h"
#include <gal/e-table/e-table-memory-store.h>
+#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-option-menu.h>
#include <libgnome/gnome-i18n.h>
@@ -32,6 +33,7 @@
#include <gnome-xml/xmlmemory.h>
#include <gal/util/e-xml-utils.h>
#include <glade/glade.h>
+#include "Evolution.h"
static GtkVBoxClass *parent_class = NULL;
#define PARENT_TYPE (gtk_vbox_get_type ())
@@ -59,11 +61,66 @@ struct _EFolderListPrivate {
GtkFrame *frame;
ETableMemoryStore *model;
EvolutionShellClient *client;
+ GNOME_Evolution_StorageRegistry corba_storage_registry;
EOptionMenu *option_menu;
char **possible_types;
};
+
+static GNOME_Evolution_Folder *
+get_folder_for_uri (EFolderList *efl,
+ const char *uri)
+{
+ EFolderListPrivate *priv = efl->priv;
+ CORBA_Environment ev;
+ GNOME_Evolution_Folder *folder;
+
+ CORBA_exception_init (&ev);
+ folder = GNOME_Evolution_StorageRegistry_getFolderByUri (
+ priv->corba_storage_registry, uri, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ folder = CORBA_OBJECT_NIL;
+ CORBA_exception_free (&ev);
+
+ return folder;
+}
+
+static char *
+create_display_string (EFolderList *efl, char *folder_uri, char *folder_name)
+{
+ char *storage_lname, *p;
+ char *label_text;
+
+ storage_lname = NULL;
+ p = strchr (folder_uri, '/');
+ if (p) {
+ p = strchr (p + 1, '/');
+ if (p) {
+ GNOME_Evolution_Folder *storage_folder;
+ char *storage_uri;
+
+ storage_uri = g_strndup (folder_uri,
+ p - folder_uri);
+ storage_folder = get_folder_for_uri (efl, storage_uri);
+ storage_lname = e_utf8_to_gtk_string (GTK_WIDGET(efl), storage_folder->displayName);
+ CORBA_free (storage_folder);
+ g_free (storage_uri);
+ }
+ }
+
+ if (storage_lname) {
+ label_text = g_strdup_printf ("\"%s\" in \"%s\"", folder_name,
+ storage_lname);
+ g_free (storage_lname);
+ } else
+ label_text = g_strdup_printf ("\"%s\"", folder_name);
+
+ return label_text;
+}
+
+
+
static void
e_folder_list_changed (EFolderList *efl)
{
@@ -189,6 +246,14 @@ e_folder_list_class_init (EFolderListClass *klass)
" no-headers=\"true\"" \
">" \
" <ETableColumn model_col=\"0\"" \
+ " expansion=\"0.0\"" \
+ " cell=\"pixbuf\"" \
+ " minimum_width=\"18\"" \
+ " resizable=\"false\"" \
+ " _title=\"icon\"" \
+ " compare=\"string\"" \
+ " search=\"string\"/>" \
+ " <ETableColumn model_col=\"1\"" \
" expansion=\"1.0\"" \
" cell=\"string\"" \
" minimum_width=\"32\"" \
@@ -198,14 +263,16 @@ e_folder_list_class_init (EFolderListClass *klass)
" search=\"string\"/>" \
" <ETableState>" \
" <column source=\"0\"/>" \
+ " <column source=\"1\"/>" \
" <grouping>" \
- " <leaf column=\"0\" ascending=\"true\"/>" \
" </grouping>" \
" </ETableState>" \
"</ETableSpecification>"
static ETableMemoryStoreColumnInfo columns[] = {
+ E_TABLE_MEMORY_STORE_PIXBUF,
+ E_TABLE_MEMORY_STORE_STRING,
E_TABLE_MEMORY_STORE_STRING,
E_TABLE_MEMORY_STORE_STRING,
E_TABLE_MEMORY_STORE_STRING,
@@ -248,8 +315,15 @@ add_clicked (GtkButton *button, EFolderList *efl)
&folder);
if (folder != NULL) {
- e_table_memory_store_insert (efl->priv->model, -1, NULL, folder->displayName, folder->evolutionUri, folder->physicalUri);
+ GdkPixbuf *pixbuf;
+ char *display_string = create_display_string (efl, folder->evolutionUri, folder->displayName);
+
+ pixbuf = evolution_shell_client_get_pixbuf_for_type (efl->priv->client, folder->type, TRUE);
+ e_table_memory_store_insert (efl->priv->model, -1, NULL, pixbuf, display_string,
+ folder->displayName, folder->evolutionUri, folder->physicalUri);
e_folder_list_changed (efl);
+ gdk_pixbuf_unref (pixbuf);
+ g_free (display_string);
}
}
@@ -287,33 +361,6 @@ remove_clicked (GtkButton *button, EFolderList *efl)
}
static void
-edit_clicked (GtkButton *button, EFolderList *efl)
-{
- ETable *table;
- GNOME_Evolution_Folder *folder;
- int cursor_row;
-
- table = e_table_scrolled_get_table (efl->priv->scrolled_table);
- cursor_row = e_table_get_cursor_row (table);
-
- if (cursor_row != -1) {
- char *initial = e_table_model_value_at (E_TABLE_MODEL (efl->priv->model), 1, cursor_row);
- evolution_shell_client_user_select_folder (efl->priv->client,
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (efl))),
- _("Edit this Folder"),
- initial,
- (const gchar **) efl->priv->possible_types,
- &folder);
-
- if (folder != NULL) {
- e_table_memory_store_remove (efl->priv->model, cursor_row);
- e_table_memory_store_insert (efl->priv->model, -1, NULL, folder->displayName, folder->evolutionUri, folder->physicalUri);
- e_folder_list_changed (efl);
- }
- }
-}
-
-static void
optionmenu_changed (EOptionMenu *option_menu, int value, EFolderList *efl)
{
gtk_signal_emit (GTK_OBJECT (efl), signals[OPTION_MENU_CHANGED], value);
@@ -329,9 +376,7 @@ update_buttons (EFolderList *efl)
table = e_table_scrolled_get_table (efl->priv->scrolled_table);
cursor_row = e_table_get_cursor_row (table);
selection_count = e_table_selected_count (table);
-
- e_glade_xml_set_sensitive (efl->priv->gui, "button-edit", cursor_row != -1);
e_glade_xml_set_sensitive (efl->priv->gui, "button-remove", selection_count >= 1);
}
@@ -375,8 +420,6 @@ e_folder_list_init (EFolderList *efl)
GTK_SIGNAL_FUNC (add_clicked), efl);
e_glade_xml_connect_widget (gui, "button-remove", "clicked",
GTK_SIGNAL_FUNC (remove_clicked), efl);
- e_glade_xml_connect_widget (gui, "button-edit", "clicked",
- GTK_SIGNAL_FUNC (edit_clicked), efl);
e_glade_xml_connect_widget (gui, "custom-optionmenu", "changed",
GTK_SIGNAL_FUNC (optionmenu_changed), efl);
@@ -514,6 +557,7 @@ e_folder_list_construct (EFolderList *efl, EvolutionShellClient *client, char *x
{
efl->priv->client = client;
bonobo_object_client_ref (BONOBO_OBJECT_CLIENT (efl->priv->client), NULL);
+ efl->priv->corba_storage_registry = evolution_shell_client_get_storage_registry_interface (client);
e_folder_list_set_xml (efl, xml);
return GTK_WIDGET (efl);
}
@@ -524,7 +568,21 @@ e_folder_list_set_items (EFolderList *efl, EFolderListItem *items)
int i;
e_table_memory_store_clear (efl->priv->model);
for (i = 0; items[i].uri; i++) {
- e_table_memory_store_insert (efl->priv->model, -1, NULL, items[i].display_name, items[i].uri, items[i].physical_uri);
+ GNOME_Evolution_Folder *folder;
+ GdkPixbuf *pixbuf;
+ char *display_string;
+
+ display_string = create_display_string (efl, items[i].uri, items[i].display_name);
+
+ folder = get_folder_for_uri (efl, items[i].uri);
+ pixbuf = evolution_shell_client_get_pixbuf_for_type (efl->priv->client, folder->type, TRUE);
+
+ e_table_memory_store_insert (efl->priv->model, -1, NULL,
+ pixbuf, display_string,
+ items[i].display_name, items[i].uri, items[i].physical_uri);
+ CORBA_free (folder);
+ gdk_pixbuf_unref (pixbuf);
+ g_free (display_string);
}
}