diff options
Diffstat (limited to 'shell')
85 files changed, 0 insertions, 22642 deletions
diff --git a/shell/.cvsignore b/shell/.cvsignore deleted file mode 100644 index 417b3c6bcf..0000000000 --- a/shell/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -.pure -evolution -evolution.pure -Makefile.in -Makefile -Evolution-stubs.c -Evolution-skels.c -Evolution-common.c -Evolution.h diff --git a/shell/ChangeLog b/shell/ChangeLog deleted file mode 100644 index a04c095269..0000000000 --- a/shell/ChangeLog +++ /dev/null @@ -1,2996 +0,0 @@ -2000-11-06 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c (impl_ShellComponent_create_view): - `CORBA_Object_duplicate()' the return value. - -2000-11-06 Kjartan Maraas <kmaraas@gnome.org> - - * e-setup.c: Added #include <config.h> - -2000-11-03 Ettore Perazzoli <ettore@helixcode.com> - - * main.c: New local static variables `evolution_directory', - `no_splash'. - (main): Removed local variable `evolution_directory'. Add a - `--no-splash' command-line option for setting the value of - `no_splash'. - (idle_cb): Use the static `evolution_directory'. Make the newly - created shell show the splash or not according to the value of - `no_splash'. - - * e-shell.c (setup_components): Deal with a NULL @splash - parameter. - (e_shell_construct): New arg `show_splash'. Don't create a splash - screen if FALSE; instead, pass NULL to `setup_components()' as the - @splash arg. - (e_shell_new): New arg `show_splash'. Pass it to - `e_shell_construct()'. - -2000-11-03 Dan Winship <danw@helixcode.com> - - * evolution-storage-listener.c (class_init): Fix the name of the - signal passed to gtk_signal_new so that this actually works. - -2000-11-01 Dan Winship <danw@helixcode.com> - - * evolution-storage.c (evolution_storage_new_folder): Make this - take "highlighted" as well. - - * e-local-storage.c (new_folder): - * e-corba-storage.c (impl_StorageListener_new_folder): set - highlighted on the new folder. - - * e-storage-set-view.c (updated_folder_cb): Remove an unused - variable. - -2000-10-26 Iain Holmes <iain@helixcode.com> - - * Evolution-ShellView.idl: Added a change_current_view method and - a set_title. - - * evolution-shell-view.c (class_init): Added signals for the above methods. - (impl_ShellView_change_current_view), (impl_ShellView_set_title): Implementations - for above methods. - (corba_class_init): Connect the implemenations. - - * e-shell-view.c (shell_view_interface_change_current_view): Change - the display to the new uri. - (shell_view_interface_set_title): Set the window title. - (setup_evolution_shell_view_interface): Connect the signals to the above - functions. - -2000-11-01 Dan Winship <danw@helixcode.com> - - * Evolution-Storage.idl: Add "highligted" field to Folder. Add - update_folder method to StorageListener to change display_name and - highlight status. - - * e-folder.c: Add "highlighted" to EFolder to match the - Evolution::Folder type. - (e_folder_get_highlighted, e_folder_set_highlighted): Added - - * evolution-storage-listener.c - (impl_Evolution_StorageListener_update_folder, etc): - * e-storage.c (e_storage_updated_folder, etc): - * e-corba-storage.c (impl_StorageListener_update_folder, etc): - Implement update_folder. - - * e-storage-set.c (storage_updated_folder_cb, etc): Re-emit - updated_folder signals received from EStorage. - - * e-storage-set-view.c (various): Add another model column to the - ETable and set it up as a bold_column based on - e_folder_get_highligted. - (updated_folder_cb, etc): Listen to EStorageSet update_folder - signal and emit ETree node_changed signals. - - * evolution-storage.c (evolution_storage_update_folder): Client - function to update a folder's display_name and highlighted status. - - * Evolution-LocalStorage.idl: - * evolution-local-storage.c: - * e-local-storage.c: Change set_display_name to update_folder to - match Evolution::StorageListener - -2000-10-25 <jpr@helixcode.com> - - * e-shortcuts-view-model.c (load_group_into_model): Set folder to NULL to - kill warning - -2000-10-23 Dan Winship <danw@helixcode.com> - - * Makefile.am (INCLUDES): Update EVOLUTION_LOCALEDIR - -2000-10-20 Michael Meeks <michael@helixcode.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_populate_folder_context_menu), - (evolution_shell_component_client_create_view): update to new UI handler - - * e-shell-view-menu.c (command_create_folder): ditto. - - * e-storage-set-view.c (popup_folder_menu): ditto. - - * evolution-shell-component-client.h: kill ui-compat include. - -2000-10-19 Iain Holmes <iain@helixcode.com> - - *e-shell-view.c (e_shell_view_save_settings): If there is no view - save the default uri instead. - (socket_destroy_cb): When a view crashes, change the view to the - default one. - -2000-10-18 Michael Meeks <michael@helixcode.com> - - * evolution-shell-component.c (impl_ShellComponent_populate_folder_context_menu): - update for new UI handler. - -2000-10-18 Iain Holmes <iain@helixcode.com> - - * e-shell-view.c (start_progress_bar): If the widget is not realized - don't do anything, to prevent BadGC's at shut down. - (stop_progress_bar): Don't draw anything if the widget is not realized. - Same reason. - - * e-shell-folder-selection-dialog.c (dbl_click_cb): Emit the - folder-selected signal. - (e_shell_folder_selection_dialog_construct): Connect to the e-table's - double-click signal. - -2000-10-17 Iain Holmes <iain@helixcode.com> - - * e-shell.c (view_deleted_cb): Save the settings before the - view is destroyed. - (e_shell_quit): Don't save the settings when there are no views. - -2000-10-16 Iain Holmes <iain@helixcode.com> - - * e-setup.c (check_evolution_directory): Better dialog. - - * e-splash.c (icon_free): Don't unref the canvas item. - (e_splash_construct): Add a frame round the splash screen. - -2000-10-16 Dan Winship <danw@helixcode.com> - - * evolution-storage-set-view-factory.c - (evolution_storage_set_view_factory_new_view): Add a typecast. - - * e-storage-set-view.c (popup_folder_menu): Move variable - declarations into the #if 0 to kill warnings. - (populate_folder_context_menu_with_common_items, - folder_context_menu_activate_cb): Move these into #if 0 too. - - * e-shell.c: Add prototype. - - * e-shell-view.c (storage_set_view_box_map_cb): - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Remove unused variables. - - * e-setup.c: Fix warning caused by e-util -> gal migration. - -2000-10-11 Iain Holmes <iain@helixcode.com> - - * e-setup.c (check_evolution_directory): Check if there are any - files in default_user that are not in ~/evolution and if so - copy them over. - (check_dir_recur): Recursive function to check the directory. - - * e-shell-view-menu.c: Look Maw! I'm an Evolution hacker too. - - * e-shell-view.c: Don't quit on when a view is destroyed. - - * e-shell.c: Save the settings for the remaining views whenever - a view is destroyed. - -2000-10-15 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (setup_storage_set_subwindow): Use an - EScrollFrame instead of a GtkScrolledWindow. - -2000-10-14 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (e_shell_construct): Display a splash screen. - (setup_components): New arg @splash, pointer to an ESplash. - Display the icons of the components in the splash and highlight - them as the components are activated. - - * e-splash.c: New. - * e-splash.h: New. - -2000-10-13 Anna Marie Dirks <anna@helixcode.com> - - * e-shell-folder-creation-dialog.glade: Added focus to the - folder-name text entry. - -2000-10-11 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c: Fixed the spec on this. - -2000-10-11 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c: Changed this to use the built in cells. - -2000-10-11 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c: Adapted this for the new ETable system. - -2000-10-09 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c: Change paths in such a way as to require - HEAD bonobo. - (command_toggle_folder_bar, command_toggle_shortcut_bar): only - respond to state changes. - -2000-10-07 Matt Wilson <msw@redhat.com> - - * e-shell-view.c (init): initialize priv->sockets to NULL, fixes - startup crash on non-ia32 platforms - -2000-10-06 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c: New member `sockets. - (init): Init to NULL. - (destroy): Free. Also, disconnect the "destroy" signal from them - before the controls get destroyed. - (find_socket): New function. [Thanks Dan.] - (socket_destroy_cb): New callback for the destruction of a socket. - (get_control_for_uri): Get the socket through `find_socket()' and - connect the "destroy" signal to `socket_destroy_cb'. - -2000-10-06 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (insert_storages): call - _set_compare_function after inserting the storage. - -2000-10-06 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (e_shell_view_display_uri): add a freeze / thaw - pair to reduce flicker on switching controls. - -2000-10-05 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (command_xml_dump): fix. - -2000-10-05 Chris Toshok <toshok@helixcode.com> - - * e-shell-folder-creation-dialog.c: #include <gal/widgets/e-gui-utils.h> - - * e-shell-folder-selection-dialog.c: same. - -2000-10-05 Chris Toshok <toshok@helixcode.com> - - * e-shell-folder-selection-dialog.c: add #include for - libgnomeui/gnome-messagebox.h - -2000-10-05 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (shortcut_bar_mode_changed_cb): upd. - (folder_bar_mode_changed_cb): upd. - (command_xml_dump): clobber. - (e_shell_view_menu_setup): upd. - - * e-shell-view.c (shell_view_interface_set_message_cb): upd. - (shell_view_interface_unset_message_cb): upd. - (e_shell_view_construct): upd. - (get_control_for_uri): upd. - (e_shell_view_get_bonobo_ui_component): upd. - -2000-10-04 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (setup_progress_bar): remove evil usize set. - -2000-10-03 Matt Bissiri <bissiri@eecs.umich.edu> - - * e-shell-view-menu.c (e_shell_view_menu_setup): Use - `bonobo_ui_component_add_verb_list' instead of - `bonobo_ui_component_add_verb_list_with_data' for help_verbs, - so that `command_help' gets an html filename as user_data, - instead of a ptr to EShellView. - (menu_do_misc): Move DumpXML from help_verbs to here, because - `command_xml_dump' needs to get EShellView as user_data. - -2000-10-02 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts-view.c (show_new_group_dialog): Destroy the dialog - if the user has clicked on "OK" or "Cancel". - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (e_storage_set_view_get_current_folder): if - we're not displaying folders, the current folder is NULL. - (class_init): fix typo. - - * Makefile.am (libeshell_a_SOURCES): - evolution-storage-set-view-listener.[ch] should be here, not - evolution_SOURCES. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * evolution-storage-set-view.c: add storage_selected behavior - - loop over the listeners calling _storage_selected. - - * Evolution-StorageSetView.idl: add storage_selected to the - Listener interface. - - * e-storage-set-view.c add storage_selected signal. - (on_cursor_change): if the depth is less than 2, emit - "storage_selected", otherwise emit "folder_selected". - - * e-storage-set-view.h: add storage_selected signal. - - * evolution-storage-set-view-listener.h: add storage_selected - signal. - - * evolution-storage-set-view-listener.c: add storage_selected - signal. - -2000-10-02 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage-set-view-listener.c: New. - * evolution-storage-set-view-listener.h: New. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * evolution-storage-set-view.c (impl_StorageSetView_add_listener): fix typo. - (impl_StorageSetView_remove_listener): same. - (impl_StorageSetView__get_show_folders): implementation of getter for show_folders. - (impl_StorageSetView__set_show_folders): implementation of setter for show_folders. - (corba_class_init): install _set_show_folders and _get_show_folders. - - * Evolution-StorageSetView.idl: add show_folders attribute to - StorageSetView. - - * e-storage-set-view.h: add prototypes for - e_storage_set_view_{get,set}_show_folders. - - * e-storage-set-view.c (insert_storages): split this code out from - e_storage_set_view_construct so we can call it when "show_folders" - has been changed. - (e_storage_set_view_construct): remove the code to insert - storages. - (e_storage_set_view_set_show_folders): new function. tears down - existing tree and node/path hashtable and calls insert_storages. - (e_storage_set_view_get_show_folders): new function, retrieves - current show_folders state. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * evolution-storage-set-view-factory.c - (evolution_storage_set_view_factory_new_view): pass - storage_set_view_interface as second argument to - bonobo_object_add_interface, and call gtk_widget_show on the - storage_set_view widget. - -2000-10-03 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (setup_bonobo_ui_handler): kill. - - * e-shell-view-menu.c (e_shell_view_menu_setup): strip - out the XML UI merge; move it to - - * e-shell-view.c (e_shell_view_construct): here, + - freeze / thaw pair. - - * e-shell-view.c (setup_progress_bar): impl. - (setup_widgets): hook in. - (progress_bar_timeout_cb): fix. - (start_progress_bar): fix. - (stop_progress_bar): fix. - (e_shell_view_construct): setup ui handler first. - -2000-09-22 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): upd. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (new_folder_cb): set the new node's compare function. - (insert_folders): same. - - (new_storage_cb): remove uunecessary cast. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (new_storage_cb): track e-tree sort api change. - (treepath_compare): same. - (new_folder_cb): same. - -2000-10-02 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (e_storage_set_view_construct): pass NULL - for the open/closed pixbuf of the tree renderer. we'll let it - supply the default. - (destroy): remove the expanded/unexpanded pixbuf references. - (new_storage_cb): use e_tree_model_node_insert_id so we can (soon) - save expanded/collapsed state. - (new_folder_cb): same. - (insert_folders): same. - (e_storage_set_view_construct): same. - -2000-10-02 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (impl_Shell_create_storage_set_view): New, - implementation for `::create_storage_set_view'. - (corba_class_init): Install. - - * evolution-storage-set-view-factory.c: New. - * evolution-storage-set-view-factory.h: New. - - * evolution-storage-set-view.c: New. - * evolution-storage-set-view.h: New. - - * Evolution-Shell.idl: New method - `Shell::create_storage_set_view'. - - * Evolution.idl: #include <Evolution-StorageSetView.idl>. - - * Evolution-StorageSetView.idl: New. - -2000-10-02 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c (find_listener_in_list): New helper - function. - (impl_Storage_remove_listener): New, implementation for - `Storage::remove_listener'. - (remove_listener): Helper function for - `impl_Storage_remove_listener'. - (evolution_storage_get_epv): Install the implementation for - `::remove_listener'. - (add_listener): Return a boolean indicating success or failure. - Reject multiple additions of the same listener. - (impl_Storage_add_listener): Updated accordingly: raise an - exception if `add_listener' fails. - - * Evolution-Storage.idl: Added `Storage::remove_listener'. Added - exception `AlreadyListening' for `::add_listener'. - -2000-09-29 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (popup_storage_set_view_button_clicked): Renamed - from `popup_storage_set_view_close_button_clicked'. - (storage_set_view_box_map_cb): Updated accordingly. Connect to - "button_clicked" instead of "close_button_clicked". - (disconnect_popup_signals): Updated accordingly. - (e_shell_view_set_folder_bar_mode): Update the button mode of the - title bar according to the folder bar mode. - -2000-09-28 Dan Winship <danw@helixcode.com> - - * e-corba-storage.c (impl_StorageListener_new_folder): Don't print - "Folder registered successfully" if it didn't. (Duh. :) - -2000-09-28 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c: New constant `DEFAULT_URI'. - (e_shell_view_load_settings): If the `DisplayedURI' from - `gnome_config' cannot be displayed, display the `DEFAULT_URI'. - -2000-09-26 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c (e_shortcuts_get_group_title): Cast the data - pointer, not the node pointer. - (e_shortcuts_add_group): If @group_num is -1, emit the effective - group number with the "new_group" signal instead of -1, which is - going to confuse the signal handler. - (e_shortcuts_add_shortcut): Likewise with the shortcut. - - * e-shortcuts-view-model.c (shortcuts_new_group_cb): We are @data, - not @shortcuts. - (class_init): Install the `::destroy' handler. - - * e-shortcuts-view.c (e_shortcuts_view_construct): Set - `priv->shortcuts'. - (remove_shortcut_cb): Don't remove the item both on the data and - the model. - (toggle_small_icons_cb): Removed some crufty checks. - (toggle_large_icons_cb): Likewise. - (show_new_group_dialog): New, implementation for the "Create new - shortcut group" dialog. - (destroy_group_cb): Callback for the "Destroy this group" item. - (create_new_group): Callback for the "Create new group" item. - -2000-09-25 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts-view.c (item_selected): Renamed from - `selected_item'. - (class_init): Updated accordingly. - (impl_shortcut_dropped): New function, implementation for - `EShortcutBar::shortcut_dropped'. - (impl_shortcut_dragged): New function, implementation for - `EShortcutBar::shortcut_dragged'. - (e_shortcuts_view_construct): Update to use EShortcutsViewModel. - (class_init): Install them. - - * e-shortcuts.c (e_shortcuts_get_group_title): New. - - * e-shortcuts-view-model.c: New. - * e-shortcuts-view-model.h: New. - -2000-09-24 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (setup_local_storage): Don't unref the local storage. - -2000-09-22 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): upd. - -2000-09-21 Federico Mena Quintero <federico@helixcode.com> - - * e-shell-view-menu.c: Fix mis-spelling of "calendar". - -2000-09-21 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (show_existing_view): upd. - - * Evolution-ShellComponent.idl: upd. - - * evolution-shell-component.c (impl_ShellComponent_populate_folder_context_menu): - upd. - -2000-09-18 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (command_xml_dump): add xml dump option. - -2000-09-18 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and - $(EXTRA_GNOME_LIBS). Removed unneeded libraries. - - * e-component-registry.c, e-corba-storage-registry.c, - e-corba-storage.c, e-folder-type-registry.c, e-folder.c, - e-local-folder.c, e-local-storage.c, - e-shell-folder-creation-dialog.c, - e-shell-folder-selection-dialog.c, e-shell-folder-title-bar.c, - e-shell-view.c, e-shell.c, e-shortcuts-view.c, e-shortcuts.c, - e-storage-set-view.c, e-storage-set-view.h, e-storage-set.c, - e-storage.c, evolution-local-storage.c, evolution-session.c, - evolution-shell-client.c, evolution-shell-component-client.c, - evolution-shell-component.c, evolution-shell-view.c, - evolution-storage-listener.c, evolution-storage.c, main.c: Fixed - the #include lines to deal properly with gal. - -2000-09-16 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): use datadir. - -2000-09-16 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.h: #include "bonobo-win.h", not "bonobo-app.h". - -2000-09-15 Dan Winship <danw@helixcode.com> - - * e-storage.c (get_path_for_physical_uri_foreach): foreach_data - should be set to the caller-supplied data, not the tree item data. - -2000-09-14 Iain Holmes <iain@helixcode.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Remove the *kludge* so that the button width is set properly. - Fixes bug #XXXX - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c: Remove sillies in toggle paths. - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c: move fn to bonobo. - -2000-09-14 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added $(GNOME_PRINT_LIBS) to evolution_LDADD. - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (e_shell_view_construct): prune cruft. - (shell_view_interface_unset_message_cb), - (shell_view_interface_set_message_cb): impl. - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): re-order to suit and - add freeze / thaw, update paths to toggles, remove warnings - -2000-09-07 Michael Meeks <michael@helixcode.com> - - * e-shell-view-menu.c: Re-hash pretty much the whole file - - * ui.xml: Add. - - * e-shell-view.c (e_shell_view_construct): connect unrealize & delete_event - to theit signals on the window (class_init): remove widget_class bits. - -2000-09-06 Michael Meeks <michael@helixcode.com> - - * e-shell.c (view_destroy_cb, destroy, e_shell_new_view, e_shell_quit): - update to track object type change. - - * e-shell.c (e_shell_restore_from_settings): ditto. - - * main.c (idle_cb): ditto. - - * e-shell-view.c (e_shell_view_new, e_shell_view_construct, setup_widgets): - updated for BonoboApp. - (progress_bar_timeout_cb, start_progress_bar, stop_progress_bar), - (shell_view_interface_set_message_cb, shell_view_interface_unset_message_cb): - emasculated for now. - - * e-storage-set-view.c (popup_folder_menu): disable popup menu for now. - -2000-09-13 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (popdown_transient_folder_bar): New. - (storage_set_view_box_button_release_event_cb): Rewritten to use - it. - (folder_selected_cb): Pop down the transient folder bar if the - folder bar mode is `TRANSIENT'. - -2000-09-12 Ettore Perazzoli <ettore@helixcode.com> - - * ($(IDL_GENERATED)): Stupid `orbit-idl' wants a space after the - `-I'. - -2000-09-12 Lauris Kaplinski <lauris@helixcode.com> - - * e-shell-view.c (update_folder_title_bar): Translate UTF-8 - -2000-09-12 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am: Remove the `ui.xml' stuff. - -2000-09-11 Dan Winship <danw@helixcode.com> - - * main.c (main): Initialize libunicode - -2000-09-11 Christopher James Lahey <clahey@helixcode.com> - - * e-local-storage.c: Fixed some warnings. - -2000-09-11 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-folder-selection-dialog.c (set_default_folder): Work on - the assumption that @default_uri is not NULL. - (e_shell_folder_selection_dialog_construct): Only call if the - @default_uri is not NULL. - -2000-09-11 Ettore Perazzoli <ettore@helixcode.com> - - * e-local-storage.c (new_folder): Removed debugging message. - -2000-09-11 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c (evolution_storage_new_folder): If - description is NULL, use the empty string instead. - - * e-local-storage.c (new_folder): New utility function to add a - new folder by keeping both the Bonobo interface and the EStorage - up-to-date. - (load_folders): Use it here instead of just - `e_storage_new_folder()'. - (component_async_create_folder_callback): Likewise. - - * e-shell-view.c (update_for_current_uri): Prevent an - EStorageSetView warning if the path is NULL. - - * evolution-storage.c (impl_Storage_add_listener): New, - implementation for `Evolution::Storage::add_listener'. - (evolution_storage_get_epv): Install it. - - * evolution-storage-listener.c - (evolution_storage_listener_corba_objref): New. - (create_servant): Create the servant with `g_new0()' instead of - `g_new()'. - -2000-09-11 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage-listener.c - (evolution_storage_listener_construct): Unset the `GTK_FLOATING' - flag as `EvolutionStorageListener' is self-owned. - -2000-09-11 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage.c (impl_list_folders): Removed. - (impl_get_subfolder_paths): New static function, implementation - for `::get_subfolder_paths'. - (class_init): Install it. - (e_storage_get_subfolder_paths): New. - - * e-storage.h: `list_folders' virtual method removed. New virtual - method `list_subfolder_paths'. - - * e-storage-set-view.c (etree_icon_at): If the folder is not - found, return NULL. - - * e-local-storage.c (bonobo_interface_set_display_name_cb): New - function, callback for the `set_display_name' signal on the - EvolutionLocalStorage. - (construct): Connect it. - - * e-storage-set-view.c (folder_changed_cb): New callback for the - "changed" signal emitted by the EFolders. It makes the model emit - the "changed" signal for the appropriate row. - (insert_folders): Connect it. - -2000-09-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c (etree_value_at): Return the name of the - folder or the storage instead of just returning the last segment - of the path. - - * e-storage-set.c (e_storage_set_get_folder): If the storage is - not found, just return NULL to avoid a g_warning. - -2000-09-09 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Fixed some warnings. - -2000-09-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (update_for_current_uri): Make sure `folder_name' - is always dynamically allocated, as we `g_free()' it. - -2000-09-08 Lauris Kaplinski <lauris@helixcode.com> - - * e-shell-view.c (update_for_current_uri): Translate UTF-8 string - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c (list_through_listener_foreach): Don't crash - on nodes with no data. [The root node has none indeed.] - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-folder-tree.c (e_folder_tree_get_folder): Return NULL if there - is no folder with that @path, instead of segfaulting. - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c: New member `folder_tree' in - `EvolutionStoragePrivate'. - (init): Initialize it. - (destroy): Destroy it. - (list_through_listener): New. - (add_listener): Use it to list all the current folders through the - listener. - (evolution_storage_new_folder): Add the thingie to the - `folder_tree'. - (evolution_storage_removed_folder): Remove the thingie from the - `folder_tree'. - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage.c: Replaced the `path_to_folder' GHashTable with an - EFolderTree named `folder_tree'. - (init): Updated accordingly. - (destroy): Updated accordingly. - (free_private): Removed. - (remove_folder): Removed. - (folder_new): Removed. - (folder_remove_subfolder): Removed. - (folder_add_subfolder): Removed. - (folder_destroy): Removed. - (get_parent_path): Removed. - (impl_list_folders): Reimplemented by using the `EFolderTree' - methods. - (e_storage_construct): Don't create the root folder here. - (get_path_for_physical_uri_foreach): Updated to be an - `EFolderTreeForeachFunc'. - (e_storage_get_path_for_physical_uri): Likewise, updated to use - `e_folder_tree_foreach()'. - (e_storage_new_folder): Updated to use the EFolderTree. - (e_storage_removed_folder): Likewise. - (folder_destroy_notify): New function, for the destroy - notification of `EFolder'. - - * evolution-storage-listener.c: Change the `servant' member in - `EvolutionStorageListenerPrivate' into an - `EvolutionStorageListenerServant'. - - * e-folder-tree.c: New. - * e-folder-tree.h: New. - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage-listener.c (create_servant): Return an - `EvolutionStorageListenerServant' instead of a - `POA_Evolution_StorageListener'. - (evolution_storage_listener_new): Add a cast accordingly. - - * evolution-storage.c (corba_class_init): Remove `NO_WARNINGS' - madness. - -2000-09-08 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c: Added base ETableModel functions. - - * evolution-storage-listener.c, evolution-storage.c: Fixed some - warnings. - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (set_owner_on_components): New. - (e_shell_construct): Call it after setting up the local storage. - - * e-component-registry.c (register_component): Don't set the owner - here. - - * evolution-shell-client.c - (evolution_shell_client_get_local_storage): New. - -2000-09-08 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-view.c (destroy): Chain to the parent's - destroy method. - - * evolution-shell-component.c (destroy): Chain to the parent's - destroy method. - - * evolution-storage.c: `corba_storage_listener' in - `EvolutionStoragePrivate' replaced with a list of listeners, - `corba_storage_listeners'. - (init): Init to NULL. - (add_listener): New utility function. - (destroy): Destroy all the listeners. - (evolution_storage_new_folder): Notify all the listeners. - (evolution_storage_removed_folder): Likewise. - - * e-local-storage.c: New member `bonobo_interface' in - `ELocalStoragePrivate'. - (init): Init to NULL. - (e_local_storage_get_corba_interface): New. - - * e-shell.c: New member `local_storage' in `EShellPrivate'. - (init): Init to NULL. - (setup_local_storage): Make it point to the newly created local - storage. - (destroy): Unref if not NULL. - (impl_Shell_get_local_storage): New, implementation for - `Evolution::Shell::get_local_storage'. - (corba_class_init): Set it up. - - * evolution-local-storage-client.c: New. - * evolution-local-storage-client.h: New. - * evolution-local-storage.c: New. - * evolution-local-storage.h: New. - * evolution-storage-listener.c: New. - * evolution-storage-listener.h: New. - - * Evolution-Storage.idl: New method `Storage::add_listener'. - - * Evolution-Shell.idl: New method `Shell::get_local_storage'. - - * Evolution-LocalStorage.idl: New. - -2000-09-02 Lauris Kaplinski <lauris@helixcode.com> - - * e-shell-folder-creation-dialog.c: Use e_utf8 wrappers - -2000-09-01 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c (removed_folder_cb): free node_data. - (removed_storage_cb): same. - (new_storage_cb): don't free the path we put in the node's - node_data. - (e_storage_set_view_set_current_folder): remove calls to - set_cursor_row (-1), and clean up a little bit. - -2000-09-01 Christopher James Lahey <clahey@helixcode.com> - - * e-local-storage.c: Strdup path when setting the callback data. - - * evolution-storage.c: Removed an unused variable. - -2000-08-31 Chris Toshok <toshok@helixcode.com> - - * e-shell-view.c (init): initialize delayed_selection = NULL; - -2000-09-01 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c (evolution_storage_new_folder): Handle @path - as the full path. - - * e-storage.c (e_storage_new_folder): Consider @path to be the - full path, not the parent path. - * e-local-storage.c (load_folders): Updated accordingly. - - * Evolution-Storage.idl: Member `name' of `struct Folder' renamed - to `display_name'. - -2000-08-31 Chris Toshok <toshok@helixcode.com> - - * e-shell-view.c: add delayed_selection to _EShellViewPrivate. - (new_folder_cb): new function. check if the path is our - delayed_selection and if so, select it. - (folder_selected_cb): if the user selects something using a UI - gesture, clear out a pending delayed selection. - (e_shell_view_display_uri): if the uri isn't available, save it in - the delayed_selection field, and set up the new_folder signal. - -2000-08-29 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (shell_view_interface_set_message_cb): If the - message contains a newline, only display the part until the - newline, excluding the newline. Otherwise the status bar resizes - nastily. - -2000-08-28 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (setup_components): Removed the hardcoding of the - shell component IDs. Rather, do an OAF query looking for the - `Evolution::ShellComponent' interface and activate all the - components in the result. - (MAIL_COMPONENT_ID): Removed. - (CALENDAR_COMPONENT_ID): Removed. - (ADDRESSBOOK_COMPONENT_ID): Removed. - - * e-storage-set-view.c: Make `sort_model' static. - -2000-08-25 Chris Toshok <toshok@helixcode.com> - - * e-storage-set-view.c: convert to use ETree instead of GtkCTree. - - * e-storage-set-view.h: change superclass from GtkCTree to ETable. - - * main.c (main): call e_cursors_init. - - * Makefile.am (evolution_LDADD): add libetable.a - -2000-08-25 Peter Williams <peterw@helixcode.com> - - Silence some obvious assertions. - - * e-shell.c (e_shell_construct): Ref our shortcut bar to - sink it. Same with the folder_type_registry. - - * e-shell-folder-title-bar.c (destroy): Only attempt to unref - priv->icon if nonnull. - - * e-shell-view.c (update_folder_title_bar): Don't attempt to set - the folder_icon/_name if they're NULL. - -2000-08-24 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_new): Don't abort if the - component cannot be activated. Rather, just return NULL. - -2000-08-20 arik devens <arik@helixcode.com> - - * Makefile.am (evolution_LDADD): Added UNICODE_LIBS to link in the - new e-text stuff. - -2000-08-19 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-folder-title-bar.c: Fixed a warning. - -2000-08-19 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Fixed a warning. - -2000-08-18 Larry Ewing <lewing@helixcode.com> - - * e-shell-folder-title-bar.c (style_set_cb): update the pixmap - define E_USE_STYLES to disable the current darkening behavior - (destroy): free the icon. - (e_shell_folder_title_bar_construct): style_set_cb does everything - important now. - (e_shell_folder_title_bar_set_icon): actually store the pixbuf - when we set it so that we still have it if the style changes and - take care of refcounting them properly. - -2000-08-17 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c (menu_create_file): Make capitalization of - menu items consistent. - (menu_create_view): Likewise. - (menu_create_help): Likewise. - (e_shell_view_menu_setup): Create a component menu placeholder so - that components can add their own component-specific menus there. - (menu_create_actions): Removed. - (e_shell_view_menu_setup): Don't call it. - (menu_create_tools): Removed. - (e_shell_view_menu_setup): Don't call it. - (menu_create_settings): New. - (e_shell_view_menu_setup): Call it. - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (delete_event): New. Make the parent shell quit. - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (shell_view_interface_set_message_cb): Removed - debugging message. - (shell_view_interface_unset_message_cb): Likewise. - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c: New members `progress_bar_timeout_id', - `progress_bar_value' in `EShellViewPrivate'. - (init): Init them. - (destroy): If the timeout id is not zero, remove the associated - timeout. - (progress_bar_timeout_cb): New. - (start_progress_bar): New. - (stop_progress_bar): New. - (shell_view_interface_set_message_cb): If busy, start the progress - bar. Otherwise, stop it. - (shell_view_interface_unset_message_cb): Stop the progress bar. - - * e-shell-view.c (setup_widgets): Enable the progress bar in the - appbar. - - * e-shell-view.c (shell_view_interface_unset_message_cb): New - function, callback for the `EvolutionShellView::unset_message' - signal. - (shell_view_interface_set_message_cb): New function, callback for - the `EvolutionShellView::set_message' signal. - (setup_evolution_shell_view_interface): Connect these signals to a - newly created EvolutionShellView object, add ::add_interface this - object to the control's frame. - - * evolution-shell-view.c: New. - * evolution-shell-view.h: New. - - * Evolution-ShellView.idl: New interface. - -2000-08-10 Dan Winship <danw@helixcode.com> - - * Evolution-ShellComponent.idl: add "in string evolution_homedir" - to ShellComponent::set_owner's arguments. - - * e-shell.c (e_shell_get_local_directory): Expose local_directory. - - * e-component-registry.c (register_component): Pass the shell's - "local_directory" to the component as its evolution_homedir. - - * evolution-shell-component.c (impl_ShellComponent_set_owner): - Update to include evolution_homedir. - (class_init): Update signal prototype. - - * evolution-shell-component-client.c - (evolution_shell_component_client_set_owner): Update to include - evolution_homedir. - - * e-init.c: Remove. This wasn't being used. - -2000-08-10 Peter Williams <peterw@helixcode.com> - - * e-shell-view-menu.c (command_about_box): Add lil' ol' - me to the about box. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * e-setup.c, e-shell.c: Fixed some warnings. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Fixed a warning. - -2000-08-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c (menu_create_file_new): Create a placeholder - for the print items. - -2000-08-08 Dan Winship <danw@helixcode.com> - - * e-setup.c (e_setup): Check for ~/evolution/shortcuts.xml in - addition to ~/evolution, to make sure it's really the directory - we're expecting it to be. Also, convert from old-style config file - to new-style config directory. - -2000-08-04 Michael Meeks <michael@helixcode.com> - - * evolution-shell-component.c (impl_ShellComponent_populate_folder_context_menu): - unref. - - * e-shell.c (e_shell_construct): Remove erroneous refs on - folder_type_registry, storage_set. - - * e-shortcuts-view.c (destroy): unref the shortcuts, causing a - massive ripple chain ref-count reaction. - -2000-08-03 JP Rosevear <jpr@helixcode.com> - - * e-shell.h: Remove gconf references - - * e-shell-view.h: Remove gconf references - - * main.c (idle_cb): Remove gconf references - - * Makefile.am: Remove gconf cflags and libs - - * e-shell-view.c (e_shell_view_load_settings): Change to use - gnome-config - (e_shell_view_save_settings): ditto - - * e-shell.c (e_shell_restore_from_settings): Change to - use gnome_config - (save_settings_for_views): ditto - -2000-08-03 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (destroy): unref the UI handler. - -2000-08-03 Jeffrey Stedfast <fejj@helixcode.com> - - * e-shell-folder-selection-dialog.c (set_default_folder): Make - sure default_uri isn't NULL!! - -2000-08-03 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c (command_goto_folder): Just use the current - URI as the @default_uri parameter for - `e_shell_folder_selection_dialog_new()'. - - * evolution-session.c (class_init): Call `corba_class_init()'. - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_new): @default_path renamed to - @default_uri. - (e_shell_folder_selection_dialog_construct): Likewise. If the - @default_uri is an `evolution:' one, use it as a path; if it is - different, assume it is a physical URI and consequently look for - the folder that has that physical URI and make it the default. - (set_default_folder): New helper function. - (e_shell_folder_selection_dialog_construct): Use it. - - * e-storage-set.c (e_storage_set_get_path_for_physical_uri): New. - - * e-storage.c (e_storage_get_path_for_physical_uri): New. - -2000-07-27 Dan Winship <danw@helixcode.com> - - * main.c (idle_cb): work with either gconf 0.5 or newer - -2000-07-26 Peter Williams <peterw@helixcode.com> - - * e-storage.c (e_storage_new_folder): Fix tiny mem leak. - -2000-07-26 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (disconnect_popup_signals): Disconnect the "map" - signal handler too. - -2000-07-25 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-folder-creation-dialog.c (add_folder_types): Work around - GtkOptionMenu utter brokenness by destroying the associated - Glade-built GtkMenu and creating a new one from scratch. - -2000-07-24 Dan Winship <danw@helixcode.com> - - * e-shell.c, main.c: Remove GOAD support. - - * evolution-shell-component-client.c: Remove GOAD support. - (evolution_shell_component_client_new): Give the "maybe - OAF_INFO_PATH" message if no oafinfo file was found, and give a - "consult previous error messages" message if the component was - found but not activated. Abort in either case. - -2000-07-23 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c: Converted to use `bonobo_ui_handler_*()' - stuff directly, instead of converting from GnomeUIInfo. - (command_quit): Update arg types for BonoboUIHandler. - (command_run_bugbuddy): Likewise. - (command_about_box): Likewise. - (command_new_task): Removed. - (command_new_journal_entry): Removed. - (menu_create_file_new): New. - (menu_create_file): New. - (menu_create_edit): New. - (menu_create_view): New. - (menu_create_tools): New. - (menu_create_actions): New. - (e_shell_view_menu_setup): Create menus using them instead of - converting from GnomeUIInfo. - -2000-07-22 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (e_shell_construct): Don't unref NULL shortcuts, you - idiot. - -2000-07-22 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (e_shell_view_set_folder_bar_mode): Make the - title bar non-clickable when the folder tree is visible. - - * e-shell-folder-title-bar.c: New members `button_arrow' and - `clickable' in `EShellFolderTitleBarPrivate'. Renamed `label' - into `button_label'. Added `label'. - (init): Init them. - (e_shell_folder_title_bar_construct): Pass a pointer to the title - bar as the user data for the "realize" signal. Create `label'. - (title_button_box_realize_cb): Use the `button_arrow' member - instead of using `gtk_object_{set,get}_data()'. - (setup_style): Set the style for `label' too. - (e_shell_folder_title_bar_set_clickable): New. - (e_shell_folder_title_bar_set_title): Set both `label' and - `button_label'. - -2000-07-21 Peter Williams <peterw@helixcode.com> - - * evolution-shell-client.c (user_select_folder): Don't use - g_main_loop to block the caller; this will break when - threads are enabled and GDK_THREADS_ENTER deadlocks. Use - gtk_main / gtk_main_exit to enter and exit the main loop, - which handles the recursive case correctly. - (impl_FolderSelectionListener_selected): Same. - (impl_FolderSelectionListener_cancel): Same. - (struct _FolderSelectionListenerServant): No more main_loop member. - -2000-07-21 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (storage_set_view_box_button_release_event_cb): - Set the toggle state to FALSE on the title bar. - - * e-shell-folder-title-bar.c: Signal "title_clicked" replaced by - "title_toggled". - (setup_style): Change the style for the button too. - (e_shell_folder_title_bar_construct): Use a GtkToggleButton, not a - GtkButton. - (e_shell_folder_title_bar_set_toggle_state): New. - -2000-07-21 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-folder-title-bar.c (create_icon_pixmap): New. Create a - small arrow-shaped GtkPixmap. - (title_button_box_realize_cb): New. Callback for the "realize" - signal of the button's inner box. - - * e-shell-view.c (title_bar_clicked_cb): New function, callback - for the "title_clicked" signal of the title bar. - (setup_widgets): Connect it. - - * e-shell-view.c: New member `storage_set_title_bar' in - `EShellViewPrivate'. - (setup_storage_set_subwindow): Set it. - - * e-shell-folder-title-bar.c: Use a GtkLabel instead of an - EClippedLabel for the title. - (title_button_clicked_cb): New. - (e_shell_folder_title_bar_construct): Put the label into a button. - Connect the button's "clicked" signal to - `title_button_clicked_cb'. - -2000-07-21 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c - (impl_ShellComponent_populate_folder_context_menu): If the pointer - to the function to populate the folder context menu is NULL, don't - do anything. - -2000-07-21 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c (popup_folder_menu): New. Create a - BonoboUIHandler-managed pop-up menu, let the component fill it in - with `::populate_folder_context_menu', and display it. Then - destroy it with the associated BonoboUIHandler. - (handle_right_button_selection): New. - (handle_left_button_selection): New. This pops up the right-click - menu. - (button_release_event): Use them. - (init): Set the `GTK_BUTTON_SELECTS' flag for button #3's actions. - - * evolution-shell-component-client.c - (evolution_shell_component_client_populate_folder_context_menu): - New. - (evolution_shell_component_client_async_create_folder): Added - preconditions. - - * e-shell-view.c (e_shell_view_save_settings): Add missing cast. - - * evolution-shell-component.c: New member - `populate_folder_context_menu' in - `EvolutionShellComponentPrivate'. - (impl_ShellComponent_populate_folder_context_menu): New, - implementation for - `Evolution::ShellComponent::populate_folder_context_menu'. - (corba_class_init): Install it. - (evolution_shell_component_new): New arg - @populate_folder_context_menu. - (evolution_shell_component_construct): Likewise. - - * Evolution-ShellComponent.idl: New method - `::populate_folder_context_menu'. - -2000-07-20 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (e_shell_view_save_settings): Save the paned - positions. - (e_shell_view_load_settings): Restore them. - -2000-07-20 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (save_settings_for_views): New. Code moved out of - `e_shell_save_settings'. - (e_shell_save_settings): Use it. - (save_settings_for_component): New. - (save_settings_for_components): New. - (e_shell_save_settings): Use it, so that we make all the - components save settings too. - - * e-component-registry.c - (e_component_registry_get_id_list): New. - (e_component_registry_get_component_by_id): New. - - * Makefile.am (libeshell_a_SOURCES): Add - `evolution-shell-component-client' and `evolution-session'. - - * evolution-session.c: New. - * evolution-session.h: New. - - * Makefile.am (evolution_SOURCES): Removed files that were already - in `libeshell.a'. - - * Evolution.idl: #include <Evolution-Session.idl>. - - * Evolution-Session.idl: New. - -2000-07-20 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (no_views_left_cb): Call `e_shell_quit()' on the shell - before getting out of the GTK+ main loop. - (view_delete_event_cb): Removed. - (idle_cb): Don't call it. - - * e-shell-view-menu.c (command_new_view): New, implementation of - the "New view" command. - -2000-07-16 Damon Chaplin <damon@helixcode.com> - - * e-shortcuts-view.c (e_shortcuts_view_construct): created a model - for the EShortcutBar. This will probably have to be moved to support - multiple views. - (class_init): #if'd out overriding the class functions. They don't - exist any more (they are in the model instead). - -2000-07-12 Christopher James Lahey <clahey@helixcode.com> - - * main.c: Fixed to match gconf API change. - -2000-07-10 Dan Winship <danw@helixcode.com> - - * main.c (development_warning): Update the message. - -2000-07-10 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-folder-title-bar.c (title_button_clicked_cb): - Temporarily `#if 0'ed out. - -2000-07-10 Dan Winship <danw@helixcode.com> - - * e-shell.c (impl_Shell_user_select_folder): Translate a - default_folder of "" into NULL (which can't be passed over CORBA). - -2000-07-10 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage.c (e_storage_new_folder): Removed debugging message. - - * e-storage-set.c (storage_new_folder_cb): Removed debugging - message. - -2000-07-10 Federico Mena Quintero <federico@helixcode.com> - - * e-shell-view.c (unrealize): As a quasi-hack, do a gdk_flush() - when the shell view is unrealized so that the DeleteEvent gets - sent to the remote plugs as soon as possible before we start - making other CORBA calls. The problem is that our CORBA pipe is - synchronous while our X pipe is asynch. We have to ensure - ordering for certain operations. This is NOT the correct and - complete fix, which should go in Bonobo. - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (e_shell_view_display_uri): Don't update the - current URI if there are problems creating a view for it. - (show_error): Remove. Not used anymore. - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c: Cleanup some unused menu items and added - "FIXMEs" for the ones we plan to add in the short term but are not - implemented yet. - (command_create_folder): Get rid of an unused variable. - -2000-07-07 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-client.c (user_select_folder): Fix small warning - by adding proper cast when filling in the CORBA sequence struct. - -2000-07-07 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (setup_corba_storages): Ref the CORBA storage - registry. - -2000-07-06 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c: Removed `corba_storage_registry' member - from `EvolutionStoragePrivate'. - (destroy): Don't unref/release it. Call - `StorageListener::destroy' to notify that we are dead. - (evolution_storage_register): Don't ref and store the registry. - -2000-07-05 Dan Winship <danw@helixcode.com> - - * e-shell.c (e_shell_save_settings): Use the correct gconf path - (/apps, not /app), and call gconf_client_suggest_sync at the end. - (e_shell_restore_from_settings): Use the correct gconf path. - -2000-07-05 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c (command_goto_folder): Set the folder - selection dialog as transient for the shell view. - (command_create_folder): New, bound to the "Create folder" - command in the "File" menu. - -2000-07-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (impl_Shell_user_select_folder): New arg - @allowed_types. Pass it to the EShellFolderSelectionDialog. - Connect to the "cancelled" and "folder_selected" signals instead - of "clicked". - (corba_listener_destroy_notify): New callback. - (impl_Shell_user_select_folder): Associate it to the DestroyNotify - for the "corba_listener" GtkObject data, so we don't leak it. - (folder_selection_dialog_clicked_cb): Don't release the listener - interface here. - (folder_selection_dialog_cancelled_cb): New callback for the - "cancelled" signal. - (folder_selection_dialog_folder_selected_cb): New callback for the - "folder_selected" signal. - - * e-shell-view-menu.c (command_goto_folder): Don't connect to - "clicked". Connect to "cancelled" and "folder_selected" instead. - (folder_selection_dialog_cancelled_cb): New, callback for the - "cancelled" signal. - (folder_selection_dialog_folder_selected_cb): New, callback for - the "folder_selected" signal. - - * e-shell-folder-selection-dialog.c New members `allowed_types', - `storage_set' in `EShellFolderSelectionDialogPrivate'. - (class_init): Install signals "folder_selected", "cancelled". - (init): Init to NULL. - (impl_destroy): Free/unref them. - (e_shell_folder_selection_dialog_new): New arg @allowed_types. - (e_shell_folder_selection_dialog_construct): New arg - @allowed_types. Initialize `priv->allowed_types' from it. - (check_folder_type): New function. Check if the selected folder - is of the appropriate type and, if not, return FALSE and pop up an - error dialog. Otherwise, return TRUE. - (impl_clicked): Use `check_folder_type()' to check if the folder - type is OK. If it is not, stop emission of the "clicked" signal. - - * e-shell-folder-selection-dialog.h: New signals - "folder_selected", "cancelled". - - * evolution-shell-client.c - (evolution_shell_client_user_select_folder): New arg - @allowed_types. - (user_select_folder): New arg @allowed_types. Pass this to the - ::user_select_folder method. - - * Evolution-Shell.idl: New arg @required_types in - ::user_select_folder. - -2000-07-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (setup_components): Don't ref the component registry. - -2000-06-30 Dan Winship <danw@helixcode.com> - - * Evolution-Shell.idl: add "cancel" to FolderSelectionListener. - - * evolution-shell-client.c (impl_FolderSelectionListener_cancel): - Implement cancel (set *uri and *physical_uri to NULL). - (evolution_shell_client_user_select_folder): document %NULL uri - and physical_uri return values. - - * e-shell.c (folder_selection_dialog_clicked_cb): If the user - clicked "Cancel" or used the wm to close the dialog, call _cancel - instead of _selected. - -2000-06-30 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c (impl_ShellComponent_set_owner): - Duplicate the object before storing it, you doofus. - -2000-06-30 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c (impl_ShellComponent_unset_owner): - NULL the owner_client. - -2000-06-30 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-client.h - (evolution_shell_client_user_select_folder): Add prototype. - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c: New member `owner_client'. Removed - member `corba_owner'. All the code updated to use it. - (evolution_shell_component_get_owner): Changed so that it returns - an EvolutionShellClient instead of the raw CORBA object. - - * evolution-shell-component.h: Change signal "owner_set" to get an - EvolutionShellClient wrapper instead of a CORBA interface. - - * evolution-shell-client.c: New. - * evolution-shell-client.h: New. - -2000-06-29 Dan Winship <danw@helixcode.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_new): Update warning message to - not say "CRASHING", since it won't if you have current bonobo. - -2000-06-29 Peter Williams <peter@beta.newton.cx> - - * e-shell.c (e_shell_restore_from_settings): Check for the - insanely invalid NumberOfViews = 0 case. - -2000-06-29 Peter Williams <peter@helixcode.com> - - * e-shell.c (e_shell_construct): Ref the various E-things that - we create to go with our unrefs in the destructor. - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (e_shell_view_construct): Don't ref the shell. - (destroy): Don't unref the shell. - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c (e_shortcuts_construct): Fix typo: @shortcuts - should unset `GTK_FLOATING', not @storage_set. - - * e-shell-view.c (get_storage_set_path_from_uri): If @uri is NULL, - return NULL. - - * main.c (idle_cb): Restore the shell from the settings. If this - fails, just create a new view. - - * e-shell.c (e_shell_save_settings): New. - (e_shell_quit): Save settings before exiting. - (e_shell_restore_from_settings): New. - - * e-shell-view.c (e_shell_view_save_settings): New. - (e_shell_view_load_settings): New. - - * main.c (idle_cb): Initialize Gconf, create the GConfClient and - pass it to `e_shell_new()'. - - * e-shell.c: New member `gconf_client' in `EShellPrivate'. - (destroy): Unref it if not NULL. - (init): Init to NULL. - (e_shell_new): New param @gconf_client. - (e_shell_construct): Likewise. - - * Makefile.am (INCLUDES): Add `GCONF_CFLAGS'. - -2000-06-27 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Enable the title bar button. - -2000-06-27 Michael Zucchi <zucchi@zedzone.mmc.com.au> - - * e-shell.c (folder_selection_dialog_clicked_cb): Close the dialog - when done. Dont do anything if 'new' was pressed, and always - return empty strings if 'cancel' was pressed. - -2000-06-27 Michael Zucchi <zucchi@zedzone.mmc.com.au> - - * e-shell.c (impl_Shell_user_select_folder): Set the listener as - the corba_listener data, not the shell. - -2000-06-26 Christopher James Lahey <clahey@helixcode.com> - - * glade/Makefile.am: Added EXTRA_DIST for make distcheck. - -2000-06-19 Ettore Perazzoli <ettore@helixcode.com> - - * e-local-storage.c: Don't #define POSIX_SOURCE at all; this is - not needed anymore as we no longer use `readdir_r'. - -2000-06-19 Chris Toshok <toshok@helixcode.com> - - * e-local-storage.c: #undef _POSIX_SOURCE after including - dirent.h. this breaks the build on freebsd if we leave it - #defined. go figure. - -2000-06-19 Dan Winship <danw@helixcode.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_new): Add a warning before - crashing due to a known bug when it can't activate a component, so - people don't have to waste any time trying to figure out what's - up. - -2000-06-13 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am: Compile the CORBA-built files, - evolution-shell-component.c and evolution-storage.c into a - separate `libeshell.a' library. Link the `evolution' executable - to it. Also cleaned up a bit and got rid of the `CPP_FLAGS' - assignment. - -2000-06-12 Michael Meeks <michael@helixcode.com> - - * e-shell-folder-selection-dialog.c: include gnome-dialog.h - (PARENT_TYPE): GNOME_TYPE_DIALOG replaced with gnome_dialog_get_type. - -2000-06-10 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (impl_Shell_user_select_folder): New, implementation - for `Shell:user_select_folder'. - (corba_class_init): Install it. - (folder_selection_dialog_clicked_cb): Callback for the folder - selection dialog. - - * Evolution-Shell.idl: New method `Shell::user_select_folder'. - New interface `FolderSelectionListener'. - - * glade/e-shell-folder-creation-dialog.glade: Make it larger. - - * e-shell-folder-creation-dialog.h: Fix typo: #include - <gtk/gtkwindow.h>, not <gtk/gtkwidget.h>. - - * e-shell-view-menu.c: Added "Go to folder..." command. - (commmand_goto_folder): Implementation for it. - - * e-shell-folder-selection-dialog.c: New. - * e-shell-folder-selection-dialog.h: New. - -2000-06-10 Ettore Perazzoli <ettore@helixcode.com> - - * e-local-folder.c (save_metadata): Don't set the description in - the XML file if null. Compute the physical path correctly. - - * e-folder.c (e_folder_construct): Allow NULL description. - - * evolution-shell-component-client.c (init): Initalize - `listener_interface' to `CORBA_OBJECT_NIL' and `listener_servant' - to NULL. - (create_listener_interface): Return void and set the `servant' and - `listener_servant' fields directly. - (evolution_shell_component_client_async_create_folder): Updated - accordingly. - - * e-shell-folder-creation-dialog.c: New struct `DialogData' to be - passed to the dialog's callbacks. - (dialog_data_destroy): New. - (e_shell_show_folder_creation_dialog): Set up a `DialogData' - object and pass it as the data for the signals. - (shell_destroy_cb): New handler for the "destroy" signal on the - shell. - (e_shell_show_folder_creation_dialog): Connect it. - (dialog_destroy_cb): New handler for the "destroy" signal on the - dialog; it frees the associated `DialogData'. - (e_shell_show_folder_creation_dialog): Connect it. - (async_create_cb): New function, callback for the async folder - creation function. - (entry_name_is_valid): New function to check if the entered folder - name is valid. - (dialog_clicked_cb): Check if the specified folder name is valid - and, if so, asynchronously create the new folder. - (add_folder_types): Set "type_name" data on each menu item. - - * e-storage-set-view.c (e_storage_set_view_get_current_folder): - New function. - - * e-storage-set.c (get_storage_for_path): New helper function. - (e_storage_set_get_folder): Use it. - - * e-storage.c (e_storage_async_create_folder): Renamed from - `e_storage_create_folder'. - (e_storage_remove_folder): Renamed from `e_storage_remove_folder'. - (impl_create_create_folder): Renamed from `impl_create_folder'. - (impl_create_remove_folder): Renamed from `impl_remove_folder'. - (class_init): Updated accordingly. - (e_storage_result_to_string): New function. - - * e-storage.h: `::create_folder' renamed to - `::async_create_folder'. `::remove_folder' renamed to - `::async_remove_folder'. - - * evolution-shell-component.h: Return type of - `EvolutionShellComponentCreateFolderFn' and - `EvolutionShellComponentRemoveFolderFn' changed to `void'. - - * e-local-storage.c: `EComponentRegistry component_registry' - replaced with `EFolderTypeRegistry folder_type_registry' in - `ELocalStoragePrivate' - (component_async_create_folder_callback): New function, to handle - the callback from EvolutionShellComponent. - (construct): Likewise. - (e_local_storage_open): Replaced @component_registry with - @folder_type_registry. - (impl_create_folder): Implemented. - - * e-local-folder.c (e_local_folder_new): New. - (e_local_folder_construct): New. - (e_local_folder_save): Precondition: physical URI is not NULL. - (save_metadata): Unlink the metadata file if `xmlSaveFile()' - fails. - - * e-storage.c (e_storage_create_folder): Precondition: @path is - absolute. - (e_storage_remove_folder): Likewise. - -2000-06-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c: Removed folder menu and "save as..." command. - - * main.c (main): Call `glade_gnome_init()'. - - * e-shell-view-menu.c (command_new_folder): Implemented. - - * e-shell-folder-creation-dialog.c: New. - * e-shell-folder-creation-dialog.h: New. - - * glade/Makefile.am: New. - * glade/e-shell-folder-creation-dialog.glade: New. - - * e-shell-view.c (e_shell_view_get_current_uri): New. - - * e-folder-type-registry.c - (e_folder_type_registry_get_type_names): New. - - * e-shell-view.c (get_control_for_uri): Updated to use - `EvolutionShellComponentClient'. - - * e-folder-type-registry.c: Use `EvolutionShellComponentClient's - instead of `BonoboObjectClient's. - - * e-component-registry.c: Use `EvolutionShellComponentClient' - instead of `BonoboObjectClient' in `Component'. - (component_new): Updated accordingly. - (register_component): Likewise. - - * evolution-shell-component-client.h: New. - * evolution-shell-component-client.c: New. - - * evolution-shell-component.c - (impl_ShellComponent_async_create_folder): New, implementation of - `::async_create_folder'. - (impl_ShellComponent_async_remove_folder): New, implementation of - `::async_remove_folder'. - (corba_class_init): Install them. - (evolution_shell_component_new): New args `create_folder_fn' and - `remove_folder_fn' for setting the handlers for these new methods. - (evolution_shell_component_construct): Likewise. - - * Evolution-ShellComponent.idl - (ShellComponent::async_create_folder): New. - (ShellComponent::async_remove_folder): New. - (ShellComponentListener): New. - - * evolution-shell-component.c (impl_ShellComponent_create_view): - New param @type. Use the new `EvolutionShellComponentCreateViewFn'. - - * evolution-shell-component.h: New enum `EvolutionShellComponentResult'. - Changed `EvolutionShellComponentCreateViewFn' to return an - `EvolutionShellComponentResult'. - - * e-shell-view.c (get_control_for_uri): Pass the folder type to - `ShellComponent::create_view'. - - * Evolution-ShellComponent.idl: New param @type for - `ShellComponent::create_view'. - -2000-06-08 Miguel de Icaza <miguel@helixcode.com> - - * main.c (development_warning): Use version here. Add padding to - the message. - Only destroy object if its window was not closed. - -2000-06-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (setup_bonobo_ui_handler): Oops. Don't create - the toolbar. This was not supposed to be committed. - -2000-06-07 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage.c (folder_destroy): Don't destroy the subfolders. - (remove_folder): New helper function. - (free_private): Use it. - (e_storage_removed_folder): Use it here too. - (folder_destroy): Don't unref the EFolder if NULL. - - * e-storage-set-view.c (e_storage_set_view_construct): Use - `gtk_signal_connect_while_alive()' instead of just - `gtk_signal_connect()' so that the signal handler is automatically - removed when we are destroyed. - - * e-storage-set.c (e_storage_set_remove_all_storages): New - function. - - * e-shell-view.c (e_shell_view_construct): Use `bonobo_object_ref' - on the shell instead of `gtk_object_ref'. - (destroy): Unref the shell. - - * e-local-storage.h: #include "e-component-registry.h". - - * e-shell.c (setup_local_storage): Renamed from `setup_storages'. - Only set up the local storage, not the CORBA one, and don't create - the storage set. - (e_shell_construct): Create the storage set here instead. Call - `setup_local_storage' after setting up the components. - - * e-local-storage.c: New member `component_registry' in - `ELocalStoragePrivate'. - (init): Init to NULL. - (destroy): If not null, unref it. - (e_local_storage_open): New arg @component_registry. - (construct): New arg @component_registry. Init - `priv->component_registry' from it. - - * e-local-storage.c (impl_get_name): Renamed from `get_name'. - (impl_create_folder): New function, implementing - `EStorage::create_folder'. Just a stub for now. - (impl_remove_folder): New function, implementing - `EStorage::remove_folder'. Just a stub for now. - (class_init): Install these stub implementations. - - * e-storage.c (e_storage_remove_folder): New function. - (e_storage_create_folder): New function. - (impl_create_folder): New function, default implementation for - `::create_folder'. - (impl_remove_folder): New function, default implementation for - `::remove_folder'. - (class_init): Install the implementations. - - * e-storage.c (impl_get_name): Renamed from `get_name'. - (impl_get_folder): Renamed from `get_folder'. - (impl_list_folders): Renamed from `list_folders'. - - * e-storage.h: New virtual methods `remove_folder', - `create_folder'. - - * e-storage.c (e_storage_removed_folder): Renamed from - `e_storage_remove_folder'. - * e-corba-storage.c (impl_StorageListener_removed_folder): Updated - accordingly. - -2000-06-02 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (setup_bonobo_ui_handler): Create the default toolbar. - -2000-06-02 Jeffrey Stedfast <fejj@helixcode.com> - - * e-shell-view-menu.c: Changed "Using the Shell" to "Getting Started" - -2000-06-02 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Free the uri variable. - - * e-shell.c: Free the local_directory variable. - -2000-06-02 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (view_delete_event_cb): New callback for the - "delete_event" on the view. - (idle_cb): Connect it. - -2000-06-01 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c (set_e_shortcut_selection): Added a - g_return_if_fail check. - -2000-06-01 Dan Winship <danw@helixcode.com> - - * e-shell-view-menu.c (command_help): New menu callback to launch - the help browser. - (menu_help): add pointers to the users' guide. - (e_shell_view_menu_setup): Add the help menu stuff to the uih. - - * main.c (main): Set up gettext. (Problem noted by Héctor García - Alvarez) - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (DEFAULT_WIDTH): Add more 5 pixels. - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (DEFAULT_WIDTH): Made the default window a bit - narrower. - (DEFAULT_HEIGHT): And shorter. - (setup_widgets): Set the border width of the vbox that holds the - title bar to 2 pixels, so that the view looks a bit nicer. - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (DEFAULT_TREE_WIDTH): Made the tree 150 pixel - wide [instead of 100]. - (setup_widgets): Use `DEFAULT_TREE_WIDTH' instead of - `DEFAULT_SHORTCUT_BAR_WIDTH' where appropriate. - (e_shell_view_construct): Hide the folder bar by default. - - * e-storage-set-view.c (e_storage_set_view_construct): Set - auto-resize mode for column one. - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): Set the - statusbar. - - * e-shell-view.c: New member `appbar' for `EShellViewPrivate'. - (init): Initialize to NULL. - (setup_widgets): Install a status bar and set `appbar' to point to - it. - (setup_bonobo_ui_handler): Make the BonoboUIHandler use `appbar' - as its statusbar. - (e_shell_view_get_appbar): New function. - (e_shell_view_construct): Set up the BonoboUIHandler after setting - up the widgets. - - * e-shortcuts.c (class_init): Add new signals "new_shortcut", - "removed_shortcut", "new_group", "removed_group". - (e_shortcuts_remove_shortcut): Emit "remove_shortcut". - (e_shortcuts_add_shortcut): Emit "new_shortcut". - (e_shortcuts_remove_group): Emit "remove_group". - (e_shortcuts_add_group): Emit "new_group". - (unload_shortcuts): Emit "remove_group" for all the groups. - - * e-shortcuts.h: New signals "new_shortcut", "removed_shortcut", - "new_group", "removed_group". - - * e-shortcuts-view.c (pop_up_right_click_menu): New function to - pop up the right-click menu for the shortcut bar. - (pop_up_right_click_menu_for_shortcut): New function. - (selected_item): Pop up right click menu when appropriate. Don't - activate the shortcut when right-clicking. - -2000-05-31 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.h: #include 'Evolution.h". - -2000-05-31 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c (show_error): Use `set_current_notebook_page()' - instead of `gtk_notebook_set_page()'; this will also deactivate - the current control properly. - - * e-shell-view-menu.c (e_shell_view_menu_setup): Initialize the - state of the shortcut/folder toggle menu items using - `e_shell_view_get_shortcut_bar_mode()' and - `e_shell_view_get_folder_bar_mode()'. - (command_toggle_shortcut_bar): Removed debugging message. - (command_toggle_folder_bar): Likewise. - - * e-shell-view.c (e_shell_view_get_shortcut_bar_mode): New - function. - (e_shell_view_get_folder_bar_mode): New function. - -2000-05-31 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c: New constant `DRAG_RESISTANCE'. New - members `button_x', `button_y' in `EStorageSetViewPrivate'. - (init): Initialize to zero. - (button_press_event): Set. - (motion_notify_event): Don't start drag unless the current x/y - position is farther than `DRAG_RESISTANCE', in any of the two - directions, from the original position of the button click. - (button_release_event): Always ungrab the pointer, even if - `selected_row_path' is NULL. - -2000-05-31 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-component.c (class_init): Eeek! - s/owner_set/owner_unset/. - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Increase the size of the border of the hbox slightly to make the - title bar a bit nicer. - -2000-05-31 Ettore Perazzoli <ettore@helixcode.com> - - * e-component-registry.c (component_free): Invoke `::unset_owner' - on the component before releasing it. - - * evolution-shell-component.c (class_init): Install the - "owner_set" signal. - (impl_ShellComponent_unset_owner): New function, implementation of - `ShellComponent::unset_owner'. - (corba_class_init): Install it. - - * evolution-shell-component.h: New signal "owner_unset". - - * Evolution-ShellComponent.idl: New method `ShellComponent:: - unset_owner'. - - * e-shell.c (e_shell_quit): Destroy all the views explicitly. - - * e-shell-view-menu.c: Changed `Show shortcut bar' and `Show - folder tree' items into toggle items. - (shortcut_bar_mode_changed_cb): New callback to update the status - of the "show shortcut bar" toggle item when the shortcut bar is - hidden/shown in the view. - (folder_bar_mode_changed_cb): Likewise for the folder bar. - (e_shell_view_menu_setup): Connect these to the corresponding - signals on the shell. - - * e-shell-view.c: New members `shortcut_bar_mode' and - `folder_bar_mode' in `EShellViewPrivate'. - (init): Initialize `shortcut_bar_mode' and `folder_bar_mode' to - `E_SHELL_VIEW_SUBWINDOW_HIDDEN'. - (class_init): Add the new signals. - (e_shell_view_set_shortcut_bar_mode): Renamed from - `e_shell_view_show_shortcuts'. Emit "shortcut_bar_mode_changed" - and update the `shortcut_bar_mode' member. - (e_shell_view_set_folder_bar_mode): Renamed from - `e_shell_view_show_folders'. Emit "folder_bar_mode_changed" and - update the `folder_bar_mode' member. - - * e-shell-view.h: New signals "shortcut_bar_mode_changed", - "folder_bar_mode_changed". - - * e-shell-view.c (setup_menus): Removed. - (e_shell_view_construct): Use `e_shell_view_menu_setup' instead. - (e_shell_view_get_bonobo_ui_handler): New function. - - * e-shell-view-menu.c (e_shell_view_menu_setup): New. - - * e-shell.c (impl_Shell_get_component_for_type): New function, - implementation of `Evolution::Shell::get_component_for_type'. - (corba_class_init): Install it into the EPV. - - * Evolution-Shell.idl: Added method `get_component_for_type'. - -2000-05-30 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c: New members `dirty', `save_idle_id' in - `EShortcutsPrivate'. - (init): Initialize. - (destroy): If the idle ID is nonzero, remove the idle. If `dirty' - is true, save. - (idle_cb): New. - (schedule_idle): New. - (make_dirty): New. - (e_shortcuts_remove_shortcut): Call it. - (e_shortcuts_add_shortcut): Likewise. - (e_shortcuts_remove_group): Likewise. - (e_shortcuts_add_group): Likewise. - - * e-shell.c (e_shell_construct): Updated to match the `EShortcuts' - API changes. - - * e-shortcuts.c: New member `file_name' in `EShortcutsPrivate'. - (init): Init to NULL. - (destroy): Free it. - (e_shortcuts_load): Removed. - (e_shortcuts_save): Removed. - (e_shortcuts_new): New arg @file_name. Load from the specified - file name. - - * e-shortcuts-view.c (added_item): New method implementation. - (removed_item): New method implementation. - (added_group): New method implementation. - (removed_group): New method implementation. - (class_init): Install these. - - * e-shortcuts.c (e_shortcuts_remove_shortcut): New function. - (e_shortcuts_add_shortcut): New function. - (e_shortcuts_remove_group): New function. - (e_shortcuts_add_group): New function. - - * e-shell-view.c: New member `view_title_bar' in - `EShellViewPrivate'. - (setup_widgets): Put an EShellFolderTitleBar on top of the tree - view and the content view. - (update_window_icon): Renamed from `set_icon'. - (update_folder_title_bar): New. - (popup_tree): New function to pop up the tree view when the title - button in the title bar is clicked. - (folder_title_clicked_cb): New callback for the "clicked" signal - of EShellFolderTitleBar. - (setup_widgets): Don't add a title bar to the shortcut bar. - (create_storage_set_subwindow): New helper function. - (setup_widgets): Use it. - (show_error): Use an EClippedLabel instead of a GtkLabel. - - * e-shell-view.c: Replaced all the occurences of `gpointer' with - `void *' for consistency. - - * e-shell-folder-title-bar.c: New file. - * e-shell-folder-title-bar.h: New file. - - * e-storage-set-view.c (e_storage_set_view_construct): Ooops. Fix - inverted key/value pair in the call to `g_hash_table_insert()'. - -2000-05-28 Dan Winship <danw@helixcode.com> - - * main.c (main): Remove extra free of evolution_directory. - -2000-05-28 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-storage.c (evolution_storage_register): Use the - storage's name when registering. - -2000-05-26 Matt Loper <matt@helixcode.com> - - * e-shell-view-menu.c (command_about_box): Make authorlist more - alphabetical. - (command_show_treeview): New function; shows the treeview, when it - has been hidden. - (command_show_shortcut_bar): New function; shows the shortcut bar, - when it's been hidden. - -2000-05-26 Ettore Perazzoli <ettore@helixcode.com> - - * e-corba-storage.c (impl_StorageListener_new_folder): Set the - physical URI on the folder using `e_folder_set_physical_uri()'. - - * e-local-folder.c (get_physical_uri): Removed. - (construct_loading_metadata): Use EFolder's `physical_uri' field - instead of ours, which is gone. - (save_metadata): Likewise. - (destroy): Don't free. - - * e-local-folder.h: Removed `physical_uri' from `ELocalFolder'. - - * e-folder.c: New member `physical_uri' in `EFolderPrivate'. - (init): Initialize to NULL. - (destroy): Free it. - (get_physical_uri): Removed. - (e_folder_set_physical_uri): New function. - - * e-storage-set.c (e_storage_set_get_folder): Fix off-by-one error - in extracting the base name. - - * e-storage.c: New member `path' in `Folder'. - (folder_destroy): Free it. - (folder_new): New arg. Initialize `path' from it. - (e_storage_construct): Updated accordingly. - (e_storage_new_folder): Likewise. - (e_storage_remove_folder): Remove the folder from the hash. - - * e-storage-set-view.c (remove_node): New function. - (removed_storage_cb): Use it. - (new_folder_cb): New function, callback for the "new_folder" - signal on the EStorageSet. - (removed_folder_cb): New function, callback for the - "removed_folder" signal on the EStorageSet. - (e_storage_set_view_construct): Connect these signal handlers to - the respective signals on our model storage. - - * e-storage-set.c (storage_new_folder_cb): New function, callback - for the "new_folder" signal on the storages. - (storage_removed_folder_cb): New function, callback for the - "removed_folder" signal on the storages. - (e_storage_set_add_storage): Connect them to the signals of the - storage being added. - - * e-corba-storage-registry.c - (impl_StorageRegistry_register_storage): Throw an exception if - `e_storage_set_add_storage()' returns false. - - * e-shell.c (setup_storages): Unref the local storage after adding - to the storage set. - - * e-corba-storage-registry.c - (impl_StorageRegistry_register_storage): Unref the storage after - adding to the storage set. - - * e-storage-set.c: New hash table `name_to_named_storage' in - `EStorageSetPrivate'. - (named_storage_new): New helper function. - (named_storage_destroy): New helper function. - (e_storage_set_add_storage): Use the hash table. Return value - changed to `gboolean'. Return FALSE if there is a storage with - that name already. Also, ref the storage. - (e_storage_set_remove_storage): Likewise [but of course don't ref - the storage]. - (e_storage_set_get_storage): Use the `name_to_named_storage' hash - table. - (destroy): Destroy the `name_to_named_storage' hash. - - * e-storage-set.h: New signals "new_folder", "removed_folder". - - * e-storage.c (e_storage_get_watcher_for_path): Removed. - (get_watcher_for_path): Removed. - (class_init): Install signals "new_folder" and "removed_folder". - (e_storage_remove_folder): Emit "removed_folder". - (e_storage_new_folder): Emit "new_folder". - - * e-storage.h: Removed method `get_watcher_for_path'. New signals - "new_folder", "removed_folder". - - * e-storage-watcher.c: Removed. - * e-storage-watcher.h: Removed. - - * e-corba-storage-registry.c (corba_class_init): Set the - Bonobo_Unknown evp parts. - - * evolution-storage.c: New. - * evolution-storage.h: New. - - * evolution-shell-component.c - (evolution_shell_component_get_owner): New. - - * e-storage-set-view.c (new_storage_cb): New function. - (e_storage_set_view_construct): Connect to the "new_storage" - signal on the EStorageSet. - (removed_storage_cb): New function. - (e_storage_set_view_construct): Connect to the "removed_storage" - signal on the EStorageSet. - - * e-storage-set-view.c (e_storage_set_view_construct): Make this - always look pretty, with Helix GNOME or without. - -2000-05-25 Christopher James Lahey <clahey@helixcode.com> - - * e-storage-set-view.c: Make this always look pretty, with Helix - GNOME or without. - -2000-05-25 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c (e_storage_set_view_construct): Set the - dotted line type again. Dotted is less butt-ugly than continuous. - - * e-shell-view.c (show_error): Display page zero in the notebook. - - * main.c (idle_cb): Renamed from `new_view_idle_cb'. Create the - EShell object here, because now the shell depends on the GLib loop - to be running for correct operation. - (main): Don't create the EShell here. - - * e-storage-set-view.c (get_pixmap_and_mask_for_folder): If the - icon is not found, set the returned pixmap and mask to NULL. - - * e-shell.c (e_shell_construct): Added precondition: @corba_object - must be non-nil. - (e_shell_new): Added precondition: @local_direcory must be - non-null. - - * evolution-shell-component.c: New. - * evolution-shell-component.h: New. - - * e-shell.c: New member `component_registry' in `EShellPrivate'. - (init): Initialize to NULL. - (destroy): Unref it. - (setup_components): New function to set up the compnent registry - and initialize the mail, calendar and addressbook components. - (e_shell_construct): Call it. - - * e-storage-set.c: Updated to use EFolderTypeRegistry. - * e-storage-set.h: Likewise. - * e-shortcuts.c: Likewise. - * e-shortcuts.h: Likewise. - * e-shell.c: Likewise. - - * e-shell.h: Likewise. - * e-shell-view.c: Likewise. - * e-shortcuts-view.c: Likewise. - * e-storage-set-view.c: Likewise. - - * e-component-registry.c: New. - * e-component-registry.h: New. - - * e-folder-type-registry.c: New. - * e-folder-type-registry.h: New. - - * e-folder-type-repository.c: Removed. - * e-folder-type-repository.h: Removed. - - * Evolution-ShellComponent.idl: New struct `FolderType'; new type - `FolderTypeList'. New attribute `supported_types'. - (ShellComponent::set_owner): Renamed from `set_shell'. - (ShellComponent::create_view): New. - -2000-05-24 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Was using the wrong include here. - - * e-storage-set-view.c: Got rid of the lines in the tree view. - -2000-05-24 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added libepaned.a. - - * e-shell-view.c: Switched from GtkPaned to EPaned. - -2000-05-23 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c: New member `corba_storage_registry' in - `EShellPrivate'. - (init): Initialize it to NULL. - (destroy): Unref it if not NULL. - (setup_corba_storages): New function to set up the CORBA storage - registry and `bonobo_object_add_interface()' it to the shell. - (setup_storages): Call it from here. - - * e-shell.h, e-shell.c: Derive EShell from BonoboObject instead of - GtkObject. - - * e-storage.c (e_storage_remove_folder): Return value changed into - `gboolean'; return false if an error occurs, true otherwise. - (e_storage_new_folder): Likewise. - - * e-corba-storage-registry.c: New. - * e-corba-storage-registry.h: New. - - * e-corba-storage.c: New. - * e-corba-storage.h: New. - - * Evolution.idl: Include the new IDLs, but no - `evolution-service-repository.idl' anymore. - - * Evolution-Shell.idl: New. - * Evolution-ShellComponent.idl: New. - * Evolution-Storage.idl: New. - - * evolution-service-repository.idl: Removed. - * evolution-service-repository.c: Removed. - * evolution-service-repository.h: Removed. - - * e-folder-type-repository.c (folder_type_new): Free `icon_path'. - -2000-05-18 Dan Winship <danw@helixcode.com> - - * main.c (new_view_idle_cb): add development_warning (moved from - mail component) - -2000-05-16 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c: Get rid of the `ICON_WIDTH' and - `ICON_HEIGHT' #defines. - (get_pixmap_and_mask_for_folder): Get the mini icon instead of the - big one. Use `E_SHELL_MINI_ICON_SIZE' instead of `ICON_WIDTH' and - `ICON_HEIGHT'. - - * e-folder-type-repository.c: New member `mini_icon_pixbuf' in - `FolderType'. - (folder_type_new): Initialize `mini_icon_pixbuf' by loading the - mini icon if possible. If the mini icon is not found, resort to - the big one. - (folder_type_free): Unref the mini icon. - (e_folder_type_repository_get_icon_for_type): New arg @mini. If - true, return the mini icon instead of the standard one. - - * e-shell-view.c (set_icon): Get the mini icon instead of the big - one by using `e_shell_get_icon_path's @try_mini arg. - - * e-shell-constants.h: New file. - - * e-shell-utils.c - (e_shell_get_icon_path): New arg @try_mini. If true, look for the - mini version [whose name ends in `-mini']. - - * e-folder-type-repository.c - (folder_type_new): Free string returned by - `e_shell_get_icon_path()'. - -2000-05-16 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c: New members `storage_set_view_box', - `shortcut_bar_box', `hpaned1_position', `hpaned2_position' in - `EShellViewPrivate'. - (init): Initialize them. - (setup_widgets): Add title bars to the tree and shortcut views. - (shortcuts_view_close_button_clicked_cb): New callback function. - (setup_widgets): Connect to the "close_button_clicked" signal of - the shortcut view's title bar. - (storage_set_view_close_button_clicked_cb): New callback function. - (setup_widgets): Connect to the "close_button_clicked" signal of - the storage set view's title bar. - (e_shell_view_show_shortcuts): New function. - (e_shell_view_show_folders): New function. - - * e-shell-view.c: New members `hpaned1', `hpaned2' in - `EShellViewPrivate'. - (init): Initialize both to NULL. - (setup_widgets): Invert the parenting order for the GtkHPaneds and - store them into the private `hpaned' and `hpaned2' members. - - * Makefile.am (evolution_LDADD): Link with `libemiscwidgets.a'. - -2000-05-15 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c - (load_shortcuts_into_view): Removed. - (e_shortcuts_new_view): Don't set up the shortcut bar manually - here anymore, and don't set the icon callback either. The - `EShortcutsView' object is now able to do this by itself. - - * e-shortcuts-view.c - (icon_callback): Moved here from `e-shortcuts.c'. - (load_group): New function. - (load_all_shortcuts): New function. - (e_shortcuts_view_construct): Call it to load the shortcuts from - the `EShortcuts' object. Also, set `icon_callback' as the icon - callback. - - * e-storage-set-view.c - (button_press_event): Add/remove grab with `gtk_grab_add' and - `gtk_grab_remove'. - (button_release_event): Call `gtk_grab_remove' when removing the - grab. - - * e-shortcuts.c: New member `title_to_group' in - `EShortcutsPrivate'. - (init): Initialize here. - (destroy): Destroy here. - (unload_shortcuts): Destroy and recreate here. - (load_shortcuts): Avoid inserting multiple groups with the same - title, and insert the groups into the `title_to_group' hash table. - Also, avoid leaking the return value from `xmlNodeListGetString'. - (e_shortcuts_get_group_titles): New function. - (e_shortcuts_get_shortcuts_in_group): New function. - (e_shortcuts_get_storage_set): New function. - - * e-storage-set-view.c - (e_storage_set_view_set_current_folder): Emit the - "folder_selected" signal. - - * e-local-folder.c - (get_string_value): Return a `char *' to be deallocated by the - caller instead of a `const char *' that does not need to be - deallocated. - (construct_loading_metadata): Free values returned from - `get_string_value'. - -2000-05-15 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c: New members `dragged_row_path', - `selected_row_path_before_click' in `EStorageSetViewPrivate'. - (init): Initialize them to NULL. - (motion_notify_event): Set `dragged_row_path' from - `selected_row_path'. - (button_press_event): Initialize `selected_row_path_before_click' - from `selected_row_path'. - (button_release_event): Set `selected_row_path_before_click' to - NULL. - (drag_end): Restore the current selection from - `selected_row_path_before_click'; then set both `dragged_row_path' - to NULL. - -2000-05-15 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c: New members `in_drag' and `drag_button' in - `EStorageSetViewPrivate'. New static variables `drag_types', - `num_drag_types', `target_list'. - (class_init): Create the `target_list'. - (init): Initialize the private `in_drag' member to false. - Initialize the private `drag_button' member to zero. - (button_release_event): Set it to false. - (motion_notify_event): New function, implementation of - `GtkWidget::motion_notify_event'. If `in_drag' is false, set it - to true and set ourselves up as a drag source. - (button_press_event): New function, implementation of - `GtkWidget::button_press_event'. Set `drag_button' to the event's - button number and then chain to the implementation in the parent - class. - (drag_end): New function, implementation of `GtkWidget::drag_end'. - (drag_data_get): New function, implementation of - `GtkWidget::drag_data_get'. - (set_e_shortcut_selection): New function, helper for `drag_data_get'. - (set_uri_list_selection): New function, helper for `drag_data_get'. - (class_init): Install these method implementations. - - * e-storage-set-view.c: New member `selected_row_path' in - `EStorageSetViewPrivate'. - (init): Initialize it to NULL. - (tree_select_row): Set it to the path of the selected row. Don't - emit "folder_selected" yet. Also, keep the grab. - (button_release_event): New function, implementation of - `GtkWidget::button_release_event'. If `selected_row_path' is not - NULL, emit the "folder_selected" signal with `selected_row_path' - as the parameter and then set `selected_row_path' to NULL again. - (class_init): Install `button_release_event'. - - * e-storage-set-view.c: Made `ICON_WIDTH' and `ICON_HEIGHT' global - #defines. - (e_storage_set_view_construct): Set the row height to - `ICON_HEIGHT'. Alos, set the selection mode to - `GTK_SELECTION_BROWSE'. - -2000-05-15 Iain Holmes <ih@csd.abdn.ac.uk> - - * e-local-folder.c (get_string_value): Use the correct function to - get the node's contents. - - * e-shortcuts.c (load_shortcuts): Same as above. - -2000-05-14 Ettore Perazzoli <ettore@helixcode.com> - - * e-folder-type-repository.c - (e_folder_type_repository_get_control_id_for_type): Protect - against non-existing types. - (e_folder_type_repository_get_icon_for_type): Likewise. - -2000-05-14 Ettore Perazzoli <ettore@helixcode.com> - - * e-storage-set-view.c - (folder_compare_cb): Callback comparison function for comparing - folders based on their names. - (insert_folders): Use it to sort the folder list before using it. - -2000-05-14 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c - (setup_storages): Pass the pointer to the folder type repository. - (e_shell_construct): Initialize the folder type repository before - everything else. - - * e-storage-set.c: New member `folder_type_repository' in - `EStorageSetPrivate'. - (init): Initialize it to NULL. - (destroy): Unref it. - (e_storage_set_construct): New arg @folder_type_repository. - Initialize the corresponding member in the private struct through - it. - (e_storage_set_new): New arg @folder_type_repository. - (e_storage_set_get_folder_type_repository): New function. - - * e-shortcuts.c (icon_callback): Just use [the new version of] - `e_folder_type_repository_get_icon_for_type()' instead of loading - the image manually. - - * e-folder-type-repository.c: New member `icon_pixbuf' in - `FolderType'. - (folder_type_new): Load the pixbuf. - (folder_type_free): Unref the pixbuf. - (e_folder_type_repository_get_icon_name_for_type): Renamed from - `e_folder_type_repository_get_icon_for_type'. - (e_folder_type_repository_get_icon_for_type): New function, now - returning a `GdkPixbuf *'. - - * e-shortcuts.c - (icon_callback): Use `e_shell_get_icon_name()'. - - * e-shell-view.c: New member `storage_set_view' in - `EShellViewPrivate'. - (init): Initialize it to NULL. - (e_shell_view_construct): Create an EStorageSetView for the - shell's EStorageSet and put it into a scrolled window. Also, put - the scrolled window into the EShellView with some - [temporary] GtkPaned action. Store the pointer to the - EStorageSetView to `priv->storage_set_view'. - (set_icon): Get an EShellView and an EFolder instead of an - EShellView and a URI. Also, don't leak. - (update_for_current_uir): New helper function. Call `set_icon'. - (show_error): Call it. - (folder_selected_cb): New function. - (setup_widgets): Connect it to the "folder_selected" signal of the - storage set view. - - * e-storage-set-view.c: New file. - * e-storage-set-view.h: New file. - - * e-shell-utils.c: New file. - * e-shell-utils.h: New file. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view-menu.c: Added an about box. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Set the icons when changing between components. - - * main.c: Set the default icon. (The change in e-shell-view.c - doesn't work unless we do this.) - -2000-05-09 Matt Loper <matt@helixcode.com> - - * e-shell-view-menu.c (command_run_bugbuddy): New function; allows - users to submit a bug. - (command_run_bugbuddy): Implemented with jacob's patch. - -2000-05-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (e_shell_new_view): Display the specified @uri in the - view. - - * e-shell-view.c (e_shell_view_construct): Removed arg @uri. - (e_shell_view_new): Likewise. - - * main.c: New string constant `STARTUP_URI', specifying the URI to - show in the startup view. - (new_view_idle_cb): New callback function to create a new view for - `STARTUP_URI' in the idle loop. We need to do this in the idle - loop because the CORBA stuff cannot work until the loop starts - running. - (main): Set `new_view_idle_cb' up as the idle callback instead of - creating the view right away. - -2000-05-09 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (setup_storages): Woops. Don't free the path before - the warning message, as we need to print it. - -2000-05-08 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (destroy_cb): New function. - (main): Connect it to the `destroy' signal on the shell. - -2000-05-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c (load_shortcuts): Const fix. - -2000-05-08 Larry Ewing <lewing@helixcode.com> - - * e-shortcuts.c (load_shortcuts_into_view): xmlFree the return - value of xmlGetProp. - -2000-05-07 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts-view.c (e_shortcuts_view_construct): Use - correct cast. - -2000-05-07 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (main): Connect to "no_views_left", not "destroy". - - * e-shell.c (view_destroy_cb): Grmpf. - -2000-05-07 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c (e_shell_construct): Output a warning message if the - shortcut file is not found. - (setup_storages): Output a warning message if the local storage - cannot be initialized. - (destroy): Destroy all the views. - - * e-shell-view.c - (e_shell_view_construct): Ref the shell. - - * e-shortcuts-view.c - (e_shortcuts_view_construct): Ref the shortcuts. - - * e-shell.c: Create the "no_views_left" signal. New member - `views' in `EShellPrivate'. - (init): Initialize `views' to NULL. - (view_destroy_cb): Destroy handler for a view: remove the view - from `views', and emit the "no_views_left" signal if this was the - last view. - (e_shell_new_view): Add the new view to `views' and connect the - "destroy" signal to `view_destroy_cb'. - (destroy): Destroy the views. - - * e-shell.h: New signal "no_views_left". - - * e-shell-view-menu.c (command_quit): New function, implementation - of the "quit" command. - - * e-shell-view.c (e_shell_view_get_shell): New function. - - * e-shell.c (e_shell_quit): New function. - - * main.c (main): If it is not possible to create the shell for - some reason, pop up an error message. - (shell_destroy_cb): New function, signal handler for "destroy" on - the shell object. - (main): Connect it. - -2000-05-06 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts.c (destroy): Be safer about NULL objects. - - * e-shell.c (destroy): Be safer about NULL objects. - - * e-local-storage.c (load_folders): Use `readdir()', not - `readdir_r()'. - -2000-05-06 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (init_corba) [! USING_OAF]: We have no options no - popt context. - -2000-05-06 Ettore Perazzoli <ettore@helixcode.com> - - * All files: Reorganized and redone a lot of the shell. New - features: internal URI namespace, extensible storage/folder - mechanism, configurable shortcuts. - -2000-05-03 Damon Chaplin <damon@helixcode.com> - - * e-shell-view.c (e_shell_view_new): turned the notebook border off. - The calendar looks better without it. If any of the views want a - border they should create it themselves, shouldn't they? - -2000-05-04 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcut.c (shell_icon_cb): Type of @url changed from `gchar - *' to `const gchar *'; new arg @data. - (e_shortcut_bar_view_new): Pass NULL as the closure value for - `e_shortcut_bar_set_icon_callback()'. - -2000-05-02 Ettore Perazzoli <ettore@helixcode.com> - - * e-folder-mail.c: Removed. - - * e-folder-mail.h: Removed. - - * eshell-types.h: Removed. - - * e-folder.h: Don't #include "eshell-types.h". - -2000-05-02 Ettore Perazzoli <ettore@helixcode.com> - - * e-folder.h: Removed member `eservice' from `EFolder'. - - * e-service.c: Removed. - - * e-service.h: Removed. - -2000-05-02 Matt Loper <matt@helixcode.com> - - * Makefile.am: set G_LOG_DOMAIN. - -2000-05-01 Dan Winship <danw@helixcode.com> - - * e-shell-view.c (e_shell_view_set_view): Turn off control frame - autoactivation, so the toolbars work correctly. This may actually - be a bug in Bonobo, but we'll kludge around it here for now. - -2000-04-27 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell-view.c: OAFized. - (get_view): If `bonobo_widget_new_control()' fails for the - calendar, don't try to get the property bag and stuff and thus - prevent a segfault. - - * main.c - (corba_init): Removed Bonobo initialization. Implemented OAF - version for the case in which `USING_OAF' is #defined. - (init_bonob): New function. - (main): Call `init_bonobo()'. - -2000-04-26 Matt Loper <matt@helixcode.com> - - * e-shell-view.c (bonobo_widget_is_dead): Helper function to see - whether a bonobo widget is a zombie (ie the remote bonobo control - died). - (e_shell_view_set_view): Try to respawn dead widgets. - -2000-04-25 Dan Winship <danw@helixcode.com> - - * Makefile.am: include -I$(datadir)/idl in orbit-idl arguments so - that you can have bonobo installed in the same prefix as - evolution, when that isn't the same prefix is gnome-libs, which a - lot of people seem to be doing. - (CLEANFILES): add EVOLUTION_CORBA_GENERATED - -2000-04-24 Christopher James Lahey <clahey@helixcode.com> - - * idl/folder.idl: Made some functions syncronous that didn't need - to be asyncronous. - -2000-04-24 Matt Loper <matt@helixcode.com> - - * e-shell-view.h: Added hpaned and treeview widgets to - EShellView. Added e_shell_view_toggle_shortcut_bar() and - e_shell_view_toggle_treeview(). - - * e-shell-view.c (e_shell_view_setup_shortcut_display): Use EPaned - widget to house our shortcut bar. - (e_shell_view_toggle_shortcut_bar): New function; toggles whether - the shortcut bar is showing. - (e_shell_view_toggle_treeview): Same, for the treeview (NYI). - (e_shell_view_new): Put the notebook view in our EPaned widget. - - * e-shell-view-menu.c (esv_cmd_toggle_shortcut_bar): New function; - toggles whether the shortcut bar is viewed. - (esv_cmd_toggle_treeview): Same, but with the treeview. Added - menuitems in the "view" menu to allow access to the above. - -2000-04-19 Seth Alves <alves@hungry.com> - - * e-shell-view.c (get_view): set calendar's uri with a property bag - -2000-04-19 Christopher James Lahey <clahey@helixcode.com> - - * idl/folder.idl: New idl file. Still unused. - -2000-04-14 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Made the left pane of the shell view not - autoresize. - -2000-04-09 Matt Loper <matt@helixcode.com> - - * e-shell-view.c (e_shell_view_setup): Set the default height - bigger, to 600, so that everything in the shortcut-bar shows up. - -2000-04-07 Matt Loper <matt@helixcode.com> - - * e-shell-view.c (destroy_folder_view): New function; - Bonobo_Unknown_unref's the controls that have the views in them. - (esv_destroy): Calls the above for each folder_view in the - hashtable. - (get_view): unref the ServiceRepository interface of the control - when we're done with it. - -2000-04-06 Miguel de Icaza <miguel@gnu.org> - - * shell/e-shortcut.c (shell_icon_cb): Append a slash here. - (shell_icons): Only list the filenames. - - * shell/main.c (evolution_boot): Be less rude. - -2000-04-06 Matt Loper <matt@helixcode.com> - - * shell/main.c (evolution_boot): Make sure our data directory is - available with e_setup_base_dir (). - -2000-04-06 Miguel de Icaza <miguel@gnu.org> - - * shell/e-shortcut.c (shell_icon_cb): Load the icons from the - installation path, not form the GNOME-libs installation prefix. - (shell_icon_cb): Memory leak fix. - - * shell/Makefile.am (imagesdir): Pass the EVOLUTION_IMAGES - installation directory here. - -2000-04-05 Seth Alves <alves@hungry.com> - - * shell/e-shell-view.c (get_view): hook up control:calendar - -2000-03-31 Dan Winship <danw@helixcode.com> - - * shell/e-shortcut.c (e_shortcut_bar_view_new, shell_icon_cb): - Update for shortcut bar changes. - - * shell/e-folder.h: add E_FOLDER_SUMMARY - * shell/e-shell.c (e_shell_setup_default_folders): make the - "Today" icon be of type E_FOLDER_SUMMARY, not E_FOLDER_MAIL. - -2000-03-30 Dan Winship <danw@helixcode.com> - - * shell/e-shell-view.c (e_shell_view_set_view): Hold off on - deactivating the "outgoing" control until after setting up the - "incoming" control. That way if the new control takes a few - seconds to load, there won't be an ugly empty spot where the - toolbar used to be while the new control loads. - -2000-03-29 Dan Winship <danw@helixcode.com> - - * shell/e-shell-view.c (e_shell_view_set_view): Call - bonobo_control_frame_activate on the folder_view every time it - is displayed, and bonobo_control_frame_deactivate every time it is - hidden. - -2000-03-25 Matt Loper <matt@helixcode.com> - - * shell/e-shell-view.c (get_view): Move CORBA_Environment to - different scope. - -2000-03-22 Matt Loper <matt@helixcode.com> - - * shell/main.c (evolution_boot): gtk_signal_connect'ed "destroy" - to gtk_main_quit, so that the shell dies when you want it to. - - * shell/e-shell-view.c (get_view): Reorganized, and added - assertions. - (e_shell_view_set_view): Added assertions. - -2000-03-20 Matt Loper <matt@helixcode.com> - - * shell/e-shell-view.h: New private field in EShellView added, - which contains the notebook and a hashtable of folders to views. - - * shell/e-shell-view.c (e_shell_view_set_view): Instead of - creating a new control every time we set the view, we now keep our - controls in a notebook. This function now switches to the correct - notebook page, or creates a new page/control as necessary. - (e_shell_view_new): Creates and inserts the notebook into the - shell. - -2000-03-13 Christopher James Lahey <clahey@helixcode.com> - - * shell/e-shell-view.c: Added an E_FOLDER_CONTACTS section to the - get_view function. - -2000-03-13 bertrand <bertrand@helixcode.com> - - * shell/e-shell.c (EShell_register_service): - test implementation. Show the uri and the type - of service that has just been registered. - - * shell/e-shell-view.c (get_view): - once we have the bonobo control widget, - disable the autoactivation and activate - the control frame. - (get_view): added a parameter to have - a reference to the EShellView. - (get_view): In the case of the mail component - use the Evolution_ServiceRepository to - give the component a reference to the - Shell server. - -2000-03-12 bertrand <bertrand@helixcode.com> - - * shell/e-shell-view.c (get_view): name change - - - * shell/e-folder.c (e_folder_get_folder_type): added the - get_e_folder_type function. - - * shell/evolution-service-repository.c: - (evolution_service_repository_new): creates an - Evolution_ServiceRepository object. - (create_evolution_service_repository): - create the corresponding servant. - (evolution_service_repository_construct): set - the closure as well as the virtual functions. - -2000-03-12 bertrand <bertrand@helixcode.com> - - * shell/evolution-service-repository.c: - * shell/evolution-service-repository.h: - Implementation of the service repository interface - as a bonobo object. - - * shell/evolution-service-repository.idl: - new file. Contains the definition for the service - repository interface. - - * shell/Shell.idl: move the shell related stuff - here - -2000-03-12 bertrand <bertrand@helixcode.com> - - * shell/e-folder.h: add a field refering to a - service associated to the efolder. In the case of - distant folders, it is generally a server. - - * shell/e-service.c: New class. Models a service. - A service is an object with an URI and a root folder. - It genreally reporesents a distant folder. - A service is generally a ressource shared amongst - several folders. - * shell/e-service.h: - -2000-03-07 bertrand <bertrand@helixcode.com> - - * shell/e-shell-shortcut.c (shortcut_bar_item_selected): - removed a test that prevented the standard menu - to be shown. - -2000-03-01 Ettore Perazzoli <ettore@helixcode.com> - - * shell/Makefile.am (INCLUDES): use `top_srcdir' instead of - `srcdir'. Also, add `$(top_srcdir)'. And put the srcdir includes - before everything else. - (evolution_LDADD): `libeutil.la', not `libeutil.a'. - -2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org> - - * shell/Makefile.am (evolution_LDADD): - add libetext.a. - -2000-02-08 Iain Holmes <ih@csd.abdn.ac.uk> - - * shell/Makefile.am: Changed the order of the compilation, so the CORBA - stuff was generated before it was needed. - -2000-01-15 Miguel de Icaza <miguel@gnu.org> - - * shell/e-shell.c: Construct the default folders - - * shell/e-shell-view.c (e_shell_view_new): Setup the main GnomeApp - application, load the shortcut, internal api. - - * shell/e-folder.c (e_folder_get_type_name): Return description - here; Change of policy; We now know about all of the possible - types that can be displayed on Evolution. - -2000-01-15 Miguel de Icaza <miguel@gnu.org> - - * shell/e-folder.c: Renamed signal. - - * widgets/shortcut-bar/e-shortcut-bar.c (e_shortcut_bar_add_item): - Use e_bar_set_item_data. - - Drop item_url; Require image argument; Require user data - argument. - -2000-01-05 Miguel de Icaza <miguel@gnu.org> - - * shell/Makefile.am: New file. - diff --git a/shell/Evolution-LocalStorage.idl b/shell/Evolution-LocalStorage.idl deleted file mode 100644 index 4ca81670e4..0000000000 --- a/shell/Evolution-LocalStorage.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution local storage. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { - interface LocalStorage : Evolution::Storage { - /** - * update_folder: - * @path: Path of a folder within the storage. - * @display_name: Name to be displayed in the tree view for - * this folder - * @highlighted: Whether or not to highlight the name. - * - * Set the name to display for the folder at the specified - * @path. - */ - void update_folder (in string path, - in string display_name, - in boolean highlighted); - }; -}; diff --git a/shell/Evolution-Session.idl b/shell/Evolution-Session.idl deleted file mode 100644 index 855f1c03ea..0000000000 --- a/shell/Evolution-Session.idl +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for saving configuration information. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.h> - -module Evolution { - - interface Session : Bonobo::Unknown { - exception Failed {}; - - /** - * save_configuration: - * @prefix: A configuration path prefix. - * - * Save the current configuration at the specified @prefix. - * The component can use any path starting by @prefix for its - * keys. - */ - void save_configuration (in string prefix) - raises (Failed); - - /** - * load_configuration: - * @prefix: A configuration path prefix. - * - * Load the saved configuration at the specified @prefix. - */ - void load_configuration (in string prefix) - raises (Failed); - }; - -}; diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl deleted file mode 100644 index 0102ba09ec..0000000000 --- a/shell/Evolution-Shell.idl +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { - interface ShellComponent; - - interface FolderSelectionListener; - - interface Shell : Bonobo::Unknown { - exception NotFound {}; - exception Busy {}; - - /** - * get_component_for_type: - * @type: name of a valid folder type - * - * Get the shell component associated with a specific folder type. - * - * Return value: the Evolution::ShellComponent interface for the component that - * handles @type. - */ - ShellComponent get_component_for_type (in string type) - raises (NotFound); - - typedef sequence<string> FolderTypeList; - - /** - * user_select_folder: - * @listener: a listener interface to report the answer of the user. - * @title: title for the folder selector dialog - * @default_folder: physical or `evolution:' URI for the folder that must be - * selected by default, when the dialog is popped up - * @possible_types: list of the names of the types of folders that are allowed - * - * Pop up a folder selection dialog from which the user can select a folder. - * Initially, the @default_folder is selected. The user can also create a new - * folder by using the "New..." button. The dialog only lets the user choose - * a folder whose type is listed in @possible_types. - */ - void user_select_folder (in FolderSelectionListener listener, - in string title, - in string default_folder, - in FolderTypeList possible_types) - raises (Busy); - - /** - * get_local_storage: - * - * Get the interface to the local storage. - * - * FIXME: Probably we just want to be able to request this to - * the StorageRegistry. This is an ugly kludge. - * - * Return value: the `Evolution::LocalStorage' interface for - * the local storage. */ - LocalStorage get_local_storage (); - - /** - * create_storage_set_view: - * - * Create a control for the storage set view. This control - * will also implement the `Evolution::StorageSetView' interface. - * - * Return value: the newly created control. - */ - Bonobo::Control create_storage_set_view (); - }; - - interface FolderSelectionListener { - void selected (in string uri, in string physical_uri); - void cancel (); - }; -}; diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl deleted file mode 100644 index 106ec0d571..0000000000 --- a/shell/Evolution-ShellComponent.idl +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution components. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.h> - -module Evolution { - interface Shell; - - struct FolderType { - string name; - string icon_name; - }; - - typedef sequence<FolderType> FolderTypeList; - - interface ShellComponentListener; - - interface ShellComponent : Bonobo::Unknown { - readonly attribute FolderTypeList supported_types; - - /* FIXME: Can we use an attribute here? */ - exception AlreadyOwned {}; - - void set_owner (in Shell shell, in string evolution_homedir) - raises (AlreadyOwned); - - exception NotOwned {}; - - void unset_owner () - raises (NotOwned); - - /* FIXME: We might want more exceptions here. */ - exception NotFound {}; - exception UnsupportedType {}; - exception InternalError {}; - - Bonobo::Control create_view (in string physical_uri, - in string type) - raises (NotFound, UnsupportedType, InternalError); - - exception Busy {}; - - void async_create_folder (in ShellComponentListener listener, - in string physical_uri, - in string type) - raises (Busy); - void async_remove_folder (in ShellComponentListener listener, - in string physical_uri) - raises (Busy); - - void populate_folder_context_menu (in Bonobo::UIContainer uih, - in string physical_uri, - in string type); - }; - - interface ShellComponentListener { - enum Result { - OK, - UNSUPPORTED_OPERATION, - UNSUPPORTED_TYPE, - EXISTS, - INVALID_URI, - PERMISSION_DENIED, - HAS_SUBFOLDERS, - NO_SPACE - }; - - void report_result (in Result result); - }; -}; diff --git a/shell/Evolution-ShellView.idl b/shell/Evolution-ShellView.idl deleted file mode 100644 index d155b3397c..0000000000 --- a/shell/Evolution-ShellView.idl +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution shell views. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { - interface ShellView : Bonobo::Unknown { - void set_message (in string message, in boolean busy); - void unset_message (); - void change_current_view (in string uri); - void set_title (in string title); - }; -}; diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl deleted file mode 100644 index 5aadf8eb19..0000000000 --- a/shell/Evolution-Storage.idl +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Storage interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.h> - -module Evolution { - struct Folder { - string type; - string description; - string display_name; - string physical_uri; - boolean highlighted; - }; - - interface Storage; - interface StorageListener; - - interface Storage : Bonobo::Unknown { - exception AlreadyListening {}; - exception NotFound {}; - - attribute string name; - - void add_listener (in StorageListener listener) - raises (AlreadyListening); - - void remove_listener (in StorageListener listener) - raises (NotFound); - }; - - interface StorageListener { - exception Exists {}; - exception NotFound {}; - - void destroyed (); - - /* FIXME exceptions don't make much sense here... */ - - void new_folder (in string path, in Folder folder) - raises (Exists); - - void update_folder (in string path, in string display_name, - in boolean highlighted) - raises (NotFound); - - void removed_folder (in string path) - raises (NotFound); - }; - - interface StorageRegistry : Bonobo::Unknown { - exception Exists {}; - exception NotFound {}; - - StorageListener register_storage (in Storage storage, in string name) - raises (Exists); - - void unregister_storage (in string name) - raises (NotFound); - }; -}; diff --git a/shell/Evolution-StorageSetView.idl b/shell/Evolution-StorageSetView.idl deleted file mode 100644 index 3d95b075be..0000000000 --- a/shell/Evolution-StorageSetView.idl +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution's StorageSetView control. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonoob.idl> - -module Evolution { - interface StorageSetViewListener { - void folder_selected (in string uri); - void storage_selected (in string uri); - }; - - /* FIXME: Maybe we should have a generic Bonobo::Listener interface. */ - interface StorageSetView : Bonobo::Unknown { - exception AlreadyListening {}; - exception NotFound {}; - - attribute boolean show_folders; - - void add_listener (in StorageSetViewListener listener) - raises (AlreadyListening); - void remove_listener (in StorageSetViewListener listener) - raises (NotFound); - }; -}; diff --git a/shell/Evolution.idl b/shell/Evolution.idl deleted file mode 100644 index 71ae040684..0000000000 --- a/shell/Evolution.idl +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * CORBA interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -#include <Evolution-Session.idl> -#include <Evolution-ShellComponent.idl> -#include <Evolution-ShellView.idl> -#include <Evolution-Storage.idl> -#include <Evolution-StorageSetView.idl> -#include <Evolution-LocalStorage.idl> -#include <Evolution-Shell.idl> diff --git a/shell/Makefile.am b/shell/Makefile.am deleted file mode 100644 index 97205112ff..0000000000 --- a/shell/Makefile.am +++ /dev/null @@ -1,150 +0,0 @@ -SUBDIRS = glade - -INCLUDES = \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir) \ - $(BONOBO_GNOME_CFLAGS) \ - $(EXTRA_GNOME_CFLAGS) \ - -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \ - -DG_LOG_DOMAIN=\"evolution-shell\" - -EXTRA_DIST = $(IDLS) - -CLEANFILES = $(IDL_GENERATED) - -# CORBA stuff - -IDLS = \ - Evolution-LocalStorage.idl \ - Evolution-Session.idl \ - Evolution-Shell.idl \ - Evolution-ShellComponent.idl \ - Evolution-ShellView.idl \ - Evolution-Storage.idl \ - Evolution-StorageSetView.idl \ - Evolution.idl - -IDL_GENERATED = \ - Evolution.h \ - Evolution-common.c \ - Evolution-skels.c \ - Evolution-stubs.c - -Evolution-impl.o: Evolution.h - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - -I$(srcdir) $(srcdir)/Evolution.idl - -# Shell library - -noinst_LIBRARIES = \ - libeshell.a - -libeshell_a_SOURCES = \ - $(IDL_GENERATED) \ - e-folder-tree.c \ - e-folder-tree.h \ - evolution-local-storage.c \ - evolution-local-storage.h \ - evolution-session.c \ - evolution-session.h \ - evolution-shell-client.c \ - evolution-shell-client.h \ - evolution-shell-component-client.c \ - evolution-shell-component-client.h \ - evolution-shell-component.c \ - evolution-shell-component.h \ - evolution-shell-view.c \ - evolution-shell-view.h \ - evolution-storage-listener.c \ - evolution-storage-listener.h \ - evolution-storage-set-view-listener.c \ - evolution-storage-set-view-listener.h \ - evolution-storage.c \ - evolution-storage.h - -# Evolution executable - -bin_PROGRAMS = evolution - -evolution_SOURCES = \ - e-component-registry.c \ - e-component-registry.h \ - e-corba-storage-registry.c \ - e-corba-storage-registry.h \ - e-corba-storage.c \ - e-corba-storage.h \ - e-folder-type-registry.c \ - e-folder-type-registry.h \ - e-folder.c \ - e-folder.h \ - e-local-folder.c \ - e-local-folder.h \ - e-local-storage.c \ - e-local-storage.h \ - e-setup.c \ - e-setup.h \ - e-shell-constants.h \ - e-shell-folder-creation-dialog.c \ - e-shell-folder-creation-dialog.h \ - e-shell-folder-selection-dialog.c \ - e-shell-folder-selection-dialog.h \ - e-shell-folder-title-bar.c \ - e-shell-folder-title-bar.h \ - e-shell-utils.c \ - e-shell-utils.h \ - e-shell-view-menu.c \ - e-shell-view-menu.h \ - e-shell-view.c \ - e-shell-view.h \ - e-shell.c \ - e-shell.h \ - e-shortcuts-view-model.c \ - e-shortcuts-view-model.h \ - e-shortcuts-view.c \ - e-shortcuts-view.h \ - e-shortcuts.c \ - e-shortcuts.h \ - e-splash.c \ - e-splash.h \ - e-storage-set-view.c \ - e-storage-set-view.h \ - e-storage-set.c \ - e-storage-set.h \ - e-storage.c \ - e-storage.h \ - evolution-storage-set-view.c \ - evolution-storage-set-view.h \ - evolution-storage-set-view-factory.c \ - evolution-storage-set-view-factory.h \ - main.c - -evolution_LDADD = \ - libeshell.a \ - $(top_builddir)/widgets/shortcut-bar/libshortcut-bar.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(EXTRA_GNOME_LIBS) \ - $(UNICODE_LIBS) \ - $(GNOME_PRINT_LIBS) \ - $(BONOBO_GNOME_LIBS) - -# Purify support - -if ENABLE_PURIFY - -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution.pure - -evolution.pure: evolution - @rm -f evolution.pure - $(PLINK) $(evolution_LDFLAGS) $(evolution_OBJECTS) $(evolution_LDADD) $(LIBS) - -endif diff --git a/shell/README b/shell/README deleted file mode 100644 index fc0871eb5d..0000000000 --- a/shell/README +++ /dev/null @@ -1,14 +0,0 @@ -Two things are built in this directory: the shell's executable, named -`evolution', and the shell utility library, `libeshell'. - -The `e-*' files belong to the shell, and their API is not exported at -all. - -The `evolution-*' files, instead, are Bonobo-style wrappers for the -shell's Evolution:: CORBA interfaces. They are all compiled into -`libeshell'; the shell itself links against `libeshell'. - -The `evolution-*-client' files are utility GTK+-style wrappers for the -CORBA methods; the modules whose name does not end with `-client', -instead, are Bonobo-like GTK+ objects wrapping the implementation of -the CORBA server. diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c deleted file mode 100644 index 4ec951a81c..0000000000 --- a/shell/e-component-registry.c +++ /dev/null @@ -1,365 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtktypeutils.h> -#include <bonobo.h> - -#include <gal/util/e-util.h> -#include "e-shell-utils.h" - -#include "Evolution.h" - -#include "evolution-shell-component-client.h" - -#include "e-component-registry.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -typedef struct _Component Component; - -struct _Component { - char *id; - - EvolutionShellComponentClient *client; - - /* Names of the folder types we support (normal ASCII strings). */ - GList *folder_type_names; -}; - -struct _EComponentRegistryPrivate { - EShell *shell; - - GHashTable *component_id_to_component; -}; - - -/* Component information handling. */ - -static Component * -component_new (const char *id, - EvolutionShellComponentClient *client) -{ - Component *new; - - bonobo_object_ref (BONOBO_OBJECT (client)); - - new = g_new (Component, 1); - new->id = g_strdup (id); - new->folder_type_names = NULL; - new->client = client; - - return new; -} - -static void -component_free (Component *component) -{ - Evolution_ShellComponent corba_shell_component; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (component->client)); - Evolution_ShellComponent_unset_owner (corba_shell_component, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Cannot unregister component -- %s", component->id); - else - g_print ("Component unregistered successfully -- %s\n", component->id); - CORBA_exception_free (&ev); - - g_free (component->id); - - bonobo_object_unref (BONOBO_OBJECT (component->client)); - - e_free_string_list (component->folder_type_names); - - g_free (component); -} - -static gboolean -register_type (EComponentRegistry *component_registry, - const char *name, - const char *icon_name, - Component *handler) -{ - EComponentRegistryPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - - priv = component_registry->priv; - - folder_type_registry = e_shell_get_folder_type_registry (priv->shell); - g_assert (folder_type_registry != NULL); - - if (! e_folder_type_registry_register_type (folder_type_registry, name, icon_name)) { - g_warning ("Trying to register duplicate folder type -- %s", name); - return FALSE; - } - - e_folder_type_registry_set_handler_for_type (folder_type_registry, name, handler->client); - - return TRUE; -} - -static gboolean -register_component (EComponentRegistry *component_registry, - const char *id) -{ - EComponentRegistryPrivate *priv; - Evolution_ShellComponent component_corba_interface; - Evolution_Shell shell_corba_interface; - Evolution_FolderTypeList *supported_types; - Component *component; - EvolutionShellComponentClient *client; - CORBA_Environment ev; - CORBA_unsigned_long i; - - priv = component_registry->priv; - - if (g_hash_table_lookup (priv->component_id_to_component, id) != NULL) { - g_warning ("Trying to register component twice -- %s", id); - return FALSE; - } - - client = evolution_shell_component_client_new (id); - if (client == NULL) - return FALSE; - - CORBA_exception_init (&ev); - - /* FIXME we could use the EvolutionShellComponentClient API here instead, but for - now we don't care. */ - - component_corba_interface = bonobo_object_corba_objref (BONOBO_OBJECT (client)); - shell_corba_interface = bonobo_object_corba_objref (BONOBO_OBJECT (priv->shell)); - - supported_types = Evolution_ShellComponent__get_supported_types (component_corba_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION || supported_types->_length == 0) { - bonobo_object_unref (BONOBO_OBJECT (client)); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - component = component_new (id, client); - g_hash_table_insert (priv->component_id_to_component, component->id, component); - - for (i = 0; i < supported_types->_length; i++) { - const Evolution_FolderType *type; - - type = supported_types->_buffer + i; - - if (! register_type (component_registry, type->name, type->icon_name, component)) { - g_warning ("Cannot register type `%s' for component %s", - type->name, component->id); - } else { - g_print ("Registered type for component -- (%s) %s\n", - type->name, component->id); - } - } - - CORBA_free (supported_types); - - return TRUE; -} - - -/* GtkObject methods. */ - -static void -component_id_foreach_free (void *key, - void *value, - void *user_data) -{ - Component *component; - - component = (Component *) value; - component_free (component); -} - -static void -destroy (GtkObject *object) -{ - EComponentRegistry *component_registry; - EComponentRegistryPrivate *priv; - - component_registry = E_COMPONENT_REGISTRY (object); - priv = component_registry->priv; - - bonobo_object_unref (BONOBO_OBJECT (priv->shell)); - - g_hash_table_foreach (priv->component_id_to_component, component_id_foreach_free, NULL); - g_hash_table_destroy (priv->component_id_to_component); - - g_free (priv); -} - - -static void -class_init (EComponentRegistryClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); -} - - -static void -init (EComponentRegistry *component_registry) -{ - EComponentRegistryPrivate *priv; - - priv = g_new (EComponentRegistryPrivate, 1); - priv->shell = NULL; - priv->component_id_to_component = g_hash_table_new (g_str_hash, g_str_equal); - - component_registry->priv = priv; -} - - -void -e_component_registry_construct (EComponentRegistry *component_registry, - EShell *shell) -{ - EComponentRegistryPrivate *priv; - - g_return_if_fail (component_registry != NULL); - g_return_if_fail (E_IS_COMPONENT_REGISTRY (component_registry)); - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - priv = component_registry->priv; - - bonobo_object_ref (BONOBO_OBJECT (shell)); - priv->shell = shell; -} - -EComponentRegistry * -e_component_registry_new (EShell *shell) -{ - EComponentRegistry *component_registry; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - component_registry = gtk_type_new (e_component_registry_get_type ()); - e_component_registry_construct (component_registry, shell); - - return component_registry; -} - - -gboolean -e_component_registry_register_component (EComponentRegistry *component_registry, - const char *id) -{ - g_return_val_if_fail (component_registry != NULL, FALSE); - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), FALSE); - g_return_val_if_fail (id != NULL, FALSE); - - return register_component (component_registry, id); -} - - -static void -compose_id_list_foreach (void *key, - void *value, - void *data) -{ - GList **listp; - const char *id; - - listp = (GList **) data; - id = (const char *) key; - - *listp = g_list_prepend (*listp, g_strdup (id)); -} - -/** - * e_component_registry_get_id_list: - * @component_registry: - * - * Get the list of components registered. - * - * Return value: A GList of strings containining the IDs for all the registered - * components. The list must be freed by the caller when not used anymore. - **/ -GList * -e_component_registry_get_id_list (EComponentRegistry *component_registry) -{ - EComponentRegistryPrivate *priv; - GList *list; - - g_return_val_if_fail (component_registry != NULL, NULL); - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), NULL); - - priv = component_registry->priv; - list = NULL; - - g_hash_table_foreach (priv->component_id_to_component, compose_id_list_foreach, &list); - - return list; -} - -/** - * e_component_registry_get_component_by_id: - * @component_registry: - * @id: The component's OAF ID - * - * Get the registered component client for the specified ID. If that component - * is not registered, return NULL. - * - * Return value: A pointer to the ShellComponentClient for that component. - **/ -EvolutionShellComponentClient * -e_component_registry_get_component_by_id (EComponentRegistry *component_registry, - const char *id) -{ - EComponentRegistryPrivate *priv; - const Component *component; - - g_return_val_if_fail (component_registry != NULL, NULL); - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), NULL); - g_return_val_if_fail (id != NULL, NULL); - - priv = component_registry->priv; - - component = g_hash_table_lookup (priv->component_id_to_component, id); - if (component == NULL) - return NULL; - - return component->client; -} - - -E_MAKE_TYPE (e_component_registry, "EComponentRegistry", EComponentRegistry, - class_init, init, PARENT_TYPE) diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h deleted file mode 100644 index 0a34413844..0000000000 --- a/shell/e-component-registry.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_COMPONENT_REGISTRY_H__ -#define __E_COMPONENT_REGISTRY_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#include "e-shell.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_COMPONENT_REGISTRY (e_component_registry_get_type ()) -#define E_COMPONENT_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_COMPONENT_REGISTRY, EComponentRegistry)) -#define E_COMPONENT_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_REGISTRY, EComponentRegistryClass)) -#define E_IS_COMPONENT_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY)) -#define E_IS_COMPONENT_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY)) - - -typedef struct _EComponentRegistry EComponentRegistry; -typedef struct _EComponentRegistryPrivate EComponentRegistryPrivate; -typedef struct _EComponentRegistryClass EComponentRegistryClass; - -struct _EComponentRegistry { - GtkObject parent; - - EComponentRegistryPrivate *priv; -}; - -struct _EComponentRegistryClass { - GtkObjectClass parent_class; -}; - - -GtkType e_component_registry_get_type (void); -void e_component_registry_construct (EComponentRegistry *component_registry, - EShell *shell); -EComponentRegistry *e_component_registry_new (EShell *shell); - -gboolean e_component_registry_register_component (EComponentRegistry *component_registry, - const char *id); - -GList *e_component_registry_get_id_list (EComponentRegistry *component_registry); - -EvolutionShellComponentClient *e_component_registry_get_component_by_id (EComponentRegistry *component_registry, - const char *id); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_COMPONENT_REGISTRY_H__ */ diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c deleted file mode 100644 index a1881f10dd..0000000000 --- a/shell/e-corba-storage-registry.c +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage-registry.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gal/util/e-util.h> - -#include "e-corba-storage.h" - -#include "e-corba-storage-registry.h" - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _ECorbaStorageRegistryPrivate { - EStorageSet *storage_set; -}; - - -/* CORBA interface implementation. */ - -static POA_Evolution_StorageRegistry__vepv storage_registry_vepv; - -static POA_Evolution_StorageRegistry * -create_servant (void) -{ - POA_Evolution_StorageRegistry *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_StorageRegistry *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &storage_registry_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_StorageRegistry__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static Evolution_StorageListener -impl_StorageRegistry_register_storage (PortableServer_Servant servant, - const Evolution_Storage storage_interface, - const CORBA_char *name, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ECorbaStorageRegistry *storage_registry; - ECorbaStorageRegistryPrivate *priv; - EStorage *storage; - Evolution_StorageListener listener_interface; - - g_print ("Shell: Registering storage -- %s\n", name); - - bonobo_object = bonobo_object_from_servant (servant); - storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object); - priv = storage_registry->priv; - - storage = e_corba_storage_new (storage_interface, name); - - if (! e_storage_set_add_storage (priv->storage_set, storage)) { - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_Evolution_StorageRegistry_Exists, - NULL); - return CORBA_OBJECT_NIL; - } - - gtk_object_unref (GTK_OBJECT (storage)); - - listener_interface = CORBA_Object_duplicate (e_corba_storage_get_StorageListener - (E_CORBA_STORAGE (storage)), ev); - - return listener_interface; -} - -static void -impl_StorageRegistry_unregister_storage (PortableServer_Servant servant, - const CORBA_char *name, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ECorbaStorageRegistry *storage_registry; - ECorbaStorageRegistryPrivate *priv; - EStorage *storage; - - bonobo_object = bonobo_object_from_servant (servant); - storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object); - priv = storage_registry->priv; - - storage = e_storage_set_get_storage (priv->storage_set, name); - if (storage == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_StorageRegistry_NotFound, - NULL); - return; - } - - /* FIXME: Yucky to get the storage by name and then remove it. */ - /* FIXME: Check failure. */ - e_storage_set_remove_storage (priv->storage_set, storage); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - ECorbaStorageRegistry *corba_storage_registry; - ECorbaStorageRegistryPrivate *priv; - - corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object); - priv = corba_storage_registry->priv; - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -corba_class_init (void) -{ - POA_Evolution_StorageRegistry__vepv *vepv; - POA_Evolution_StorageRegistry__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_StorageRegistry__epv, 1); - epv->register_storage = impl_StorageRegistry_register_storage; - epv->unregister_storage = impl_StorageRegistry_unregister_storage; - - vepv = &storage_registry_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_StorageRegistry_epv = epv; -} - -static void -class_init (ECorbaStorageRegistryClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - - corba_class_init (); -} - -static void -init (ECorbaStorageRegistry *corba_storage_registry) -{ - ECorbaStorageRegistryPrivate *priv; - - priv = g_new (ECorbaStorageRegistryPrivate, 1); - priv->storage_set = NULL; - - corba_storage_registry->priv = priv; -} - - -void -e_corba_storage_registry_construct (ECorbaStorageRegistry *corba_storage_registry, - Evolution_StorageRegistry corba_object, - EStorageSet *storage_set) -{ - ECorbaStorageRegistryPrivate *priv; - - g_return_if_fail (corba_storage_registry != NULL); - g_return_if_fail (E_IS_CORBA_STORAGE_REGISTRY (corba_storage_registry)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - - bonobo_object_construct (BONOBO_OBJECT (corba_storage_registry), corba_object); - - priv = corba_storage_registry->priv; - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; -} - -ECorbaStorageRegistry * -e_corba_storage_registry_new (EStorageSet *storage_set) -{ - ECorbaStorageRegistry *corba_storage_registry; - POA_Evolution_StorageRegistry *servant; - Evolution_StorageRegistry corba_object; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - servant = create_servant (); - if (servant == NULL) - return NULL; - - corba_storage_registry = gtk_type_new (e_corba_storage_registry_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (corba_storage_registry), - servant); - - e_corba_storage_registry_construct (corba_storage_registry, corba_object, storage_set); - - return corba_storage_registry; -} - - -E_MAKE_TYPE (e_corba_storage_registry, "ECorbaStorageRegistry", ECorbaStorageRegistry, class_init, init, PARENT_TYPE) diff --git a/shell/e-corba-storage-registry.h b/shell/e-corba-storage-registry.h deleted file mode 100644 index baf689c551..0000000000 --- a/shell/e-corba-storage-registry.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage-registry.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_CORBA_STORAGE_REGISTRY_H__ -#define __E_CORBA_STORAGE_REGISTRY_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object.h> - -#include "Evolution.h" -#include "e-storage-set.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_CORBA_STORAGE_REGISTRY (e_corba_storage_registry_get_type ()) -#define E_CORBA_STORAGE_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CORBA_STORAGE_REGISTRY, ECorbaStorageRegistry)) -#define E_CORBA_STORAGE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_STORAGE_REGISTRY, ECorbaStorageRegistryClass)) -#define E_IS_CORBA_STORAGE_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CORBA_STORAGE_REGISTRY)) -#define E_IS_CORBA_STORAGE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_STORAGE_REGISTRY)) - - -typedef struct _ECorbaStorageRegistry ECorbaStorageRegistry; -typedef struct _ECorbaStorageRegistryPrivate ECorbaStorageRegistryPrivate; -typedef struct _ECorbaStorageRegistryClass ECorbaStorageRegistryClass; - -struct _ECorbaStorageRegistry { - BonoboObject parent; - - ECorbaStorageRegistryPrivate *priv; -}; - -struct _ECorbaStorageRegistryClass { - BonoboObjectClass parent_class; -}; - - -GtkType e_corba_storage_registry_get_type (void); -void e_corba_storage_registry_construct (ECorbaStorageRegistry *corba_storage_registry, - Evolution_StorageRegistry corba_object, - EStorageSet *storage_set); -ECorbaStorageRegistry *e_corba_storage_registry_new (EStorageSet *storage_set); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_CORBA_STORAGE_REGISTRY_H__ */ diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c deleted file mode 100644 index c6a3a99cdc..0000000000 --- a/shell/e-corba-storage.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include <gal/util/e-util.h> - -#include "Evolution.h" - -#include "e-corba-storage.h" - - -#define PARENT_TYPE E_TYPE_STORAGE -static EStorageClass *parent_class = NULL; - -typedef struct _StorageListenerServant StorageListenerServant; - -struct _ECorbaStoragePrivate { - char *name; - - Evolution_Storage storage_interface; - - /* The Evolution::StorageListener interface we expose. */ - - Evolution_StorageListener storage_listener_interface; - StorageListenerServant *storage_listener_servant; -}; - - -/* Implementation of the CORBA Evolution::StorageListener interface. */ - -static POA_Evolution_StorageListener__vepv storage_listener_vepv; - -struct _StorageListenerServant { - POA_Evolution_StorageListener servant; - EStorage *storage; -}; - -static StorageListenerServant * -storage_listener_servant_new (ECorbaStorage *corba_storage) -{ - StorageListenerServant *servant; - - servant = g_new0 (StorageListenerServant, 1); - - servant->servant.vepv = &storage_listener_vepv; - - gtk_object_ref (GTK_OBJECT (corba_storage)); - servant->storage = E_STORAGE (corba_storage); - - return servant; -} - -static void -storage_listener_servant_free (StorageListenerServant *servant) -{ - gtk_object_unref (GTK_OBJECT (servant->storage)); - - g_free (servant); -} - -#if 0 -static void -impl_StorageListener_destroy (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - /* FIXME */ -} -#endif - -static void -impl_StorageListener_new_folder (PortableServer_Servant servant, - const CORBA_char *path, - const Evolution_Folder *folder, - CORBA_Environment *ev) -{ - StorageListenerServant *storage_listener_servant; - EStorage *storage; - EFolder *e_folder; - - storage_listener_servant = (StorageListenerServant *) servant; - storage = storage_listener_servant->storage; - - e_folder = e_folder_new (folder->display_name, - folder->type, - folder->description); - - e_folder_set_physical_uri (e_folder, folder->physical_uri); - e_folder_set_highlighted (e_folder, folder->highlighted); - - if (! e_storage_new_folder (storage, path, e_folder)) { - g_print ("Cannot register folder -- %s %s\n", path, folder->display_name); - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_Evolution_StorageListener_Exists, - NULL); - gtk_object_unref (GTK_OBJECT (e_folder)); - return; - } - - g_print ("Folder registered successfully -- %s %s\n", path, folder->display_name); -} - -static void -impl_StorageListener_update_folder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_boolean highlighted, - CORBA_Environment *ev) -{ - StorageListenerServant *storage_listener_servant; - EStorage *storage; - EFolder *e_folder; - - storage_listener_servant = (StorageListenerServant *) servant; - storage = storage_listener_servant->storage; - - e_folder = e_storage_get_folder (storage, path); - if (e_folder == NULL) { - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_Evolution_StorageListener_NotFound, - NULL); - return; - } - - e_folder_set_name (e_folder, display_name); - e_folder_set_highlighted (e_folder, highlighted); - - e_storage_updated_folder (storage, path); -} - -static void -impl_StorageListener_removed_folder (PortableServer_Servant servant, - const CORBA_char *path, - CORBA_Environment *ev) -{ - StorageListenerServant *storage_listener_servant; - EStorage *storage; - - storage_listener_servant = (StorageListenerServant *) servant; - storage = storage_listener_servant->storage; - - if (! e_storage_removed_folder (storage, path)) - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_Evolution_StorageListener_NotFound, - NULL); -} - - -static gboolean -setup_storage_listener (ECorbaStorage *corba_storage) -{ - StorageListenerServant *servant; - ECorbaStoragePrivate *priv; - Evolution_StorageListener storage_listener_interface; - CORBA_Environment ev; - - priv = corba_storage->priv; - - servant = storage_listener_servant_new (corba_storage); - - CORBA_exception_init (&ev); - - POA_Evolution_StorageListener__init (servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - goto error; - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - if (ev._major != CORBA_NO_EXCEPTION) - goto error; - - storage_listener_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), - servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - goto error; - - priv->storage_listener_interface = storage_listener_interface; - priv->storage_listener_servant = servant; - - return TRUE; - - error: - storage_listener_servant_free (servant); - CORBA_exception_free (&ev); - return FALSE; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - CORBA_Environment ev; - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - - corba_storage = E_CORBA_STORAGE (object); - priv = corba_storage->priv; - - g_free (priv->name); - - CORBA_exception_init (&ev); - - if (priv->storage_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->storage_interface, &ev); - CORBA_Object_release (priv->storage_interface, &ev); - } - - if (priv->storage_listener_interface != CORBA_OBJECT_NIL) - CORBA_Object_release (priv->storage_listener_interface, &ev); - - if (priv->storage_listener_servant != NULL) { - PortableServer_ObjectId *object_id; - - object_id = PortableServer_POA_servant_to_id (bonobo_poa (), priv->storage_listener_servant, - &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev); - - POA_Evolution_StorageListener__fini (priv->storage_listener_servant, &ev); - CORBA_free (object_id); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EStorage methods. */ - -static const char * -get_name (EStorage *storage) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - return priv->name; -} - - -static void -corba_class_init (void) -{ - POA_Evolution_StorageListener__vepv *vepv; - POA_Evolution_StorageListener__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_StorageListener__epv, 1); - epv->new_folder = impl_StorageListener_new_folder; - epv->update_folder = impl_StorageListener_update_folder; - epv->removed_folder = impl_StorageListener_removed_folder; - - vepv = &storage_listener_vepv; - vepv->_base_epv = base_epv; - vepv->Evolution_StorageListener_epv = epv; -} - -static void -class_init (ECorbaStorageClass *klass) -{ - GtkObjectClass *object_class; - EStorageClass *storage_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - storage_class = E_STORAGE_CLASS (klass); - storage_class->get_name = get_name; - - corba_class_init (); - - parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -init (ECorbaStorage *corba_storage) -{ - ECorbaStoragePrivate *priv; - - priv = g_new (ECorbaStoragePrivate, 1); - priv->name = NULL; - priv->storage_interface = CORBA_OBJECT_NIL; - - corba_storage->priv = priv; -} - - -/* FIXME: OK to have a boolean construct function? */ -void -e_corba_storage_construct (ECorbaStorage *corba_storage, - const Evolution_Storage storage_interface, - const char *name) -{ - ECorbaStoragePrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (corba_storage != NULL); - g_return_if_fail (E_IS_CORBA_STORAGE (corba_storage)); - g_return_if_fail (storage_interface != CORBA_OBJECT_NIL); - g_return_if_fail (name != NULL); - - e_storage_construct (E_STORAGE (corba_storage)); - - priv = corba_storage->priv; - - priv->name = g_strdup (name); - - CORBA_exception_init (&ev); - - Bonobo_Unknown_ref (storage_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("%s -- Cannot reference Bonobo object", __FUNCTION__); - } else { - priv->storage_interface = CORBA_Object_duplicate (storage_interface, &ev); - } - - CORBA_exception_free (&ev); - - setup_storage_listener (corba_storage); -} - -EStorage * -e_corba_storage_new (const Evolution_Storage storage_interface, - const char *name) -{ - EStorage *new; - - g_return_val_if_fail (storage_interface != CORBA_OBJECT_NIL, NULL); - g_return_val_if_fail (name != NULL, NULL); - - new = gtk_type_new (e_corba_storage_get_type ()); - - e_corba_storage_construct (E_CORBA_STORAGE (new), storage_interface, name); - - return new; -} - - -const Evolution_StorageListener -e_corba_storage_get_StorageListener (ECorbaStorage *corba_storage) -{ - g_return_val_if_fail (corba_storage != NULL, NULL); - g_return_val_if_fail (E_IS_CORBA_STORAGE (corba_storage), NULL); - - return corba_storage->priv->storage_listener_interface; -} - - -E_MAKE_TYPE (e_corba_storage, "ECorbaStorage", ECorbaStorage, class_init, init, PARENT_TYPE) diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h deleted file mode 100644 index 99ab23e97e..0000000000 --- a/shell/e-corba-storage.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_CORBA_STORAGE_H__ -#define __E_CORBA_STORAGE_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-storage.h" - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_CORBA_STORAGE (e_corba_storage_get_type ()) -#define E_CORBA_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CORBA_STORAGE, ECorbaStorage)) -#define E_CORBA_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_STORAGE, ECorbaStorageClass)) -#define E_IS_CORBA_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CORBA_STORAGE)) -#define E_IS_CORBA_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_STORAGE)) - - -typedef struct _ECorbaStorage ECorbaStorage; -typedef struct _ECorbaStoragePrivate ECorbaStoragePrivate; -typedef struct _ECorbaStorageClass ECorbaStorageClass; - -struct _ECorbaStorage { - EStorage parent; - - ECorbaStoragePrivate *priv; -}; - -struct _ECorbaStorageClass { - EStorageClass parent_class; -}; - - -GtkType e_corba_storage_get_type (void); -void e_corba_storage_construct (ECorbaStorage *corba_storage, - const Evolution_Storage storage_interface, - const char *name); -EStorage *e_corba_storage_new (const Evolution_Storage storage_interface, - const char *name); - -/* FIXME: I don't like this call. */ -const Evolution_StorageListener e_corba_storage_get_StorageListener (ECorbaStorage *corba_storage); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_CORBA_STORAGE_H__ */ diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c deleted file mode 100644 index 9962fa508f..0000000000 --- a/shell/e-folder-tree.c +++ /dev/null @@ -1,380 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-set.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <string.h> - -#include "e-folder-tree.h" - - -struct _Folder { - struct _Folder *parent; - char *path; - void *data; - GList *subfolders; -}; -typedef struct _Folder Folder; - -struct _EFolderTree { - GHashTable *path_to_folder; - - EFolderDestroyNotify folder_destroy_notify; - void *folder_destroy_notify_closure; -}; - - -/* Utility functions. */ - -static char * -get_parent_path (const char *path) -{ - const char *last_separator; - - g_assert (g_path_is_absolute (path)); - - last_separator = strrchr (path, G_DIR_SEPARATOR); - - if (last_separator == path) - return g_strdup (G_DIR_SEPARATOR_S); - - return g_strndup (path, last_separator - path); -} - -static void -traverse_subtree (EFolderTree *tree, - Folder *root_folder, - EFolderTreeForeachFunc foreach_func, - void *data) -{ - GList *p; - - g_assert (foreach_func != NULL); - - (* foreach_func) (tree, root_folder->path, root_folder->data, data); - - for (p = root_folder->subfolders; p != NULL; p = p->next) { - Folder *folder; - - folder = (Folder *) p->data; - traverse_subtree (tree, folder, foreach_func, data); - } -} - - -/* Folder handling. */ - -static Folder * -folder_new (const char *path, - void *data) -{ - Folder *folder; - - folder = g_new (Folder, 1); - folder->parent = NULL; - folder->path = g_strdup (path); - folder->data = data; - folder->subfolders = NULL; - - return folder; -} - -static void -folder_remove_subfolder (Folder *folder, - Folder *subfolder) -{ - g_list_remove (folder->subfolders, folder); -} - -static void -folder_add_subfolder (Folder *folder, - Folder *subfolder) -{ - folder->subfolders = g_list_prepend (folder->subfolders, subfolder); - subfolder->parent = folder; -} - -static void -folder_destroy (Folder *folder) -{ - g_assert (folder->subfolders == NULL); - - if (folder->parent != NULL) - folder_remove_subfolder (folder->parent, folder); - - g_free (folder->path); - - g_free (folder); -} - -static void -remove_folder (EFolderTree *folder_tree, - Folder *folder) -{ - if (folder->subfolders != NULL) { - GList *p; - - for (p = folder->subfolders; p != NULL; p = p->next) { - Folder *subfolder; - - subfolder = (Folder *) p->data; - remove_folder (folder_tree, subfolder); - } - - g_list_free (folder->subfolders); - folder->subfolders = NULL; - } - - g_hash_table_remove (folder_tree->path_to_folder, folder->path); - - if (folder_tree->folder_destroy_notify != NULL) - (* folder_tree->folder_destroy_notify) (folder_tree, - folder->path, - folder->data, - folder_tree->folder_destroy_notify_closure); - - folder_destroy (folder); -} - - -/** - * e_folder_tree_new: - * @folder_destroy_notify: Function to be called when a folder gets removed from the tree - * @closure: Additional data to pass to @folder_destroy_notify - * - * Create a new EFolderTree. - * - * Return value: A pointer to the newly created EFolderTree. - **/ -EFolderTree * -e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, - void *closure) -{ - EFolderTree *new; - Folder *root_folder; - - new = g_new (EFolderTree, 1); - - new->folder_destroy_notify = folder_destroy_notify; - new->folder_destroy_notify_closure = closure; - - new->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal); - - root_folder = folder_new (G_DIR_SEPARATOR_S, NULL); - g_hash_table_insert (new->path_to_folder, root_folder->path, root_folder); - - return new; -} - -/** - * e_folder_tree_destroy: - * @folder_tree: A pointer to an EFolderTree - * - * Destroy @folder_tree. - **/ -void -e_folder_tree_destroy (EFolderTree *folder_tree) -{ - Folder *root_folder; - - g_return_if_fail (folder_tree != NULL); - - root_folder = g_hash_table_lookup (folder_tree->path_to_folder, G_DIR_SEPARATOR_S); - remove_folder (folder_tree, root_folder); - - g_hash_table_destroy (folder_tree->path_to_folder); - - g_free (folder_tree); -} - -/** - * e_folder_tree_add: - * @folder_tree: A pointer to an EFolderTree - * @path: Path at which the new folder must be added - * @data: Data associated with the new folder - * - * Insert a new folder at @path, with the specified @data. - * - * Return value: %TRUE if successful, %FALSE if failed. - **/ -gboolean -e_folder_tree_add (EFolderTree *folder_tree, - const char *path, - void *data) -{ - Folder *parent_folder; - Folder *folder; - char *parent_path; - - g_return_val_if_fail (folder_tree != NULL, FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - parent_path = get_parent_path (path); - - parent_folder = g_hash_table_lookup (folder_tree->path_to_folder, parent_path); - if (parent_folder == NULL) { - g_warning ("%s: Trying to add a subfolder to a path that does not exist yet -- %s", - __FUNCTION__, parent_path); - return FALSE; - } - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder != NULL) { - g_warning ("%s: Trying to add a subfolder for a path that already exists -- %s", - __FUNCTION__, path); - return FALSE; - } - - folder = folder_new (path, data); - folder_add_subfolder (parent_folder, folder); - - g_hash_table_insert (folder_tree->path_to_folder, folder->path, folder); - - g_free (parent_path); - - return TRUE; -} - -/** - * e_folder_tree_remove: - * @folder_tree: A pointer to an EFolderTree - * @path: Path of the folder to remove - * - * Remove the folder at @path from @folder_tree. - * - * Return value: %TRUE if successful, %FALSE if failed. - **/ -gboolean -e_folder_tree_remove (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - - g_return_val_if_fail (folder_tree != NULL, FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return FALSE; - - remove_folder (folder_tree, folder); - return TRUE; -} - -/** - * e_folder_tree_get_folder: - * @folder_tree: A pointer to an EFolderTree - * @path: Path of the folder for which we want to get the data - * - * Get the data for the folder at @path. - * - * Return value: The pointer to the data for the folder at @path. - **/ -void * -e_folder_tree_get_folder (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return NULL; - - return folder->data; -} - -/** - * e_folder_tree_get_subfolders: - * @folder_tree: A pointer to an EFolderTree - * @path: A path in @folder_tree - * - * Get a list of the paths of the subfolders of @path. - * - * Return value: A list of pointers to the paths of the subfolders. The list - * and the strings must be freed by the caller. - **/ -GList * -e_folder_tree_get_subfolders (EFolderTree *folder_tree, - const char *path) -{ - Folder *folder; - GList *list; - GList *p; - - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder == NULL) - return NULL; - - list = NULL; - for (p = folder->subfolders; p != NULL; p = p->next) { - const Folder *folder; - - folder = (const Folder *) p->data; - list = g_list_prepend (list, g_strdup (folder->path)); - } - - return list; -} - - -/** - * e_folder_tree_foreach: - * @folder_tree: - * @foreach_func: - * @data: - * - * Call @foreach_func with the specified @data for all the folders - * in @folder_tree, starting at the root node. - **/ -void -e_folder_tree_foreach (EFolderTree *folder_tree, - EFolderTreeForeachFunc foreach_func, - void *data) -{ - Folder *root_node; - - g_return_if_fail (folder_tree != NULL); - g_return_if_fail (foreach_func != NULL); - - root_node = g_hash_table_lookup (folder_tree->path_to_folder, - G_DIR_SEPARATOR_S); - if (root_node == NULL) { - g_warning ("e_folder_tree_foreach -- What?! No root node!?"); - return; - } - - traverse_subtree (folder_tree, root_node, foreach_func, data); -} diff --git a/shell/e-folder-tree.h b/shell/e-folder-tree.h deleted file mode 100644 index 59613cbaba..0000000000 --- a/shell/e-folder-tree.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-tree.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_FOLDER_TREE_H_ -#define _E_FOLDER_TREE_H_ - - -typedef struct _EFolderTree EFolderTree; - -typedef void (* EFolderDestroyNotify) (EFolderTree *tree, const char *path, void *data, void *closure); -typedef void (* EFolderTreeForeachFunc) (EFolderTree *tree, const char *path, void *data, void *closure); - - -EFolderTree *e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, - void *closure); -void e_folder_tree_destroy (EFolderTree *folder_tree); -gboolean e_folder_tree_add (EFolderTree *folder_tree, - const char *path, - void *data); -gboolean e_folder_tree_remove (EFolderTree *folder_tree, - const char *path); - -void *e_folder_tree_get_folder (EFolderTree *folder_tree, - const char *path); -GList *e_folder_tree_get_subfolders (EFolderTree *folder_tree, - const char *path); - -void e_folder_tree_foreach (EFolderTree *folder_tree, - EFolderTreeForeachFunc foreach_func, - void *data); - -#endif /* _E_FOLDER_TREE_H_ */ diff --git a/shell/e-folder-type-registry.c b/shell/e-folder-type-registry.c deleted file mode 100644 index 515efe88a7..0000000000 --- a/shell/e-folder-type-registry.c +++ /dev/null @@ -1,367 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-registry.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gtk/gtktypeutils.h> - -#include <gal/util/e-util.h> - -#include "e-shell-utils.h" - -#include "e-folder-type-registry.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _FolderType { - char *name; - char *icon_name; - - EvolutionShellComponentClient *handler; - - /* The icon, standard (48x48) and mini (16x16) versions. */ - GdkPixbuf *icon_pixbuf; - GdkPixbuf *mini_icon_pixbuf; -}; -typedef struct _FolderType FolderType; - -struct _EFolderTypeRegistryPrivate { - GHashTable *name_to_type; -}; - - -/* FolderType handling. */ - -static FolderType * -folder_type_new (const char *name, - const char *icon_name) -{ - FolderType *new; - char *icon_path; - - new = g_new (FolderType, 1); - - new->name = g_strdup (name); - new->icon_name = g_strdup (icon_name); - new->handler = NULL; - - icon_path = e_shell_get_icon_path (icon_name, FALSE); - if (icon_path == NULL) - new->icon_pixbuf = NULL; - else - new->icon_pixbuf = gdk_pixbuf_new_from_file (icon_path); - - g_free (icon_path); - - icon_path = e_shell_get_icon_path (icon_name, TRUE); - if (icon_path != NULL) { - new->mini_icon_pixbuf = gdk_pixbuf_new_from_file (icon_path); - } else { - if (new->icon_pixbuf != NULL) - new->mini_icon_pixbuf = gdk_pixbuf_ref (new->icon_pixbuf); - else - new->mini_icon_pixbuf = NULL; - } - - g_free (icon_path); - - return new; -} - -static void -folder_type_free (FolderType *folder_type) -{ - g_free (folder_type->name); - g_free (folder_type->icon_name); - - if (folder_type->icon_pixbuf != NULL) - gdk_pixbuf_unref (folder_type->icon_pixbuf); - if (folder_type->mini_icon_pixbuf != NULL) - gdk_pixbuf_unref (folder_type->mini_icon_pixbuf); - - if (folder_type->handler != NULL) - bonobo_object_unref (BONOBO_OBJECT (folder_type->handler)); - - g_free (folder_type); -} - -static FolderType * -get_folder_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name) -{ - EFolderTypeRegistryPrivate *priv; - - priv = folder_type_registry->priv; - - return g_hash_table_lookup (priv->name_to_type, type_name); -} - -static gboolean -register_folder_type (EFolderTypeRegistry *folder_type_registry, - const char *name, - const char *icon_name) -{ - EFolderTypeRegistryPrivate *priv; - FolderType *folder_type; - - priv = folder_type_registry->priv; - - /* Make sure we don't add the same type twice. */ - if (get_folder_type (folder_type_registry, name) != NULL) - return FALSE; - - folder_type = folder_type_new (name, icon_name); - g_hash_table_insert (priv->name_to_type, folder_type->name, folder_type); - - return TRUE; -} - -static gboolean -set_handler (EFolderTypeRegistry *folder_type_registry, - const char *name, - EvolutionShellComponentClient *handler) -{ - EFolderTypeRegistryPrivate *priv; - FolderType *folder_type; - - priv = folder_type_registry->priv; - - folder_type = get_folder_type (folder_type_registry, name); - if (folder_type == NULL) - return FALSE; - if (folder_type->handler != NULL) { - g_warning ("Folder type already has a handler -- %s", - folder_type->name); - return FALSE; - } - - bonobo_object_ref (BONOBO_OBJECT (handler)); - folder_type->handler = handler; - - return TRUE; -} - - -/* GtkObject methods. */ - -static void -hash_forall_free_folder_type (gpointer key, - gpointer value, - gpointer data) -{ - FolderType *folder_type; - - folder_type = (FolderType *) value; - folder_type_free (folder_type); -} - -static void -destroy (GtkObject *object) -{ - EFolderTypeRegistry *folder_type_registry; - EFolderTypeRegistryPrivate *priv; - - folder_type_registry = E_FOLDER_TYPE_REGISTRY (object); - priv = folder_type_registry->priv; - - g_hash_table_foreach (priv->name_to_type, - hash_forall_free_folder_type, NULL); - g_hash_table_destroy (priv->name_to_type); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EFolderTypeRegistryClass *class) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (class); - object_class->destroy = destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); -} - -static void -init (EFolderTypeRegistry *folder_type_registry) -{ - EFolderTypeRegistryPrivate *priv; - - priv = g_new (EFolderTypeRegistryPrivate, 1); - priv->name_to_type = g_hash_table_new (g_str_hash, g_str_equal); - - folder_type_registry->priv = priv; -} - - -void -e_folder_type_registry_construct (EFolderTypeRegistry *folder_type_registry) -{ - g_return_if_fail (folder_type_registry != NULL); - g_return_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry)); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (folder_type_registry), GTK_FLOATING); -} - -EFolderTypeRegistry * -e_folder_type_registry_new (void) -{ - EFolderTypeRegistry *new; - - new = gtk_type_new (e_folder_type_registry_get_type ()); - - e_folder_type_registry_construct (new); - - return new; -} - - -gboolean -e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - const char *icon_name) -{ - g_return_val_if_fail (folder_type_registry != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), FALSE); - g_return_val_if_fail (type_name != NULL, FALSE); - g_return_val_if_fail (icon_name != NULL, FALSE); - - return register_folder_type (folder_type_registry, type_name, icon_name); -} - -gboolean -e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - EvolutionShellComponentClient *handler) -{ - g_return_val_if_fail (folder_type_registry != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), FALSE); - g_return_val_if_fail (handler != NULL, FALSE); - g_return_val_if_fail (BONOBO_IS_OBJECT_CLIENT (handler), FALSE); - - return set_handler (folder_type_registry, type_name, handler); -} - - -static void -get_type_names_hash_forall (void *key, - void *value, - void *data) -{ - GList **type_name_list; - - type_name_list = (GList **) data; - - *type_name_list = g_list_prepend (*type_name_list, g_strdup ((const char *) key)); -} - -GList * -e_folder_type_registry_get_type_names (EFolderTypeRegistry *folder_type_registry) -{ - GList *type_name_list; - EFolderTypeRegistryPrivate *priv; - - g_return_val_if_fail (folder_type_registry != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL); - - priv = folder_type_registry->priv; - - type_name_list = NULL; - g_hash_table_foreach (priv->name_to_type, get_type_names_hash_forall, &type_name_list); - - return type_name_list; -} - - -const char * -e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_registry != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_registry, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - return folder_type->icon_name; -} - -GdkPixbuf * -e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - gboolean mini) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_registry != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_registry, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - if (mini) - return folder_type->mini_icon_pixbuf; - else - return folder_type->icon_pixbuf; -} - -EvolutionShellComponentClient * -e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_registry != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_registry, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - return folder_type->handler; -} - - -E_MAKE_TYPE (e_folder_type_registry, "EFolderTypeRegistry", EFolderTypeRegistry, - class_init, init, PARENT_TYPE) diff --git a/shell/e-folder-type-registry.h b/shell/e-folder-type-registry.h deleted file mode 100644 index 6d832282aa..0000000000 --- a/shell/e-folder-type-registry.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-registry.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_FOLDER_TYPE_REGISTRY_H_ -#define _E_FOLDER_TYPE_REGISTRY_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "evolution-shell-component-client.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_FOLDER_TYPE_REGISTRY (e_folder_type_registry_get_type ()) -#define E_FOLDER_TYPE_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER_TYPE_REGISTRY, EFolderTypeRegistry)) -#define E_FOLDER_TYPE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER_TYPE_REGISTRY, EFolderTypeRegistryClass)) -#define E_IS_FOLDER_TYPE_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER_TYPE_REGISTRY)) -#define E_IS_FOLDER_TYPE_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_TYPE_REGISTRY)) - - -typedef struct _EFolderTypeRegistry EFolderTypeRegistry; -typedef struct _EFolderTypeRegistryPrivate EFolderTypeRegistryPrivate; -typedef struct _EFolderTypeRegistryClass EFolderTypeRegistryClass; - -struct _EFolderTypeRegistry { - GtkObject parent; - - EFolderTypeRegistryPrivate *priv; -}; - -struct _EFolderTypeRegistryClass { - GtkObjectClass parent_class; -}; - - -GtkType e_folder_type_registry_get_type (void); -void e_folder_type_registry_construct (EFolderTypeRegistry *folder_type_registry); -EFolderTypeRegistry *e_folder_type_registry_new (void); - -gboolean e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - const char *icon_name); -gboolean e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - EvolutionShellComponentClient *handler); - -GList *e_folder_type_registry_get_type_names (EFolderTypeRegistry *folder_type_registry); - -GdkPixbuf *e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name, - gboolean mini); -const char *e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name); -EvolutionShellComponentClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_TYPE_REGISTRY_H_ */ diff --git a/shell/e-folder.c b/shell/e-folder.c deleted file mode 100644 index 28f72fc705..0000000000 --- a/shell/e-folder.c +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> - -#include <gal/util/e-util.h> - -#include "e-folder.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _EFolderPrivate { - char *name; - char *type; - char *description; - char *physical_uri; - gboolean highlighted; -}; - -#define EF_CLASS(obj) \ - E_FOLDER_CLASS (GTK_OBJECT (obj)->klass) - - -enum { - CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* EFolder methods. */ - -static gboolean -save_info (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::save_info()'", - gtk_type_name (GTK_OBJECT_TYPE (folder))); - return FALSE; -} - -static gboolean -load_info (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::load_info()'", - gtk_type_name (GTK_OBJECT_TYPE (folder))); - return FALSE; -} - -static gboolean -remove (EFolder *folder) -{ - g_warning ("`%s' does not implement `EFolder::remove()'", - gtk_type_name (GTK_OBJECT_TYPE (folder))); - return FALSE; -} - -static const char * -get_physical_uri (EFolder *folder) -{ - return folder->priv->physical_uri; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EFolder *folder; - EFolderPrivate *priv; - - folder = E_FOLDER (object); - priv = folder->priv; - - g_free (priv->name); - g_free (priv->type); - g_free (priv->description); - g_free (priv->physical_uri); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EFolderClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[CHANGED] = gtk_signal_new ("changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EFolderClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - klass->save_info = save_info; - klass->load_info = load_info; - klass->remove = remove; - klass->get_physical_uri = get_physical_uri; -} - -static void -init (EFolder *folder) -{ - EFolderPrivate *priv; - - priv = g_new (EFolderPrivate, 1); - priv->type = NULL; - priv->name = NULL; - priv->description = NULL; - priv->physical_uri = NULL; - priv->highlighted = FALSE; - - folder->priv = priv; -} - - -void -e_folder_construct (EFolder *folder, - const char *name, - const char *type, - const char *description) -{ - EFolderPrivate *priv; - - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (name != NULL); - g_return_if_fail (type != NULL); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (folder), GTK_FLOATING); - - priv = folder->priv; - - priv->name = g_strdup (name); - priv->type = g_strdup (type); - priv->description = g_strdup (description); -} - -EFolder * -e_folder_new (const char *name, - const char *type, - const char *description) -{ - EFolder *folder; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (type != NULL, NULL); - g_return_val_if_fail (description != NULL, NULL); - - folder = gtk_type_new (E_TYPE_FOLDER); - - e_folder_construct (folder, name, type, description); - - return folder; -} - - -const char * -e_folder_get_name (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->name; -} - -const char * -e_folder_get_type_string (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->type; -} - -const char * -e_folder_get_description (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->description; -} - -const char * -e_folder_get_physical_uri (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (folder), NULL); - - return folder->priv->physical_uri; -} - -gboolean -e_folder_get_highlighted (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->highlighted; -} - - -void -e_folder_set_name (EFolder *folder, - const char *name) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (name != NULL); - - g_free (folder->priv->name); - folder->priv->name = g_strdup (name); - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_type_string (EFolder *folder, - const char *type) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (type != NULL); - - g_free (folder->priv->type); - folder->priv->type = g_strdup (type); - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_description (EFolder *folder, - const char *description) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (description != NULL); - - g_free (folder->priv->description); - folder->priv->description = g_strdup (description); - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_physical_uri (EFolder *folder, - const char *physical_uri) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - g_return_if_fail (physical_uri != NULL); - - g_free (folder->priv->physical_uri); - folder->priv->physical_uri = g_strdup (physical_uri); - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_highlighted (EFolder *folder, - gboolean highlighted) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->highlighted = highlighted; - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - - -E_MAKE_TYPE (e_folder, "EFolder", EFolder, class_init, init, PARENT_TYPE) diff --git a/shell/e-folder.h b/shell/e-folder.h deleted file mode 100644 index 1f3a5885f0..0000000000 --- a/shell/e-folder.h +++ /dev/null @@ -1,94 +0,0 @@ - /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_FOLDER_H_ -#define _E_FOLDER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_FOLDER (e_folder_get_type ()) -#define E_FOLDER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER, EFolder)) -#define E_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER, EFolderClass)) -#define E_IS_FOLDER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER)) -#define E_IS_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER)) - - -typedef struct _EFolder EFolder; -typedef struct _EFolderPrivate EFolderPrivate; -typedef struct _EFolderClass EFolderClass; - -struct _EFolder { - GtkObject parent; - - EFolderPrivate *priv; -}; - -struct _EFolderClass { - GtkObjectClass parent_class; - - /* Virtual methods. */ - gboolean (* save_info) (EFolder *folder); - gboolean (* load_info) (EFolder *folder); - gboolean (* remove) (EFolder *folder); - const char * (* get_physical_uri) (EFolder *folder); - - /* Signals. */ - void (* changed) (EFolder *folder); -}; - - -GtkType e_folder_get_type (void); -void e_folder_construct (EFolder *folder, - const char *name, - const char *type, - const char *description); -EFolder *e_folder_new (const char *name, - const char *type, - const char *description); - -const char *e_folder_get_name (EFolder *folder); -const char *e_folder_get_type_string (EFolder *folder); -const char *e_folder_get_description (EFolder *folder); -const char *e_folder_get_physical_uri (EFolder *folder); -gboolean e_folder_get_highlighted (EFolder *folder); - -void e_folder_set_name (EFolder *folder, const char *name); -void e_folder_set_type_string (EFolder *folder, const char *type); -void e_folder_set_description (EFolder *folder, const char *description); -void e_folder_set_physical_uri (EFolder *folder, const char *physical_uri); -void e_folder_set_highlighted (EFolder *folder, gboolean highlighted); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_H_ */ diff --git a/shell/e-local-folder.c b/shell/e-local-folder.c deleted file mode 100644 index 62dad4f4c2..0000000000 --- a/shell/e-local-folder.c +++ /dev/null @@ -1,261 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* The metafile goes like this: - - <?xml version="1.0"?> - <efolder> - <type>mail</type> - <description>This is the folder where I store mail from my gf</description> - <homepage>http://www.somewhere.net</homepage> - </efolder> - - FIXME: Do we want to use a namespace for this? - FIXME: Do we want to have an internationalized description? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> - -#include "e-local-folder.h" - - -#define PARENT_TYPE E_TYPE_FOLDER -static EFolderClass *parent_class = NULL; - -#define URI_PREFIX "file://" -#define URI_PREFIX_LEN 7 - -#define METADATA_FILE_NAME "folder-metadata.xml" -#define METADATA_FILE_NAME_LEN 19 - -struct _ELocalFolderPrivate { - int dummy; -}; - - -static char * -get_string_value (xmlNode *node, - const char *name) -{ - xmlNode *p; - xmlChar *xml_string; - char *retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return NULL; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) - return NULL; - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = g_strdup ((char *) xml_string); - xmlFree (xml_string); - - return retval; -} - -static gboolean -construct_loading_metadata (ELocalFolder *local_folder, - const char *path) -{ - EFolder *folder; - xmlDoc *doc; - xmlNode *root; - char *type; - char *description; - char *metadata_path; - char *physical_uri; - - folder = E_FOLDER (local_folder); - - metadata_path = g_concat_dir_and_file (path, METADATA_FILE_NAME); - - doc = xmlParseFile (metadata_path); - if (doc == NULL) { - g_free (metadata_path); - return FALSE; - } - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "efolder") != 0) { - g_free (metadata_path); - xmlFreeDoc (doc); - return FALSE; - } - - type = get_string_value (root, "type"); - description = get_string_value (root, "description"); - - e_folder_construct (folder, g_basename (path), type, description); - - g_free (type); - g_free (description); - - xmlFreeDoc (doc); - - physical_uri = g_strconcat (URI_PREFIX, path, NULL); - e_folder_set_physical_uri (folder, physical_uri); - g_free (physical_uri); - - g_free (metadata_path); - - return TRUE; -} - -static gboolean -save_metadata (ELocalFolder *local_folder) -{ - EFolder *folder; - xmlDoc *doc; - xmlNode *root; - const char *physical_directory; - char *physical_path; - - folder = E_FOLDER (local_folder); - - doc = xmlNewDoc ((xmlChar *) "1.0"); - root = xmlNewDocNode (doc, NULL, (xmlChar *) "efolder", NULL); - xmlDocSetRootElement (doc, root); - - xmlNewChild (root, NULL, (xmlChar *) "type", - (xmlChar *) e_folder_get_type_string (folder)); - - if (e_folder_get_description (folder) != NULL) - xmlNewChild (root, NULL, (xmlChar *) "description", - (xmlChar *) e_folder_get_description (folder)); - - physical_directory = e_folder_get_physical_uri (folder) + URI_PREFIX_LEN - 1; - physical_path = g_concat_dir_and_file (physical_directory, METADATA_FILE_NAME); - - if (xmlSaveFile (physical_path, doc) < 0) { - unlink (physical_path); - g_free (physical_path); - xmlFreeDoc (doc); - return FALSE; - } - - g_free (physical_path); - - xmlFreeDoc (doc); - return TRUE; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - /* No ELocalFolder-specific data to free. */ - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (ELocalFolderClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (e_folder_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; -} - -static void -init (ELocalFolder *local_folder) -{ -} - - -void -e_local_folder_construct (ELocalFolder *local_folder, - const char *name, - const char *type, - const char *description) -{ - g_return_if_fail (local_folder != NULL); - g_return_if_fail (E_IS_LOCAL_FOLDER (local_folder)); - g_return_if_fail (name != NULL); - g_return_if_fail (type != NULL); - - e_folder_construct (E_FOLDER (local_folder), name, type, description); -} - -EFolder * -e_local_folder_new (const char *name, - const char *type, - const char *description) -{ - ELocalFolder *local_folder; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (type != NULL, NULL); - - local_folder = gtk_type_new (e_local_folder_get_type ()); - - e_local_folder_construct (local_folder, name, type, description); - - return E_FOLDER (local_folder); -} - -EFolder * -e_local_folder_new_from_path (const char *path) -{ - EFolder *folder; - - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - folder = gtk_type_new (e_local_folder_get_type ()); - - if (! construct_loading_metadata (E_LOCAL_FOLDER (folder), path)) { - gtk_object_unref (GTK_OBJECT (folder)); - return NULL; - } - - return folder; -} - -gboolean -e_local_folder_save (ELocalFolder *local_folder) -{ - g_return_val_if_fail (local_folder != NULL, FALSE); - g_return_val_if_fail (E_IS_LOCAL_FOLDER (local_folder), FALSE); - g_return_val_if_fail (e_folder_get_physical_uri (E_FOLDER (local_folder)) != NULL, FALSE); - - return save_metadata (local_folder); -} - - -E_MAKE_TYPE (e_local_folder, "ELocalFolder", ELocalFolder, class_init, init, PARENT_TYPE) diff --git a/shell/e-local-folder.h b/shell/e-local-folder.h deleted file mode 100644 index aa9e79a990..0000000000 --- a/shell/e-local-folder.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_LOCAL_FOLDER_H_ -#define _E_LOCAL_FOLDER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#include "e-folder.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_LOCAL_FOLDER (e_local_folder_get_type ()) -#define E_LOCAL_FOLDER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_LOCAL_FOLDER, ELocalFolder)) -#define E_LOCAL_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_LOCAL_FOLDER, ELocalFolderClass)) -#define E_IS_LOCAL_FOLDER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_LOCAL_FOLDER)) -#define E_IS_LOCAL_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_LOCAL_FOLDER)) - -typedef struct _ELocalFolder ELocalFolder; -typedef struct _ELocalFolderClass ELocalFolderClass; - -struct _ELocalFolder { - EFolder parent; -}; - -struct _ELocalFolderClass { - EFolderClass parent_class; -}; - - -GtkType e_local_folder_get_type (void); -void e_local_folder_construct (ELocalFolder *local_folder, - const char *name, - const char *type, - const char *description); -EFolder *e_local_folder_new (const char *name, - const char *type, - const char *description); -EFolder *e_local_folder_new_from_path (const char *physical_path); -gboolean e_local_folder_save (ELocalFolder *local_folder); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_LOCAL_FOLDER_H__ */ diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c deleted file mode 100644 index 852a6e2945..0000000000 --- a/shell/e-local-storage.c +++ /dev/null @@ -1,669 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* FIXMEs: - * - * - If we have `.' or `..' as path elements, we lose. - * - * - If the LocalStorage is destroyed and an async operation on a shell component is - * pending, we get a callback on a bogus object. We need support for cancelling - * operations on the shell component. - * - * - The tree is kept both in the EStorage and the EvolutionStorage. Very - * bad design. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <dirent.h> - -#include <errno.h> -#include <string.h> -#include <sys/param.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include <gnome.h> - -#include <bonobo.h> - -#include <gal/util/e-util.h> -#include "e-local-folder.h" - -#include "evolution-local-storage.h" - -#include "e-local-storage.h" - - -#define PARENT_TYPE E_TYPE_STORAGE -static EStorageClass *parent_class = NULL; - -#define SUBFOLDER_DIR_NAME "subfolders" -#define SUBFOLDER_DIR_NAME_LEN 10 - -struct _ELocalStoragePrivate { - EFolderTypeRegistry *folder_type_registry; - char *base_path; - EvolutionLocalStorage *bonobo_interface; -}; - - -/* Utility functions. */ - -/* Translate a storage path into a physical path on the file system. */ -static char * -get_physical_path (ELocalStorage *local_storage, - const char *path) -{ - EStorage *storage; - ELocalStoragePrivate *priv; - const char *p, *newp; - char *dp; - char *real_path; - int real_path_len; - int base_path_len; - - storage = E_STORAGE (local_storage); - priv = local_storage->priv; - - /* @path is always absolute, so it starts with a slash. The base class should - make sure this is the case; if not, it's broken. */ - g_assert (*path == G_DIR_SEPARATOR); - path++; - - /* Calculate the length of the real path. */ - - real_path_len = strlen (path); - real_path_len++; /* For the ending zero. */ - - base_path_len = strlen (priv->base_path); - real_path_len += base_path_len; - real_path_len++; /* For the separating slash. */ - - /* Take account for the fact that we need to translate every separator into - `subfolders/'. */ - p = path; - while (1) { - newp = strchr (p, G_DIR_SEPARATOR); - if (newp == NULL) - break; - - real_path_len += SUBFOLDER_DIR_NAME_LEN; - real_path_len++; /* For the separating slash. */ - - /* Skip consecutive slashes. */ - while (*newp == G_DIR_SEPARATOR) - newp++; - - p = newp; - }; - - real_path = g_malloc (real_path_len); - dp = real_path; - - memcpy (dp, priv->base_path, base_path_len); - dp += base_path_len; - *(dp++) = G_DIR_SEPARATOR; - - /* Copy the mangled path. */ - p = path; - while (1) { - newp = strchr (p, G_DIR_SEPARATOR); - if (newp == NULL) { - strcpy (dp, p); - break; - } - - memcpy (dp, p, newp - p + 1); /* `+ 1' to copy the slash too. */ - dp += newp - p + 1; - - memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN); - dp += SUBFOLDER_DIR_NAME_LEN; - - *(dp++) = G_DIR_SEPARATOR; - - /* Skip consecutive slashes. */ - while (*newp == G_DIR_SEPARATOR) - newp++; - - p = newp; - } - - return real_path; -} - -static void -new_folder (ELocalStorage *local_storage, - const char *path, - EFolder *folder) -{ - ELocalStoragePrivate *priv; - - priv = local_storage->priv; - - e_storage_new_folder (E_STORAGE (local_storage), path, folder); - - evolution_storage_new_folder (EVOLUTION_STORAGE (priv->bonobo_interface), - path, - e_folder_get_name (folder), - e_folder_get_type_string (folder), - e_folder_get_physical_uri (folder), - e_folder_get_description (folder), - e_folder_get_highlighted (folder)); -} - -static gboolean -load_folders (ELocalStorage *local_storage, - const char *parent_path, - const char *path, - const char *physical_path) -{ - DIR *dir; - char *subfolder_directory_path; - - if (parent_path == NULL) { - /* On the top level, we don't have any folders and, consequently, no - subfolder directory. */ - - subfolder_directory_path = g_strdup (physical_path); - } else { - EFolder *folder; - - /* Otherwise, we have to load the corresponding folder. */ - - folder = e_local_folder_new_from_path (physical_path); - if (folder == NULL) - return FALSE; - - new_folder (local_storage, path, folder); - - subfolder_directory_path = g_concat_dir_and_file (physical_path, SUBFOLDER_DIR_NAME); - } - - /* Now scan the subfolders and load them. The subfolders are represented by - directories under the "SUBFOLDER_DIR_NAME" directory. */ - - dir = opendir (subfolder_directory_path); - - if (dir == NULL) { - g_free (subfolder_directory_path); - return FALSE; - } - - while (1) { - struct stat file_stat; - struct dirent *dirent; - char *file_path; - char *new_path; - - dirent = readdir (dir); - if (dirent == NULL) - break; - - if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0) - continue; - - file_path = g_concat_dir_and_file (subfolder_directory_path, - dirent->d_name); - - if (stat (file_path, &file_stat) < 0) { - g_free (file_path); - continue; - } - if (! S_ISDIR (file_stat.st_mode)) { - g_free (file_path); - continue; - } - - new_path = g_concat_dir_and_file (path, dirent->d_name); - - load_folders (local_storage, path, new_path, file_path); - - g_free (file_path); - g_free (new_path); - } - - closedir (dir); - g_free (subfolder_directory_path); - - return TRUE; -} - -static gboolean -load_all_folders (ELocalStorage *local_storage) -{ - const char *base_path; - - base_path = e_local_storage_get_base_path (local_storage); - - return load_folders (local_storage, NULL, G_DIR_SEPARATOR_S, base_path); -} - -static EStorageResult -errno_to_storage_result (void) -{ - EStorageResult storage_result; - - switch (errno) { - case EACCES: - case EROFS: - storage_result = E_STORAGE_PERMISSIONDENIED; - break; - case EEXIST: - storage_result = E_STORAGE_EXISTS; - break; - case ENOSPC: - storage_result = E_STORAGE_NOSPACE; - break; - default: - storage_result = E_STORAGE_GENERICERROR; - } - - return storage_result; -} - -static EStorageResult -shell_component_result_to_storage_result (EvolutionShellComponentResult result) -{ - /* FIXME: Maybe we need better mapping here. */ - switch (result) { - case EVOLUTION_SHELL_COMPONENT_OK: - return E_STORAGE_OK; - case EVOLUTION_SHELL_COMPONENT_NOTFOUND: - return E_STORAGE_NOTFOUND; - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE: - return E_STORAGE_UNSUPPORTEDTYPE; - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION: - return E_STORAGE_UNSUPPORTEDOPERATION; - case EVOLUTION_SHELL_COMPONENT_EXISTS: - return E_STORAGE_EXISTS; - case EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED: - return E_STORAGE_PERMISSIONDENIED; - case EVOLUTION_SHELL_COMPONENT_ALREADYOWNED: - case EVOLUTION_SHELL_COMPONENT_BUSY: - case EVOLUTION_SHELL_COMPONENT_CORBAERROR: - case EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS: - case EVOLUTION_SHELL_COMPONENT_INTERNALERROR: - case EVOLUTION_SHELL_COMPONENT_INTERRUPTED: - case EVOLUTION_SHELL_COMPONENT_INVALIDARG: - case EVOLUTION_SHELL_COMPONENT_INVALIDURI: - case EVOLUTION_SHELL_COMPONENT_NOSPACE: - case EVOLUTION_SHELL_COMPONENT_NOTOWNED: - case EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR: - default: - return E_STORAGE_GENERICERROR; - } -} - - -/* Callbacks for the async methods invoked on the `Evolution::ShellComponent's. */ - -struct _AsyncCreateFolderCallbackData { - EStorage *storage; - - char *path; - char *display_name; - char *type; - char *description; - char *physical_uri; - char *physical_path; - - EStorageResultCallback callback; - void *callback_data; -}; -typedef struct _AsyncCreateFolderCallbackData AsyncCreateFolderCallbackData; - -static void -component_async_create_folder_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result, - void *data) -{ - AsyncCreateFolderCallbackData *callback_data; - - callback_data = (AsyncCreateFolderCallbackData *) data; - - if (result != EVOLUTION_SHELL_COMPONENT_OK) { - /* XXX: This assumes the component won't leave any files in the directory. */ - rmdir (callback_data->physical_path); - } else { - EFolder *folder; - - folder = e_local_folder_new (callback_data->display_name, - callback_data->type, - callback_data->description); - - e_folder_set_physical_uri (folder, callback_data->physical_uri); - - if (e_local_folder_save (E_LOCAL_FOLDER (folder))) { - new_folder (E_LOCAL_STORAGE(callback_data->storage), callback_data->path, folder); - } else { - rmdir (callback_data->physical_path); - gtk_object_unref (GTK_OBJECT (folder)); - result = E_STORAGE_IOERROR; - } - } - - bonobo_object_unref (BONOBO_OBJECT (shell_component_client)); - - (* callback_data->callback) (callback_data->storage, - shell_component_result_to_storage_result (result), - callback_data->callback_data); - - g_free (callback_data->path); - g_free (callback_data->display_name); - g_free (callback_data->type); - g_free (callback_data->description); - g_free (callback_data->physical_uri); - g_free (callback_data->physical_path); - g_free (callback_data); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ELocalStorage *local_storage; - ELocalStoragePrivate *priv; - CORBA_Environment ev; - - local_storage = E_LOCAL_STORAGE (object); - priv = local_storage->priv; - - CORBA_exception_init (&ev); - - g_free (priv->base_path); - - if (priv->folder_type_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); - - if (priv->bonobo_interface != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->bonobo_interface)); - - g_free (priv); - - CORBA_exception_free (&ev); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EStorage methods. */ - -static const char * -impl_get_name (EStorage *storage) -{ - return E_LOCAL_STORAGE_NAME; -} - -static void -impl_async_create_folder (EStorage *storage, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - ELocalStorage *local_storage; - ELocalStoragePrivate *priv; - EvolutionShellComponentClient *component_client; - const char *folder_name; - AsyncCreateFolderCallbackData *callback_data; - char *physical_path; - char *physical_uri; - char *parent_path; - - local_storage = E_LOCAL_STORAGE (storage); - priv = local_storage->priv; - - component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, - type); - if (component_client == NULL) { - (* callback) (storage, E_STORAGE_INVALIDTYPE, data); - return; - } - - g_assert (g_path_is_absolute (path)); - - folder_name = g_basename (path); - if (folder_name == path + 1) { - /* We want a direct child of the root, so we don't need to create a - `subfolders' directory. */ - physical_path = get_physical_path (local_storage, path); - parent_path = g_strdup (G_DIR_SEPARATOR_S); - } else { - char *parent_physical_path; - char *subfolders_directory_physical_path; - - /* Create the `subfolders' subdirectory under the parent. */ - - parent_path = g_strndup (path, folder_name - path - 1); - parent_physical_path = get_physical_path (local_storage, parent_path); - subfolders_directory_physical_path = g_concat_dir_and_file (parent_physical_path, - SUBFOLDER_DIR_NAME); - - if (! g_file_exists (subfolders_directory_physical_path) - && mkdir (subfolders_directory_physical_path, 0700) == -1) { - g_free (parent_path); - g_free (subfolders_directory_physical_path); - g_free (parent_physical_path); - - (* callback) (storage, errno_to_storage_result (), data); - return; - } - - physical_path = g_concat_dir_and_file (subfolders_directory_physical_path, - folder_name); - g_free (subfolders_directory_physical_path); - g_free (parent_physical_path); - } - - /* Create the directory that holds the folder. */ - - if (mkdir (physical_path, 0700) == -1) { - g_free (physical_path); - (* callback) (storage, errno_to_storage_result (), data); - return; - } - - /* Finally tell the component to do the job of creating the physical files in - it. */ - /* FIXME: We should put the operations on a queue so that we can cancel them when - the ELocalStorage is destroyed. */ - - physical_uri = g_strconcat ("file://", physical_path, NULL); - - callback_data = g_new (AsyncCreateFolderCallbackData, 1); - callback_data->storage = storage; - callback_data->path = g_strdup (path); - callback_data->display_name = g_strdup (folder_name); - callback_data->type = g_strdup (type); - callback_data->description = g_strdup (description); - callback_data->physical_uri = physical_uri; - callback_data->physical_path = physical_path; - callback_data->callback = callback; - callback_data->callback_data = data; - - bonobo_object_ref (BONOBO_OBJECT (component_client)); - - evolution_shell_component_client_async_create_folder (component_client, - physical_path, - type, - component_async_create_folder_callback, - callback_data); -} - -static void -impl_async_remove_folder (EStorage *storage, - const char *path, - EStorageResultCallback callback, - void *data) -{ - ELocalStorage *local_storage; - - local_storage = E_LOCAL_STORAGE (storage); -} - - -/* Callbacks for the `Evolution::LocalStorage' interface we are exposing to the outside world. */ - -static void -bonobo_interface_update_folder_cb (EvolutionLocalStorage *bonobo_local_storage, - const char *path, - const char *display_name, - gboolean highlighted, - void *data) -{ - ELocalStorage *local_storage; - EFolder *folder; - - local_storage = E_LOCAL_STORAGE (data); - - folder = e_storage_get_folder (E_STORAGE (local_storage), path); - if (folder == NULL) - return; - - e_folder_set_name (folder, display_name); - e_folder_set_highlighted (folder, highlighted); -} - - -/* Initialization. */ - -static void -class_init (ELocalStorageClass *class) -{ - EStorageClass *storage_class; - GtkObjectClass *object_class; - - parent_class = gtk_type_class (e_storage_get_type ()); - object_class = GTK_OBJECT_CLASS (class); - storage_class = E_STORAGE_CLASS (class); - - object_class->destroy = impl_destroy; - - storage_class->get_name = impl_get_name; - storage_class->async_create_folder = impl_async_create_folder; - storage_class->async_remove_folder = impl_async_remove_folder; -} - -static void -init (ELocalStorage *local_storage) -{ - ELocalStoragePrivate *priv; - - priv = g_new (ELocalStoragePrivate, 1); - - priv->base_path = NULL; - priv->folder_type_registry = NULL; - priv->bonobo_interface = NULL; - - local_storage->priv = priv; -} - - -static gboolean -construct (ELocalStorage *local_storage, - EFolderTypeRegistry *folder_type_registry, - const char *base_path) -{ - ELocalStoragePrivate *priv; - int base_path_len; - - e_storage_construct (E_STORAGE (local_storage)); - - priv = local_storage->priv; - - base_path_len = strlen (base_path); - while (base_path_len > 0 && base_path[base_path_len - 1] == G_DIR_SEPARATOR) - base_path_len--; - - g_return_val_if_fail (base_path_len != 0, FALSE); - - g_assert (priv->folder_type_registry == NULL); - gtk_object_ref (GTK_OBJECT (folder_type_registry)); - priv->folder_type_registry = folder_type_registry; - - g_assert (priv->base_path == NULL); - priv->base_path = g_strndup (base_path, base_path_len); - - g_assert (priv->bonobo_interface == NULL); - priv->bonobo_interface = evolution_local_storage_new (E_LOCAL_STORAGE_NAME); - - gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "update_folder", - GTK_SIGNAL_FUNC (bonobo_interface_update_folder_cb), - local_storage); - - return load_all_folders (local_storage); -} - -EStorage * -e_local_storage_open (EFolderTypeRegistry *folder_type_registry, - const char *base_path) -{ - EStorage *new; - - g_return_val_if_fail (folder_type_registry != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL); - g_return_val_if_fail (base_path != NULL, NULL); - - new = gtk_type_new (e_local_storage_get_type ()); - - if (! construct (E_LOCAL_STORAGE (new), folder_type_registry, base_path)) { - gtk_object_unref (GTK_OBJECT (new)); - return NULL; - } - - return new; -} - -const char * -e_local_storage_get_base_path (ELocalStorage *local_storage) -{ - g_return_val_if_fail (local_storage != NULL, NULL); - g_return_val_if_fail (E_IS_LOCAL_STORAGE (local_storage), NULL); - - return local_storage->priv->base_path; -} - - -const Evolution_LocalStorage -e_local_storage_get_corba_interface (ELocalStorage *local_storage) -{ - ELocalStoragePrivate *priv; - Evolution_LocalStorage corba_interface; - - g_return_val_if_fail (local_storage != NULL, NULL); - g_return_val_if_fail (E_IS_LOCAL_STORAGE (local_storage), NULL); - - priv = local_storage->priv; - corba_interface = bonobo_object_corba_objref (BONOBO_OBJECT (priv->bonobo_interface)); - - return corba_interface; -} - - -E_MAKE_TYPE (e_local_storage, "ELocalStorage", ELocalStorage, class_init, init, PARENT_TYPE) diff --git a/shell/e-local-storage.h b/shell/e-local-storage.h deleted file mode 100644 index 4abb72077c..0000000000 --- a/shell/e-local-storage.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_LOCAL_STORAGE_H_ -#define _E_LOCAL_STORAGE_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-folder-type-registry.h" -#include "e-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_LOCAL_STORAGE (e_local_storage_get_type ()) -#define E_LOCAL_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_LOCAL_STORAGE, ELocalStorage)) -#define E_LOCAL_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_LOCAL_STORAGE, ELocalStorageClass)) -#define E_IS_LOCAL_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_LOCAL_STORAGE)) -#define E_IS_LOCAL_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_LOCAL_STORAGE)) - -typedef struct _ELocalStorage ELocalStorage; -typedef struct _ELocalStoragePrivate ELocalStoragePrivate; -typedef struct _ELocalStorageClass ELocalStorageClass; - -struct _ELocalStorage { - EStorage parent; - - ELocalStoragePrivate *priv; -}; - -struct _ELocalStorageClass { - EStorageClass parent_class; -}; - - -#define E_LOCAL_STORAGE_NAME "local" - - -GtkType e_local_storage_get_type (void); - -EStorage *e_local_storage_open (EFolderTypeRegistry *folder_type_registry, - const char *base_path); -const char *e_local_storage_get_base_path (ELocalStorage *storage); - -const Evolution_LocalStorage e_local_storage_get_corba_interface (ELocalStorage *storage); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_LOCAL_STORAGE_H__ */ diff --git a/shell/e-setup.c b/shell/e-setup.c deleted file mode 100644 index ee39f0d398..0000000000 --- a/shell/e-setup.c +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-setup.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/* This needs to be a lot better. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gnome.h> - -#include <errno.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <dirent.h> - -#include <gal/widgets/e-gui-utils.h> - -#include "e-setup.h" - - -static GList * -check_dir_recur (const char *evolution_directory, - const char *current_directory) -{ - DIR *def; - GList *newfiles = NULL; - struct dirent *current; - - def = opendir (current_directory); - if (def == NULL) - return NULL; - - current = readdir (def); - while (current != NULL) { - struct stat buf; - char *fullname, *fulldefaultname; - - fullname = g_concat_dir_and_file (evolution_directory, - current->d_name); - fulldefaultname = g_concat_dir_and_file (current_directory, - current->d_name); - - if (current->d_name[0] == '.' && - (current->d_name[1] == '\0' || - (current->d_name[1] == '.' && current->d_name[2] == '\0'))) { - current = readdir (def); - continue; - } - - if (stat (fullname, &buf) == -1) { - char *name; - - name = g_strdup (fulldefaultname); - newfiles = g_list_append (newfiles, name); - } else { - if (S_ISDIR (buf.st_mode)) { - newfiles = g_list_concat (newfiles, - check_dir_recur (fullname, - fulldefaultname)); - } - } - - g_free (fulldefaultname); - g_free (fullname); - current = readdir (def); - } - - closedir (def); - return newfiles; -} - -static gboolean -check_evolution_directory (const char *evolution_directory) -{ - GtkWidget *dialog; - GtkWidget *label1, *label2; - gboolean retval; - GList *newfiles, *l; - char *defaultdir; - int result; - - defaultdir = g_strdup (EVOLUTION_DATADIR "/evolution/default_user"); - newfiles = g_list_concat (NULL, check_dir_recur (evolution_directory, - defaultdir)); - - if (newfiles == NULL) - return TRUE; - - dialog = gnome_dialog_new (_("Evolution installation"), - GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, - NULL); - - label1 = gtk_label_new (_("This new version of Evolution needs to install additional files\ninto your personal Evolution directory")); - label2 = gtk_label_new (_("Please click \"OK\" to install the files, or \"Cancel\" to exit.")); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label1, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label2, TRUE, TRUE, 0); - - gtk_widget_show (label1); - gtk_widget_show (label2); - - result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - if (result != 0) - return FALSE; - - retval = TRUE; - for (l = newfiles; l; l = l->next) { - char *command; - char *shortpath; - - shortpath = l->data + strlen (EVOLUTION_DATADIR "/evolution/default_user/"); - command = g_strconcat ("cp -r ", - l->data, " ", - evolution_directory, "/", - shortpath, - NULL); - - if (system (command) != 0) { - retval = FALSE; - } else { - retval = (retval && TRUE); - } - - g_free (command); - - g_free (l->data); - } - - g_list_free (newfiles); - g_free (defaultdir); - - if (retval == FALSE) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Could not update files correctly")); - return FALSE; - } else { - e_notice (NULL, GNOME_MESSAGE_BOX_INFO, - _("Evolution files successfully installed.")); - return TRUE; - } - - return TRUE; -} - - -static gboolean -copy_default_stuff (const char *evolution_directory) -{ - GtkWidget *dialog; - GtkWidget *label1; - GtkWidget *label2; - GtkWidget *label3; - gboolean retval; - char *command; - int result; - - dialog = gnome_dialog_new (_("Evolution installation"), - GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, - NULL); - - label1 = gtk_label_new (_("This seems to be the first time you run Evolution.")); - label2 = gtk_label_new (_("Please click \"OK\" to install the Evolution user files under")); - label3 = gtk_label_new (evolution_directory); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label1, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label2, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label3, TRUE, TRUE, 0); - - gtk_widget_show (label1); - gtk_widget_show (label2); - gtk_widget_show (label3); - - result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - if (result != 0) - return FALSE; - - if (mkdir (evolution_directory, 0700)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot create the directory\n%s\nError: %s"), - evolution_directory, - g_strerror (errno)); - return FALSE; - } - - command = g_strconcat ("cp -r ", - EVOLUTION_DATADIR, - "/evolution/default_user/* ", - evolution_directory, - NULL); - - if (system (command) != 0) { - /* FIXME: Give more help. */ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot copy files into\n`%s'."), evolution_directory); - retval = FALSE; - } else { - e_notice (NULL, GNOME_MESSAGE_BOX_INFO, - _("Evolution files successfully installed.")); - retval = TRUE; - } - - g_free (command); - - return retval; -} - - -gboolean -e_setup (const char *evolution_directory) -{ - struct stat statinfo; - char *file; - - if (stat (evolution_directory, &statinfo) != 0) - return copy_default_stuff (evolution_directory); - - if (! S_ISDIR (statinfo.st_mode)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("The file `%s' is not a directory.\n" - "Please move it in order to allow installation\n" - "of the Evolution user files.")); - return FALSE; - } - - /* Make sure this is really our directory, not an Evolution - * build tree or something like that. - */ - file = g_strdup_printf ("%s/shortcuts.xml", evolution_directory); - if (stat (file, &statinfo) != 0) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("The directory `%s' exists but is not the\n" - "Evolution directory. Please move it in order\n" - "to allow installation of the Evolution user " - "files."), evolution_directory); - g_free (file); - return FALSE; - } - g_free (file); - - /* If the user has an old-style config file, replace it with - * the new-style config directory. FIXME: This should be - * temporary. - */ - file = g_strdup_printf ("%s/config", evolution_directory); - if (stat (file, &statinfo) == 0 && ! S_ISDIR (statinfo.st_mode)) { - char *old = g_strdup_printf ("%s.old", file); - rename (file, old); - mkdir (file, 0700); - g_free (old); - } - g_free (file); - - /* User has evolution directory... - Check if it is up to date. */ - return check_evolution_directory (evolution_directory); -} diff --git a/shell/e-setup.h b/shell/e-setup.h deleted file mode 100644 index a69d216b94..0000000000 --- a/shell/e-setup.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-setup.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SETUP_H -#define _E_SETUP_H - -#include <glib.h> - -gboolean e_setup (const char *evolution_directory); - -#endif /* _E_SETUP_H */ diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h deleted file mode 100644 index 70986144d0..0000000000 --- a/shell/e-shell-constants.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_CONSTANTS_H -#define E_SHELL_CONSTANTS_H - -#define E_SHELL_URI_PREFIX "evolution:" -#define E_SHELL_URI_PREFIX_LEN 10 - -#define E_SHELL_MINI_ICON_SUFFIX "-mini" -#define E_SHELL_MINI_ICON_SUFFIX_LEN 5 - -#define E_SHELL_ICON_SIZE 48 -#define E_SHELL_MINI_ICON_SIZE 16 - -#endif diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c deleted file mode 100644 index a05fcfea76..0000000000 --- a/shell/e-shell-folder-creation-dialog.c +++ /dev/null @@ -1,401 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <glade/glade-xml.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-gui-utils.h> - -#include <gal/widgets/e-scroll-frame.h> - -#include "e-storage-set.h" -#include "e-storage-set-view.h" - -#include "e-shell-folder-creation-dialog.h" - - -#define GLADE_FILE_NAME EVOLUTION_GLADEDIR "/e-shell-folder-creation-dialog.glade" - - -/* Data for the callbacks. */ -struct _DialogData { - GtkWidget *dialog; - EShell *shell; - GtkWidget *folder_name_entry; - GtkWidget *storage_set_view; - GtkWidget *folder_type_option_menu; - GList *folder_types; -}; -typedef struct _DialogData DialogData; - -static void -dialog_data_destroy (DialogData *dialog_data) -{ - e_free_string_list (dialog_data->folder_types); - g_free (dialog_data); -} - - -/* Callback for the asynchronous folder creation function. */ - -static void -async_create_cb (EStorage *storage, - EStorageResult result, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - if (result == E_STORAGE_OK) { - gtk_widget_destroy (dialog_data->dialog); - return; - } - - e_notice (GTK_WINDOW (dialog_data->dialog), GNOME_MESSAGE_BOX_ERROR, - _("Cannot create the specified folder:\n%s"), - e_storage_result_to_string (result)); -} - - -/* Sanity check for the user-specified folder name. */ -/* FIXME in the future we would like not to have the `G_DIR_SEPARATOR' limitation. */ -static gboolean -entry_name_is_valid (GtkEntry *entry) -{ - const char *name; - - name = gtk_entry_get_text (entry); - - if (name == NULL || *name == '\0') - return FALSE; - - if (strchr (name, G_DIR_SEPARATOR) != NULL) - return FALSE; - - if (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) - return FALSE; - - return TRUE; -} - - -/* Dialog signal callbacks. */ - -static void -dialog_clicked_cb (GnomeDialog *dialog, - int button_number, - void *data) -{ - DialogData *dialog_data; - EStorageSet *storage_set; - GtkWidget *folder_type_menu_item; - const char *folder_type; - const char *parent_path; - char *folder_name; - char *path; - - if (button_number != 0) { - gnome_dialog_close (dialog); - return; - } - - dialog_data = (DialogData *) data; - - if (! entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry))) { - /* FIXME: Explain better. */ - e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR, - _("The specified folder name is not valid.")); - return; - } - - parent_path = e_storage_set_view_get_current_folder - (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - if (parent_path == NULL) { - gnome_dialog_close (dialog); - return; - } - - folder_name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog_data->folder_name_entry)); - path = g_concat_dir_and_file (parent_path, folder_name); - g_free (folder_name); - - storage_set = e_shell_get_storage_set (dialog_data->shell); - - folder_type_menu_item = GTK_OPTION_MENU (dialog_data->folder_type_option_menu)->menu_item; - folder_type = gtk_object_get_data (GTK_OBJECT (folder_type_menu_item), "folder_type"); - - if (folder_type == NULL) { - g_warning ("Cannot get folder type for selected GtkOptionMenu item."); - return; - } - - e_storage_set_async_create_folder (storage_set, - path, - folder_type, - NULL, /* description */ - async_create_cb, dialog_data); -} - -static void -dialog_close_cb (GnomeDialog *dialog, - void *data) -{ - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -dialog_destroy_cb (GtkObject *object, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - dialog_data_destroy (dialog_data); -} - -static void -folder_name_entry_changed_cb (GtkEditable *editable, - void *data) -{ - GnomeDialog *dialog; - GtkEntry *entry; - - entry = GTK_ENTRY (editable); - dialog = GNOME_DIALOG (data); - - if (entry->text_length > 0) - gnome_dialog_set_sensitive (dialog, 0, TRUE); - else - gnome_dialog_set_sensitive (dialog, 0, FALSE); -} - - -/* Shell signal callbacks. */ - -static void -shell_destroy_cb (GtkObject *object, - void *data) -{ - GnomeDialog *dialog; - - dialog = GNOME_DIALOG (data); - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - - -/* Dialog setup. */ - -static void -setup_dialog (GtkWidget *dialog, - GladeXML *gui, - EShell *shell, - GtkWindow *parent_window) -{ - if (parent_window != NULL) - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); - - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution - Create new folder")); - - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); - - gtk_widget_show (dialog); -} - -static void -setup_folder_name_entry (GtkWidget *dialog, - GladeXML *gui, - EShell *shell) -{ - GtkWidget *folder_name_entry; - - folder_name_entry = glade_xml_get_widget (gui, "folder_name_entry"); - - gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE (folder_name_entry)); - - gtk_signal_connect (GTK_OBJECT (folder_name_entry), "changed", - GTK_SIGNAL_FUNC (folder_name_entry_changed_cb), dialog); -} - -static GtkWidget * -add_storage_set_view (GtkWidget *dialog, - GladeXML *gui, - EShell *shell, - const char *default_parent_folder) -{ - EStorageSet *storage_set; - GtkWidget *storage_set_view; - GtkWidget *scroll_frame; - GtkWidget *vbox; - - storage_set = e_shell_get_storage_set (shell); - storage_set_view = e_storage_set_new_view (storage_set); - - GTK_WIDGET_SET_FLAGS (storage_set_view, GTK_CAN_FOCUS); - - if (default_parent_folder != NULL) - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (storage_set_view), - default_parent_folder); - - vbox = glade_xml_get_widget (gui, "main_vbox"); - - scroll_frame = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start (GTK_BOX (vbox), scroll_frame, TRUE, TRUE, 0); - - gtk_container_add (GTK_CONTAINER (scroll_frame), storage_set_view); - - gtk_widget_show (scroll_frame); - gtk_widget_show (storage_set_view); - - return storage_set_view; -} - -static GList * -add_folder_types (GtkWidget *dialog, - GladeXML *gui, - EShell *shell) -{ - EFolderTypeRegistry *folder_type_registry; - GtkWidget *folder_type_option_menu; - GtkWidget *menu; - GList *folder_types; - GList *p; - int default_item; - int i; - - folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu"); - - /* KLUDGE. So, GtkOptionMenu is badly broken. It calculates its size - in `gtk_option_menu_set_menu()' instead of using `size_request()' as - any sane widget would do. So, in order to avoid the "narrow - GtkOptionMenu" bug, we have to destroy the existing associated menu - and create a new one. Life sucks. */ - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (folder_type_option_menu)); - g_assert (menu != NULL); - gtk_widget_destroy (menu); - - menu = gtk_menu_new (); - - folder_type_registry = e_shell_get_folder_type_registry (shell); - g_assert (folder_type_registry != NULL); - - folder_types = e_folder_type_registry_get_type_names (folder_type_registry); - if (folder_types == NULL) - return NULL; /* Uh? */ - - folder_types = g_list_sort (folder_types, (GCompareFunc) g_strcasecmp); - - /* FIXME: Use descriptive name (not in the registry's implementation yet). */ - /* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */ - - default_item = 0; - for (p = folder_types, i = 0; p != NULL; p = p->next, i++) { - const char *type_name; - GtkWidget *menu_item; - - type_name = (const char *) p->data; - - menu_item = gtk_menu_item_new_with_label (type_name); - gtk_widget_show (menu_item); - gtk_menu_append (GTK_MENU (menu), menu_item); - - gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type_name); - - if (strcmp (type_name, "mail") == 0) - default_item = i; - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (folder_type_option_menu), menu); - gtk_widget_show (menu); - - gtk_option_menu_set_history (GTK_OPTION_MENU (folder_type_option_menu), default_item); - gtk_widget_queue_resize (folder_type_option_menu); - - return folder_types; -} - - -/* FIXME: Currently this is modal. I think it's OK, but if people think it is - not, we should change it to non-modal and make sure only one of these is - open at once. Currently it relies on modality for this. */ -void -e_shell_show_folder_creation_dialog (EShell *shell, - GtkWindow *parent_window, - const char *default_parent_folder) -{ - GladeXML *gui; - GtkWidget *dialog; - GtkWidget *storage_set_view; - GList *folder_types; - DialogData *dialog_data; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - gui = glade_xml_new (GLADE_FILE_NAME, NULL); - if (gui == NULL) { - g_warning ("Cannot load Glade description file for the folder creation dialog -- %s", - GLADE_FILE_NAME); - return; - } - - dialog = glade_xml_get_widget (gui, "create_folder_dialog"); - - setup_dialog (dialog, gui, shell, parent_window); - setup_folder_name_entry (dialog, gui, shell); - - storage_set_view = add_storage_set_view (dialog, gui, shell, default_parent_folder); - folder_types = add_folder_types (dialog, gui, shell); - - dialog_data = g_new (DialogData, 1); - dialog_data->dialog = dialog; - dialog_data->shell = shell; - dialog_data->folder_name_entry = glade_xml_get_widget (gui, "folder_name_entry"); - dialog_data->storage_set_view = storage_set_view; - dialog_data->folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu"); - dialog_data->folder_types = folder_types; - - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), dialog_data); - gtk_signal_connect (GTK_OBJECT (dialog), "close", - GTK_SIGNAL_FUNC (dialog_close_cb), dialog_data); - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), dialog_data); - - gtk_signal_connect_while_alive (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (shell_destroy_cb), dialog_data, - GTK_OBJECT (dialog)); - - gtk_object_unref (GTK_OBJECT (gui)); -} diff --git a/shell/e-shell-folder-creation-dialog.h b/shell/e-shell-folder-creation-dialog.h deleted file mode 100644 index ac7518f986..0000000000 --- a/shell/e-shell-folder-creation-dialog.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_FOLDER_CREATION_DIALOG_H -#define E_SHELL_FOLDER_CREATION_DIALOG_H - -#include <gtk/gtkwindow.h> - -#include "e-shell.h" - -void e_shell_show_folder_creation_dialog (EShell *shell, - GtkWindow *parent, - const char *default_parent_folder); - -#endif /* E_SHELL_FOLDER_CREATION_DIALOG_H */ diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c deleted file mode 100644 index dac2e90df3..0000000000 --- a/shell/e-shell-folder-selection-dialog.c +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-selection-dialog.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnome/gnome-i18n.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-scroll-frame.h> -#include <gal/widgets/e-gui-utils.h> - -#include "e-shell-constants.h" -#include "e-storage-set-view.h" -#include "e-storage-set.h" - -#include "e-shell-folder-creation-dialog.h" - -#include "e-shell-folder-selection-dialog.h" - - -#define PARENT_TYPE (gnome_dialog_get_type ()) -static GnomeDialogClass *parent_class = NULL; - -struct _EShellFolderSelectionDialogPrivate { - EShell *shell; - GList *allowed_types; - EStorageSet *storage_set; - GtkWidget *storage_set_view; -}; - -enum { - FOLDER_SELECTED, - CANCELLED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static gboolean -check_folder_type (EShellFolderSelectionDialog *folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - const char *selected_path; - EFolder *folder; - const char *folder_type; - GList *p; - - priv = folder_selection_dialog->priv; - if (priv->allowed_types == NULL) - return TRUE; - - selected_path = e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog); - if (selected_path == NULL) - return FALSE; - - folder = e_storage_set_get_folder (priv->storage_set, selected_path); - if (folder == NULL) - return FALSE; - - folder_type = e_folder_get_type_string (folder); - - for (p = priv->allowed_types; p != NULL; p = p->next) { - const char *type; - - type = (const char *) p->data; - if (strcasecmp (folder_type, type) == 0) - return TRUE; - } - - e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, - _("The type of the selected folder is not valid for\nthe requested operation.")); - - return FALSE; -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EShellFolderSelectionDialog *folder_selection_dialog; - EShellFolderSelectionDialogPrivate *priv; - - folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (object); - priv = folder_selection_dialog->priv; - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - e_free_string_list (priv->allowed_types); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* ETable callback */ -static void -dbl_click_cb (EStorageSetView *essv, - int row, - EShellFolderSelectionDialog *folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - - priv = folder_selection_dialog->priv; - if (check_folder_type (folder_selection_dialog)) { - gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), - signals[FOLDER_SELECTED], - e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - } -} - - -/* GnomeDialog methods. */ - -static void -impl_clicked (GnomeDialog *dialog, - int button_number) -{ - EShellFolderSelectionDialog *folder_selection_dialog; - EShellFolderSelectionDialogPrivate *priv; - EStorageSetView *storage_set_view; - const char *default_parent_folder; - - folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (dialog); - priv = folder_selection_dialog->priv; - - switch (button_number) { - case 0: /* OK */ - if (check_folder_type (folder_selection_dialog)) { - gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[FOLDER_SELECTED], - e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - gtk_widget_destroy (GTK_WIDGET (dialog)); - } - break; - case 1: /* Cancel */ - gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[CANCELLED]); - gtk_widget_destroy (GTK_WIDGET (dialog)); - break; - case 2: /* Add */ - storage_set_view = E_STORAGE_SET_VIEW (priv->storage_set_view); - default_parent_folder = e_storage_set_view_get_current_folder (storage_set_view); - - e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog), - default_parent_folder); - - break; - } -} - - -/* GTK+ type initialization. */ - -static void -class_init (EShellFolderSelectionDialogClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - parent_class = gtk_type_class (PARENT_TYPE); - object_class = GTK_OBJECT_CLASS (klass); - dialog_class = GNOME_DIALOG_CLASS (klass); - - object_class->destroy = impl_destroy; - - dialog_class->clicked = impl_clicked; - - signals[FOLDER_SELECTED] - = gtk_signal_new ("folder_selected", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellFolderSelectionDialogClass, folder_selected), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - signals[CANCELLED] - = gtk_signal_new ("cancelled", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellFolderSelectionDialogClass, cancelled), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShellFolderSelectionDialog *shell_folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - - priv = g_new (EShellFolderSelectionDialogPrivate, 1); - priv->shell = NULL; - priv->storage_set = NULL; - priv->storage_set_view = NULL; - priv->allowed_types = NULL; - - shell_folder_selection_dialog->priv = priv; -} - - -static void -set_default_folder (EShellFolderSelectionDialog *shell_folder_selection_dialog, - const char *default_uri) -{ - EShellFolderSelectionDialogPrivate *priv; - char *default_path; - - g_assert (default_uri != NULL); - - priv = shell_folder_selection_dialog->priv; - - if (strncmp (default_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { - /* `evolution:' URI. */ - default_path = g_strdup (default_uri + E_SHELL_URI_PREFIX_LEN); - } else { - /* Physical URI. */ - default_path = e_storage_set_get_path_for_physical_uri (priv->storage_set, - default_uri); - } - - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), - default_path); - - g_free (default_path); -} - - -/** - * e_shell_folder_selection_dialog_construct: - * @folder_selection_dialog: A folder selection dialog widget - * @shell: The this folder selection dialog is for - * @title: Title of the window - * @default_uri: The URI of the folder to be selected by default - * @allowed_types: List of the names of the allowed types - * - * Construct @folder_selection_dialog. - **/ -void -e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_selection_dialog, - EShell *shell, - const char *title, - const char *default_uri, - const char *allowed_types[]) -{ - EShellFolderSelectionDialogPrivate *priv; - GtkWidget *scroll_frame; - int i; - - g_return_if_fail (folder_selection_dialog != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog)); - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - priv = folder_selection_dialog->priv; - - gtk_window_set_modal (GTK_WINDOW (folder_selection_dialog), TRUE); - gtk_window_set_title (GTK_WINDOW (folder_selection_dialog), title); - - gnome_dialog_append_buttons (GNOME_DIALOG (folder_selection_dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - _("New..."), - NULL); - gnome_dialog_set_default (GNOME_DIALOG (folder_selection_dialog), 0); - - gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (folder_selection_dialog), 350, 300); - - priv->shell = shell; - gtk_signal_connect_object_while_alive (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (folder_selection_dialog)); - - priv->storage_set = e_shell_get_storage_set (shell); - gtk_object_ref (GTK_OBJECT (priv->storage_set)); - - priv->storage_set_view = e_storage_set_new_view (priv->storage_set); - GTK_WIDGET_SET_FLAGS (priv->storage_set_view, GTK_CAN_FOCUS); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), - "double_click", GTK_SIGNAL_FUNC (dbl_click_cb), - folder_selection_dialog); - - g_assert (priv->allowed_types == NULL); - if (allowed_types != NULL) { - for (i = 0; allowed_types[i] != NULL; i++) - priv->allowed_types = g_list_prepend (priv->allowed_types, - g_strdup (allowed_types[i])); - } - - if (default_uri != NULL) - set_default_folder (folder_selection_dialog, default_uri); - - scroll_frame = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (scroll_frame), priv->storage_set_view); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (folder_selection_dialog)->vbox), - scroll_frame, TRUE, TRUE, 2); - - gtk_widget_show (scroll_frame); - gtk_widget_show (priv->storage_set_view); -} - -/** - * e_shell_folder_selection_dialog_new: - * @shell: The this folder selection dialog is for - * @title: Title of the window - * @default_uri: The URI of the folder to be selected by default - * @allowed_types: List of the names of the allowed types - * - * Create a new folder selection dialog widget. @default_uri can be either an - * `evolution:' URI or a physical URI (all the non-`evoluion:' URIs are - * considered to be physical URIs). - * - * Return value: - **/ -GtkWidget * -e_shell_folder_selection_dialog_new (EShell *shell, - const char *title, - const char *default_uri, - const char *allowed_types[]) -{ - EShellFolderSelectionDialog *folder_selection_dialog; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - folder_selection_dialog = gtk_type_new (e_shell_folder_selection_dialog_get_type ()); - e_shell_folder_selection_dialog_construct (folder_selection_dialog, shell, - title, default_uri, allowed_types); - - return GTK_WIDGET (folder_selection_dialog); -} - - -const char * -e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - - g_return_val_if_fail (folder_selection_dialog != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), NULL); - - priv = folder_selection_dialog->priv; - - return e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view)); -} - - -E_MAKE_TYPE (e_shell_folder_selection_dialog, "EShellFolderSelectionDialog", EShellFolderSelectionDialog, - class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-folder-selection-dialog.h b/shell/e-shell-folder-selection-dialog.h deleted file mode 100644 index 2ddb98bafe..0000000000 --- a/shell/e-shell-folder-selection-dialog.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-selection-dialog.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_FOLDER_SELECTION_DIALOG_H -#define E_SHELL_FOLDER_SELECTION_DIALOG_H - -#include <libgnomeui/gnome-dialog.h> - -#include "e-shell.h" - -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define E_TYPE_SHELL_FOLDER_SELECTION_DIALOG (e_shell_folder_selection_dialog_get_type ()) -#define E_SHELL_FOLDER_SELECTION_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_FOLDER_SELECTION_DIALOG, EShellFolderSelectionDialog)) -#define E_SHELL_FOLDER_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_FOLDER_SELECTION_DIALOG, EShellFolderSelectionDialogClass)) -#define E_IS_SHELL_FOLDER_SELECTION_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_FOLDER_SELECTION_DIALOG)) -#define E_IS_SHELL_FOLDER_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_FOLDER_SELECTION_DIALOG)) - - -typedef struct _EShellFolderSelectionDialog EShellFolderSelectionDialog; -typedef struct _EShellFolderSelectionDialogPrivate EShellFolderSelectionDialogPrivate; -typedef struct _EShellFolderSelectionDialogClass EShellFolderSelectionDialogClass; - -struct _EShellFolderSelectionDialog { - GnomeDialog parent; - - EShellFolderSelectionDialogPrivate *priv; -}; - -struct _EShellFolderSelectionDialogClass { - GnomeDialogClass parent_class; - - void (* folder_selected) (EShellFolderSelectionDialog *folder_selection_dialog, - const char *path); - void (* cancelled) (EShellFolderSelectionDialog *folder_selection_dialog); -}; - - -GtkType e_shell_folder_selection_dialog_get_type (void); -void e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_selection_dialog, - EShell *shell, - const char *title, - const char *default_path, - const char *allowed_types[]); -GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell, - const char *title, - const char *default_path, - const char *allowed_types[]); - -const char *e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* E_SHELL_FOLDER_SELECTION_DIALOG_H */ diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c deleted file mode 100644 index 7a51e77ad3..0000000000 --- a/shell/e-shell-folder-title-bar.c +++ /dev/null @@ -1,544 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-title-bar.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "widgets/misc/e-clipped-label.h" -#include <gal/util/e-util.h> - -#include "e-shell-constants.h" -#include "e-shell-folder-title-bar.h" - - -#define PARENT_TYPE GTK_TYPE_EVENT_BOX -static GtkEventBox *parent_class = NULL; - -struct _EShellFolderTitleBarPrivate { - GdkPixbuf *icon; - GtkWidget *icon_widget; - - /* The hbox containing the button, the label and the icon on the right. */ - GtkWidget *hbox; - - /* We have a label and a button. When the button is enabled, the label is hidden; - when the button is disable, only the label is visible. */ - - /* The label. */ - GtkWidget *label; - - /* The button. */ - GtkWidget *button; - GtkWidget *button_label; - GtkWidget *button_arrow; - - gboolean clickable; -}; - -enum { - TITLE_TOGGLED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static char *arrow_xpm[] = { - "11 5 2 1", - " c none", - ". c #ffffffffffff", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . ", -}; - - -/* Icon handling. */ - -static unsigned int -rgb_from_gdk_color (GdkColor *color) -{ - return (((color->red >> 8) << 16) - | ((color->green >> 8) << 8) - | ((color->blue >> 8))); -} - -static GdkPixmap * -make_icon_pixmap (EShellFolderTitleBar *folder_title_bar, - const GdkPixbuf *pixbuf) -{ - GdkPixmap *pixmap; - GtkWidget *widget; - unsigned int depth; - unsigned int rgb; - - widget = GTK_WIDGET (folder_title_bar); - - rgb = rgb_from_gdk_color (&widget->style->bg[GTK_STATE_NORMAL]); - - depth = gtk_widget_get_visual (widget)->depth; - - pixmap = gdk_pixmap_new (GTK_WIDGET (folder_title_bar)->window, - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - depth); - - if (pixbuf == NULL) { - gdk_draw_rectangle (pixmap, widget->style->bg_gc[GTK_STATE_NORMAL], TRUE, - 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); - } else { - GdkPixbuf *composited_pixbuf; - - composited_pixbuf = gdk_pixbuf_composite_color_simple - (pixbuf, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), - GDK_INTERP_NEAREST, 255, 32, rgb, rgb); - - gdk_pixbuf_render_to_drawable (composited_pixbuf, - pixmap, widget->style->fg_gc[GTK_STATE_NORMAL], - 0, 0, 0, 0, - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - GDK_RGB_DITHER_MAX, 0, 0); - - gdk_pixbuf_unref (composited_pixbuf); - } - - return pixmap; -} - - -/* Icon pixmap. */ - -static GtkWidget * -create_icon_pixmap (GtkWidget *parent) -{ - GtkWidget *gtk_pixmap; - GdkPixmap *gdk_pixmap; - GdkBitmap *gdk_mask; - - gdk_pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &gdk_mask, NULL, arrow_xpm); - gtk_pixmap = gtk_pixmap_new (gdk_pixmap, gdk_mask); - - gdk_pixmap_unref (gdk_pixmap); - gdk_bitmap_unref (gdk_mask); - - return gtk_pixmap; -} - -static void -title_button_box_realize_cb (GtkWidget *widget, - void *data) -{ - EShellFolderTitleBar *folder_title_bar; - EShellFolderTitleBarPrivate *priv; - GtkWidget *button_arrow; - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data); - priv = folder_title_bar->priv; - - if (priv->button_arrow != NULL) - return; - - button_arrow = create_icon_pixmap (widget); - - gtk_widget_show (button_arrow); - gtk_box_pack_start (GTK_BOX (widget), button_arrow, FALSE, TRUE, 2); - - priv->button_arrow = button_arrow; -} - - -/* Style handling. */ - -static void -endarken_style (GtkWidget *widget) -{ -#ifndef E_USE_STYLES - GtkStyle *style; - GtkRcStyle *new_rc_style; - int i; - - style = widget->style; - - new_rc_style = gtk_rc_style_new (); - - for (i = 0; i < 5; i++) { - new_rc_style->bg[i].red = style->bg[i].red * .8; - new_rc_style->bg[i].green = style->bg[i].green * .8; - new_rc_style->bg[i].blue = style->bg[i].blue * .8; - new_rc_style->fg[i].red = 0xffff; - new_rc_style->fg[i].green = 0xffff; - new_rc_style->fg[i].blue = 0xffff; - - new_rc_style->color_flags[i] = GTK_RC_BG | GTK_RC_FG; - } - - gtk_widget_modify_style (widget, new_rc_style); - - gtk_rc_style_unref (new_rc_style); -#endif -} - -static void -style_set_cb (GtkWidget *widget, - GtkStyle *previous_style, - void *data) -{ - EShellFolderTitleBar *folder_title_bar; - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (widget); - - /* - This will cause a style_set signal to be emitted again, - so we need to do this to prevent infinite recursion. - */ - gtk_signal_handler_block_by_func (GTK_OBJECT (widget), GTK_SIGNAL_FUNC (style_set_cb), data); - - endarken_style (widget); - gtk_signal_handler_unblock_by_func (GTK_OBJECT (widget), GTK_SIGNAL_FUNC (style_set_cb), data); - - if (folder_title_bar->priv->icon) - e_shell_folder_title_bar_set_icon (folder_title_bar, folder_title_bar->priv->icon); -} - - -/* Popup button callback. */ - -static void -title_button_toggled_cb (GtkToggleButton *button, - void *data) -{ - EShellFolderTitleBar *folder_title_bar; - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data); - gtk_signal_emit (GTK_OBJECT (folder_title_bar), - signals[TITLE_TOGGLED], - gtk_toggle_button_get_active (button)); -} - - -/* GTkWidget methods. */ - -static void -realize (GtkWidget *widget) -{ - EShellFolderTitleBar *folder_title_bar; - EShellFolderTitleBarPrivate *priv; - GdkPixmap *pixmap; - - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (widget); - priv = folder_title_bar->priv; - - pixmap = make_icon_pixmap (folder_title_bar, priv->icon); - priv->icon_widget = gtk_pixmap_new (pixmap, NULL); - gdk_pixmap_unref (pixmap); - gtk_widget_show (priv->icon_widget); - - gtk_misc_set_alignment (GTK_MISC (priv->icon_widget), 1.0, .5); - gtk_misc_set_padding (GTK_MISC (priv->icon_widget), 5, 0); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_widget, TRUE, TRUE, 2); -} - -static void -unrealize (GtkWidget *widget) -{ - EShellFolderTitleBar *folder_title_bar; - EShellFolderTitleBarPrivate *priv; - - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (widget); - priv = folder_title_bar->priv; - - gtk_widget_destroy (priv->icon_widget); - priv->icon_widget = NULL; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShellFolderTitleBar *folder_title_bar; - EShellFolderTitleBarPrivate *priv; - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (object); - priv = folder_title_bar->priv; - - if (priv->icon) - gdk_pixbuf_unref (priv->icon); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EShellFolderTitleBarClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->realize = realize; - widget_class->unrealize = unrealize; - - parent_class = gtk_type_class (PARENT_TYPE); - - signals[TITLE_TOGGLED] = gtk_signal_new ("title_toggled", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, title_toggled), - gtk_marshal_NONE__BOOL, - GTK_TYPE_NONE, 1, - GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShellFolderTitleBar *shell_folder_title_bar) -{ - EShellFolderTitleBarPrivate *priv; - - priv = g_new (EShellFolderTitleBarPrivate, 1); - - priv->icon = NULL; - priv->icon_widget = NULL; - priv->hbox = NULL; - priv->label = NULL; - priv->button_label = NULL; - priv->button = NULL; - priv->button_arrow = NULL; - - priv->clickable = TRUE; - - shell_folder_title_bar->priv = priv; -} - - -/** - * e_shell_folder_title_bar_construct: - * @folder_title_bar: - * - * Construct the folder title bar widget. - **/ -void -e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) -{ - EShellFolderTitleBarPrivate *priv; - GtkWidget *button_hbox; - GtkWidget *widget; - - g_return_if_fail (folder_title_bar != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); - - priv = folder_title_bar->priv; - widget = GTK_WIDGET (folder_title_bar); - - priv->label = gtk_label_new (""); - gtk_misc_set_padding (GTK_MISC (priv->label), 5, 0); - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); - - priv->button_label = gtk_label_new (""); - gtk_misc_set_padding (GTK_MISC (priv->button_label), 5, 0); - gtk_misc_set_alignment (GTK_MISC (priv->button_label), 0.0, 0.5); - gtk_widget_show (priv->button_label); - - button_hbox = gtk_hbox_new (FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button_hbox), "realize", - GTK_SIGNAL_FUNC (title_button_box_realize_cb), folder_title_bar); - gtk_box_pack_start (GTK_BOX (button_hbox), priv->button_label, TRUE, TRUE, 0); - gtk_widget_show (button_hbox); - - priv->button = gtk_toggle_button_new (); - gtk_button_set_relief (GTK_BUTTON (priv->button), GTK_RELIEF_NONE); - gtk_container_add (GTK_CONTAINER (priv->button), button_hbox); - GTK_WIDGET_UNSET_FLAGS (priv->button, GTK_CAN_FOCUS); - gtk_widget_show (priv->button); - - priv->hbox = gtk_hbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (priv->hbox), 2); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->button, FALSE, TRUE, 0); - - gtk_widget_show (priv->hbox); - - gtk_signal_connect (GTK_OBJECT (priv->button), "toggled", - GTK_SIGNAL_FUNC (title_button_toggled_cb), folder_title_bar); - - gtk_container_add (GTK_CONTAINER (folder_title_bar), priv->hbox); - - gtk_signal_connect (GTK_OBJECT (folder_title_bar), "style_set", - GTK_SIGNAL_FUNC (style_set_cb), NULL); - - e_shell_folder_title_bar_set_title (folder_title_bar, NULL); -} - -/** - * e_shell_folder_title_bar_new: - * @void: - * - * Create a new title bar widget. - * - * Return value: - **/ -GtkWidget * -e_shell_folder_title_bar_new (void) -{ - EShellFolderTitleBar *new; - - new = gtk_type_new (e_shell_folder_title_bar_get_type ()); - - e_shell_folder_title_bar_construct (new); - - return GTK_WIDGET (new); -} - -/** - * e_shell_folder_title_bar_set_title: - * @folder_title_bar: - * @title: - * - * Set the title for the title bar. - **/ -void -e_shell_folder_title_bar_set_title (EShellFolderTitleBar *folder_title_bar, - const char *title) -{ - EShellFolderTitleBarPrivate *priv; - - g_return_if_fail (folder_title_bar != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); - - priv = folder_title_bar->priv; - - if (title == NULL) { - gtk_label_set_text (GTK_LABEL (priv->button_label), _("(Untitled)")); - gtk_label_set_text (GTK_LABEL (priv->label), _("(Untitled)")); - } else { - gtk_label_set_text (GTK_LABEL (priv->button_label), title); - gtk_label_set_text (GTK_LABEL (priv->label), title); - } - - /* FIXME: There seems to be a bug in EClippedLabel, this is just a workaround. */ - gtk_widget_queue_draw (GTK_WIDGET (folder_title_bar)); -} - -/** - * e_shell_folder_title_bar_set_icon: - * @folder_title_bar: - * @icon: - * - * Set the name of the icon for the title bar. - **/ -void -e_shell_folder_title_bar_set_icon (EShellFolderTitleBar *folder_title_bar, - const GdkPixbuf *icon) -{ - EShellFolderTitleBarPrivate *priv; - GdkPixmap *pixmap; - - g_return_if_fail (icon != NULL); - - g_return_if_fail (folder_title_bar != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); - - priv = folder_title_bar->priv; - - gdk_pixbuf_ref ((GdkPixbuf *) icon); - if (priv->icon) - gdk_pixbuf_unref (priv->icon); - priv->icon = (GdkPixbuf *) icon; - - pixmap = make_icon_pixmap (folder_title_bar, icon); - - gtk_pixmap_set (GTK_PIXMAP (priv->icon_widget), pixmap, NULL); -} - - -/** - * e_shell_folder_title_bar_set_toggle_state: - * @folder_title_bar: - * @state: - * - * Set whether the title bar's button is in pressed state (TRUE) or not (FALSE). - **/ -void -e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *folder_title_bar, - gboolean state) -{ - EShellFolderTitleBarPrivate *priv; - - g_return_if_fail (folder_title_bar != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); - - priv = folder_title_bar->priv; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), state); -} - -/** - * e_shell_folder_title_bar_set_clickable: - * @folder_title_bar: - * @clickable: - * - * Specify whether @folder_title_bar is clickable. If not, the arrow pixmap is not shown. - **/ -void -e_shell_folder_title_bar_set_clickable (EShellFolderTitleBar *folder_title_bar, - gboolean clickable) -{ - EShellFolderTitleBarPrivate *priv; - - g_return_if_fail (folder_title_bar != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); - - priv = folder_title_bar->priv; - - if ((priv->clickable && clickable) || (! priv->clickable && ! clickable)) - return; - - if (clickable) { - gtk_widget_show (priv->button); - gtk_widget_hide (priv->label); - } else { - gtk_widget_hide (priv->button); - gtk_widget_show (priv->label); - } - - priv->clickable = !! clickable; -} - - -E_MAKE_TYPE (e_shell_folder_title_bar, "EShellFolderTitleBar", EShellFolderTitleBar, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-folder-title-bar.h b/shell/e-shell-folder-title-bar.h deleted file mode 100644 index c8bab9994c..0000000000 --- a/shell/e-shell-folder-title-bar.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-title-bar.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_SHELL_FOLDER_TITLE_BAR_H__ -#define __E_SHELL_FOLDER_TITLE_BAR_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkeventbox.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHELL_FOLDER_TITLE_BAR (e_shell_folder_title_bar_get_type ()) -#define E_SHELL_FOLDER_TITLE_BAR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_FOLDER_TITLE_BAR, EShellFolderTitleBar)) -#define E_SHELL_FOLDER_TITLE_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_FOLDER_TITLE_BAR, EShellFolderTitleBarClass)) -#define E_IS_SHELL_FOLDER_TITLE_BAR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_FOLDER_TITLE_BAR)) -#define E_IS_SHELL_FOLDER_TITLE_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_FOLDER_TITLE_BAR)) - - -typedef struct _EShellFolderTitleBar EShellFolderTitleBar; -typedef struct _EShellFolderTitleBarPrivate EShellFolderTitleBarPrivate; -typedef struct _EShellFolderTitleBarClass EShellFolderTitleBarClass; - -struct _EShellFolderTitleBar { - GtkEventBox parent; - - EShellFolderTitleBarPrivate *priv; -}; - -struct _EShellFolderTitleBarClass { - GtkEventBoxClass parent_class; - - /* Signals. */ - void (* title_toggled) (EShellFolderTitleBar *folder_title_bar, gboolean pressed); -}; - - -GtkType e_shell_folder_title_bar_get_type (void); -void e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar); -GtkWidget *e_shell_folder_title_bar_new (void); - -void e_shell_folder_title_bar_set_title (EShellFolderTitleBar *folder_title_bar, - const char *title); -void e_shell_folder_title_bar_set_icon (EShellFolderTitleBar *folder_title_bar, - const GdkPixbuf *icon); -void e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *folder_title_bar, - gboolean state); -void e_shell_folder_title_bar_set_clickable (EShellFolderTitleBar *folder_title_bar, - gboolean clickable); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_SHELL_FOLDER_TITLE_BAR_H__ */ diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c deleted file mode 100644 index 9065fc224c..0000000000 --- a/shell/e-shell-utils.c +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "e-shell-constants.h" - -#include "e-shell-utils.h" - - -static char * -get_icon_path (const char *icon_name) -{ - char *icon_path; - - if (g_path_is_absolute (icon_name)) { - icon_path = g_strdup (icon_name); - } else { - icon_path = gnome_pixmap_file (icon_name); - - if (icon_path == NULL) - icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, - icon_name); - } - - if (g_file_exists (icon_path)) { - return icon_path; - } else { - g_free (icon_path); - return NULL; - } -} - -static char * -get_mini_name (const char *icon_name) -{ - const char *dot_ptr; - const char *basename; - char *name_without_extension; - char *mini_name; - - basename = g_basename (icon_name); - if (basename == NULL) - return NULL; - - dot_ptr = strrchr (basename, '.'); - - if (dot_ptr == NULL) { - /* No extension. */ - return g_strconcat (icon_name, E_SHELL_MINI_ICON_SUFFIX, NULL); - } - - name_without_extension = g_strndup (icon_name, dot_ptr - icon_name); - mini_name = g_strconcat (name_without_extension, E_SHELL_MINI_ICON_SUFFIX, - dot_ptr, NULL); - g_free (name_without_extension); - - return mini_name; -} - - -char * -e_shell_get_icon_path (const char *icon_name, - gboolean try_mini) -{ - if (try_mini) { - char *path; - char *mini_name; - - mini_name = get_mini_name (icon_name); - if (mini_name == NULL) { - path = NULL; - } else { - path = get_icon_path (mini_name); - g_free (mini_name); - } - - if (path != NULL) - return path; - } - - return get_icon_path (icon_name); -} diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h deleted file mode 100644 index a701dd38eb..0000000000 --- a/shell/e-shell-utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_UTILS_H -#define E_SHELL_UTILS_H - -char *e_shell_get_icon_path (const char *icon_name, - gboolean try_mini); - -#endif diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c deleted file mode 100644 index e2906b2fbf..0000000000 --- a/shell/e-shell-view-menu.c +++ /dev/null @@ -1,480 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Miguel de Icaza - * Ettore Perazzoli - */ - -#include <config.h> -#include <gnome.h> - -#include "e-shell-folder-creation-dialog.h" -#include "e-shell-folder-selection-dialog.h" - -#include "e-shell-constants.h" - -#include "e-shell-view-menu.h" -#include <bonobo.h> - - -/* EShellView callbacks. */ - -static void -shortcut_bar_mode_changed_cb (EShellView *shell_view, - EShellViewSubwindowMode new_mode, - void *data) -{ - BonoboUIComponent *uic; - const char *path; - char *txt; - - if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN) - txt = "0"; - else - txt = "1"; - - path = (const char *) data; - uic = e_shell_view_get_bonobo_ui_component (shell_view); - - bonobo_ui_component_set_prop (uic, path, "state", txt, NULL); -} - -static void -folder_bar_mode_changed_cb (EShellView *shell_view, - EShellViewSubwindowMode new_mode, - void *data) -{ - BonoboUIComponent *uic; - const char *path; - char *txt; - - if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN) - txt = "0"; - else - txt = "1"; - - path = (const char *) data; - uic = e_shell_view_get_bonobo_ui_component (shell_view); - - bonobo_ui_component_set_prop (uic, path, "state", txt, NULL); -} - - -/* Command callbacks. */ -static void -command_quit (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - EShell *shell; - - shell_view = E_SHELL_VIEW (data); - - shell = e_shell_view_get_shell (shell_view); - e_shell_quit (shell); -} - -static void -command_run_bugbuddy (BonoboUIComponent *uih, - void *data, - const char *path) -{ - int pid; - char *args[] = { - "bug-buddy", - "--sm-disable", - "--package=evolution", - "--package-ver="VERSION, - NULL - }; - args[0] = gnome_is_program_in_path ("bug-buddy"); - if (!args[0]) { - /* you might have to call gnome_dialog_run() on the - * dialog returned here, I don't remember... - */ - gnome_error_dialog (_("Bug buddy was not found in your $PATH.")); - } - pid = gnome_execute_async (NULL, 4, args); - g_free (args[0]); - if (pid == -1) { - /* same as above */ - gnome_error_dialog (_("Bug buddy could not be run.")); - } -} - -static void -zero_pointer(GtkObject *object, void **pointer) -{ - *pointer = NULL; -} - -static void -command_about_box (BonoboUIComponent *uih, - void *data, - const char *path) -{ - static GtkWidget *about_box = NULL; - - if (about_box) - gdk_window_raise(GTK_WIDGET(about_box)->window); - else { - const gchar *authors[] = { - "Seth Alves", - "Anders Carlsson", - "Damon Chaplin", - "Clifford R. Conover", - "Miguel de Icaza", - "Radek Doulik", - "Arturo Espinoza", - "Larry Ewing", - "Nat Friedman", - "Bertrand Guiheneuf", - "Iain Holmes", - "Tuomas Kuosmanen", - "Christopher J. Lahey", - "Matthew Loper", - "Federico Mena", - "Eskil Heyn Olsen", - "Ettore Perazzoli", - "Jeffrey Stedfast", - "Russell Steinthal", - "Peter Teichman", - "Chris Toshok", - "Peter Williams", - "Dan Winship", - "Michael Zucchi", - NULL}; - - about_box = gnome_about_new(_("Evolution"), - VERSION, - _("Copyright 1999, 2000 Helix Code, Inc."), - authors, - _("Evolution is a suite of groupware applications\n" - "for mail, calendaring, and contact management\n" - "within the GNOME desktop environment."), - NULL); - gtk_signal_connect(GTK_OBJECT(about_box), "destroy", - GTK_SIGNAL_FUNC(zero_pointer), &about_box); - gtk_widget_show(about_box); - } -} - -static void -command_help (BonoboUIComponent *uih, - void *data, - const char *path) -{ - char *url; - - url = g_strdup_printf ("ghelp:%s/gnome/help/evolution/C/%s", - EVOLUTION_DATADIR, (char *)data); - gnome_url_show (url); -} - -static void -command_toggle_folder_bar (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - EShellView *shell_view; - EShellViewSubwindowMode mode; - gboolean show; - - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - shell_view = E_SHELL_VIEW (user_data); - - show = atoi (state); - if (show) - mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - else - mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - - e_shell_view_set_folder_bar_mode (shell_view, mode); -} - -static void -command_toggle_shortcut_bar (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) - -{ - EShellView *shell_view; - EShellViewSubwindowMode mode; - gboolean show; - - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - shell_view = E_SHELL_VIEW (user_data); - - show = atoi (state); - - if (show) - mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - else - mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - - e_shell_view_set_shortcut_bar_mode (shell_view, mode); -} - - -static void -command_new_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - EShell *shell; - const char *current_uri; - const char *default_parent_folder; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - current_uri = e_shell_view_get_current_uri (shell_view); - - if (strncmp (current_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) - default_parent_folder = current_uri + E_SHELL_URI_PREFIX_LEN; - else - default_parent_folder = NULL; - - e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), - default_parent_folder); -} - -static void -command_new_view (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - EShell *shell; - const char *current_uri; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - current_uri = e_shell_view_get_current_uri (shell_view); - - e_shell_new_view (shell, current_uri); -} - - -/* Going to a folder. */ - -static void -folder_selection_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - -static void -folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog, - const char *path, - void *data) -{ - if (path != NULL) { - EShellView *shell_view; - char *uri; - - shell_view = E_SHELL_VIEW (data); - - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - e_shell_view_display_uri (shell_view, uri); - g_free (uri); - } -} - -static void -command_goto_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - GtkWidget *folder_selection_dialog; - EShellView *shell_view; - EShell *shell; - const char *current_uri; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - - current_uri = e_shell_view_get_current_uri (shell_view); - - folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, - _("Go to folder..."), - current_uri, - NULL); - - gtk_window_set_transient_for (GTK_WINDOW (folder_selection_dialog), GTK_WINDOW (shell_view)); - - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected", - GTK_SIGNAL_FUNC (folder_selection_dialog_folder_selected_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled", - GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell_view); - - gtk_widget_show (folder_selection_dialog); -} - -static void -command_create_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - EShell *shell; - const char *current_uri; - const char *default_folder; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - - current_uri = e_shell_view_get_current_uri (shell_view); - - if (strncmp (current_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) - default_folder = current_uri + E_SHELL_URI_PREFIX_LEN; - else - default_folder = NULL; - - e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), default_folder); -} - -static void -command_xml_dump (gpointer dummy, - EShellView *view) -{ - bonobo_window_dump (BONOBO_WINDOW (view), "On demand"); -} - - -/* Unimplemented commands. */ - -#define DEFINE_UNIMPLEMENTED(func) \ -static void \ -func (BonoboUIComponent *uic, void *data, const char *path) \ -{ \ - g_warning ("EShellView: %s: not implemented.", __FUNCTION__); \ -} \ - -DEFINE_UNIMPLEMENTED (command_new_shortcut) -DEFINE_UNIMPLEMENTED (command_new_mail_message) -DEFINE_UNIMPLEMENTED (command_new_contact) -DEFINE_UNIMPLEMENTED (command_new_task_request) - -BonoboUIVerb new_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("NewView", command_new_view), - BONOBO_UI_UNSAFE_VERB ("NewFolder", command_new_folder), - BONOBO_UI_UNSAFE_VERB ("NewShortcut", command_new_shortcut), - BONOBO_UI_UNSAFE_VERB ("NewMailMessage", command_new_mail_message), - - BONOBO_UI_UNSAFE_VERB ("NewAppointment", command_new_shortcut), - BONOBO_UI_UNSAFE_VERB ("NewContact", command_new_contact), - BONOBO_UI_UNSAFE_VERB ("NewTask", command_new_task_request), - - BONOBO_UI_VERB_END -}; - -BonoboUIVerb file_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("FileGoToFolder", command_goto_folder), - BONOBO_UI_UNSAFE_VERB ("FileCreateFolder", command_create_folder), - BONOBO_UI_UNSAFE_VERB ("FileExit", command_quit), - - BONOBO_UI_VERB_END -}; - -BonoboUIVerb help_verbs [] = { - BONOBO_UI_UNSAFE_VERB_DATA ("HelpIndex", command_help, "index.html"), - BONOBO_UI_UNSAFE_VERB_DATA ("HelpGetStarted", command_help, "usage-mainwindow.html"), - BONOBO_UI_UNSAFE_VERB_DATA ("HelpUsingMail", command_help, "usage-mail.html"), - BONOBO_UI_UNSAFE_VERB_DATA ("HelpUsingCalendar", command_help, "usage-calendar.html"), - BONOBO_UI_UNSAFE_VERB_DATA ("HelpUsingContact", command_help, "usage-contact.html"), - - BONOBO_UI_VERB_END -}; - -static void -menu_do_misc (BonoboUIComponent *component, - EShellView *shell_view) -{ - bonobo_ui_component_add_listener ( - component, "ViewShortcutBar", - command_toggle_shortcut_bar, shell_view); - bonobo_ui_component_add_listener ( - component, "ViewFolderBar", - command_toggle_folder_bar, shell_view); - bonobo_ui_component_add_verb ( - component, "HelpSubmitBug", - (BonoboUIVerbFn) command_run_bugbuddy, shell_view); - bonobo_ui_component_add_verb ( - component, "HelpAbout", - (BonoboUIVerbFn) command_about_box, shell_view); - bonobo_ui_component_add_verb ( - component, "DebugDumpXml", - (BonoboUIVerbFn) command_xml_dump, shell_view); -} - - -#define SHORTCUT_BAR_TOGGLE_PATH "/commands/ViewShortcutBar" -#define FOLDER_BAR_TOGGLE_PATH "/commands/ViewFolderBar" - -void -e_shell_view_menu_setup (EShellView *shell_view) -{ - BonoboUIComponent *uic; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - uic = e_shell_view_get_bonobo_ui_component (shell_view); - - bonobo_ui_component_add_verb_list_with_data ( - uic, file_verbs, shell_view); - - bonobo_ui_component_add_verb_list_with_data ( - uic, new_verbs, shell_view); - - bonobo_ui_component_add_verb_list ( - uic, help_verbs); - - menu_do_misc (uic, shell_view); - - gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed", - GTK_SIGNAL_FUNC (shortcut_bar_mode_changed_cb), - SHORTCUT_BAR_TOGGLE_PATH); - gtk_signal_connect (GTK_OBJECT (shell_view), "folder_bar_mode_changed", - GTK_SIGNAL_FUNC (folder_bar_mode_changed_cb), - FOLDER_BAR_TOGGLE_PATH); - - /* Initialize the toggles. Yeah, this is, well, yuck. */ - folder_bar_mode_changed_cb (shell_view, e_shell_view_get_folder_bar_mode (shell_view), - FOLDER_BAR_TOGGLE_PATH); - shortcut_bar_mode_changed_cb (shell_view, e_shell_view_get_shortcut_bar_mode (shell_view), - SHORTCUT_BAR_TOGGLE_PATH); -} diff --git a/shell/e-shell-view-menu.h b/shell/e-shell-view-menu.h deleted file mode 100644 index 7f8c3ce0b3..0000000000 --- a/shell/e-shell-view-menu.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Miguel de Icaza - * Ettore Perazzoli - */ - -#ifndef E_SHELL_VIEW_MENU_H -#define E_SHELL_VIEW_MENU_H - -#include "e-shell-view.h" - -void e_shell_view_menu_setup (EShellView *shell_view); - -#endif diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c deleted file mode 100644 index f3ce68ad07..0000000000 --- a/shell/e-shell-view.c +++ /dev/null @@ -1,1622 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * Miguel de Icaza <miguel@helixcode.com> - * Matt Loper <matt@helixcode.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> -#include <bonobo/bonobo-socket.h> -#include <libgnomeui/gnome-window-icon.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-scroll-frame.h> - -#include "widgets/misc/e-clipped-label.h" - -#include "evolution-shell-view.h" - -#include "e-shell-constants.h" -#include "e-shell-folder-title-bar.h" -#include "e-shell-utils.h" -#include "e-shell.h" -#include "e-shortcuts-view.h" -#include "e-storage-set-view.h" -#include "e-title-bar.h" - -#include "e-shell-view.h" -#include "e-shell-view-menu.h" - -#include <gal/e-paned/e-hpaned.h> - - -static BonoboWindowClass *parent_class = NULL; - -struct _EShellViewPrivate { - /* The shell. */ - EShell *shell; - - /* The UI handler. */ - BonoboUIComponent *ui_component; - - /* Currently displayed URI. */ - char *uri; - - /* delayed selection, used when a path doesn't exist in an - EStorage. cleared when we're signaled with - "folder_selected" */ - char *delayed_selection; - - /* The widgetry. */ - GtkWidget *appbar; - GtkWidget *hpaned; - GtkWidget *view_vbox; - GtkWidget *view_title_bar; - GtkWidget *view_hpaned; - GtkWidget *contents; - GtkWidget *notebook; - GtkWidget *shortcut_bar; - GtkWidget *storage_set_title_bar; - GtkWidget *storage_set_view; - GtkWidget *storage_set_view_box; - GtkWidget *progress_bar; - - /* The view we have already open. */ - GHashTable *uri_to_control; - - /* Position of the handles in the paneds, to be restored when we show elements - after hiding them. */ - unsigned int hpaned_position; - unsigned int view_hpaned_position; - - /* Status of the shortcut and folder bars. */ - EShellViewSubwindowMode shortcut_bar_mode; - EShellViewSubwindowMode folder_bar_mode; - - /* Timeout ID for the progress bar. */ - int progress_bar_timeout_id; - - /* Status of the progress bar. */ - int progress_bar_value; - - /* List of sockets we created. */ - GList *sockets; -}; - -enum { - SHORTCUT_BAR_MODE_CHANGED, - FOLDER_BAR_MODE_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -#define DEFAULT_SHORTCUT_BAR_WIDTH 100 -#define DEFAULT_TREE_WIDTH 130 - -#define DEFAULT_WIDTH 705 -#define DEFAULT_HEIGHT 550 - -#define DEFAULT_URI "evolution:/local/Inbox" - - -/* Utility functions. */ - -static GtkWidget * -create_label_for_empty_page (void) -{ - GtkWidget *label; - - label = e_clipped_label_new (_("(No folder displayed)")); - gtk_widget_show (label); - - return label; -} - -/* FIXME this is broken. */ -static gboolean -bonobo_widget_is_dead (BonoboWidget *bonobo_widget) -{ - BonoboControlFrame *control_frame; - CORBA_Object corba_object; - CORBA_Environment ev; - gboolean is_dead; - - control_frame = bonobo_widget_get_control_frame (bonobo_widget); - corba_object = bonobo_control_frame_get_control (control_frame); - - CORBA_exception_init (&ev); - is_dead = CORBA_Object_non_existent (corba_object, &ev); - CORBA_exception_free (&ev); - - return is_dead; -} - - -/* Folder bar pop-up handling. */ - -static void disconnect_popup_signals (EShellView *shell_view); - -static void -popdown_transient_folder_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (priv->storage_set_view_box); - - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - disconnect_popup_signals (shell_view); - - e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), FALSE); -} - -static void -storage_set_view_box_button_release_event_cb (GtkWidget *widget, - GdkEventButton *button_event, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - puts (__FUNCTION__); - - popdown_transient_folder_bar (shell_view); -} - -static void -popup_storage_set_view_button_clicked (ETitleBar *title_bar, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (priv->storage_set_view_box); - - disconnect_popup_signals (shell_view); - - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_STICKY); - e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), FALSE); -} - -static void -storage_set_view_box_map_cb (GtkWidget *widget, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - if (gdk_pointer_grab (widget->window, TRUE, - (GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK - | GDK_POINTER_MOTION_MASK), - NULL, NULL, GDK_CURRENT_TIME) != 0) { - g_warning ("%s -- pointer grab failed.", __FUNCTION__); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_STICKY); - return; - } - - gtk_grab_add (widget); - gtk_signal_connect (GTK_OBJECT (widget), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_title_bar), "button_clicked", - GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), shell_view); -} - -static void -disconnect_popup_signals (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view_box), - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_title_bar), - GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view_box), - GTK_SIGNAL_FUNC (storage_set_view_box_map_cb), - shell_view); -} - -static void -pop_up_folder_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_TRANSIENT; - - /* We need to show the storage set view box and do a pointer grab to catch the - mouse clicks. But until the box is shown, we cannot grab. So we connect to - the "map" signa; `storage_set_view_box_map_cb' will do the grab. */ - - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view_box), "map", - GTK_SIGNAL_FUNC (storage_set_view_box_map_cb), shell_view); - gtk_widget_show (priv->storage_set_view_box); - - e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position); -} - - -/* Callbacks. */ - -/* Callback when a new folder is added. removed when we clear the - delayed_selection */ -static void -new_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - char *delayed_path; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - delayed_path = strchr (priv->delayed_selection, ':'); - if (delayed_path) { - delayed_path ++; - if (!strcmp(path, delayed_path)) { - gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set(priv->shell)), - GTK_SIGNAL_FUNC (new_folder_cb), - shell_view); - g_free (priv->uri); - priv->uri = priv->delayed_selection; - priv->delayed_selection = NULL; - e_shell_view_display_uri (shell_view, priv->uri); - } - } -} - -/* Callback called when an icon on the shortcut bar gets clicked. */ -static void -activate_shortcut_cb (EShortcutsView *shortcut_view, - EShortcuts *shortcuts, - const char *uri, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_display_uri (shell_view, uri); -} - -/* Callback called when a folder on the tree view gets clicked. */ -static void -folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - char *uri; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - e_shell_view_display_uri (shell_view, uri); - g_free (uri); - - if (priv->delayed_selection) { - g_free (priv->delayed_selection); - priv->delayed_selection = NULL; - gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set(priv->shell)), - GTK_SIGNAL_FUNC (new_folder_cb), - shell_view); - } - - if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT) - popdown_transient_folder_bar (shell_view); -} - -/* Callback called when the button on the tree's title bar is clicked. */ -static void -storage_set_view_button_clicked_cb (ETitleBar *title_bar, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); -} - -/* Callback called when the title bar button has been pressed. */ -static void -title_bar_toggled_cb (EShellFolderTitleBar *title_bar, - gboolean state, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - if (! state) - return; - - if (e_shell_view_get_folder_bar_mode (shell_view) != E_SHELL_VIEW_SUBWINDOW_TRANSIENT) - pop_up_folder_bar (shell_view); -} - - -/* Widget setup. */ - -static void -setup_storage_set_subwindow (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkWidget *storage_set_view; - GtkWidget *vbox; - GtkWidget *scroll_frame; - - priv = shell_view->priv; - - storage_set_view = e_storage_set_view_new (e_shell_get_storage_set (priv->shell)); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_selected", - GTK_SIGNAL_FUNC (folder_selected_cb), shell_view); - - scroll_frame = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll_frame), GTK_SHADOW_IN); - - gtk_container_add (GTK_CONTAINER (scroll_frame), storage_set_view); - - vbox = gtk_vbox_new (FALSE, 0); - priv->storage_set_title_bar = e_title_bar_new (_("Folders")); - - gtk_box_pack_start (GTK_BOX (vbox), priv->storage_set_title_bar, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), scroll_frame, TRUE, TRUE, 0); - - gtk_signal_connect (GTK_OBJECT (priv->storage_set_title_bar), "button_clicked", - GTK_SIGNAL_FUNC (storage_set_view_button_clicked_cb), shell_view); - - gtk_widget_show (vbox); - gtk_widget_show (storage_set_view); - gtk_widget_show (priv->storage_set_title_bar); - gtk_widget_show (scroll_frame); - - priv->storage_set_view_box = vbox; - priv->storage_set_view = storage_set_view; -} - -static void -setup_progress_bar (EShellViewPrivate *priv) -{ - GtkProgressBar *progress_bar; - BonoboControl *control; - - progress_bar = (GTK_PROGRESS_BAR (gtk_progress_bar_new ())); - - gtk_progress_bar_set_orientation (progress_bar, GTK_PROGRESS_LEFT_TO_RIGHT); - gtk_progress_bar_set_bar_style (progress_bar, GTK_PROGRESS_CONTINUOUS); - - priv->progress_bar = GTK_WIDGET (progress_bar); - gtk_widget_show (priv->progress_bar); - - control = bonobo_control_new (priv->progress_bar); - g_return_if_fail (control != NULL); - - bonobo_ui_component_object_set (priv->ui_component, "/status/Progress", - bonobo_object_corba_objref (BONOBO_OBJECT (control)), - NULL); -} - -static void -setup_widgets (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - /* The progress bar. */ - - setup_progress_bar (priv); - - /* The shortcut bar. */ - - priv->shortcut_bar = e_shortcuts_new_view (e_shell_get_shortcuts (priv->shell)); - gtk_signal_connect (GTK_OBJECT (priv->shortcut_bar), "activate_shortcut", - GTK_SIGNAL_FUNC (activate_shortcut_cb), shell_view); - - /* The storage set view. */ - - setup_storage_set_subwindow (shell_view); - - /* The tabless notebook which we used to contain the views. */ - - priv->notebook = gtk_notebook_new (); - gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE); - - /* Page for "No URL displayed" message. */ - - gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), create_label_for_empty_page (), NULL); - - /* Put things into a paned and the paned into the GnomeApp. */ - - priv->view_vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (priv->view_vbox), 2); - - priv->view_title_bar = e_shell_folder_title_bar_new (); - gtk_signal_connect (GTK_OBJECT (priv->view_title_bar), "title_toggled", - GTK_SIGNAL_FUNC (title_bar_toggled_cb), shell_view); - - priv->view_hpaned = e_hpaned_new (); - e_paned_add1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box); - e_paned_add2 (E_PANED (priv->view_hpaned), priv->notebook); - e_paned_set_position (E_PANED (priv->view_hpaned), DEFAULT_TREE_WIDTH); - - gtk_box_pack_start (GTK_BOX (priv->view_vbox), priv->view_title_bar, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (priv->view_vbox), priv->view_hpaned, - TRUE, TRUE, 2); - - priv->hpaned = e_hpaned_new (); - e_paned_add1 (E_PANED (priv->hpaned), priv->shortcut_bar); - e_paned_add2 (E_PANED (priv->hpaned), priv->view_vbox); - e_paned_set_position (E_PANED (priv->hpaned), DEFAULT_SHORTCUT_BAR_WIDTH); - - bonobo_window_set_contents (BONOBO_WINDOW (shell_view), priv->hpaned); - - /* Show stuff. */ - - gtk_widget_show (priv->shortcut_bar); - gtk_widget_show (priv->storage_set_view); - gtk_widget_show (priv->storage_set_view_box); - gtk_widget_show (priv->notebook); - gtk_widget_show (priv->hpaned); - gtk_widget_show (priv->view_hpaned); - gtk_widget_show (priv->view_vbox); - gtk_widget_show (priv->view_title_bar); - - /* By default, both the folder bar and shortcut bar are visible. */ - priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - - /* FIXME: Session management and stuff? */ - gtk_window_set_default_size (GTK_WINDOW (shell_view), DEFAULT_WIDTH, DEFAULT_HEIGHT); -} - - -/* GtkObject methods. */ - -static void -hash_forall_destroy_control (void *name, - void *value, - void *data) -{ - BonoboWidget *bonobo_widget; - - bonobo_widget = BONOBO_WIDGET (value); - gtk_widget_destroy (GTK_WIDGET (bonobo_widget)); - - g_free (name); -} - -static void -destroy (GtkObject *object) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - GList *p; - - shell_view = E_SHELL_VIEW (object); - priv = shell_view->priv; - - for (p = priv->sockets; p != NULL; p = p->next) { - GtkWidget *socket_widget; - int destroy_connection_id; - - socket_widget = GTK_WIDGET (p->data); - destroy_connection_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (socket_widget), - "e_shell_view_destroy_connection_id")); - gtk_signal_disconnect (GTK_OBJECT (socket_widget), destroy_connection_id); - } - - g_hash_table_foreach (priv->uri_to_control, hash_forall_destroy_control, NULL); - g_hash_table_destroy (priv->uri_to_control); - - bonobo_object_unref (BONOBO_OBJECT (priv->ui_component)); - - g_free (priv->uri); - - if (priv->progress_bar_timeout_id != 0) - gtk_timeout_remove (priv->progress_bar_timeout_id); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* Unrealize handler */ -static void -unrealize (GtkWidget *widget) -{ - /* We flush so that all the destroy window requests for foreign windows - * get sent over the X wire. Hopefully this will diminish the chance of - * hitting the CORBA (sync) vs. Xlib (async) race conditions. This is - * not the complete fix, which should actually be put in Bonobo and - * completed. FIXME. - */ - gdk_flush (); -} - -static int -delete_event (GtkWidget *widget, - GdkEventAny *event) -{ - EShell *shell; - - shell = e_shell_view_get_shell (E_SHELL_VIEW (widget)); -/* e_shell_quit (shell); */ - - /* FIXME: Is this right, or should it be FALSE? */ - return FALSE; -} - - -/* Initialization. */ - -static void -class_init (EShellViewClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) klass; - - object_class->destroy = destroy; - - parent_class = gtk_type_class (BONOBO_TYPE_WINDOW); - - signals[SHORTCUT_BAR_MODE_CHANGED] - = gtk_signal_new ("shortcut_bar_mode_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, shortcut_bar_mode_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - signals[FOLDER_BAR_MODE_CHANGED] - = gtk_signal_new ("folder_bar_mode_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, folder_bar_mode_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = g_new (EShellViewPrivate, 1); - - priv->shell = NULL; - priv->ui_component = NULL; - priv->uri = NULL; - priv->delayed_selection = NULL; - - priv->appbar = NULL; - priv->hpaned = NULL; - priv->view_hpaned = NULL; - priv->contents = NULL; - priv->notebook = NULL; - - priv->storage_set_title_bar = NULL; - priv->storage_set_view = NULL; - priv->storage_set_view_box = NULL; - priv->shortcut_bar = NULL; - - priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - - priv->hpaned_position = 0; - priv->view_hpaned_position = 0; - - priv->uri_to_control = g_hash_table_new (g_str_hash, g_str_equal); - - priv->progress_bar_timeout_id = 0; - priv->progress_bar_value = 0; - priv->sockets = NULL; - - shell_view->priv = priv; -} - - -/* Progress bar handling. */ - -#define PROGRESS_BAR_TIMEOUT 80 - -static int -progress_bar_timeout_cb (void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - GtkWidget *progress_bar; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - progress_bar = priv->progress_bar; - - priv->progress_bar_value = ! priv->progress_bar_value; - gtk_progress_set_value (GTK_PROGRESS (progress_bar), priv->progress_bar_value); - - return TRUE; -} - -static void -start_progress_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkProgress *progress; - - priv = shell_view->priv; - - progress = GTK_PROGRESS (priv->progress_bar); - - if (!GTK_WIDGET_REALIZED (progress)) - return; - - if (priv->progress_bar_timeout_id != 0) - return; - - priv->progress_bar_timeout_id = gtk_timeout_add (PROGRESS_BAR_TIMEOUT, progress_bar_timeout_cb, shell_view); - - gtk_progress_set_activity_mode (progress, TRUE); - gtk_progress_set_value (progress, priv->progress_bar_value); -} - -static void -stop_progress_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkWidget *progress_bar; - - priv = shell_view->priv; - progress_bar = priv->progress_bar; - - if (priv->progress_bar_timeout_id != 0) { - gtk_timeout_remove (priv->progress_bar_timeout_id); - priv->progress_bar_timeout_id = 0; - } - - if (!GTK_WIDGET_REALIZED (progress_bar)) - return; - - gtk_progress_set_activity_mode (GTK_PROGRESS (progress_bar), FALSE); - gtk_progress_set_value (GTK_PROGRESS (progress_bar), 0); -} - - -/* EvolutionShellView interface callbacks. */ - -static void -shell_view_interface_set_message_cb (EvolutionShellView *shell_view, - const char *message, - gboolean busy, - void *data) -{ - char *status; - EShellView *view; - - view = E_SHELL_VIEW (data); - - g_return_if_fail (view != NULL); - - if (message != NULL) { - const char *newline; - - newline = strchr (message, '\n'); - if (newline == NULL) - status = g_strdup (message); - else - status = g_strndup (message, newline - message); - } else { - status = g_strdup (""); - } - - bonobo_ui_component_set_status (view->priv->ui_component, status, NULL); - - g_free (status); - - if (busy) - start_progress_bar (E_SHELL_VIEW (data)); - else - stop_progress_bar (E_SHELL_VIEW (data)); -} - -static void -shell_view_interface_unset_message_cb (EvolutionShellView *shell_view, - void *data) -{ - EShellView *view; - - view = E_SHELL_VIEW (data); - - g_return_if_fail (view != NULL); - - bonobo_ui_component_set_status (view->priv->ui_component, "", NULL); - - stop_progress_bar (E_SHELL_VIEW (data)); -} - -static void -shell_view_interface_change_current_view_cb (EvolutionShellView *shell_view, - const char *uri, - void *data) -{ - EShellView *view; - - view = E_SHELL_VIEW (data); - - g_return_if_fail (view != NULL); - - e_shell_view_display_uri (view, uri); -} - -static void -shell_view_interface_set_title (EvolutionShellView *shell_view, - const char *title, - void *data) -{ - EShellView *view; - - view = E_SHELL_VIEW (data); - - g_return_if_fail (view != NULL); - - gtk_window_set_title (GTK_WINDOW (view), title); -} - - -EShellView * -e_shell_view_construct (EShellView *shell_view, - EShell *shell) -{ - EShellViewPrivate *priv; - EShellView *view; - GtkObject *window; - BonoboUIContainer *container; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - priv = shell_view->priv; - - view = E_SHELL_VIEW (bonobo_window_construct (BONOBO_WINDOW (shell_view), "evolution", "Evolution")); - - if (!view) { - gtk_object_unref (GTK_OBJECT (shell_view)); - return NULL; - } - - window = GTK_OBJECT (view); - gtk_signal_connect_after (window, "unrealize", - (GtkSignalFunc) unrealize, NULL); - - gtk_signal_connect (window, "delete_event", - (GtkSignalFunc) delete_event, NULL); - - priv->shell = shell; - - container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (shell_view)); - - priv->ui_component = bonobo_ui_component_new ("evolution"); - bonobo_ui_component_set_container (priv->ui_component, - bonobo_object_corba_objref (BONOBO_OBJECT (container))); - - bonobo_ui_component_freeze (priv->ui_component, NULL); - - bonobo_ui_util_set_ui (priv->ui_component, EVOLUTION_DATADIR, - "evolution.xml", "evolution"); - - setup_widgets (shell_view); - - e_shell_view_menu_setup (shell_view); - - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - bonobo_ui_component_thaw (priv->ui_component, NULL); - - return view; -} - -EShellView * -e_shell_view_new (EShell *shell) -{ - GtkWidget *new; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - new = gtk_type_new (e_shell_view_get_type ()); - - return e_shell_view_construct (E_SHELL_VIEW (new), shell); -} - - -static const char * -get_storage_set_path_from_uri (const char *uri) -{ - const char *colon; - - if (uri == NULL) - return NULL; - - if (g_path_is_absolute (uri)) - return NULL; - - colon = strchr (uri, ':'); - if (colon == NULL || colon == uri || colon[1] == '\0') - return NULL; - - if (! g_path_is_absolute (colon + 1)) - return NULL; - - if (g_strncasecmp (uri, E_SHELL_URI_PREFIX, colon - uri) != 0) - return NULL; - - return colon + 1; -} - -static void -update_window_icon (EShellView *shell_view, - EFolder *folder) -{ - EShellViewPrivate *priv; - const char *type; - const char *icon_name; - char *icon_path; - - priv = shell_view->priv; - - if (folder == NULL) - type = NULL; - else - type = e_folder_get_type_string (folder); - - if (type == NULL) { - icon_path = NULL; - } else { - EFolderTypeRegistry *folder_type_registry; - - folder_type_registry = e_shell_get_folder_type_registry (priv->shell); - icon_name = e_folder_type_registry_get_icon_name_for_type (folder_type_registry, type); - if (icon_name == NULL) - icon_path = NULL; - else - icon_path = e_shell_get_icon_path (icon_name, TRUE); - } - - if (icon_path == NULL) { - gnome_window_icon_set_from_default (GTK_WINDOW (shell_view)); - } else { - gnome_window_icon_set_from_file (GTK_WINDOW (shell_view), icon_path); - g_free (icon_path); - } -} - -static void -update_folder_title_bar (EShellView *shell_view, - EFolder *folder) -{ - EShellViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - GdkPixbuf *folder_icon; - const char *folder_name; - const char *folder_type_name; - - priv = shell_view->priv; - - if (folder == NULL) - folder_type_name = NULL; - else - folder_type_name = e_folder_get_type_string (folder); - - if (folder_type_name == NULL) { - folder_name = NULL; - folder_icon = NULL; - } else { - folder_type_registry = e_shell_get_folder_type_registry (priv->shell); - folder_icon = e_folder_type_registry_get_icon_for_type (folder_type_registry, - folder_type_name, - TRUE); - folder_name = e_folder_get_name (folder); - } - - if (folder_icon) - e_shell_folder_title_bar_set_icon (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), folder_icon); - if (folder_name) { - gchar * utf; - utf = e_utf8_to_gtk_string (GTK_WIDGET (priv->view_title_bar), folder_name); - e_shell_folder_title_bar_set_title (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), utf); - g_free (utf); - } -} - -static void -update_for_current_uri (EShellView *shell_view) -{ - EShellViewPrivate *priv; - EFolder *folder; - char *folder_name; - const char *path; - char *window_title; - - priv = shell_view->priv; - - path = get_storage_set_path_from_uri (priv->uri); - - if (path == NULL) - folder = NULL; - else - folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), - path); - - if (folder == NULL) - folder_name = g_strdup (_("None")); - else - folder_name = e_utf8_to_gtk_string ((GtkWidget *) shell_view, e_folder_get_name (folder)); - - window_title = g_strdup_printf (_("Evolution - %s"), folder_name); - gtk_window_set_title (GTK_WINDOW (shell_view), window_title); - g_free (window_title); - g_free (folder_name); - - update_folder_title_bar (shell_view, folder); - - update_window_icon (shell_view, folder); - - gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (folder_selected_cb), - shell_view); - - if (path != NULL) - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), path); - - gtk_signal_handler_unblock_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (folder_selected_cb), - shell_view); -} - -/* This displays the specified page, doing the appropriate Bonobo activation/deactivation - magic to make sure things work nicely. FIXME: Crappy way to solve the issue. */ -static void -set_current_notebook_page (EShellView *shell_view, - int page_num) -{ - EShellViewPrivate *priv; - GtkNotebook *notebook; - GtkWidget *current; - BonoboControlFrame *control_frame; - int current_page; - - priv = shell_view->priv; - notebook = GTK_NOTEBOOK (priv->notebook); - - current_page = gtk_notebook_get_current_page (notebook); - if (current_page == page_num) - return; - - if (current_page != -1 && current_page != 0) { - current = gtk_notebook_get_nth_page (notebook, current_page); - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (current)); - - bonobo_control_frame_set_autoactivate (control_frame, FALSE); - bonobo_control_frame_control_deactivate (control_frame); - } - - gtk_notebook_set_page (notebook, page_num); - - if (page_num == -1 || page_num == 0) - return; - - current = gtk_notebook_get_nth_page (notebook, page_num); - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (current)); - - bonobo_control_frame_set_autoactivate (control_frame, FALSE); - bonobo_control_frame_control_activate (control_frame); -} - -static void -setup_evolution_shell_view_interface (EShellView *shell_view, - GtkWidget *control) -{ - BonoboControlFrame *control_frame; - EvolutionShellView *shell_view_interface; - - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control)); - shell_view_interface = evolution_shell_view_new (); - - gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "set_message", - GTK_SIGNAL_FUNC (shell_view_interface_set_message_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "unset_message", - GTK_SIGNAL_FUNC (shell_view_interface_unset_message_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "change_current_view", - GTK_SIGNAL_FUNC (shell_view_interface_change_current_view_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (shell_view_interface), "set_title", - GTK_SIGNAL_FUNC (shell_view_interface_set_title), - shell_view, GTK_OBJECT (shell_view)); - - bonobo_object_add_interface (BONOBO_OBJECT (control_frame), - BONOBO_OBJECT (shell_view_interface)); -} - - -/* Socket destruction handling. */ - -static GtkWidget * -find_socket (GtkContainer *container) -{ - GList *children, *tmp; - - children = gtk_container_children (container); - while (children) { - if (BONOBO_IS_SOCKET (children->data)) - return children->data; - else if (GTK_IS_CONTAINER (children->data)) { - GtkWidget *socket = find_socket (children->data); - if (socket) - return socket; - } - tmp = children->next; - g_list_free_1 (children); - children = tmp; - } - return NULL; -} - -static void -socket_destroy_cb (GtkWidget *socket_widget, gpointer data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - EFolder *folder; - GtkWidget *control; - const char *uri; - char *copy_of_uri; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - uri = (const char *) gtk_object_get_data (GTK_OBJECT (socket_widget), "e_shell_view_folder_uri"); - - /* Strdup here as the string will be freed when the socket is destroyed. */ - copy_of_uri = g_strdup (uri); - - control = g_hash_table_lookup (priv->uri_to_control, uri); - if (control == NULL) { - g_warning ("What?! Destroyed socket for non-existing URI? -- %s", uri); - return; - } - - priv->sockets = g_list_remove (priv->sockets, socket_widget); - - gtk_widget_destroy (control); - g_hash_table_remove (priv->uri_to_control, uri); - - folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), - get_storage_set_path_from_uri (uri)); - - e_shell_view_display_uri (shell_view, NULL); - - e_notice (GTK_WINDOW (shell_view), GNOME_MESSAGE_BOX_ERROR, - _("Ooops! The view for `%s' has died unexpectedly. :-(\n" - "This probably means that the %s component has crashed."), - uri, e_folder_get_type_string (folder)); - - g_free (copy_of_uri); - - e_shell_view_display_uri (shell_view, DEFAULT_URI); -} - - -/* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */ -static GtkWidget * -get_control_for_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - EStorageSet *storage_set; - EFolder *folder; - EvolutionShellComponentClient *handler_client; - Bonobo_Control corba_control; - Evolution_ShellComponent handler; - const char *path; - const char *folder_type; - GtkWidget *control; - CORBA_Environment ev; - Bonobo_UIContainer container; - GtkWidget *socket; - int destroy_connection_id; - - priv = shell_view->priv; - - path = strchr (uri, ':'); - if (path == NULL) - return NULL; - - path++; - if (*path == '\0') - return NULL; - - storage_set = e_shell_get_storage_set (priv->shell); - folder_type_registry = e_shell_get_folder_type_registry (priv->shell); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) - return NULL; - - folder_type = e_folder_get_type_string (folder); - if (folder_type == NULL) - return NULL; - - handler_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, folder_type); - if (handler_client == NULL) - return NULL; - - handler = bonobo_object_corba_objref (BONOBO_OBJECT (handler_client)); - if (handler_client == CORBA_OBJECT_NIL) - return NULL; - - CORBA_exception_init (&ev); - - corba_control = Evolution_ShellComponent_create_view (handler, e_folder_get_physical_uri (folder), - folder_type, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - container = bonobo_ui_component_get_container (priv->ui_component); - control = bonobo_widget_new_control_from_objref (corba_control, container); - - socket = find_socket (GTK_CONTAINER (control)); - destroy_connection_id = gtk_signal_connect (GTK_OBJECT (socket), "destroy", - GTK_SIGNAL_FUNC (socket_destroy_cb), - shell_view); - gtk_object_set_data (GTK_OBJECT (socket), - "e_shell_view_destroy_connection_id", - GINT_TO_POINTER (destroy_connection_id)); - gtk_object_set_data_full (GTK_OBJECT (socket), "e_shell_view_folder_uri", g_strdup (uri), g_free); - - priv->sockets = g_list_prepend (priv->sockets, socket); - - setup_evolution_shell_view_interface (shell_view, control); - - return control; -} - -static gboolean -show_existing_view (EShellView *shell_view, - const char *uri, - GtkWidget *control) -{ - EShellViewPrivate *priv; - int notebook_page; - - g_print ("Already have view for %s\n", uri); - - priv = shell_view->priv; - - notebook_page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - g_assert (notebook_page != -1); - - /* A BonoboWidget can be a "zombie" in the sense that its actual - control is dead; if it's zombie, we have to recreate it. */ - if (bonobo_widget_is_dead (BONOBO_WIDGET (control))) { - GtkWidget *parent; - - parent = control->parent; - - /* Out with the old. */ - gtk_container_remove (GTK_CONTAINER (parent), control); - g_hash_table_remove (priv->uri_to_control, uri); - - /* In with the new. */ - control = get_control_for_uri (shell_view, uri); - if (control == NULL) - return FALSE; - - gtk_container_add (GTK_CONTAINER (parent), control); - g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control); - - /* Show. */ - gtk_widget_show (control); - } - - set_current_notebook_page (shell_view, notebook_page); - - return TRUE; -} - -static gboolean -create_new_view_for_uri (EShellView *shell_view, - const char *uri) -{ - GtkWidget *control; - EShellViewPrivate *priv; - int page_num; - - priv = shell_view->priv; - - control = get_control_for_uri (shell_view, uri); - if (control == NULL) - return FALSE; - - gtk_widget_show (control); - - gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), control, NULL); - - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - g_assert (page_num != -1); - set_current_notebook_page (shell_view, page_num); - - g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control); - - return TRUE; -} - -gboolean -e_shell_view_display_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - GtkWidget *control; - gboolean retval; - - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - - priv = shell_view->priv; - - bonobo_window_freeze (BONOBO_WINDOW (shell_view)); - - if (uri == NULL) { - gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0); - gtk_notebook_prepend_page (GTK_NOTEBOOK (priv->notebook), create_label_for_empty_page (), NULL); - - set_current_notebook_page (shell_view, 0); - - if (priv->uri != NULL) { - g_free (priv->uri); - priv->uri = NULL; - } - - retval = TRUE; - - goto end; - } - - if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) { - retval = FALSE; - goto end; - } - - control = g_hash_table_lookup (priv->uri_to_control, uri); - if (control != NULL) { - g_assert (GTK_IS_WIDGET (control)); - show_existing_view (shell_view, uri, control); - } else if (! create_new_view_for_uri (shell_view, uri)) { - priv->delayed_selection = g_strdup (uri); - gtk_signal_connect_after (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), "new_folder", - GTK_SIGNAL_FUNC (new_folder_cb), shell_view); - retval = FALSE; - goto end; - } - - g_free (priv->uri); - priv->uri = g_strdup (uri); - - retval = TRUE; - - end: - update_for_current_uri (shell_view); - - bonobo_window_thaw (BONOBO_WINDOW (shell_view)); - - return retval; -} - - -void -e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode) -{ - EShellViewPrivate *priv; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY - || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - priv = shell_view->priv; - - if (priv->shortcut_bar_mode == mode) - return; - - if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) { - if (! GTK_WIDGET_VISIBLE (priv->shortcut_bar)) { - gtk_widget_show (priv->shortcut_bar); - e_paned_set_position (E_PANED (priv->hpaned), priv->hpaned_position); - } - } else { - if (GTK_WIDGET_VISIBLE (priv->shortcut_bar)) { - gtk_widget_hide (priv->shortcut_bar); - /* FIXME this is a private field! */ - priv->hpaned_position = E_PANED (priv->hpaned)->child1_size; - e_paned_set_position (E_PANED (priv->hpaned), 0); - } - } - - priv->shortcut_bar_mode = mode; - - gtk_signal_emit (GTK_OBJECT (shell_view), signals[SHORTCUT_BAR_MODE_CHANGED], mode); -} - -/** - * e_shell_view_set_folder_bar_mode: - * @shell_view: - * @mode: - * - * Set the visualization mode for the folder bar's subwindow. - **/ -void -e_shell_view_set_folder_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode) -{ - EShellViewPrivate *priv; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY - || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - priv = shell_view->priv; - - if (priv->folder_bar_mode == mode) - return; - - if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) { - if (! GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) { - gtk_widget_show (priv->storage_set_view_box); - e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position); - } - - e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar), - E_TITLE_BAR_BUTTON_MODE_CLOSE); - - e_shell_folder_title_bar_set_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), - FALSE); - } else { - if (GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) { - gtk_widget_hide (priv->storage_set_view_box); - /* FIXME this is a private field! */ - priv->view_hpaned_position = E_PANED (priv->view_hpaned)->child1_size; - e_paned_set_position (E_PANED (priv->view_hpaned), 0); - } - - e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar), - E_TITLE_BAR_BUTTON_MODE_PIN); - - e_shell_folder_title_bar_set_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), - TRUE); - } - - priv->folder_bar_mode = mode; - - gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_MODE_CHANGED], mode); -} - -EShellViewSubwindowMode -e_shell_view_get_shortcut_bar_mode (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - return shell_view->priv->shortcut_bar_mode; -} - -EShellViewSubwindowMode -e_shell_view_get_folder_bar_mode (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); - - return shell_view->priv->folder_bar_mode; -} - - -EShell * -e_shell_view_get_shell (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return shell_view->priv->shell; -} - -BonoboUIComponent * -e_shell_view_get_bonobo_ui_component (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return shell_view->priv->ui_component; -} - -GtkWidget * -e_shell_view_get_appbar (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return shell_view->priv->appbar; -} - -const char * -e_shell_view_get_current_uri (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return shell_view->priv->uri; -} - - -/** - * e_shell_view_save_settings: - * @shell_view: - * @prefix: - * - * Save settings for @shell_view at the specified gnome config @prefix - * - * Return value: TRUE if successful, FALSE if not. - **/ -gboolean -e_shell_view_save_settings (EShellView *shell_view, - const char *prefix) -{ - EShellViewPrivate *priv; - const char *uri; - - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - g_return_val_if_fail (prefix != NULL, FALSE); - - priv = shell_view->priv; - - gnome_config_push_prefix (prefix); - - gnome_config_set_int ("FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view)); - gnome_config_set_int ("ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view)); - gnome_config_set_int ("HPanedPosition", e_paned_get_position (E_PANED (priv->hpaned))); - gnome_config_set_int ("ViewHPanedPosition", e_paned_get_position (E_PANED (priv->view_hpaned))); - - uri = e_shell_view_get_current_uri (shell_view); - if (uri != NULL) - gnome_config_set_string ("DisplayedURI", uri); - else - gnome_config_set_string ("DisplayedURI", DEFAULT_URI); - - gnome_config_pop_prefix (); - - return TRUE; -} - -/** - * e_shell_view_load_settings: - * @shell_view: - * @prefix: - * - * Load settings for @shell_view at the specified gnome config @prefix - * - * Return value: - **/ -gboolean -e_shell_view_load_settings (EShellView *shell_view, - const char *prefix) -{ - EShellViewPrivate *priv; - int val; - char *stringval; - - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - g_return_val_if_fail (prefix != NULL, FALSE); - - priv = shell_view->priv; - - gnome_config_push_prefix (prefix); - - val = gnome_config_get_int ("FolderBarMode"); - e_shell_view_set_folder_bar_mode (shell_view, val); - - val = gnome_config_get_int ("ShortcutBarMode"); - e_shell_view_set_shortcut_bar_mode (shell_view, val); - - val = gnome_config_get_int ("HPanedPosition"); - e_paned_set_position (E_PANED (priv->hpaned), val); - - val = gnome_config_get_int ("ViewHPanedPosition"); - e_paned_set_position (E_PANED (priv->view_hpaned), val); - - stringval = gnome_config_get_string ("DisplayedURI"); - if (! e_shell_view_display_uri (shell_view, stringval)) - e_shell_view_display_uri (shell_view, DEFAULT_URI); - g_free (stringval); - - gnome_config_pop_prefix (); - - return TRUE; -} - - -E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, BONOBO_TYPE_WINDOW) diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h deleted file mode 100644 index d3eb889fec..0000000000 --- a/shell/e-shell-view.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHELL_VIEW_H_ -#define _E_SHELL_VIEW_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-win.h> - -#include "e-shell.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - - -#define E_TYPE_SHELL_VIEW (e_shell_view_get_type ()) -#define E_SHELL_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView)) -#define E_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass)) -#define E_IS_SHELL_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_VIEW)) -#define E_IS_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW)) - -typedef struct _EShellView EShellView; -typedef struct _EShellViewPrivate EShellViewPrivate; -typedef struct _EShellViewClass EShellViewClass; - -enum _EShellViewSubwindowMode { - E_SHELL_VIEW_SUBWINDOW_HIDDEN, - E_SHELL_VIEW_SUBWINDOW_TRANSIENT, - E_SHELL_VIEW_SUBWINDOW_STICKY -}; -typedef enum _EShellViewSubwindowMode EShellViewSubwindowMode; - -struct _EShellView { - BonoboWindow parent; - - EShellViewPrivate *priv; -}; - -struct _EShellViewClass { - BonoboWindowClass parent_class; - - /* Signals. */ - void (* shortcut_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode new_mode); - void (* folder_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode mode); -}; - - -GtkType e_shell_view_get_type (void); -EShellView *e_shell_view_construct (EShellView *shell_view, - EShell *shell); -EShellView *e_shell_view_new (EShell *shell); - -gboolean e_shell_view_display_uri (EShellView *shell_view, - const char *uri); - -void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); -void e_shell_view_set_folder_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); -EShellViewSubwindowMode e_shell_view_get_shortcut_bar_mode (EShellView *shell_view); -EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view); - -EShell *e_shell_view_get_shell (EShellView *shell_view); -BonoboUIComponent *e_shell_view_get_bonobo_ui_component(EShellView *shell_view); -GtkWidget *e_shell_view_get_appbar (EShellView *shell_view); -const char *e_shell_view_get_current_uri (EShellView *shell_view); - -gboolean e_shell_view_save_settings (EShellView *shell_view, - const char *prefix); -gboolean e_shell_view_load_settings (EShellView *shell_view, - const char *prefix); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHELL_VIEW_H_ */ diff --git a/shell/e-shell.c b/shell/e-shell.c deleted file mode 100644 index ee49fc997a..0000000000 --- a/shell/e-shell.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <liboaf/liboaf.h> - -#include "Evolution.h" - -#include "e-util/e-gui-utils.h" -#include <gal/util/e-util.h> - -#include "e-component-registry.h" -#include "e-corba-storage-registry.h" -#include "e-folder-type-registry.h" -#include "e-local-storage.h" -#include "e-shell-constants.h" -#include "e-shell-folder-selection-dialog.h" -#include "e-shell-view.h" -#include "e-shortcuts.h" -#include "e-storage-set.h" -#include "e-splash.h" - -#include "evolution-storage-set-view-factory.h" - -#include "e-shell.h" - -static gboolean save_settings_for_views (EShell *shell); - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EShellPrivate { - char *local_directory; - - GList *views; - - EStorageSet *storage_set; - ELocalStorage *local_storage; - - EShortcuts *shortcuts; - EFolderTypeRegistry *folder_type_registry; - - EComponentRegistry *component_registry; - - ECorbaStorageRegistry *corba_storage_registry; -}; - - -/* Constants. */ - -/* FIXME: We need a component repository instead. */ - -#define SHORTCUTS_FILE_NAME "shortcuts.xml" -#define LOCAL_STORAGE_DIRECTORY "local" - - -enum { - NO_VIEWS_LEFT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Callback for the folder selection dialog. */ - -static void -folder_selection_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog, - void *data) -{ - Evolution_FolderSelectionListener listener; - CORBA_Environment ev; - - listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener"); - - CORBA_exception_init (&ev); - - Evolution_FolderSelectionListener_cancel (listener, &ev); - - CORBA_exception_free (&ev); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - -static void -folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog, - const char *path, - void *data) -{ - CORBA_Environment ev; - EShell *shell; - Evolution_FolderSelectionListener listener; - EStorageSet *storage_set; - EFolder *folder; - char *uri; - const char *physical_uri; - - shell = E_SHELL (data); - listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener"); - - CORBA_exception_init (&ev); - - storage_set = e_shell_get_storage_set (shell); - folder = e_storage_set_get_folder (storage_set, path); - - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - - if (folder == NULL) - physical_uri = ""; - else - physical_uri = e_folder_get_physical_uri (folder); - - Evolution_FolderSelectionListener_selected (listener, uri, physical_uri, &ev); - g_free (uri); - - CORBA_exception_free (&ev); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - - -/* CORBA interface implementation. */ - -static POA_Evolution_Shell__vepv shell_vepv; - -static POA_Evolution_Shell * -create_servant (void) -{ - POA_Evolution_Shell *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_Shell *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &shell_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Shell__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static Evolution_ShellComponent -impl_Shell_get_component_for_type (PortableServer_Servant servant, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentClient *handler; - EFolderTypeRegistry *folder_type_registry; - Evolution_ShellComponent corba_component; - EShell *shell; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - folder_type_registry = shell->priv->folder_type_registry; - - handler = e_folder_type_registry_get_handler_for_type (folder_type_registry, type); - - if (handler == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_Shell_NotFound, NULL); - return CORBA_OBJECT_NIL; - } - - corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (handler)); - Bonobo_Unknown_ref (corba_component, ev); - - return CORBA_Object_duplicate (corba_component, ev); -} - -static void -corba_listener_destroy_notify (void *data) -{ - CORBA_Environment ev; - Evolution_FolderSelectionListener listener_interface; - - listener_interface = (Evolution_FolderSelectionListener) data; - - CORBA_exception_init (&ev); - CORBA_Object_release (listener_interface, &ev); - CORBA_exception_free (&ev); -} - -static void -impl_Shell_user_select_folder (PortableServer_Servant servant, - const Evolution_FolderSelectionListener listener, - const CORBA_char *title, - const CORBA_char *default_folder, - const Evolution_Shell_FolderTypeList *corba_allowed_types, - CORBA_Environment *ev) -{ - GtkWidget *folder_selection_dialog; - BonoboObject *bonobo_object; - Evolution_FolderSelectionListener listener_duplicate; - EShell *shell; - const char **allowed_types; - int i; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - - allowed_types = alloca (sizeof (allowed_types[0]) * (corba_allowed_types->_length + 1)); - for (i = 0; i < corba_allowed_types->_length; i++) - allowed_types[i] = corba_allowed_types->_buffer[i]; - allowed_types[corba_allowed_types->_length] = NULL; - - /* CORBA doesn't allow you to pass a NULL pointer. */ - if (!*default_folder) - default_folder = NULL; - folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, title, default_folder, allowed_types); - - listener_duplicate = CORBA_Object_duplicate (listener, ev); - gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener", - listener_duplicate, corba_listener_destroy_notify); - - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected", - GTK_SIGNAL_FUNC (folder_selection_dialog_folder_selected_cb), shell); - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled", - GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell); - - gtk_widget_show (folder_selection_dialog); -} - -static Evolution_LocalStorage -impl_Shell_get_local_storage (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - Evolution_LocalStorage local_storage_interface; - Evolution_LocalStorage copy_of_local_storage_interface; - EShell *shell; - EShellPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - priv = shell->priv; - - local_storage_interface = e_local_storage_get_corba_interface (priv->local_storage); - - copy_of_local_storage_interface = CORBA_Object_duplicate (local_storage_interface, ev); - Bonobo_Unknown_ref (copy_of_local_storage_interface, ev); - - return copy_of_local_storage_interface; -} - -static Bonobo_Control -impl_Shell_create_storage_set_view (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EShell *shell; - BonoboControl *control; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - - control = evolution_storage_set_view_factory_new_view (shell); - - return bonobo_object_corba_objref (BONOBO_OBJECT (control)); -} - - -/* Initialization of the storages. */ - -static gboolean -setup_corba_storages (EShell *shell) -{ - EShellPrivate *priv; - ECorbaStorageRegistry *corba_storage_registry; - - priv = shell->priv; - - g_assert (priv->storage_set != NULL); - corba_storage_registry = e_corba_storage_registry_new (priv->storage_set); - - if (corba_storage_registry == NULL) - return FALSE; - - bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (corba_storage_registry)); - - /* Notice that `bonobo_object_add_interface()' aggregates the two object's - reference counts, so we need an extra ref here if we want to keep a separate - pointer to the storage interface. */ - bonobo_object_ref (BONOBO_OBJECT (corba_storage_registry)); - priv->corba_storage_registry = corba_storage_registry; - - return TRUE; -} - -static gboolean -setup_local_storage (EShell *shell) -{ - EStorage *local_storage; - EShellPrivate *priv; - gchar *local_storage_path; - - priv = shell->priv; - - g_assert (priv->folder_type_registry != NULL); - g_assert (priv->local_storage == NULL); - - local_storage_path = g_concat_dir_and_file (priv->local_directory, LOCAL_STORAGE_DIRECTORY); - local_storage = e_local_storage_open (priv->folder_type_registry, local_storage_path); - if (local_storage == NULL) { - g_warning (_("Cannot set up local storage -- %s"), local_storage_path); - g_free (local_storage_path); - return FALSE; - } - g_free (local_storage_path); - - e_storage_set_add_storage (priv->storage_set, local_storage); - priv->local_storage = E_LOCAL_STORAGE (local_storage); - - return TRUE; -} - - -/* Initialization of the components. */ - -static char * -get_icon_path_for_component_info (const OAF_ServerInfo *info) -{ - OAF_Property *property; - const char *shell_component_icon_value; - - /* FIXME: liboaf is not const-safe. */ - property = oaf_server_info_prop_find ((OAF_ServerInfo *) info, - "evolution:shell-component-icon"); - - if (property == NULL || property->v._d != OAF_P_STRING) - return gnome_pixmap_file ("gnome-question.png"); - - shell_component_icon_value = property->v._u.value_string; - - if (g_path_is_absolute (shell_component_icon_value)) - return g_strdup (shell_component_icon_value); - - else - return g_concat_dir_and_file (EVOLUTION_IMAGES, shell_component_icon_value); -} - -static void -setup_components (EShell *shell, - ESplash *splash) -{ - EShellPrivate *priv; - OAF_ServerInfoList *info_list; - CORBA_Environment ev; - int i; - - CORBA_exception_init (&ev); - - priv = shell->priv; - priv->component_registry = e_component_registry_new (shell); - - info_list = oaf_query ("repo_ids.has ('IDL:Evolution/ShellComponent:1.0')", NULL, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_error ("Eeek! Cannot perform OAF query for Evolution components."); - - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - GdkPixbuf *icon_pixbuf; - char *icon_path; - - info = info_list->_buffer + i; - - icon_path = get_icon_path_for_component_info (info); - - icon_pixbuf = gdk_pixbuf_new_from_file (icon_path); - - if (splash != NULL) - e_splash_add_icon (splash, icon_pixbuf); - - gdk_pixbuf_unref (icon_pixbuf); - - g_free (icon_path); - } - - while (gtk_events_pending ()) - gtk_main_iteration (); - - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - - info = info_list->_buffer + i; - - if (! e_component_registry_register_component (priv->component_registry, info->iid)) - g_warning ("Cannot activate Evolution component -- %s", info->iid); - else - g_print ("Evolution component activated successfully -- %s\n", info->iid); - - if (splash != NULL) - e_splash_set_icon_highlight (splash, i, TRUE); - - while (gtk_events_pending ()) - gtk_main_iteration (); - } - - if (info_list->_length == 0) - g_warning ("No Evolution components installed."); - - CORBA_free (info_list); - - CORBA_exception_free (&ev); -} - -/* FIXME what if anything fails here? */ -static void -set_owner_on_components (EShell *shell) -{ - Evolution_Shell corba_shell; - EShellPrivate *priv; - const char *local_directory; - GList *id_list; - GList *p; - - priv = shell->priv; - local_directory = e_shell_get_local_directory (shell); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - - id_list = e_component_registry_get_id_list (priv->component_registry); - for (p = id_list; p != NULL; p = p->next) { - EvolutionShellComponentClient *component_client; - const char *id; - - id = (const char *) p->data; - component_client = e_component_registry_get_component_by_id (priv->component_registry, id); - - evolution_shell_component_client_set_owner (component_client, corba_shell, local_directory); - } - - e_free_string_list (id_list); -} - - -/* EShellView destruction callback. */ - -static int -view_deleted_cb (GtkObject *object, - GdkEvent *ev, - gpointer data) -{ - EShell *shell; - - g_assert (E_IS_SHELL_VIEW (object)); - - shell = E_SHELL (data); - e_shell_save_settings (shell); - - /* Destroy it */ - return FALSE; -} - -static void -view_destroy_cb (GtkObject *object, - gpointer data) -{ - EShell *shell; - - g_assert (E_IS_SHELL_VIEW (object)); - - shell = E_SHELL (data); - shell->priv->views = g_list_remove ( - shell->priv->views, object); - - if (shell->priv->views == NULL) { - /* FIXME: This looks like a Bonobo bug to me. */ - bonobo_object_ref (BONOBO_OBJECT (shell)); - gtk_signal_emit (GTK_OBJECT (shell), signals [NO_VIEWS_LEFT]); - bonobo_object_unref (BONOBO_OBJECT (shell)); - } -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShell *shell; - EShellPrivate *priv; - GList *p; - - shell = E_SHELL (object); - priv = shell->priv; - - g_free (priv->local_directory); - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - if (priv->local_storage != NULL) - gtk_object_unref (GTK_OBJECT (priv->local_storage)); - - if (priv->shortcuts != NULL) - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - - if (priv->folder_type_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); - - if (priv->component_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->component_registry)); - - for (p = priv->views; p != NULL; p = p->next) { - EShellView *view; - - view = E_SHELL_VIEW (p->data); - - gtk_signal_disconnect_by_func ( - GTK_OBJECT (view), - GTK_SIGNAL_FUNC (view_destroy_cb), shell); - gtk_signal_disconnect_by_func (GTK_OBJECT (view), - GTK_SIGNAL_FUNC (view_deleted_cb), - shell); - - gtk_object_destroy (GTK_OBJECT (view)); - } - - g_list_free (priv->views); - - if (priv->corba_storage_registry != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -corba_class_init (void) -{ - POA_Evolution_Shell__vepv *vepv; - POA_Evolution_Shell__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_Shell__epv, 1); - epv->get_component_for_type = impl_Shell_get_component_for_type; - epv->user_select_folder = impl_Shell_user_select_folder; - epv->get_local_storage = impl_Shell_get_local_storage; - epv->create_storage_set_view = impl_Shell_create_storage_set_view; - - vepv = &shell_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_Shell_epv = epv; -} - -static void -class_init (EShellClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[NO_VIEWS_LEFT] = - gtk_signal_new ("no_views_left", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellClass, no_views_left), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EShell *shell) -{ - EShellPrivate *priv; - - priv = g_new (EShellPrivate, 1); - - priv->views = NULL; - - priv->local_directory = NULL; - priv->storage_set = NULL; - priv->local_storage = NULL; - priv->shortcuts = NULL; - priv->component_registry = NULL; - priv->folder_type_registry = NULL; - priv->corba_storage_registry = NULL; - - shell->priv = priv; -} - - -/** - * e_shell_construct: - * @shell: An EShell object to construct - * @corba_object: A CORBA Object implementing the Evolution::Shell interface - * @local_directory: Local directory for storing local information and folders - * @show_splash: Whether to display a splash screen. - * - * Construct @shell so that it uses the specified @local_directory and - * @corba_object. - **/ -void -e_shell_construct (EShell *shell, - Evolution_Shell corba_object, - const char *local_directory, - gboolean show_splash) -{ - GtkWidget *splash; - EShellPrivate *priv; - gchar *shortcut_path; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - g_return_if_fail (local_directory != NULL); - g_return_if_fail (g_path_is_absolute (local_directory)); - - if (! show_splash) { - splash = NULL; - } else { - splash = e_splash_new (); - gtk_widget_show (splash); - } - - while (gtk_events_pending ()) - gtk_main_iteration (); - - bonobo_object_construct (BONOBO_OBJECT (shell), corba_object); - - priv = shell->priv; - - priv->local_directory = g_strdup (local_directory); - priv->folder_type_registry = e_folder_type_registry_new (); - priv->storage_set = e_storage_set_new (shell->priv->folder_type_registry); - - gtk_object_ref (GTK_OBJECT (priv->folder_type_registry)); - gtk_object_ref (GTK_OBJECT (priv->storage_set)); - - /* CORBA storages must be set up before the components, because otherwise components - cannot register their own storages. */ - if (! setup_corba_storages (shell)) - return; - - if (splash != NULL) - setup_components (shell, E_SPLASH (splash)); - else - setup_components (shell, NULL); - - /* The local storage depends on the component registry. */ - setup_local_storage (shell); - - /* Now that we have a local storage, we can tell the components we are here. */ - set_owner_on_components (shell); - - shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml"); - priv->shortcuts = e_shortcuts_new (priv->storage_set, - priv->folder_type_registry, - shortcut_path); - - if (priv->shortcuts == NULL) - g_warning ("Cannot load shortcuts -- %s", shortcut_path); - else - gtk_object_ref (GTK_OBJECT (priv->shortcuts)); - - g_free (shortcut_path); - - sleep (2); - gtk_widget_destroy (splash); -} - -/** - * e_shell_new: - * @local_directory: Local directory for storing local information and folders. - * @show_splash: Whether to display a splash screen. - * - * Create a new EShell. - * - * Return value: - **/ -EShell * -e_shell_new (const char *local_directory, - gboolean show_splash) -{ - EShell *new; - EShellPrivate *priv; - Evolution_Shell corba_object; - POA_Evolution_Shell *servant; - - g_return_val_if_fail (local_directory != NULL, NULL); - g_return_val_if_fail (*local_directory != '\0', NULL); - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (e_shell_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - e_shell_construct (new, corba_object, local_directory, show_splash); - - priv = new->priv; - - if (priv->shortcuts == NULL || priv->storage_set == NULL) { - bonobo_object_unref (BONOBO_OBJECT (new)); - return NULL; - } - - return new; -} - - -/** - * e_shell_new_view: - * @shell: The shell for which to create a new view. - * @uri: URI for the new view. - * - * Create a new view for @uri. - * - * Return value: The new view. - **/ -EShellView * -e_shell_new_view (EShell *shell, - const char *uri) -{ - EShellView *view; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - view = e_shell_view_new (shell); - - gtk_widget_show (GTK_WIDGET (view)); - gtk_signal_connect (GTK_OBJECT (view), "delete-event", - GTK_SIGNAL_FUNC (view_deleted_cb), shell); - gtk_signal_connect (GTK_OBJECT (view), "destroy", - GTK_SIGNAL_FUNC (view_destroy_cb), shell); - - if (uri != NULL) - e_shell_view_display_uri (E_SHELL_VIEW (view), uri); - - shell->priv->views = g_list_prepend (shell->priv->views, view); - - return view; -} - - -/** - * e_shell_get_local_directory: - * @shell: An EShell object. - * - * Get the local directory associated with @shell. - * - * Return value: A pointer to the path of the local directory. - **/ -const char * -e_shell_get_local_directory (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->local_directory; -} - -/** - * e_shell_get_shortcuts: - * @shell: An EShell object. - * - * Get the shortcuts associated to @shell. - * - * Return value: A pointer to the EShortcuts associated to @shell. - **/ -EShortcuts * -e_shell_get_shortcuts (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->shortcuts; -} - -/** - * e_shell_get_storage_set: - * @shell: An EShell object. - * - * Get the storage set associated to @shell. - * - * Return value: A pointer to the EStorageSet associated to @shell. - **/ -EStorageSet * -e_shell_get_storage_set (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->storage_set; -} - -/** - * e_shell_get_folder_type_registry: - * @shell: An EShell object. - * - * Get the folder type registry associated to @shell. - * - * Return value: A pointer to the EFolderTypeRegistry associated to @shell. - **/ -EFolderTypeRegistry * -e_shell_get_folder_type_registry (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->folder_type_registry; -} - - -static gboolean -save_settings_for_views (EShell *shell) -{ - EShellPrivate *priv; - GList *p; - gboolean retval; - char *prefix; - int i; - - priv = shell->priv; - retval = TRUE; - - for (p = priv->views, i = 0; p != NULL; p = p->next, i++) { - EShellView *view; - - view = E_SHELL_VIEW (p->data); - - prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/", - priv->local_directory, i); - - if (! e_shell_view_save_settings (view, prefix)) { - g_warning ("Cannot save settings for view -- %d", i); - retval = FALSE; - } - - g_free (prefix); - } - - prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews", - priv->local_directory); - gnome_config_set_int (prefix, g_list_length (priv->views)); - g_free (prefix); - - gnome_config_sync (); - - return TRUE; -} - -static gboolean -save_settings_for_component (EShell *shell, - const char *id, - EvolutionShellComponentClient *client) -{ - Bonobo_Unknown unknown_interface; - Evolution_Session session_interface; - CORBA_Environment ev; - char *prefix; - gboolean retval; - - unknown_interface = bonobo_object_corba_objref (BONOBO_OBJECT (client)); - g_assert (unknown_interface != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - session_interface = Bonobo_Unknown_queryInterface (unknown_interface, "IDL:Evolution/Session:1.0", &ev); - if (ev._major != CORBA_NO_EXCEPTION || CORBA_Object_is_nil (session_interface, &ev)) { - CORBA_exception_free (&ev); - return TRUE; - } - - prefix = g_strconcat ("/apps/Evolution/Shell/Components/", id, NULL); - Evolution_Session_save_configuration (session_interface, prefix, &ev); - - if (ev._major == CORBA_NO_EXCEPTION) - retval = TRUE; - else - retval = FALSE; - - g_free (prefix); - - CORBA_exception_free (&ev); - - return retval; -} - -static gboolean -save_settings_for_components (EShell *shell) -{ - EShellPrivate *priv; - GList *component_ids; - GList *p; - gboolean retval; - - priv = shell->priv; - - g_assert (priv->component_registry); - component_ids = e_component_registry_get_id_list (priv->component_registry); - - retval = TRUE; - for (p = component_ids; p != NULL; p = p->next) { - EvolutionShellComponentClient *client; - const char *id; - - id = p->data; - client = e_component_registry_get_component_by_id (priv->component_registry, id); - - if (! save_settings_for_component (shell, id, client)) - retval = FALSE; - } - - e_free_string_list (component_ids); - - return retval; -} - -/** - * e_shell_save_settings: - * @shell: - * - * Save the settings for this shell. - * - * Return value: %TRUE if it worked, %FALSE otherwise. Even if %FALSE is - * returned, it is possible that at least part of the settings for the views - * have been saved. - **/ -gboolean -e_shell_save_settings (EShell *shell) -{ - gboolean views_saved; - gboolean components_saved; - - g_return_val_if_fail (shell != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - - views_saved = save_settings_for_views (shell); - components_saved = save_settings_for_components (shell); - - return views_saved && components_saved; -} - -/** - * e_shell_restore_from_settings: - * @shell: An EShell object. - * - * Restore the existing views from the saved configuration. The shell must - * have no views for this to work. - * - * Return value: %FALSE if the shell has some open views or there is no saved - * configuration. %TRUE if the configuration could be restored successfully. - **/ -gboolean -e_shell_restore_from_settings (EShell *shell) -{ - EShellPrivate *priv; - gboolean retval; - char *prefix; - int num_views; - int i; - - g_return_val_if_fail (shell != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - g_return_val_if_fail (shell->priv->views == NULL, FALSE); - - priv = shell->priv; - - prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews", - priv->local_directory); - num_views = gnome_config_get_int (prefix); - if (num_views == 0) - return FALSE; - - retval = TRUE; - - for (i = 0; i < num_views; i++) { - EShellView *view; - - prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/", - priv->local_directory, i); - - /* FIXME restore the URI here. There should be an - e_shell_view_new_from_configuration() thingie. */ - view = e_shell_new_view (shell, NULL); - - if (! e_shell_view_load_settings (view, prefix)) - retval = FALSE; - - g_free (prefix); - } - - return retval; -} - -/** - * e_shell_quit: - * @shell: An EShell. - * - * Make @shell quit. This will close all the associated views and destroy the - * object. - **/ -void -e_shell_quit (EShell *shell) -{ - EShellPrivate *priv; - GList *p; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - if (shell->priv->views) - e_shell_save_settings (shell); - - priv = shell->priv; - - for (p = priv->views; p != NULL; p = p->next) { - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (p->data); - gtk_signal_disconnect_by_func ( - GTK_OBJECT (shell_view), - GTK_SIGNAL_FUNC (view_destroy_cb), shell); - gtk_object_destroy (GTK_OBJECT (shell_view)); - } - - g_list_free (priv->views); - priv->views = NULL; - - bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); - - priv->corba_storage_registry = NULL; - - e_storage_set_remove_all_storages (priv->storage_set); - - /* - * Ok, so you thought the GUI components lifecycle was coupled to - * the Shell's, in fact this is not the case, they are unref'd - * here, and NULL'd to avoid shell destruction killing them again. - * So; the shell can be destroyed either remotely or localy. - */ - - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); - gtk_object_unref (GTK_OBJECT (priv->component_registry)); - - priv->storage_set = NULL; - priv->shortcuts = NULL; - priv->folder_type_registry = NULL; - priv->component_registry = NULL; - - bonobo_object_unref (BONOBO_OBJECT (shell)); -} - - -E_MAKE_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell.h b/shell/e-shell.h deleted file mode 100644 index 98545b396d..0000000000 --- a/shell/e-shell.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHELL_H_ -#define _E_SHELL_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -typedef struct _EShell EShell; -typedef struct _EShellPrivate EShellPrivate; -typedef struct _EShellClass EShellClass; - -#include "Evolution.h" -#include "e-shortcuts.h" -#include "e-shell-view.h" - -#define E_TYPE_SHELL (e_shell_get_type ()) -#define E_SHELL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL, EShell)) -#define E_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL, EShellClass)) -#define E_IS_SHELL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL)) -#define E_IS_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL)) - - - -struct _EShell { - BonoboObject parent; - - EShellPrivate *priv; -}; - -struct _EShellClass { - BonoboObjectClass parent_class; - - void (* no_views_left) (EShell *shell); -}; - - -GtkType e_shell_get_type (void); -void e_shell_construct (EShell *shell, - Evolution_Shell corba_object, - const char *local_directory, - gboolean show_splash); - -EShell *e_shell_new (const char *local_directory, - gboolean show_splash); -EShellView *e_shell_new_view (EShell *shell, - const char *uri); - -const char *e_shell_get_local_directory (EShell *shell); -EShortcuts *e_shell_get_shortcuts (EShell *shell); -EStorageSet *e_shell_get_storage_set (EShell *shell); -EFolderTypeRegistry *e_shell_get_folder_type_registry (EShell *shell); - -gboolean e_shell_save_settings (EShell *shell); -gboolean e_shell_restore_from_settings (EShell *shell); - -void e_shell_quit (EShell *shell); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHELL_H_ */ diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c deleted file mode 100644 index f0d08b8458..0000000000 --- a/shell/e-shortcuts-view-model.c +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view-model.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* FIXME. This really sucks. We are using the model/view approach in the - dumbest possible way. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <gal/util/e-util.h> - -#include "e-shortcuts-view-model.h" - - -#define PARENT_TYPE e_shortcut_model_get_type () -static EShortcutModelClass *parent_class = NULL; - -struct _EShortcutsViewModelPrivate { - EShortcuts *shortcuts; -}; - - -/* View initialization. */ - -static const char * -get_storage_set_path_from_uri (const char *uri) -{ - const char *colon; - - if (g_path_is_absolute (uri)) - return NULL; - - colon = strchr (uri, ':'); - if (colon == NULL || colon == uri || colon[1] == '\0') - return NULL; - - if (! g_path_is_absolute (colon + 1)) - return NULL; - - if (g_strncasecmp (uri, "evolution", colon - uri) != 0) - return NULL; - - return colon + 1; -} - -static void -load_group_into_model (EShortcutsViewModel *shortcuts_view_model, - const char *group_title, - int group_num) -{ - EShortcutsViewModelPrivate *priv; - EStorageSet *storage_set; - GList *shortcut_list; - GList *p; - - priv = shortcuts_view_model->priv; - - storage_set = e_shortcuts_get_storage_set (priv->shortcuts); - g_assert (storage_set != NULL); - - shortcut_list = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, group_title); - if (shortcut_list == NULL) - return; - - for (p = shortcut_list; p != NULL; p = p->next) { - EFolder *folder = NULL; - const char *path; - const char *uri; - const char *name; - - uri = (const char *) p->data; - path = get_storage_set_path_from_uri (uri); - if (path != NULL) - folder = e_storage_set_get_folder (storage_set, path); - - if (path == NULL || folder == NULL) { - /* FIXME */ - g_warning ("Invalid link while loading shortcut bar view -- %s\n", - uri); - continue; - } - - name = e_folder_get_name (folder); - e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, -1, uri, name); - } - - e_free_string_list (shortcut_list); -} - -static void -load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model) -{ - EShortcutsViewModelPrivate *priv; - GList *group_titles; - GList *p; - int group_num; - - priv = shortcuts_view_model->priv; - - group_titles = e_shortcuts_get_group_titles (priv->shortcuts); - - for (p = group_titles; p != NULL; p = p->next) { - const char *group_title; - - group_title = (const char *) p->data; - group_num = e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), -1, group_title); - - load_group_into_model (shortcuts_view_model, group_title, group_num); - } - - e_free_string_list (group_titles); -} - - -/* EShortcuts callbacks. */ - -static void -shortcuts_new_group_cb (EShortcuts *shortcuts, - int group_num, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - EShortcutsViewModelPrivate *priv; - const char *title; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - priv = shortcuts_view_model->priv; - - title = e_shortcuts_get_group_title (priv->shortcuts, group_num); - e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, title); -} - -static void -shortcuts_remove_group_cb (EShortcuts *shortcuts, - int group_num, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - e_shortcut_model_remove_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num); -} - -static void -shortcuts_new_shortcut_cb (EShortcuts *shortcuts, - int group_num, - int item_num, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - EShortcutsViewModelPrivate *priv; - EStorageSet *storage_set; - EFolder *folder; - const char *uri; - const char *storage_set_path; - const char *folder_name; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - priv = shortcuts_view_model->priv; - - uri = e_shortcuts_get_uri (priv->shortcuts, group_num, item_num); - g_assert (uri != NULL); - - storage_set_path = get_storage_set_path_from_uri (uri); - if (storage_set_path == NULL) - return; - - storage_set = e_shortcuts_get_storage_set (priv->shortcuts); - folder = e_storage_set_get_folder (storage_set, storage_set_path); - folder_name = e_folder_get_name (folder); - - e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), - group_num, item_num, uri, folder_name); -} - -static void -shortcuts_remove_shortcut_cb (EShortcuts *shortcuts, - int group_num, - int item_num, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - e_shortcut_model_remove_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, item_num); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EShortcutsViewModel *view_model; - EShortcutsViewModelPrivate *priv; - - view_model = E_SHORTCUTS_VIEW_MODEL (object); - priv = view_model->priv; - - g_free (priv); -} - - -static void -class_init (EShortcutsViewModelClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - parent_class = gtk_type_class (e_shortcut_model_get_type ()); -} - -static void -init (EShortcutsViewModel *shortcuts_view_model) -{ - EShortcutsViewModelPrivate *priv; - - priv = g_new (EShortcutsViewModelPrivate, 1); - priv->shortcuts = NULL; - - shortcuts_view_model->priv = priv; -} - - -void -e_shortcuts_view_model_construct (EShortcutsViewModel *model, - EShortcuts *shortcuts) -{ - EShortcutsViewModelPrivate *priv; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SHORTCUTS_VIEW_MODEL (model)); - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = model->priv; - g_return_if_fail (priv->shortcuts == NULL); - - priv->shortcuts = shortcuts; - - load_all_shortcuts_into_model (model); - - gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), - "new_group", GTK_SIGNAL_FUNC (shortcuts_new_group_cb), model, - GTK_OBJECT (model)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), - "remove_group", GTK_SIGNAL_FUNC (shortcuts_remove_group_cb), model, - GTK_OBJECT (model)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), - "new_shortcut", GTK_SIGNAL_FUNC (shortcuts_new_shortcut_cb), model, - GTK_OBJECT (model)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), - "remove_shortcut", GTK_SIGNAL_FUNC (shortcuts_remove_shortcut_cb), model, - GTK_OBJECT (model)); -} - -EShortcutsViewModel * -e_shortcuts_view_model_new (EShortcuts *shortcuts) -{ - EShortcutsViewModel *new; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - new = gtk_type_new (e_shortcuts_view_model_get_type ()); - - e_shortcuts_view_model_construct (new, shortcuts); - - return new; -} - - -E_MAKE_TYPE (e_shortcuts_view_model, "EShortcutsViewModel", EShortcutsViewModel, class_init, init, PARENT_TYPE) diff --git a/shell/e-shortcuts-view-model.h b/shell/e-shortcuts-view-model.h deleted file mode 100644 index af5259bbee..0000000000 --- a/shell/e-shortcuts-view-model.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view-model.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHORTCUTS_VIEW_MODEL_H_ -#define _E_SHORTCUTS_VIEW_MODEL_H_ - -#include "e-shortcuts.h" - -#include "shortcut-bar/e-shortcut-model.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHORTCUTS_VIEW_MODEL (e_shortcuts_view_model_get_type ()) -#define E_SHORTCUTS_VIEW_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL, EShortcutsViewModel)) -#define E_SHORTCUTS_VIEW_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS_VIEW_MODEL, EShortcutsViewModelClass)) -#define E_IS_SHORTCUTS_VIEW_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL)) -#define E_IS_SHORTCUTS_VIEW_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL)) - - -typedef struct _EShortcutsViewModel EShortcutsViewModel; -typedef struct _EShortcutsViewModelPrivate EShortcutsViewModelPrivate; -typedef struct _EShortcutsViewModelClass EShortcutsViewModelClass; - -struct _EShortcutsViewModel { - EShortcutModel parent; - - EShortcutsViewModelPrivate *priv; -}; - -struct _EShortcutsViewModelClass { - EShortcutModelClass parent_class; -}; - - -GtkType e_shortcuts_view_model_get_type (void); -void e_shortcuts_view_model_construct (EShortcutsViewModel *model, - EShortcuts *shortcuts); -EShortcutsViewModel *e_shortcuts_view_model_new (EShortcuts *shortcuts); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUTS_VIEW_MODEL_H_ */ diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c deleted file mode 100644 index a4b60eee56..0000000000 --- a/shell/e-shortcuts-view.c +++ /dev/null @@ -1,548 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include <gal/util/e-util.h> - -#include "e-shortcuts-view-model.h" - -#include "e-shortcuts-view.h" - - -#define PARENT_TYPE E_TYPE_SHORTCUT_BAR -static EShortcutBarClass *parent_class = NULL; - -struct _EShortcutsViewPrivate { - EShortcuts *shortcuts; -}; - -enum { - ACTIVATE_SHORTCUT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* FIXME this should all be in the model. */ - -static const char * -get_storage_set_path_from_uri (const char *uri) -{ - const char *colon; - - if (g_path_is_absolute (uri)) - return NULL; - - colon = strchr (uri, ':'); - if (colon == NULL || colon == uri || colon[1] == '\0') - return NULL; - - if (! g_path_is_absolute (colon + 1)) - return NULL; - - if (g_strncasecmp (uri, "evolution", colon - uri) != 0) - return NULL; - - return colon + 1; -} - -/* Icon callback for the shortcut bar. */ -static GdkPixbuf * -icon_callback (EShortcutBar *shortcut_bar, - const char *uri, - gpointer data) -{ - EFolderTypeRegistry *folder_type_registry; - EShortcuts *shortcuts; - EStorageSet *storage_set; - EFolder *folder; - GdkPixbuf *pixbuf; - const char *type; - - shortcuts = E_SHORTCUTS (data); - - storage_set = e_shortcuts_get_storage_set (shortcuts); - folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); - - folder = e_storage_set_get_folder (storage_set, - get_storage_set_path_from_uri (uri)); - - if (folder == NULL) - return NULL; - - type = e_folder_get_type_string (folder); - if (type == NULL) - return NULL; - - /* FIXME mini icons? */ - pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, type, FALSE); - if (pixbuf != NULL) - gdk_pixbuf_ref (pixbuf); - - return pixbuf; -} - - -static void -show_new_group_dialog (EShortcutsView *view) -{ - GtkWidget *dialog; - GtkWidget *label; - GtkWidget *entry; - GtkWidget *box; - const char *group_name; - int button_num; - - dialog = gnome_dialog_new (_("Create new shortcut group"), - GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); - - label = gtk_label_new (_("Group name:")); - gtk_widget_show (label); - - entry = gtk_entry_new (); - gtk_widget_show (entry); - - box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); - gtk_widget_show (box); - - gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), box, FALSE, TRUE, 0); - - gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)))); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - - gtk_widget_grab_focus (entry); - gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE (entry)); - - gtk_widget_show (dialog); - - button_num = gnome_dialog_run (GNOME_DIALOG (dialog)); - if (button_num == -1) - return; - if (button_num != 0) { - gtk_widget_destroy (dialog); - return; - } - - group_name = gtk_entry_get_text (GTK_ENTRY (entry)); - e_shortcuts_add_group (view->priv->shortcuts, -1, group_name); - - gtk_widget_destroy (dialog); -} - - -/* Shortcut bar right-click menu. */ - -struct _RightClickMenuData { - EShortcutsView *shortcuts_view; - int group_num; -}; -typedef struct _RightClickMenuData RightClickMenuData; - -static void -toggle_large_icons_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - - menu_data = (RightClickMenuData *) data; - - if (menu_data == NULL) - return; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - menu_data->group_num, - E_ICON_BAR_LARGE_ICONS); -} - -static void -toggle_small_icons_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - - menu_data = (RightClickMenuData *) data; - if (menu_data == NULL) - return; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - menu_data->group_num, - E_ICON_BAR_SMALL_ICONS); -} - -static void -create_new_group_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - - menu_data = (RightClickMenuData *) data; - - show_new_group_dialog (menu_data->shortcuts_view); -} - -static void -destroy_group_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - EShortcuts *shortcuts; - EShortcutsView *shortcuts_view; - EShortcutsViewPrivate *priv; - GtkWidget *message_box; - char *question; - - menu_data = (RightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - priv = shortcuts_view->priv; - shortcuts = priv->shortcuts; - - question = g_strdup_printf (_("Do you really want to remove group\n" - "`%s' from the shortcut bar?"), - e_shortcuts_get_group_title (shortcuts, menu_data->group_num)); - - message_box = gnome_message_box_new (question, GNOME_MESSAGE_BOX_QUESTION, - _("Remove"), _("Don't remove"), NULL); - gnome_dialog_set_parent (GNOME_DIALOG (message_box), - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shortcuts_view)))); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (message_box)) != 0) - return; - - e_shortcuts_remove_group (shortcuts, menu_data->group_num); -} - -static GnomeUIInfo icon_size_radio_group_uiinfo[] = { - { GNOME_APP_UI_ITEM, N_("_Small Icons"), - N_("Show the shortcuts as small icons"), toggle_small_icons_cb, NULL, - NULL, 0, 0, 0, 0 }, - { GNOME_APP_UI_ITEM, N_("_Large Icons"), - N_("Show the shortcuts as large icons"), toggle_large_icons_cb, NULL, - NULL, 0, 0, 0, 0 }, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo right_click_menu_uiinfo[] = { - GNOMEUIINFO_RADIOLIST (icon_size_radio_group_uiinfo), - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, N_("_New Group..."), - N_("Create a new shortcut group"), create_new_group_cb, NULL, - NULL, 0, 0, 0, 0 }, - { GNOME_APP_UI_ITEM, N_("_Remove This Group..."), - N_("Remove this shortcut group"), destroy_group_cb, NULL, - NULL, 0, 0, 0, 0 }, - - GNOMEUIINFO_END -}; - -static void -pop_up_right_click_menu_for_group (EShortcutsView *shortcuts_view, - GdkEventButton *event, - int group_num) -{ - RightClickMenuData *menu_data; - GtkWidget *popup_menu; - - menu_data = g_new (RightClickMenuData, 1); - menu_data->shortcuts_view = shortcuts_view; - menu_data->group_num = group_num; - - popup_menu = gnome_popup_menu_new (right_click_menu_uiinfo); - - if (e_shortcut_bar_get_view_type (E_SHORTCUT_BAR (shortcuts_view), group_num) - == E_ICON_BAR_SMALL_ICONS) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (icon_size_radio_group_uiinfo[0].widget), - TRUE); - else - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (icon_size_radio_group_uiinfo[1].widget), - TRUE); - - if (group_num == 0) - gtk_widget_set_sensitive (right_click_menu_uiinfo[3].widget, FALSE); - - gnome_popup_menu_do_popup_modal (popup_menu, NULL, NULL, event, menu_data); - - g_free (menu_data); - gtk_widget_destroy (popup_menu); -} - - -/* Shortcut right-click menu. */ - -struct _ShortcutRightClickMenuData { - EShortcutsView *shortcuts_view; - int group_num; - int item_num; -}; -typedef struct _ShortcutRightClickMenuData ShortcutRightClickMenuData; - -static void -activate_shortcut_cb (GtkWidget *widget, - void *data) -{ - ShortcutRightClickMenuData *menu_data; - EShortcutsView *shortcuts_view; - EShortcuts *shortcuts; - const char *uri; - - menu_data = (ShortcutRightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - shortcuts = shortcuts_view->priv->shortcuts; - - uri = e_shortcuts_get_uri (shortcuts, menu_data->group_num, menu_data->item_num); - if (uri == NULL) - return; - - gtk_signal_emit (GTK_OBJECT (shortcuts_view), signals[ACTIVATE_SHORTCUT], - shortcuts, uri); -} - -static void -remove_shortcut_cb (GtkWidget *widget, - void *data) -{ - ShortcutRightClickMenuData *menu_data; - EShortcutsView *shortcuts_view; - EShortcuts *shortcuts; - - menu_data = (ShortcutRightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - shortcuts = shortcuts_view->priv->shortcuts; - - e_shortcuts_remove_shortcut (shortcuts, menu_data->group_num, menu_data->item_num); -} - -static GnomeUIInfo shortcut_right_click_menu_uiinfo[] = { - GNOMEUIINFO_ITEM (N_("Activate"), N_("Activate this shortcut"), - activate_shortcut_cb, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Remove"), N_("Remove this shortcut from the shortcut bar"), - remove_shortcut_cb, GNOME_STOCK_MENU_CLOSE), - GNOMEUIINFO_END -}; - -static void -pop_up_right_click_menu_for_shortcut (EShortcutsView *shortcuts_view, - GdkEventButton *event, - int group_num, - int item_num) -{ - ShortcutRightClickMenuData *menu_data; - GtkWidget *popup_menu; - - menu_data = g_new (ShortcutRightClickMenuData, 1); - menu_data->shortcuts_view = shortcuts_view; - menu_data->group_num = group_num; - menu_data->item_num = item_num; - - popup_menu = gnome_popup_menu_new (shortcut_right_click_menu_uiinfo); - - gnome_popup_menu_do_popup_modal (popup_menu, NULL, NULL, event, menu_data); - - g_free (menu_data); - gtk_widget_destroy (popup_menu); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShortcutsViewPrivate *priv; - EShortcutsView *shortcuts_view; - - shortcuts_view = E_SHORTCUTS_VIEW (object); - - priv = shortcuts_view->priv; - - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EShortcutBar methods. */ - -static void -item_selected (EShortcutBar *shortcut_bar, - GdkEvent *event, - int group_num, - int item_num) -{ - EShortcuts *shortcuts; - EShortcutsView *shortcuts_view; - const char *uri; - - shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar); - shortcuts = shortcuts_view->priv->shortcuts; - - if (event->button.button == 3) { - if (item_num < 0) - pop_up_right_click_menu_for_group (shortcuts_view, &event->button, - group_num); - else - pop_up_right_click_menu_for_shortcut (shortcuts_view, &event->button, - group_num, item_num); - return; - } else if (event->button.button != 1) { - return; - } - - if (item_num < 0) - return; - - uri = e_shortcuts_get_uri (shortcuts, group_num, item_num); - if (uri == NULL) - return; - - gtk_signal_emit (GTK_OBJECT (shortcuts_view), signals[ACTIVATE_SHORTCUT], - shortcuts, uri); -} - -static void -impl_shortcut_dropped (EShortcutBar *shortcut_bar, - int group_num, - int position, - const char *item_url, - const char *item_name) -{ - EShortcutsView *shortcuts_view; - EShortcutsViewPrivate *priv; - - shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar); - priv = shortcuts_view->priv; - - e_shortcuts_add_shortcut (priv->shortcuts, group_num, position, item_url); -} - -static void -impl_shortcut_dragged (EShortcutBar *shortcut_bar, - gint group_num, - gint item_num) -{ - EShortcutsView *shortcuts_view; - EShortcutsViewPrivate *priv; - - shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar); - priv = shortcuts_view->priv; - - e_shortcuts_remove_shortcut (priv->shortcuts, group_num, item_num); -} - - -static void -class_init (EShortcutsViewClass *klass) -{ - GtkObjectClass *object_class; - EShortcutBarClass *shortcut_bar_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - shortcut_bar_class = E_SHORTCUT_BAR_CLASS (klass); - shortcut_bar_class->item_selected = item_selected; - shortcut_bar_class->shortcut_dropped = impl_shortcut_dropped; - shortcut_bar_class->shortcut_dragged = impl_shortcut_dragged; - - parent_class = gtk_type_class (e_shortcut_bar_get_type ()); - - signals[ACTIVATE_SHORTCUT] = - gtk_signal_new ("activate_shortcut", - GTK_RUN_LAST | GTK_RUN_ACTION, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsViewClass, activate_shortcut), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShortcutsView *shortcuts_view) -{ - EShortcutsViewPrivate *priv; - - priv = g_new (EShortcutsViewPrivate, 1); - priv->shortcuts = NULL; - - shortcuts_view->priv = priv; -} - - -void -e_shortcuts_view_construct (EShortcutsView *shortcuts_view, - EShortcuts *shortcuts) -{ - EShortcutsViewPrivate *priv; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts_view->priv; - priv->shortcuts = shortcuts; - - e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcuts_view), icon_callback, - shortcuts); - - e_shortcut_bar_set_model (E_SHORTCUT_BAR (shortcuts_view), - E_SHORTCUT_MODEL (e_shortcuts_view_model_new (shortcuts))); -} - -GtkWidget * -e_shortcuts_view_new (EShortcuts *shortcuts) -{ - GtkWidget *new; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - new = gtk_type_new (e_shortcuts_view_get_type ()); - e_shortcuts_view_construct (E_SHORTCUTS_VIEW (new), shortcuts); - - return new; -} - - -E_MAKE_TYPE (e_shortcuts_view, "EShortcutsView", EShortcutsView, class_init, init, PARENT_TYPE) diff --git a/shell/e-shortcuts-view.h b/shell/e-shortcuts-view.h deleted file mode 100644 index 8f6f8cb0af..0000000000 --- a/shell/e-shortcuts-view.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHORTCUTS_VIEW_H_ -#define _E_SHORTCUTS_VIEW_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-shortcuts.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHORTCUTS_VIEW (e_shortcuts_view_get_type ()) -#define E_SHORTCUTS_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS_VIEW, EShortcutsView)) -#define E_SHORTCUTS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS_VIEW, EShortcutsViewClass)) -#define E_IS_SHORTCUTS_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW)) -#define E_IS_SHORTCUTS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW)) - - -typedef struct _EShortcutsView EShortcutsView; -typedef struct _EShortcutsViewPrivate EShortcutsViewPrivate; -typedef struct _EShortcutsViewClass EShortcutsViewClass; - -struct _EShortcutsView { - EShortcutBar parent; - - EShortcutsViewPrivate *priv; -}; - -struct _EShortcutsViewClass { - EShortcutBarClass parent_class; - - void (* activate_shortcut) (EShortcutsView *view, - EShortcuts *shortcuts, - const char *uri); -}; - - -GtkType e_shortcuts_view_get_type (void); -void e_shortcuts_view_construct (EShortcutsView *shortcuts_view, - EShortcuts *shortcuts); -GtkWidget *e_shortcuts_view_new (EShortcuts *shortcuts); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUTS_VIEW_H_ */ diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c deleted file mode 100644 index 7f044dd129..0000000000 --- a/shell/e-shortcuts.c +++ /dev/null @@ -1,789 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* The shortcut list goes this: - - <?xml version="1.0"?> - <shortcuts> - <group title="Evolution shortcuts"> - <item>evolution:/local/Inbox</item> - <item>evolution:/local/Trash</item> - <item>evolution:/local/Calendar</item> - </group> - - <group title="Personal shortcuts"> - <item>evolution:/local/Personal</item> - </group> - </shortcuts> - - FIXME: Do we want to use a namespace for this? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtktypeutils.h> - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <string.h> - -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> - -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-shortcuts-view.h" - -#include "e-shortcuts.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _ShortcutGroup { - /* Title of the group. */ - char *title; - - /* A list of strings with the URI for the shortcut. */ - GList *shortcuts; -}; -typedef struct _ShortcutGroup ShortcutGroup; - -struct _EShortcutsPrivate { - /* Name of the file associated with these shortcuts. Changes in the shortcuts - will update this file automatically. */ - char *file_name; - - /* ID of the idle function that will be called to save the shortcuts when they are - changed. */ - int save_idle_id; - - /* Whether these shortcuts need to be saved to disk. */ - gboolean dirty; - - /* The storage set to which these shortcuts are associated. */ - EStorageSet *storage_set; - - /* The folder type registry. */ - EFolderTypeRegistry *folder_type_registry; - - /* A list of ShortcutGroups. */ - GList *groups; - - /* A list of ShortcutViews. */ - GList *views; - - /* A hash table to get a group given its name. */ - GHashTable *title_to_group; -}; - -enum { - NEW_GROUP, - REMOVE_GROUP, - NEW_SHORTCUT, - REMOVE_SHORTCUT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static void -unload_shortcuts (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - GList *orig_groups; - GList *p, *q; - - priv = shortcuts->priv; - orig_groups = priv->groups; - - for (p = priv->groups; p != NULL; p = p->next) { - ShortcutGroup *group; - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_GROUP], 0); - - group = (ShortcutGroup *) p->data; - - g_hash_table_remove (priv->title_to_group, group->title); - - for (q = group->shortcuts; q != NULL; q = q->next) - g_free (q->data); - g_free (group->title); - - g_list_free (group->shortcuts); - - priv->groups = priv->groups->next; - } - - if (orig_groups != NULL) - g_list_free (orig_groups); - - priv->groups = NULL; - - g_hash_table_destroy (priv->title_to_group); - priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal); -} - -static gboolean -load_shortcuts (EShortcuts *shortcuts, - const char *file_name) -{ - EShortcutsPrivate *priv; - xmlDoc *doc; - xmlNode *root; - xmlNode *p, *q; - - /* FIXME: Update the views by emitting the appropriate signals. */ - - priv = shortcuts->priv; - - doc = xmlParseFile (file_name); - if (doc == NULL) - return FALSE; - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "shortcuts") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - unload_shortcuts (shortcuts); - - for (p = root->childs; p != NULL; p = p->next) { - ShortcutGroup *shortcut_group; - char *shortcut_group_title; - - if (strcmp ((char *) p->name, "group") != 0) - continue; - - shortcut_group_title = (char *) xmlGetProp (p, "title"); - if (shortcut_group_title == NULL) - continue; - - shortcut_group = g_hash_table_lookup (priv->title_to_group, - shortcut_group_title); - if (shortcut_group != NULL) { - g_warning ("Duplicate shortcut group title -- %s", - shortcut_group_title); - xmlFree (shortcut_group_title); - continue; - } - - shortcut_group = g_new (ShortcutGroup, 1); - shortcut_group->title = g_strdup (shortcut_group_title); - xmlFree (shortcut_group_title); - - shortcut_group->shortcuts = NULL; - for (q = p->childs; q != NULL; q = q->next) { - char *content; - - if (strcmp ((char *) q->name, "item") != 0) - continue; - - content = xmlNodeListGetString (doc, q->childs, 1); - shortcut_group->shortcuts = g_list_prepend (shortcut_group->shortcuts, - g_strdup (content)); - xmlFree (content); - } - shortcut_group->shortcuts = g_list_reverse (shortcut_group->shortcuts); - - priv->groups = g_list_prepend (priv->groups, shortcut_group); - g_hash_table_insert (priv->title_to_group, shortcut_group->title, shortcut_group); - } - - priv->groups = g_list_reverse (priv->groups); - - xmlFreeDoc (doc); - - return TRUE; -} - -static gboolean -save_shortcuts (EShortcuts *shortcuts, - const char *file_name) -{ - EShortcutsPrivate *priv; - xmlDoc *doc; - xmlNode *root; - GList *p, *q; - - priv = shortcuts->priv; - - doc = xmlNewDoc ((xmlChar *) "1.0"); - root = xmlNewDocNode (doc, NULL, (xmlChar *) "shortcuts", NULL); - xmlDocSetRootElement (doc, root); - - for (p = priv->groups; p != NULL; p = p->next) { - ShortcutGroup *group; - xmlNode *group_node; - - group = (ShortcutGroup *) p->data; - group_node = xmlNewChild (root, NULL, (xmlChar *) "group", NULL); - - xmlSetProp (group_node, (xmlChar *) "title", group->title); - - for (q = group->shortcuts; q != NULL; q = q->next) { - const char *shortcut; - - shortcut = (const char *) q->data; - xmlNewChild (group_node, NULL, (xmlChar *) "item", (xmlChar *) shortcut); - } - } - - if (xmlSaveFile (file_name, doc) < 0) { - xmlFreeDoc (doc); - return FALSE; - } - - xmlFreeDoc (doc); - return TRUE; -} - - -/* Idle function to update the file on disk. */ - -static int -idle_cb (void *data) -{ - EShortcuts *shortcuts; - EShortcutsPrivate *priv; - - shortcuts = E_SHORTCUTS (data); - priv = shortcuts->priv; - - if (priv->dirty) { - g_print ("Saving shortcuts -- %s\n", priv->file_name); - if (! e_shortcuts_save (shortcuts, NULL)) - g_warning ("Saving of shortcuts failed -- %s", priv->file_name); - else - priv->dirty = FALSE; - } - - priv->save_idle_id = 0; - - return FALSE; -} - -static void -schedule_idle (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - - priv = shortcuts->priv; - - if (priv->save_idle_id != 0) - return; - - gtk_idle_add (idle_cb, shortcuts); -} - -static void -make_dirty (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - - priv = shortcuts->priv; - - priv->dirty = TRUE; - schedule_idle (shortcuts); -} - - -/* Signal handlers for the views. */ - -static void -view_destroyed_cb (GtkObject *object, - gpointer data) -{ - EShortcuts *shortcuts; - EShortcutsPrivate *priv; - - shortcuts = E_SHORTCUTS (data); - priv = shortcuts->priv; - - priv->views = g_list_remove (priv->views, object); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShortcuts *shortcuts; - EShortcutsPrivate *priv; - - shortcuts = E_SHORTCUTS (object); - priv = shortcuts->priv; - - g_free (priv->file_name); - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - if (priv->folder_type_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); - - unload_shortcuts (shortcuts); - - if (priv->save_idle_id != 0) - gtk_idle_remove (priv->save_idle_id); - - if (priv->dirty) { - if (! e_shortcuts_save (shortcuts, NULL)) - g_warning (_("Error saving shortcuts.")); /* FIXME */ - } - - g_hash_table_destroy (priv->title_to_group); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EShortcutsClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - object_class->destroy = destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - signals[NEW_GROUP] - = gtk_signal_new ("new_group", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, new_group), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - signals[REMOVE_GROUP] - = gtk_signal_new ("remove_group", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, remove_group), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - signals[NEW_SHORTCUT] - = gtk_signal_new ("new_shortcut", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, new_shortcut), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, - GTK_TYPE_INT, - GTK_TYPE_INT); - - signals[REMOVE_SHORTCUT] - = gtk_signal_new ("remove_shortcut", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, remove_shortcut), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, - GTK_TYPE_INT, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - - -static void -init (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - - priv = g_new (EShortcutsPrivate, 1); - - priv->file_name = NULL; - priv->storage_set = NULL; - priv->groups = NULL; - priv->views = NULL; - priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal); - priv->dirty = 0; - priv->save_idle_id = 0; - - shortcuts->priv = priv; -} - - -void -e_shortcuts_construct (EShortcuts *shortcuts, - EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry) -{ - EShortcutsPrivate *priv; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (shortcuts), GTK_FLOATING); - - priv = shortcuts->priv; - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; - - gtk_object_ref (GTK_OBJECT (folder_type_registry)); - priv->folder_type_registry = folder_type_registry; -} - -EShortcuts * -e_shortcuts_new (EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry, - const char *file_name) -{ - EShortcuts *new; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - new = gtk_type_new (e_shortcuts_get_type ()); - e_shortcuts_construct (new, storage_set, folder_type_registry); - - if (! e_shortcuts_load (new, file_name)) { - gtk_object_unref (GTK_OBJECT (new)); - return NULL; - } - - return new; -} - - -GList * -e_shortcuts_get_group_titles (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *list; - GList *p; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - list = NULL; - - for (p = priv->groups; p != NULL; p = p->next) { - group = (ShortcutGroup *) p->data; - list = g_list_prepend (list, g_strdup (group->title)); - } - - return g_list_reverse (list); -} - -GList * -e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - const char *group_title) -{ - EShortcutsPrivate *priv; - ShortcutGroup *shortcut_group; - GList *list; - GList *p; - - priv = shortcuts->priv; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - g_return_val_if_fail (group_title != NULL, NULL); - - shortcut_group = g_hash_table_lookup (priv->title_to_group, group_title); - if (shortcut_group == NULL) - return NULL; - - list = NULL; - - for (p = shortcut_group->shortcuts; p != NULL; p = p->next) - list = g_list_prepend (list, g_strdup ((const char *) p->data)); - - return g_list_reverse (list); -} - - -EStorageSet * -e_shortcuts_get_storage_set (EShortcuts *shortcuts) -{ - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - return shortcuts->priv->storage_set; -} - - -GtkWidget * -e_shortcuts_new_view (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - GtkWidget *new; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - new = e_shortcuts_view_new (shortcuts); - priv->views = g_list_prepend (priv->views, new); - - gtk_signal_connect (GTK_OBJECT (new), "destroy", view_destroyed_cb, shortcuts); - - return new; -} - - -gboolean -e_shortcuts_load (EShortcuts *shortcuts, - const char *file_name) -{ - EShortcutsPrivate *priv; - char *tmp; - - g_return_val_if_fail (shortcuts != NULL, FALSE); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), FALSE); - g_return_val_if_fail (file_name == NULL || g_path_is_absolute (file_name), FALSE); - - priv = shortcuts->priv; - - if (file_name == NULL) { - if (priv->file_name == NULL) - return FALSE; - file_name = priv->file_name; - } - - if (! load_shortcuts (shortcuts, file_name)) - return FALSE; - - tmp = g_strdup (file_name); - g_free (priv->file_name); - priv->file_name = tmp; - - return TRUE; -} - -gboolean -e_shortcuts_save (EShortcuts *shortcuts, - const char *file_name) -{ - EShortcutsPrivate *priv; - char *tmp; - - g_return_val_if_fail (shortcuts != NULL, FALSE); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), FALSE); - g_return_val_if_fail (file_name == NULL || g_path_is_absolute (file_name), FALSE); - - priv = shortcuts->priv; - - if (file_name == NULL) { - if (priv->file_name == NULL) - return FALSE; - file_name = priv->file_name; - } - - if (! save_shortcuts (shortcuts, file_name)) - return FALSE; - - tmp = g_strdup (file_name); - g_free (priv->file_name); - priv->file_name = tmp; - - return TRUE; -} - - -const char * -e_shortcuts_get_uri (EShortcuts *shortcuts, int group_num, int num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *shortcut_element; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - group = g_list_nth (priv->groups, group_num)->data; - if (group == NULL) - return NULL; - - shortcut_element = g_list_nth (group->shortcuts, num); - if (shortcut_element == NULL) - return NULL; - - return shortcut_element->data; -} - - -void -e_shortcuts_remove_shortcut (EShortcuts *shortcuts, - int group_num, - int num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *p; - char *uri; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_list_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - group = (ShortcutGroup *) p->data; - - p = g_list_nth (group->shortcuts, num); - g_return_if_fail (p != NULL); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_SHORTCUT], group_num, num); - - uri = (char *) p->data; - g_free (uri); - - group->shortcuts = g_list_remove_link (group->shortcuts, p); - - make_dirty (shortcuts); -} - -void -e_shortcuts_add_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *p; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_list_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - group = (ShortcutGroup *) p->data; - - if (num == -1) - num = g_list_length (group->shortcuts); - - group->shortcuts = g_list_insert (group->shortcuts, g_strdup (uri), num); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[NEW_SHORTCUT], group_num, num); - - make_dirty (shortcuts); -} - -void -e_shortcuts_remove_group (EShortcuts *shortcuts, - int group_num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *p; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_list_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_GROUP], group_num); - - group = (ShortcutGroup *) p->data; - - e_free_string_list (group->shortcuts); - - priv->groups = g_list_remove_link (priv->groups, p); - - make_dirty (shortcuts); -} - -void -e_shortcuts_add_group (EShortcuts *shortcuts, - int group_num, - const char *group_name) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - group = g_new (ShortcutGroup, 1); - group->title = g_strdup (group_name); - group->shortcuts = NULL; - - if (group_num == -1) - group_num = g_list_length (priv->groups); - - priv->groups = g_list_insert (priv->groups, group, group_num); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[NEW_GROUP], group_num); - - make_dirty (shortcuts); -} - - -const char * -e_shortcuts_get_group_title (EShortcuts *shortcuts, - int group_num) -{ - EShortcutsPrivate *priv; - GList *group_element; - const ShortcutGroup *group; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - group_element = g_list_nth (priv->groups, group_num); - if (group_element == NULL) - return NULL; - - group = (ShortcutGroup *) group_element->data; - - return group->title; -} - - -E_MAKE_TYPE (e_shortcuts, "EShortcuts", EShortcuts, class_init, init, PARENT_TYPE) - diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h deleted file mode 100644 index 8fc5b335da..0000000000 --- a/shell/e-shortcuts.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHORTCUTS_H_ -#define _E_SHORTCUTS_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkwidget.h> - -#include "e-folder-type-registry.h" -#include "e-storage-set.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHORTCUTS (e_shortcuts_get_type ()) -#define E_SHORTCUTS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS, EShortcuts)) -#define E_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS, EShortcutsClass)) -#define E_IS_SHORTCUTS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS)) -#define E_IS_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS)) - - -typedef struct _EShortcuts EShortcuts; -typedef struct _EShortcutsPrivate EShortcutsPrivate; -typedef struct _EShortcutsClass EShortcutsClass; - -struct _EShortcuts { - GtkObject parent; - - EShortcutsPrivate *priv; -}; - -struct _EShortcutsClass { - GtkObjectClass parent_class; - - /* Signals. */ - - void (* new_group) (EShortcuts *shortcuts, int group_num); - void (* remove_group) (EShortcuts *shortcuts, int group_num); - void (* new_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); - void (* remove_shortcut) (EShortcuts *shortcuts, int group_num, int item_num);} -; - - -GtkType e_shortcuts_get_type (void); -void e_shortcuts_construct (EShortcuts *shortcuts, - EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry); -EShortcuts *e_shortcuts_new (EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry, - const char *file_name); - -GList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); -const char *e_shortcuts_get_group_title (EShortcuts *shortcuts, - int group_num); - -GList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - const char *group_title); -EStorageSet *e_shortcuts_get_storage_set (EShortcuts *shortcuts); -GtkWidget *e_shortcuts_new_view (EShortcuts *shortcuts); - -gboolean e_shortcuts_load (EShortcuts *shortcuts, - const char *path); -gboolean e_shortcuts_save (EShortcuts *shortcuts, - const char *path); - -const char *e_shortcuts_get_uri (EShortcuts *shortcuts, - int group_num, - int num); - -void e_shortcuts_remove_shortcut (EShortcuts *shortcuts, - int group_num, - int num); -void e_shortcuts_add_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri); -void e_shortcuts_remove_group (EShortcuts *shortcuts, - int group_num); -void e_shortcuts_add_group (EShortcuts *shortcuts, - int group_num, - const char *group_name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUTS_H_ */ diff --git a/shell/e-splash.c b/shell/e-splash.c deleted file mode 100644 index 8588d085b8..0000000000 --- a/shell/e-splash.c +++ /dev/null @@ -1,400 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-splash.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> -#include <gal/util/e-util.h> - -#include "e-splash.h" - - -#define PARENT_TYPE gtk_window_get_type () -static GtkWindowClass *parent_class = NULL; - -struct _Icon { - GdkPixbuf *dark_pixbuf; - GdkPixbuf *light_pixbuf; - GnomeCanvasItem *canvas_item; -}; -typedef struct _Icon Icon; - -struct _ESplashPrivate { - GnomeCanvas *canvas; - GdkPixbuf *splash_image_pixbuf; - - GList *icons; /* (Icon *) */ - int num_icons; - - int layout_idle_id; -}; - - -/* Layout constants. These need to be changed if the splash changes. */ - -#define ICON_Y 256 -#define ICON_SIZE 32 - - -/* Icon management. */ - -static GdkPixbuf * -create_darkened_pixbuf (GdkPixbuf *pixbuf) -{ - GdkPixbuf *new; - unsigned char *rowp; - int width, height; - int rowstride; - int i, j; - - new = gdk_pixbuf_copy (pixbuf); - if (! gdk_pixbuf_get_has_alpha (new)) - return new; - - width = gdk_pixbuf_get_width (new); - height = gdk_pixbuf_get_height (new); - rowstride = gdk_pixbuf_get_rowstride (new); - - rowp = gdk_pixbuf_get_pixels (new); - for (i = 0; i < height; i ++) { - unsigned char *p; - - p = rowp; - for (j = 0; j < width; j++) { - p[3] *= .25; - p += 4; - } - - rowp += rowstride; - } - - return new; -} - -static Icon * -icon_new (ESplash *splash, - GdkPixbuf *image_pixbuf) -{ - ESplashPrivate *priv; - GnomeCanvasGroup *canvas_root_group; - Icon *icon; - - priv = splash->priv; - - icon = g_new (Icon, 1); - - icon->light_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, ICON_SIZE, ICON_SIZE); - gdk_pixbuf_scale (image_pixbuf, icon->light_pixbuf, - 0, 0, - ICON_SIZE, ICON_SIZE, - 0, 0, - (double) ICON_SIZE / gdk_pixbuf_get_width (image_pixbuf), - (double) ICON_SIZE / gdk_pixbuf_get_height (image_pixbuf), - GDK_INTERP_HYPER); - - icon->dark_pixbuf = create_darkened_pixbuf (icon->light_pixbuf); - - /* Set up the canvas item to point to the dark pixbuf initially. */ - - canvas_root_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (priv->canvas)->root); - - icon->canvas_item = gnome_canvas_item_new (canvas_root_group, - GNOME_TYPE_CANVAS_PIXBUF, - "pixbuf", icon->dark_pixbuf, - NULL); - - return icon; -} - -static void -icon_free (Icon *icon) -{ - gdk_pixbuf_unref (icon->dark_pixbuf); - gdk_pixbuf_unref (icon->light_pixbuf); -/* gtk_object_unref (GTK_OBJECT (icon->canvas_item)); */ - - g_free (icon); -} - - -/* Icon layout management. */ - -static void -layout_icons (ESplash *splash) -{ - ESplashPrivate *priv; - GList *p; - double x_step; - double x, y; - - priv = splash->priv; - - x_step = ((double) gdk_pixbuf_get_width (priv->splash_image_pixbuf)) / priv->num_icons; - - x = (x_step - ICON_SIZE) / 2.0; - y = ICON_Y; - - for (p = priv->icons; p != NULL; p = p->next) { - Icon *icon; - - icon = (Icon *) p->data; - - gtk_object_set (GTK_OBJECT (icon->canvas_item), - "x", (double) x, - "y", (double) ICON_Y, - NULL); - - x += x_step; - } -} - -static int -layout_idle_cb (void *data) -{ - ESplash *splash; - ESplashPrivate *priv; - - splash = E_SPLASH (data); - priv = splash->priv; - - layout_icons (splash); - - priv->layout_idle_id = 0; - - return FALSE; -} - -static void -schedule_relayout (ESplash *splash) -{ - ESplashPrivate *priv; - - priv = splash->priv; - - if (priv->layout_idle_id != 0) - return; - - priv->layout_idle_id = gtk_idle_add (layout_idle_cb, splash); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ESplash *splash; - ESplashPrivate *priv; - GList *p; - - splash = E_SPLASH (object); - priv = splash->priv; - - if (priv->splash_image_pixbuf != NULL) - gdk_pixbuf_unref (priv->splash_image_pixbuf); - - for (p = priv->icons; p != NULL; p = p->next) { - Icon *icon; - - icon = (Icon *) p->data; - icon_free (icon); - } - - g_list_free (priv->icons); - - if (priv->layout_idle_id != 0) - gtk_idle_remove (priv->layout_idle_id); - - g_free (priv); -} - - -static void -class_init (ESplashClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - parent_class = gtk_type_class (gtk_window_get_type ()); -} - -static void -init (ESplash *splash) -{ - ESplashPrivate *priv; - - priv = g_new (ESplashPrivate, 1); - priv->canvas = NULL; - priv->splash_image_pixbuf = NULL; - priv->icons = NULL; - priv->num_icons = 0; - priv->layout_idle_id = 0; - - splash->priv = priv; -} - - -/** - * e_splash_construct: - * @splash: A pointer to an ESplash widget - * @splash_image_pixbuf: The pixbuf for the image to appear in the splash dialog - * - * Construct @splash with @splash_image_pixbuf as the splash image. - **/ -void -e_splash_construct (ESplash *splash, - GdkPixbuf *splash_image_pixbuf) -{ - ESplashPrivate *priv; - GtkWidget *canvas, *frame; - int image_width, image_height; - - g_return_if_fail (splash != NULL); - g_return_if_fail (E_IS_SPLASH (splash)); - g_return_if_fail (splash_image_pixbuf != NULL); - - priv = splash->priv; - - priv->splash_image_pixbuf = gdk_pixbuf_ref (splash_image_pixbuf); - - canvas = gnome_canvas_new_aa (); - priv->canvas = GNOME_CANVAS (canvas); - - image_width = gdk_pixbuf_get_width (splash_image_pixbuf); - image_height = gdk_pixbuf_get_height (splash_image_pixbuf); - - gtk_widget_set_usize (canvas, image_width, image_height); - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0, 0, image_width, image_height); - gtk_widget_show (canvas); - - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); - gtk_container_add (GTK_CONTAINER (frame), canvas); - gtk_widget_show (frame); - - gtk_container_add (GTK_CONTAINER (splash), frame); - - gnome_canvas_item_new (GNOME_CANVAS_GROUP (priv->canvas->root), - GNOME_TYPE_CANVAS_PIXBUF, - "pixbuf", splash_image_pixbuf, - NULL); - - gtk_object_set (GTK_OBJECT (splash), "type", GTK_WINDOW_POPUP, NULL); - gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER); - gtk_window_set_policy (GTK_WINDOW (splash), FALSE, FALSE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (splash), image_width, image_height); -} - -/** - * e_splash_new: - * - * Create a new ESplash widget. - * - * Return value: A pointer to the newly created ESplash widget. - **/ -GtkWidget * -e_splash_new (void) -{ - ESplash *new; - GdkPixbuf *splash_image_pixbuf; - - splash_image_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGES "/splash.png"); - g_return_val_if_fail (splash_image_pixbuf != NULL, NULL); - - new = gtk_type_new (e_splash_get_type ()); - e_splash_construct (new, splash_image_pixbuf); - - gdk_pixbuf_unref (splash_image_pixbuf); - - return GTK_WIDGET (new); -} - - -/** - * e_splash_add_icon: - * @splash: A pointer to an ESplash widget - * @icon_pixbuf: Pixbuf for the icon to be added - * - * Add @icon_pixbuf to the @splash. - * - * Return value: The total number of icons in the splash after the new icon has - * been added. - **/ -int -e_splash_add_icon (ESplash *splash, - GdkPixbuf *icon_pixbuf) -{ - ESplashPrivate *priv; - Icon *icon; - - g_return_val_if_fail (splash != NULL, 0); - g_return_val_if_fail (E_IS_SPLASH (splash), 0); - g_return_val_if_fail (icon_pixbuf != NULL, 0); - - priv = splash->priv; - - icon = icon_new (splash, icon_pixbuf); - priv->icons = g_list_append (priv->icons, icon); - - priv->num_icons ++; - - schedule_relayout (splash); - - return priv->num_icons; -} - -/** - * e_splash_set_icon_highlight: - * @splash: A pointer to an ESplash widget - * @num: Number of the icon whose highlight state must be changed - * @highlight: Whether the icon must be highlit or not - * - * Change the highlight state of the @num-th icon. - **/ -void -e_splash_set_icon_highlight (ESplash *splash, - int num, - gboolean highlight) -{ - ESplashPrivate *priv; - Icon *icon; - - g_return_if_fail (splash != NULL); - g_return_if_fail (E_IS_SPLASH (splash)); - - priv = splash->priv; - - icon = (Icon *) g_list_nth (priv->icons, num)->data; - - gtk_object_set (GTK_OBJECT (icon->canvas_item), - "pixbuf", highlight ? icon->light_pixbuf : icon->dark_pixbuf, - NULL); -} - - -E_MAKE_TYPE (e_splash, "ESplash", ESplash, class_init, init, PARENT_TYPE) diff --git a/shell/e-splash.h b/shell/e-splash.h deleted file mode 100644 index 4eb58d7692..0000000000 --- a/shell/e-splash.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-splash.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SPLASH_H_ -#define _E_SPLASH_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gtk/gtkwindow.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SPLASH (e_splash_get_type ()) -#define E_SPLASH(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SPLASH, ESplash)) -#define E_SPLASH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SPLASH, ESplashClass)) -#define E_IS_SPLASH(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SPLASH)) -#define E_IS_SPLASH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SPLASH)) - - -typedef struct _ESplash ESplash; -typedef struct _ESplashPrivate ESplashPrivate; -typedef struct _ESplashClass ESplashClass; - -struct _ESplash { - GtkWindow parent; - - ESplashPrivate *priv; -}; - -struct _ESplashClass { - GtkWindowClass parent_class; -}; - - -GtkType e_splash_get_type (void); -void e_splash_construct (ESplash *splash, - GdkPixbuf *splash_image); -GtkWidget *e_splash_new (void); - -int e_splash_add_icon (ESplash *splash, - GdkPixbuf *icon); -void e_splash_set_icon_highlight (ESplash *splash, - int num, - gboolean highlight); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SPLASH_H_ */ diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c deleted file mode 100644 index 08a4e77f8b..0000000000 --- a/shell/e-storage-set-view.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - * Etree-ification: Chris Toshok - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include <gal/util/e-util.h> -#include "e-util/e-gtk-utils.h" - -#include "e-shell-constants.h" - -#include "e-storage-set-view.h" - -#include <gal/e-table/e-tree-simple.h> -#include <gal/e-table/e-cell-tree.h> -#include <gal/e-table/e-cell-text.h> - -#define ETABLE_SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" draw-grid=\"true\"> \ - <ETableColumn model_col=\"0\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"render_tree\" compare=\"string\"/> \ - <ETableState> \ - <column source=\"0\"/> \ - <grouping></grouping> \ - </ETableState> \ -</ETableSpecification>" - - -#define PARENT_TYPE E_TABLE_TYPE -static ETableClass *parent_class = NULL; - -struct _EStorageSetViewPrivate { - EStorageSet *storage_set; - - ETreeModel *etree_model; - ETreePath *root_node; - - GHashTable *path_to_etree_node; - - GHashTable *type_name_to_pixbuf; - - /* Path of the row selected by the latest "cursor_change" signal. */ - const char *selected_row_path; - - gboolean show_folders; -}; - - -enum { - FOLDER_SELECTED, - STORAGE_SELECTED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* DND stuff. */ - -enum _DndTargetType { - DND_TARGET_TYPE_URI_LIST, - DND_TARGET_TYPE_E_SHORTCUT -}; -typedef enum _DndTargetType DndTargetType; - -#define URI_LIST_TYPE "text/uri-list" -#define E_SHORTCUT_TYPE "E-SHORTCUT" - -static GtkTargetEntry drag_types [] = { - { URI_LIST_TYPE, 0, DND_TARGET_TYPE_URI_LIST }, - { E_SHORTCUT_TYPE, 0, DND_TARGET_TYPE_E_SHORTCUT } -}; -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -static GtkTargetList *target_list; - - -/* Helper functions. */ - -static gboolean -add_node_to_hash (EStorageSetView *storage_set_view, - const char *path, - ETreePath *node) -{ - EStorageSetViewPrivate *priv; - char *hash_path; - - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - priv = storage_set_view->priv; - - if (g_hash_table_lookup (priv->path_to_etree_node, path) != NULL) { - g_warning ("EStorageSetView: Node already existing while adding -- %s", path); - return FALSE; - } - - hash_path = g_strdup (path); - - g_hash_table_insert (priv->path_to_etree_node, hash_path, node); - - return TRUE; -} - -static ETreePath * -lookup_node_in_hash (EStorageSetView *storage_set_view, - const char *path) -{ - EStorageSetViewPrivate *priv; - ETreePath *node; - - priv = storage_set_view->priv; - - node = g_hash_table_lookup (priv->path_to_etree_node, path); - if (node == NULL) - g_warning ("EStorageSetView: Node not found while updating -- %s", path); - - return node; -} - -static ETreePath * -remove_node_from_hash (EStorageSetView *storage_set_view, - const char *path) -{ - EStorageSetViewPrivate *priv; - ETreePath *node; - - priv = storage_set_view->priv; - - node = g_hash_table_lookup (priv->path_to_etree_node, path); - if (node == NULL) { - g_warning ("EStorageSetView: Node not found while removing -- %s", path); - return NULL; - } - - g_hash_table_remove (priv->path_to_etree_node, path); - - return node; -} - -static GdkPixbuf* -get_pixbuf_for_folder (EStorageSetView *storage_set_view, - EFolder *folder) -{ - GdkPixbuf *scaled_pixbuf; - const char *type_name; - EStorageSetViewPrivate *priv; - - priv = storage_set_view->priv; - - type_name = e_folder_get_type_string (folder); - - scaled_pixbuf = g_hash_table_lookup (priv->type_name_to_pixbuf, type_name); - - if (scaled_pixbuf == NULL) { - EFolderTypeRegistry *folder_type_registry; - EStorageSet *storage_set; - GdkPixbuf *icon_pixbuf; - - storage_set = priv->storage_set; - folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); - - icon_pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, - type_name, TRUE); - - if (icon_pixbuf == NULL) { - return NULL; - } - - scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf), - gdk_pixbuf_get_has_alpha (icon_pixbuf), - gdk_pixbuf_get_bits_per_sample (icon_pixbuf), - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); - - gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf, - 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - 0.0, 0.0, - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf), - (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf), - GDK_INTERP_HYPER); - - g_hash_table_insert (priv->type_name_to_pixbuf, g_strdup(type_name), scaled_pixbuf); - } - - return scaled_pixbuf; -} - - -/* Folder context menu. */ -/* FIXME: This should be moved somewhere else, so that also the sortcut code - can share it. */ - -#if 0 -static void -folder_context_menu_activate_cb (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], - priv->selected_row_path); -} - -static void -populate_folder_context_menu_with_common_items (EStorageSetView *storage_set_view, - BonoboUIComponent *uih) -{ - bonobo_ui_handler_menu_new_item (uih, "/Activate", - _("_View"), _("View the selected folder"), - 0, BONOBO_UI_HANDLER_PIXMAP_NONE, - NULL, 0, 0, - folder_context_menu_activate_cb, - storage_set_view); -} -#endif - -static void -popup_folder_menu (EStorageSetView *storage_set_view, - GdkEventButton *event) -{ -#if 0 - EvolutionShellComponentClient *handler; - EStorageSetViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - BonoboUIComponent *uih; - EFolder *folder; - - priv = storage_set_view->priv; - - uih = bonobo_ui_handler_new (); - bonobo_ui_handler_create_popup_menu (uih); - - folder = e_storage_set_get_folder (priv->storage_set, priv->selected_row_path); - if (folder == NULL) { - /* Uh!? */ - return; - } - - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - g_assert (folder_type_registry != NULL); - - handler = e_folder_type_registry_get_handler_for_type (folder_type_registry, - e_folder_get_type_string (folder)); - g_assert (handler != NULL); - - evolution_shell_component_client_populate_folder_context_menu (handler, - uih, - e_folder_get_physical_uri (folder), - e_folder_get_type_string (folder)); - - populate_folder_context_menu_with_common_items (storage_set_view, uih); - - bonobo_ui_handler_do_popup_menu (uih); - - bonobo_object_unref (BONOBO_OBJECT (uih)); -#endif -} - - -/* GtkObject methods. */ - -static void -path_free_func (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); -} - -static void -pixbuf_free_func (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - gdk_pixbuf_unref ((GdkPixbuf*)value); -} - -static void -destroy (GtkObject *object) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (object); - priv = storage_set_view->priv; - - /* need to destroy our tree */ - e_tree_model_node_remove (priv->etree_model, priv->root_node); - gtk_object_unref (GTK_OBJECT (priv->etree_model)); - - /* now free up all the paths stored in the hash table and - destroy the hash table itself */ - g_hash_table_foreach (priv->path_to_etree_node, path_free_func, NULL); - g_hash_table_destroy (priv->path_to_etree_node); - - /* now free up all the type_names and pixbufs stored in the - hash table and destroy the hash table itself */ - g_hash_table_foreach (priv->type_name_to_pixbuf, pixbuf_free_func, NULL); - g_hash_table_destroy (priv->type_name_to_pixbuf); - - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* ETable methods */ - -static void -etable_drag_begin (EStorageSetView *storage_set_view, - int row, int col, - GdkDragContext *context) -{ - EStorageSetViewPrivate *priv; - ETreePath *node; - - priv = storage_set_view->priv; - - node = e_tree_model_node_at_row (priv->etree_model, row); - - priv->selected_row_path = e_tree_model_node_get_data (priv->etree_model, node); -} - -static void -set_uri_list_selection (EStorageSetView *storage_set_view, - GtkSelectionData *selection_data) -{ - EStorageSetViewPrivate *priv; - char *uri_list; - - priv = storage_set_view->priv; - - /* FIXME: Get `evolution:' from somewhere instead of hardcoding it here. */ - uri_list = g_strconcat ("evolution:", priv->selected_row_path, "\n", NULL); - gtk_selection_data_set (selection_data, selection_data->target, - 8, (guchar *) uri_list, strlen (uri_list)); - g_free (uri_list); -} - -static void -set_e_shortcut_selection (EStorageSetView *storage_set_view, - GtkSelectionData *selection_data) -{ - EStorageSetViewPrivate *priv; - int shortcut_len; - char *shortcut; - const char *trailing_slash; - const char *name; - - g_return_if_fail(storage_set_view != NULL); - - priv = storage_set_view->priv; - - trailing_slash = strrchr (priv->selected_row_path, '/'); - if (trailing_slash == NULL) - name = NULL; - else - name = trailing_slash + 1; - - /* FIXME: Get `evolution:' from somewhere instead of hardcoding it here. */ - - if (name != NULL) - shortcut_len = strlen (name); - else - shortcut_len = 0; - - shortcut_len ++; /* Separating zero. */ - - shortcut_len += strlen ("evolution:"); - shortcut_len += strlen (priv->selected_row_path); - shortcut_len ++; /* Trailing zero. */ - - shortcut = g_malloc (shortcut_len); - - if (name == NULL) - sprintf (shortcut, "%cevolution:%s", '\0', priv->selected_row_path); - else - sprintf (shortcut, "%s%cevolution:%s", name, '\0', priv->selected_row_path); - - gtk_selection_data_set (selection_data, selection_data->target, - 8, (guchar *) shortcut, shortcut_len); - - g_free (shortcut); -} - -static void -etable_drag_data_get (EStorageSetView *storage_set_view, - int drag_row, - int drag_col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint32 time) -{ - switch (info) { - case DND_TARGET_TYPE_URI_LIST: - set_uri_list_selection (storage_set_view, selection_data); - break; - case DND_TARGET_TYPE_E_SHORTCUT: - set_e_shortcut_selection (storage_set_view, selection_data); - break; - default: - g_assert_not_reached (); - } -} - - -/* ETableModel Methods */ - -/* This function returns the number of columns in our ETableModel. */ -static int -etree_col_count (ETableModel *etc, void *data) -{ - return 2; -} - -/* This function duplicates the value passed to it. */ -static void * -etree_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup (value); - else - return (void *)value; -} - -/* This function frees the value passed to it. */ -static void -etree_free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col == 0) - g_free (value); -} - -/* This function creates an empty value. */ -static void * -etree_initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return g_strdup (""); - else - return NULL; -} - -/* This function reports if a value is empty. */ -static gboolean -etree_value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return !(value && *(char *)value); - else - return !value; -} - -/* This function reports if a value is empty. */ -static char * -etree_value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup(value); - else - return g_strdup(value ? "Yes" : "No"); -} - -/* ETreeModel Methods */ - -static GdkPixbuf* -etree_icon_at (ETreeModel *etree, ETreePath *tree_path, void *model_data) -{ - EStorageSetView *storage_set_view; - EStorageSet *storage_set; - EFolder *folder; - char *path; - - /* folders are from depth 2 on. depth 1 are storages and 0 is - our (invisible) root node. */ - if (e_tree_model_node_depth (etree, tree_path) < 2) - return NULL; - - storage_set_view = E_STORAGE_SET_VIEW (model_data); - storage_set = storage_set_view->priv->storage_set; - - path = (char*)e_tree_model_node_get_data (etree, tree_path); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) - return NULL; - - return get_pixbuf_for_folder (storage_set_view, folder); -} - -static void* -etree_value_at (ETreeModel *etree, ETreePath *tree_path, int col, void *model_data) -{ - EStorageSetView *storage_set_view; - EStorageSet *storage_set; - EStorage *storage; - EFolder *folder; - char *path; - - storage_set_view = E_STORAGE_SET_VIEW (model_data); - storage_set = storage_set_view->priv->storage_set; - - path = (char *) e_tree_model_node_get_data (etree, tree_path); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder != NULL) { - if (col == 0) - return (void *) e_folder_get_name (folder); - else - return (void *) e_folder_get_highlighted (folder); - } - - storage = e_storage_set_get_storage (storage_set, path + 1); - if (storage != NULL && col == 0) - return (void *) e_storage_get_name (storage); - - return NULL; -} - -static void -etree_set_value_at (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data) -{ - /* nada */ -} - -static gboolean -etree_is_editable (ETreeModel *etree, ETreePath *path, int col, void *model_data) -{ - return FALSE; -} - - -/* StorageSet signal handling. */ - -static gint -treepath_compare (ETreeModel *model, - ETreePath *node1, - ETreePath *node2) -{ - char *path1, *path2; - path1 = e_tree_model_node_get_data (model, node1); - path2 = e_tree_model_node_get_data (model, node2); - - return strcasecmp (path1, path2); -} - -static void -new_storage_cb (EStorageSet *storage_set, - EStorage *storage, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreePath *node; - char *path; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL); - - node = e_tree_model_node_insert_id (priv->etree_model, - priv->root_node, - -1, path, path); - - e_tree_model_node_set_expanded (priv->etree_model, node, TRUE); - - if (! add_node_to_hash (storage_set_view, path, node)) { - g_free (path); - e_tree_model_node_remove (priv->etree_model, node); - return; - } - - /* FIXME: We want a more specialized sort, e.g. the local folders should always be - on top. */ - e_tree_model_node_set_compare_function (priv->etree_model, priv->root_node, treepath_compare); -} - -static void -removed_storage_cb (EStorageSet *storage_set, - EStorage *storage, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath *node; - char *path; - char *node_data; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - etree = priv->etree_model; - - path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL); - node = remove_node_from_hash (storage_set_view, path); - g_free (path); - - node_data = e_tree_model_node_remove (etree, node); - g_free (node_data); -} - -static void -new_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath *parent_node; - ETreePath *new_node; - const char *last_separator; - char *parent_path; - char *copy_of_path; - - g_return_if_fail (g_path_is_absolute (path)); - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - etree = priv->etree_model; - - last_separator = strrchr (path, G_DIR_SEPARATOR); - - parent_path = g_strndup (path, last_separator - path); - parent_node = g_hash_table_lookup (priv->path_to_etree_node, parent_path); - if (parent_node == NULL) { - g_print ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s\n", - parent_path); - g_free (parent_path); - return; - } - - g_free (parent_path); - - copy_of_path = g_strdup (path); - new_node = e_tree_model_node_insert_id (etree, parent_node, -1, copy_of_path, copy_of_path); - e_tree_model_node_set_compare_function (priv->etree_model, new_node, treepath_compare); - - if (! add_node_to_hash (storage_set_view, path, new_node)) { - e_tree_model_node_remove (etree, new_node); - return; - } - - e_tree_model_node_sort (priv->etree_model, parent_node); -} - -static void -updated_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath *node; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - etree = priv->etree_model; - - node = lookup_node_in_hash (storage_set_view, path); - e_tree_model_node_changed (etree, node); -} - -static void -removed_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath *node; - char *node_data; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - etree = priv->etree_model; - - node = remove_node_from_hash (storage_set_view, path); - node_data = e_tree_model_node_remove (etree, node); - g_free (node_data); -} - - -static void -class_init (EStorageSetViewClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (e_table_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[FOLDER_SELECTED] - = gtk_signal_new ("folder_selected", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - signals[STORAGE_SELECTED] - = gtk_signal_new ("storage_selected", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetViewClass, storage_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - /* Set up DND. */ - - target_list = gtk_target_list_new (drag_types, num_drag_types); - g_assert (target_list != NULL); -} - -static void -init (EStorageSetView *storage_set_view) -{ - EStorageSetViewPrivate *priv; - - priv = g_new (EStorageSetViewPrivate, 1); - - priv->storage_set = NULL; - priv->path_to_etree_node = g_hash_table_new (g_str_hash, g_str_equal); - priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal); - priv->selected_row_path = NULL; - priv->show_folders = TRUE; - - storage_set_view->priv = priv; -} - - -/* Handling of the "changed" signal in EFolders displayed in the EStorageSetView. */ - -struct _FolderChangedCallbackData { - EStorageSetView *storage_set_view; - char *path; -}; -typedef struct _FolderChangedCallbackData FolderChangedCallbackData; - -static void -folder_changed_callback_data_destroy_notify (void *data) -{ - FolderChangedCallbackData *callback_data; - - callback_data = (FolderChangedCallbackData *) data; - - g_free (callback_data->path); - g_free (callback_data); -} - -static void -folder_changed_cb (EFolder *folder, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - FolderChangedCallbackData *callback_data; - ETreePath *node; - - callback_data = (FolderChangedCallbackData *) data; - - storage_set_view = callback_data->storage_set_view; - priv = callback_data->storage_set_view->priv; - - node = g_hash_table_lookup (priv->path_to_etree_node, callback_data->path); - if (node == NULL) { - g_warning ("EStorageSetView -- EFolder::changed emitted for a folder whose path I don't know."); - return; - } - - e_tree_model_node_changed (priv->etree_model, node); -} - - -static void -insert_folders (EStorageSetView *storage_set_view, - ETreePath *parent, - EStorage *storage, - const char *path) -{ - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath *node; - GList *folder_path_list; - GList *p; - const char *storage_name; - - priv = storage_set_view->priv; - etree = priv->etree_model; - - storage_name = e_storage_get_name (storage); - - folder_path_list = e_storage_get_subfolder_paths (storage, path); - if (folder_path_list == NULL) - return; - - for (p = folder_path_list; p != NULL; p = p->next) { - FolderChangedCallbackData *folder_changed_callback_data; - EFolder *folder; - const char *folder_name; - const char *folder_path; - char *full_path; - - folder_path = (const char *) p->data; - folder = e_storage_get_folder (storage, folder_path); - folder_name = e_folder_get_name (folder); - - full_path = g_strconcat ("/", storage_name, folder_path, NULL); - node = e_tree_model_node_insert_id (etree, parent, -1, (void *) full_path, full_path); - add_node_to_hash (storage_set_view, full_path, node); - e_tree_model_node_set_compare_function (priv->etree_model, node, treepath_compare); - - insert_folders (storage_set_view, node, storage, folder_path); - - folder_changed_callback_data = g_new (FolderChangedCallbackData, 1); - folder_changed_callback_data->storage_set_view = storage_set_view; - folder_changed_callback_data->path = g_strdup (folder_path); - - e_gtk_signal_connect_full_while_alive (GTK_OBJECT (folder), "changed", - GTK_SIGNAL_FUNC (folder_changed_cb), - NULL, - folder_changed_callback_data, - folder_changed_callback_data_destroy_notify, - FALSE, FALSE, - GTK_OBJECT (storage_set_view)); - } - - e_free_string_list (folder_path_list); -} - -static void -insert_storages (EStorageSetView *storage_set_view) -{ - EStorageSetViewPrivate *priv; - EStorageSet *storage_set; - GList *storage_list; - GList *p; - - priv = storage_set_view->priv; - - storage_set = priv->storage_set; - - storage_list = e_storage_set_get_storage_list (storage_set); - - for (p = storage_list; p != NULL; p = p->next) { - EStorage *storage = E_STORAGE (p->data); - const char *name; - char *path; - ETreePath *parent; - - name = e_storage_get_name (storage); - path = g_strconcat ("/", name, NULL); - - parent = e_tree_model_node_insert_id (priv->etree_model, priv->root_node, - -1, path, path); - e_tree_model_node_set_expanded (priv->etree_model, parent, TRUE); - e_tree_model_node_set_compare_function (priv->etree_model, parent, treepath_compare); - - g_hash_table_insert (priv->path_to_etree_node, path, parent); - - if (priv->show_folders) - insert_folders (storage_set_view, parent, storage, "/"); - } - - e_free_object_list (storage_list); -} - -static void -right_click (EStorageSetView *storage_set_view, int row, int col, - GdkEventButton *event, gboolean *ret) -{ - EStorageSetViewPrivate *priv; - - priv = storage_set_view->priv; - - popup_folder_menu (storage_set_view, event); -} - -static void -on_cursor_change (EStorageSetView *storage_set_view, int row, gpointer user_data) -{ - ETreePath *node; - EStorageSetViewPrivate *priv; - - priv = storage_set_view->priv; - - node = e_tree_model_node_at_row (priv->etree_model, row); - - priv->selected_row_path = e_tree_model_node_get_data (priv->etree_model, node); - - if (e_tree_model_node_depth (priv->etree_model, node) >= 2) { - /* it was a folder */ - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], - priv->selected_row_path); - } - else { - /* it was a storage */ - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[STORAGE_SELECTED], - priv->selected_row_path); - } -} - -void -e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set) -{ - EStorageSetViewPrivate *priv; - ETableExtras *extras; - ECell *cell; - - g_return_if_fail (storage_set_view != NULL); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - - priv = storage_set_view->priv; - - priv->etree_model = e_tree_simple_new (etree_col_count, - etree_duplicate_value, - etree_free_value, - etree_initialize_value, - etree_value_is_empty, - etree_value_to_string, - etree_icon_at, - etree_value_at, - etree_set_value_at, - etree_is_editable, - storage_set_view); - e_tree_model_root_node_set_visible (priv->etree_model, FALSE); - - priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node"); - - extras = e_table_extras_new (); - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), "bold_column", 1, NULL); - e_table_extras_add_cell (extras, "render_tree", - e_cell_tree_new (NULL, NULL, TRUE, cell)); - - e_table_construct (E_TABLE (storage_set_view), E_TABLE_MODEL(priv->etree_model), extras, - ETABLE_SPEC, NULL); - gtk_object_unref (GTK_OBJECT (extras)); - - e_table_drag_source_set (E_TABLE (storage_set_view), GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE); - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; - - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_storage", - GTK_SIGNAL_FUNC (new_storage_cb), storage_set_view, - GTK_OBJECT (storage_set_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "removed_storage", - GTK_SIGNAL_FUNC (removed_storage_cb), storage_set_view, - GTK_OBJECT (storage_set_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_folder", - GTK_SIGNAL_FUNC (new_folder_cb), storage_set_view, - GTK_OBJECT (storage_set_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "updated_folder", - GTK_SIGNAL_FUNC (updated_folder_cb), storage_set_view, - GTK_OBJECT (storage_set_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "removed_folder", - GTK_SIGNAL_FUNC (removed_folder_cb), storage_set_view, - GTK_OBJECT (storage_set_view)); - - gtk_signal_connect (GTK_OBJECT (storage_set_view), "right_click", - GTK_SIGNAL_FUNC (right_click), GTK_OBJECT(storage_set_view)); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "cursor_change", - GTK_SIGNAL_FUNC (on_cursor_change), GTK_OBJECT(storage_set_view)); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "table_drag_begin", - GTK_SIGNAL_FUNC (etable_drag_begin), GTK_OBJECT(storage_set_view)); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "table_drag_data_get", - GTK_SIGNAL_FUNC (etable_drag_data_get), GTK_OBJECT(storage_set_view)); - - insert_storages (storage_set_view); -} - -GtkWidget * -e_storage_set_view_new (EStorageSet *storage_set) -{ - GtkWidget *new; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - new = gtk_type_new (e_storage_set_view_get_type ()); - e_storage_set_view_construct (E_STORAGE_SET_VIEW (new), storage_set); - - return new; -} - - -void -e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, - const char *path) -{ - EStorageSetViewPrivate *priv; - ETreePath *node; - - g_return_if_fail (storage_set_view != NULL); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); - g_return_if_fail (path != NULL && g_path_is_absolute (path)); - - priv = storage_set_view->priv; - - node = g_hash_table_lookup (priv->path_to_etree_node, path); - if (node == NULL) { - return; - } - - e_table_set_cursor_row (E_TABLE (storage_set_view), - e_tree_model_row_of_node (priv->etree_model, node)); - - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], path); -} - -const char * -e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view) -{ - EStorageSetViewPrivate *priv; - ETreePath *etree_node; - const char *path; - int row; - - g_return_val_if_fail (storage_set_view != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), NULL); - - priv = storage_set_view->priv; - - if (!priv->show_folders) - return NULL; /* Mmh! */ - - row = e_table_get_cursor_row (E_TABLE (storage_set_view)); - etree_node = e_tree_model_node_at_row (priv->etree_model, row); - - if (etree_node == NULL) - return NULL; /* Mmh? */ - - path = (char*)e_tree_model_node_get_data(priv->etree_model, etree_node); - - return path; -} - -void -e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view, - gboolean show) -{ - EStorageSetViewPrivate *priv; - - g_return_if_fail (storage_set_view != NULL); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); - - priv = storage_set_view->priv; - - if (show == priv->show_folders) - return; - - /* tear down existing tree and hash table mappings */ - e_tree_model_node_remove (priv->etree_model, priv->root_node); - g_hash_table_foreach (priv->path_to_etree_node, path_free_func, NULL); - - /* now re-add the root node */ - priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node"); - - /* then reinsert the storages after setting the "show_folders" - flag. insert_storages will call insert_folders if - show_folders is TRUE */ - - priv->show_folders = show; - insert_storages (storage_set_view); -} - -gboolean -e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view) -{ - return storage_set_view->priv->show_folders; -} - - -E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h deleted file mode 100644 index f1aac5acdc..0000000000 --- a/shell/e-storage-set-view.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_STORAGE_SET_VIEW_H__ -#define __E_STORAGE_SET_VIEW_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gal/e-table/e-table.h> -#include "e-storage-set.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE_SET_VIEW (e_storage_set_view_get_type ()) -#define E_STORAGE_SET_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE_SET_VIEW, EStorageSetView)) -#define E_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE_SET_VIEW, EStorageSetViewClass)) -#define E_IS_STORAGE_SET_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE_SET_VIEW)) -#define E_IS_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE_SET_VIEW)) - - -typedef struct _EStorageSetView EStorageSetView; -typedef struct _EStorageSetViewPrivate EStorageSetViewPrivate; -typedef struct _EStorageSetViewClass EStorageSetViewClass; - -struct _EStorageSetView { - ETable parent; - - EStorageSetViewPrivate *priv; -}; - -struct _EStorageSetViewClass { - ETableClass parent_class; - - /* Signals. */ - - void (* folder_selected) (EStorageSetView *storage_set_view, - const char *uri); - void (* storage_selected) (EStorageSetView *storage_set_view, - const char *uri); -}; - - -GtkType e_storage_set_view_get_type (void); -GtkWidget *e_storage_set_view_new (EStorageSet *storage_set); -void e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set); -void e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, - const char *path); -const char *e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view); - -void e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view, - gboolean show); -gboolean e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_STORAGE_SET_VIEW_H__ */ diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c deleted file mode 100644 index 246af39f68..0000000000 --- a/shell/e-storage-set.c +++ /dev/null @@ -1,604 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <string.h> - -#include <gal/util/e-util.h> - -#include "e-storage-set-view.h" -#include "e-storage-set.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT - -static GtkObjectClass *parent_class = NULL; - -/* This is just to make GHashTable happy. */ -struct _NamedStorage { - char *name; - EStorage *storage; -}; -typedef struct _NamedStorage NamedStorage; - -struct _EStorageSetPrivate { - GList *storages; /* EStorage */ - GHashTable *name_to_named_storage; - - EFolderTypeRegistry *folder_type_registry; -}; - -enum { - NEW_STORAGE, - REMOVED_STORAGE, - NEW_FOLDER, - UPDATED_FOLDER, - REMOVED_FOLDER, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static NamedStorage * -named_storage_new (EStorage *storage) -{ - NamedStorage *new; - - new = g_new (NamedStorage, 1); - new->name = g_strdup (e_storage_get_name (storage)); - new->storage = storage; - - return new; -} - -static void -named_storage_destroy (NamedStorage *named_storage) -{ - g_free (named_storage->name); - g_free (named_storage); -} - -static gboolean -name_to_named_storage_foreach_destroy (void *key, - void *value, - void *user_data) -{ - NamedStorage *named_storage; - - named_storage = (NamedStorage *) value; - named_storage_destroy (named_storage); - - return TRUE; -} - - -/* Handling for signals coming from the EStorages. */ - -static char * -make_full_path (EStorage *storage, - const char *path) -{ - const char *storage_name; - char *full_path; - - storage_name = e_storage_get_name (storage); - - if (! g_path_is_absolute (path)) - full_path = g_strconcat (G_DIR_SEPARATOR_S, storage_name, - G_DIR_SEPARATOR_S, path, NULL); - else - full_path = g_strconcat (G_DIR_SEPARATOR_S, storage_name, - path, NULL); - - return full_path; -} - -static void -storage_new_folder_cb (EStorage *storage, - const char *path, - void *data) -{ - EStorageSet *storage_set; - char *full_path; - - storage_set = E_STORAGE_SET (data); - - full_path = make_full_path (storage, path); - gtk_signal_emit (GTK_OBJECT (storage_set), signals[NEW_FOLDER], full_path); - g_free (full_path); -} - -static void -storage_updated_folder_cb (EStorage *storage, - const char *path, - void *data) -{ - EStorageSet *storage_set; - char *full_path; - - storage_set = E_STORAGE_SET (data); - - full_path = make_full_path (storage, path); - gtk_signal_emit (GTK_OBJECT (storage_set), signals[UPDATED_FOLDER], full_path); - g_free (full_path); -} - -static void -storage_removed_folder_cb (EStorage *storage, - const char *path, - void *data) -{ - EStorageSet *storage_set; - char *full_path; - - storage_set = E_STORAGE_SET (data); - - full_path = make_full_path (storage, path); - g_print ("EStorageSet: Removed folder -- %s\n", full_path); - gtk_signal_emit (GTK_OBJECT (storage_set), signals[REMOVED_FOLDER], full_path); - g_free (full_path); -} - - -static EStorage * -get_storage_for_path (EStorageSet *storage_set, - const char *path, - const char **subpath_return) -{ - EStorage *storage; - char *storage_name; - const char *first_separator; - - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - /* Skip initial separator. */ - path++; - - first_separator = strchr (path, G_DIR_SEPARATOR); - - if (first_separator == NULL || first_separator == path || first_separator[1] == 0) { - *subpath_return = NULL; - return NULL; - } - - storage_name = g_strndup (path, first_separator - path); - storage = e_storage_set_get_storage (storage_set, storage_name); - g_free (storage_name); - - *subpath_return = first_separator; - - return storage; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EStorageSet *storage_set; - EStorageSetPrivate *priv; - - storage_set = E_STORAGE_SET (object); - priv = storage_set->priv; - - e_free_object_list (priv->storages); - - gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); - - g_hash_table_foreach (priv->name_to_named_storage, - (GHFunc) named_storage_destroy, NULL); - g_hash_table_destroy (priv->name_to_named_storage); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EStorageSetClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (gtk_object_get_type ()); - object_class = GTK_OBJECT_CLASS (klass); - - object_class->destroy = destroy; - - signals[NEW_STORAGE] = - gtk_signal_new ("new_storage", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetClass, new_storage), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - signals[REMOVED_STORAGE] = - gtk_signal_new ("removed_storage", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetClass, removed_storage), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - signals[NEW_FOLDER] = - gtk_signal_new ("new_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetClass, new_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - signals[UPDATED_FOLDER] = - gtk_signal_new ("updated_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetClass, updated_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - signals[REMOVED_FOLDER] = - gtk_signal_new ("removed_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetClass, removed_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EStorageSet *storage_set) -{ - EStorageSetPrivate *priv; - - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - - priv = g_new (EStorageSetPrivate, 1); - priv->storages = NULL; - priv->name_to_named_storage = g_hash_table_new (g_str_hash, g_str_equal); - priv->folder_type_registry = NULL; - - storage_set->priv = priv; -} - - -void -e_storage_set_construct (EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry) -{ - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - - GTK_OBJECT_UNSET_FLAGS (storage_set, GTK_FLOATING); - - gtk_object_ref (GTK_OBJECT (folder_type_registry)); - storage_set->priv->folder_type_registry = folder_type_registry; -} - -EStorageSet * -e_storage_set_new (EFolderTypeRegistry *folder_type_registry) -{ - EStorageSet *new; - - new = gtk_type_new (e_storage_set_get_type ()); - - e_storage_set_construct (new, folder_type_registry); - - return new; -} - - -GList * -e_storage_set_get_storage_list (EStorageSet *storage_set) -{ - EStorageSetPrivate *priv; - GList *list; - GList *p; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - priv = storage_set->priv; - - list = NULL; - for (p = priv->storages; p != NULL; p = p->next) { - gtk_object_ref (GTK_OBJECT (p->data)); - list = g_list_prepend (list, p->data); - } - - return g_list_reverse (list); /* Lame. */ -} - -/** - * e_storage_set_add_storage: - * @storage_set: - * @storage: - * - * Add @storage to @storage_set. Notice that will ref the storage. - **/ -gboolean -e_storage_set_add_storage (EStorageSet *storage_set, - EStorage *storage) -{ - EStorageSetPrivate *priv; - const char *storage_name; - NamedStorage *named_storage; - - g_return_val_if_fail (storage_set != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), FALSE); - g_return_val_if_fail (storage != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); - - priv = storage_set->priv; - - storage_name = e_storage_get_name (storage); - if (g_hash_table_lookup (priv->name_to_named_storage, storage_name) != NULL) - return FALSE; - - gtk_object_ref (GTK_OBJECT (storage)); - - gtk_signal_connect (GTK_OBJECT (storage), "new_folder", - GTK_SIGNAL_FUNC (storage_new_folder_cb), storage_set); - gtk_signal_connect (GTK_OBJECT (storage), "updated_folder", - GTK_SIGNAL_FUNC (storage_updated_folder_cb), storage_set); - gtk_signal_connect (GTK_OBJECT (storage), "removed_folder", - GTK_SIGNAL_FUNC (storage_removed_folder_cb), storage_set); - - priv->storages = g_list_append (priv->storages, storage); - - named_storage = named_storage_new (storage); - g_hash_table_insert (priv->name_to_named_storage, named_storage->name, named_storage); - - gtk_signal_emit (GTK_OBJECT (storage_set), signals[NEW_STORAGE], storage); - - return TRUE; -} - -gboolean -e_storage_set_remove_storage (EStorageSet *storage_set, - EStorage *storage) -{ - EStorageSetPrivate *priv; - NamedStorage *named_storage; - - g_return_val_if_fail (storage_set != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), FALSE); - g_return_val_if_fail (storage != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); - - priv = storage_set->priv; - - named_storage = g_hash_table_lookup (priv->name_to_named_storage, - e_storage_get_name (storage)); - if (named_storage == NULL) - return FALSE; - - g_hash_table_remove (priv->name_to_named_storage, named_storage->name); - named_storage_destroy (named_storage); - - priv->storages = g_list_remove (priv->storages, storage); - - gtk_signal_emit (GTK_OBJECT (storage_set), signals[REMOVED_STORAGE], storage); - gtk_object_unref (GTK_OBJECT (storage)); - - return TRUE; -} - -void -e_storage_set_remove_all_storages (EStorageSet *storage_set) -{ - EStorageSetPrivate *priv; - GList *p; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - - priv = storage_set->priv; - - for (p = priv->storages; p != NULL; p = p->next) { - EStorage *storage; - - storage = E_STORAGE (p->data); - - gtk_signal_emit (GTK_OBJECT (storage_set), signals[REMOVED_STORAGE], storage); - gtk_object_unref (GTK_OBJECT (storage)); - } - - g_hash_table_foreach_remove (priv->name_to_named_storage, - name_to_named_storage_foreach_destroy, - NULL); - - g_list_free (priv->storages); - priv->storages = NULL; -} - - -EStorage * -e_storage_set_get_storage (EStorageSet *storage_set, - const char *name) -{ - EStorageSetPrivate *priv; - NamedStorage *named_storage; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - g_return_val_if_fail (name != NULL, NULL); - - priv = storage_set->priv; - - named_storage = g_hash_table_lookup (priv->name_to_named_storage, name); - if (named_storage == NULL) - return NULL; - else - return named_storage->storage; -} - -EFolder * -e_storage_set_get_folder (EStorageSet *storage_set, - const char *path) -{ - EStorage *storage; - const char *subpath; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - storage = get_storage_for_path (storage_set, path, &subpath); - if (storage == NULL) - return NULL; - - return e_storage_get_folder (storage, subpath); -} - - -GtkWidget * -e_storage_set_new_view (EStorageSet *storage_set) -{ - GtkWidget *storage_set_view; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - storage_set_view = e_storage_set_view_new (storage_set); - - return storage_set_view; -} - - -void -e_storage_set_async_create_folder (EStorageSet *storage_set, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - EStorage *storage; - const char *subpath; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - g_return_if_fail (path != NULL); - g_return_if_fail (g_path_is_absolute (path)); - g_return_if_fail (type != NULL); - g_return_if_fail (callback != NULL); - - storage = get_storage_for_path (storage_set, path, &subpath); - - e_storage_async_create_folder (storage, subpath, type, description, callback, data); -} - -void -e_storage_set_async_remove_folder (EStorageSet *storage_set, - const char *path, - EStorageResultCallback callback, - void *data) -{ - EStorage *storage; - const char *subpath; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - g_return_if_fail (path != NULL); - g_return_if_fail (g_path_is_absolute (path)); - g_return_if_fail (callback != NULL); - - storage = get_storage_for_path (storage_set, path, &subpath); - - e_storage_async_remove_folder (storage, path, callback, data); -} - - -EFolderTypeRegistry * -e_storage_set_get_folder_type_registry (EStorageSet *storage_set) -{ - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - return storage_set->priv->folder_type_registry; -} - - -/* Utility functions. */ - -/** - * e_storage_set_get_path_for_physical_uri: - * @storage_set: A storage set - * @physical_uri: A physical URI - * - * Retrieve the path of the folder whose physical URI matches @physical_uri. - * - * Return value: - **/ -char * -e_storage_set_get_path_for_physical_uri (EStorageSet *storage_set, - const char *physical_uri) -{ - EStorageSetPrivate *priv; - GList *p; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - g_return_val_if_fail (physical_uri != NULL, NULL); - - priv = storage_set->priv; - - for (p = priv->storages; p != NULL; p = p->next) { - EStorage *storage; - char *storage_path; - - storage = E_STORAGE (p->data); - - storage_path = e_storage_get_path_for_physical_uri (storage, physical_uri); - if (storage_path != NULL) { - char *storage_set_path; - - storage_set_path = g_strconcat (G_DIR_SEPARATOR_S, - e_storage_get_name (storage), - storage_path, - NULL); - g_free (storage_path); - - return storage_set_path; - } - } - - return NULL; -} - - -E_MAKE_TYPE (e_storage_set, "EStorageSet", EStorageSet, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-set.h b/shell/e-storage-set.h deleted file mode 100644 index 887eac5134..0000000000 --- a/shell/e-storage-set.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_STORAGE_SET_H_ -#define _E_STORAGE_SET_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkwidget.h> - -#include "e-folder-type-registry.h" -#include "e-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE_SET (e_storage_set_get_type ()) -#define E_STORAGE_SET(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE_SET, EStorageSet)) -#define E_STORAGE_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE_SET, EStorageSetClass)) -#define E_IS_STORAGE_SET(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE_SET)) -#define E_IS_STORAGE_SET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE_SET)) - - -typedef struct _EStorageSet EStorageSet; -typedef struct _EStorageSetPrivate EStorageSetPrivate; -typedef struct _EStorageSetClass EStorageSetClass; - -struct _EStorageSet { - GtkObject parent; - - EStorageSetPrivate *priv; -}; - -struct _EStorageSetClass { - GtkObjectClass parent_class; - - /* Signals. */ - - void (* new_storage) (EStorageSet *storage_set, EStorage *storage); - void (* removed_storage) (EStorageSet *storage_set, EStorage *storage); - /* FIXME? Inconsistency between storage and folders. */ - void (* new_folder) (EStorageSet *storage_set, const char *path); - void (* updated_folder) (EStorageSet *storage_set, const char *path); - void (* removed_folder) (EStorageSet *storage_set, const char *path); -}; - - -GtkType e_storage_set_get_type (void); -void e_storage_set_construct (EStorageSet *storage_set, - EFolderTypeRegistry *folder_type_registry); -EStorageSet *e_storage_set_new (EFolderTypeRegistry *folder_type_registry); - -gboolean e_storage_set_add_storage (EStorageSet *storage_set, - EStorage *storage); -gboolean e_storage_set_remove_storage (EStorageSet *storage_set, - EStorage *storage); -void e_storage_set_remove_all_storages (EStorageSet *storage_set); - -GList *e_storage_set_get_storage_list (EStorageSet *storage_set); -EStorage *e_storage_set_get_storage (EStorageSet *storage_set, - const char *storage_name); -EFolder *e_storage_set_get_folder (EStorageSet *storage_set, - const char *path); - -GtkWidget *e_storage_set_new_view (EStorageSet *storage_set); - -void e_storage_set_async_create_folder (EStorageSet *storage_set, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data); -void e_storage_set_async_remove_folder (EStorageSet *storage_set, - const char *path, - EStorageResultCallback callback, - void *data); - -EFolderTypeRegistry *e_storage_set_get_folder_type_registry (EStorageSet *storage_set); - -/* Utility functions. */ - -char *e_storage_set_get_path_for_physical_uri (EStorageSet *storage_set, - const char *physical_uri); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_STORAGE_SET_H_ */ diff --git a/shell/e-storage.c b/shell/e-storage.c deleted file mode 100644 index 3ea687716c..0000000000 --- a/shell/e-storage.c +++ /dev/null @@ -1,493 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> - -#include <gnome.h> - -#include <gal/util/e-util.h> - -#include "e-folder-tree.h" - -#include "e-storage.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -#define ES_CLASS(obj) \ - E_STORAGE_CLASS (GTK_OBJECT (obj)->klass) - -struct _EStoragePrivate { - EFolderTree *folder_tree; -}; - -enum { - NEW_FOLDER, - UPDATED_FOLDER, - REMOVED_FOLDER, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Destroy notification function for the folders in the tree. */ - -static void -folder_destroy_notify (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - EFolder *e_folder; - - if (data == NULL) { - /* The root folder has no EFolder associated to it. */ - return; - } - - e_folder = E_FOLDER (data); - gtk_object_unref (GTK_OBJECT (e_folder)); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EStorage *storage; - EStoragePrivate *priv; - - storage = E_STORAGE (object); - priv = storage->priv; - - if (priv->folder_tree != NULL) - e_folder_tree_destroy (priv->folder_tree); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EStorage methods. */ - -static GList * -impl_get_subfolder_paths (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - - priv = storage->priv; - - return e_folder_tree_get_subfolders (priv->folder_tree, path); -} - -static EFolder * -impl_get_folder (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - EFolder *e_folder; - - priv = storage->priv; - - e_folder = (EFolder *) e_folder_tree_get_folder (priv->folder_tree, path); - - return e_folder; -} - -static const char * -impl_get_name (EStorage *storage) -{ - return _("(No name)"); -} - -static void -impl_async_create_folder (EStorage *storage, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - (* callback) (storage, E_STORAGE_NOTIMPLEMENTED, data); -} - -static void -impl_async_remove_folder (EStorage *storage, - const char *path, - EStorageResultCallback callback, - void *data) -{ - (* callback) (storage, E_STORAGE_NOTIMPLEMENTED, data); -} - - -/* Initialization. */ - -static void -class_init (EStorageClass *class) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (class); - parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class->destroy = destroy; - - class->get_subfolder_paths = impl_get_subfolder_paths; - class->get_folder = impl_get_folder; - class->get_name = impl_get_name; - class->async_create_folder = impl_async_create_folder; - class->async_remove_folder = impl_async_remove_folder; - - signals[NEW_FOLDER] = - gtk_signal_new ("new_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageClass, new_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - signals[UPDATED_FOLDER] = - gtk_signal_new ("updated_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageClass, updated_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - signals[REMOVED_FOLDER] = - gtk_signal_new ("removed_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageClass, removed_folder), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EStorage *storage) -{ - EStoragePrivate *priv; - - priv = g_new (EStoragePrivate, 1); - - priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL); - - storage->priv = priv; -} - - -/* Creation. */ - -void -e_storage_construct (EStorage *storage) -{ - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING); -} - -EStorage * -e_storage_new (void) -{ - EStorage *new; - - new = gtk_type_new (e_storage_get_type ()); - - e_storage_construct (new); - - return new; -} - - -gboolean -e_storage_path_is_absolute (const char *path) -{ - g_return_val_if_fail (path != NULL, FALSE); - - return *path == G_DIR_SEPARATOR; -} - -gboolean -e_storage_path_is_relative (const char *path) -{ - g_return_val_if_fail (path != NULL, FALSE); - - return *path != G_DIR_SEPARATOR; -} - - -GList * -e_storage_get_subfolder_paths (EStorage *storage, - const char *path) -{ - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (g_path_is_absolute (path), NULL); - - return (* ES_CLASS (storage)->get_subfolder_paths) (storage, path); -} - -EFolder * -e_storage_get_folder (EStorage *storage, - const char *path) -{ - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (e_storage_path_is_absolute (path), NULL); - - return (* ES_CLASS (storage)->get_folder) (storage, path); -} - -const char * -e_storage_get_name (EStorage *storage) -{ - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - return (* ES_CLASS (storage)->get_name) (storage); -} - - -/* Folder operations. */ - -void -e_storage_async_create_folder (EStorage *storage, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - g_return_if_fail (path != NULL); - g_return_if_fail (g_path_is_absolute (path)); - g_return_if_fail (type != NULL); - g_return_if_fail (callback != NULL); - - (* ES_CLASS (storage)->async_create_folder) (storage, path, type, description, callback, data); -} - -void -e_storage_async_remove_folder (EStorage *storage, - const char *path, - EStorageResultCallback callback, - void *data) -{ - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - g_return_if_fail (path != NULL); - g_return_if_fail (g_path_is_absolute (path)); - g_return_if_fail (callback != NULL); - - (* ES_CLASS (storage)->async_remove_folder) (storage, path, callback, data); -} - - -const char * -e_storage_result_to_string (EStorageResult result) -{ - switch (result) { - case E_STORAGE_OK: - return _("No error"); - case E_STORAGE_GENERICERROR: - return _("Generic error"); - case E_STORAGE_EXISTS: - return _("A folder with the same name already exists"); - case E_STORAGE_INVALIDTYPE: - return _("The specified folder type is not valid"); - case E_STORAGE_IOERROR: - return _("I/O error"); - case E_STORAGE_NOSPACE: - return _("Not enough space to create the folder"); - case E_STORAGE_NOTFOUND: - return _("The specified folder was not found"); - case E_STORAGE_NOTIMPLEMENTED: - return _("Function not implemented in this storage"); - case E_STORAGE_PERMISSIONDENIED: - return _("Permission denied"); - case E_STORAGE_UNSUPPORTEDOPERATION: - return _("Operation not supported"); - case E_STORAGE_UNSUPPORTEDTYPE: - return _("The specified type is not supported in this storage"); - default: - return _("Unknown error"); - } -} - - -/* Public utility functions. */ - -struct _GetPathForPhysicalUriForeachData { - const char *physical_uri; - char *retval; -}; -typedef struct _GetPathForPhysicalUriForeachData GetPathForPhysicalUriForeachData; - -static void -get_path_for_physical_uri_foreach (EFolderTree *folder_tree, - const char *path, - void *path_data, - void *user_data) -{ - GetPathForPhysicalUriForeachData *foreach_data; - const char *physical_uri; - EFolder *e_folder; - - foreach_data = (GetPathForPhysicalUriForeachData *) user_data; - if (foreach_data->retval != NULL) - return; - - e_folder = (EFolder *) path_data; - if (e_folder == NULL) - return; - - physical_uri = e_folder_get_physical_uri (e_folder); - - if (strcmp (foreach_data->physical_uri, physical_uri) == 0) - foreach_data->retval = g_strdup (path); -} - -/** - * e_storage_get_path_for_physical_uri: - * @storage: A storage - * @physical_uri: A physical URI - * - * Look for the folder having the specified @physical_uri. - * - * Return value: The path of the folder having the specified @physical_uri in - * @storage. If such a folder does not exist, just return NULL. The return - * value must be freed by the caller. - **/ -char * -e_storage_get_path_for_physical_uri (EStorage *storage, - const char *physical_uri) -{ - GetPathForPhysicalUriForeachData foreach_data; - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - g_return_val_if_fail (physical_uri != NULL, NULL); - - priv = storage->priv; - - foreach_data.physical_uri = physical_uri; - foreach_data.retval = NULL; - - e_folder_tree_foreach (priv->folder_tree, get_path_for_physical_uri_foreach, &foreach_data); - - return foreach_data.retval; -} - - -/* Protected functions. */ - -/* These functions are used by subclasses to add and remove folders from the - state stored in the storage object. */ - -gboolean -e_storage_new_folder (EStorage *storage, - const char *path, - EFolder *e_folder) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - g_return_val_if_fail (e_folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (e_folder), FALSE); - - priv = storage->priv; - - if (! e_folder_tree_add (priv->folder_tree, path, e_folder)) - return FALSE; - - gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], path); - - return TRUE; -} - -gboolean -e_storage_updated_folder (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - priv = storage->priv; - - if (e_folder_tree_get_folder (priv->folder_tree, path) == NULL) - return FALSE; - - gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path); - - return TRUE; -} - -gboolean -e_storage_removed_folder (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE (storage), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - priv = storage->priv; - - if (e_folder_tree_get_folder (priv->folder_tree, path) == NULL) - return FALSE; - - gtk_signal_emit (GTK_OBJECT (storage), signals[REMOVED_FOLDER], path); - - e_folder_tree_remove (priv->folder_tree, path); - - return TRUE; -} - - -E_MAKE_TYPE (e_storage, "EStorage", EStorage, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage.h b/shell/e-storage.h deleted file mode 100644 index 4500d9bb4f..0000000000 --- a/shell/e-storage.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_STORAGE_H_ -#define _E_STORAGE_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE (e_storage_get_type ()) -#define E_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE, EStorage)) -#define E_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE, EStorageClass)) -#define E_IS_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE)) -#define E_IS_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE)) - - -typedef struct _EStorage EStorage; -typedef struct _EStoragePrivate EStoragePrivate; -typedef struct _EStorageClass EStorageClass; - -enum _EStorageResult { - E_STORAGE_OK, - E_STORAGE_GENERICERROR, - E_STORAGE_EXISTS, - E_STORAGE_INVALIDTYPE, - E_STORAGE_IOERROR, - E_STORAGE_NOSPACE, - E_STORAGE_NOTFOUND, - E_STORAGE_NOTIMPLEMENTED, - E_STORAGE_PERMISSIONDENIED, - E_STORAGE_UNSUPPORTEDOPERATION, - E_STORAGE_UNSUPPORTEDTYPE -}; -typedef enum _EStorageResult EStorageResult; - -typedef void (* EStorageResultCallback) (EStorage *storage, EStorageResult result, void *data); - -#include "e-folder.h" - -struct _EStorage { - GtkObject parent; - - EStoragePrivate *priv; -}; - -struct _EStorageClass { - GtkObjectClass parent_class; - - /* Signals. */ - - void * (* new_folder) (EStorage *storage, const char *path); - void * (* updated_folder) (EStorage *storage, const char *path); - void * (* removed_folder) (EStorage *storage, const char *path); - - /* Virtual methods. */ - - GList * (* get_subfolder_paths) (EStorage *storage, const char *path); - EFolder * (* get_folder) (EStorage *storage, const char *path); - const char * (* get_name) (EStorage *storage); - - void (* async_create_folder) (EStorage *storage, const char *path, - const char *type, const char *description, - EStorageResultCallback callback, void *data); - void (* async_remove_folder) (EStorage *storage, const char *path, - EStorageResultCallback callback, void *data); -}; - - -GtkType e_storage_get_type (void); -void e_storage_construct (EStorage *storage); -EStorage *e_storage_new (void); - -gboolean e_storage_path_is_relative (const char *path); -gboolean e_storage_path_is_absolute (const char *path); - -GList *e_storage_get_subfolder_paths (EStorage *storage, - const char *path); -EFolder *e_storage_get_folder (EStorage *storage, - const char *path); - -const char *e_storage_get_name (EStorage *storage); - -/* Folder operations. */ - -void e_storage_async_create_folder (EStorage *storage, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data); -void e_storage_async_remove_folder (EStorage *storage, - const char *path, - EStorageResultCallback callback, - void *data); - -const char *e_storage_result_to_string (EStorageResult result); - -/* Utility functions. */ - -char *e_storage_get_path_for_physical_uri (EStorage *storage, - const char *physical_uri); - -/* Protected. C++ anyone? */ -gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder); -gboolean e_storage_updated_folder (EStorage *storage, const char *path); -gboolean e_storage_removed_folder (EStorage *storage, const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_STORAGE_H_ */ diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c deleted file mode 100644 index d1460488df..0000000000 --- a/shell/evolution-local-storage.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-local-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include <gal/util/e-util.h> - -#include "evolution-local-storage.h" - - -#define PARENT_TYPE evolution_storage_get_type () -static EvolutionStorageClass *parent_class = NULL; - -struct _EvolutionLocalStoragePrivate { - int dummy; -}; - - -enum { - UPDATE_FOLDER, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* CORBA interface implementation. */ - -static POA_Evolution_LocalStorage__vepv LocalStorage_vepv; - -static void -impl_Evolution_LocalStorage_update_folder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_boolean highlighted, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionLocalStorage *local_storage; - - bonobo_object = bonobo_object_from_servant (servant); - local_storage = EVOLUTION_LOCAL_STORAGE (bonobo_object); - - gtk_signal_emit (GTK_OBJECT (local_storage), signals[UPDATE_FOLDER], path, display_name, highlighted); -} - -static POA_Evolution_LocalStorage * -create_servant (void) -{ - POA_Evolution_LocalStorage *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_LocalStorage *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &LocalStorage_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_LocalStorage__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionLocalStorage *local_storage; - EvolutionLocalStoragePrivate *priv; - - local_storage = EVOLUTION_LOCAL_STORAGE (object); - priv = local_storage->priv; - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_LocalStorage__vepv *vepv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - vepv = &LocalStorage_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_Storage_epv = evolution_storage_get_epv (); - vepv->Evolution_LocalStorage_epv = evolution_local_storage_get_epv (); -} - -static void -class_init (EvolutionLocalStorageClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - - signals[UPDATE_FOLDER] = gtk_signal_new ("update_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionLocalStorageClass, - update_folder), - e_marshal_NONE__POINTER_POINTER_INT, - GTK_TYPE_NONE, 3, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EvolutionLocalStorage *local_storage) -{ - EvolutionLocalStoragePrivate *priv; - - priv = g_new (EvolutionLocalStoragePrivate, 1); - - local_storage->priv = priv; -} - - -POA_Evolution_LocalStorage__epv * -evolution_local_storage_get_epv (void) -{ - POA_Evolution_LocalStorage__epv *epv; - - epv = g_new0 (POA_Evolution_LocalStorage__epv, 1); - epv->update_folder = impl_Evolution_LocalStorage_update_folder; - - return epv; -} - -void -evolution_local_storage_construct (EvolutionLocalStorage *local_storage, - Evolution_LocalStorage corba_object, - const char *name) -{ - g_return_if_fail (local_storage != NULL); - g_return_if_fail (EVOLUTION_IS_LOCAL_STORAGE (local_storage)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - g_return_if_fail (name != NULL); - g_return_if_fail (name[0] != '\0'); - - evolution_storage_construct (EVOLUTION_STORAGE (local_storage), corba_object, name); -} - -EvolutionLocalStorage * -evolution_local_storage_new (const char *name) -{ - EvolutionLocalStorage *new; - POA_Evolution_LocalStorage *servant; - Evolution_LocalStorage corba_object; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (name[0] != '\0', NULL); - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (evolution_local_storage_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - evolution_local_storage_construct (new, corba_object, name); - - return new; -} - - -E_MAKE_TYPE (evolution_local_storage, "EvolutionLocalStorage", EvolutionLocalStorage, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-local-storage.h b/shell/evolution-local-storage.h deleted file mode 100644 index a97b0b7e81..0000000000 --- a/shell/evolution-local-storage.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-local-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_LOCAL_STORAGE_H__ -#define __EVOLUTION_LOCAL_STORAGE_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "evolution-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_LOCAL_STORAGE (evolution_local_storage_get_type ()) -#define EVOLUTION_LOCAL_STORAGE(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_LOCAL_STORAGE, EvolutionLocalStorage)) -#define EVOLUTION_LOCAL_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_LOCAL_STORAGE, EvolutionLocalStorageClass)) -#define EVOLUTION_IS_LOCAL_STORAGE(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_LOCAL_STORAGE)) -#define EVOLUTION_IS_LOCAL_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_LOCAL_STORAGE)) - - -typedef struct _EvolutionLocalStorage EvolutionLocalStorage; -typedef struct _EvolutionLocalStoragePrivate EvolutionLocalStoragePrivate; -typedef struct _EvolutionLocalStorageClass EvolutionLocalStorageClass; - -struct _EvolutionLocalStorage { - EvolutionStorage parent; - - EvolutionLocalStoragePrivate *priv; -}; - -struct _EvolutionLocalStorageClass { - EvolutionStorageClass parent_class; - - void (* update_folder) (EvolutionLocalStorage *local_storage, - const char *path, - const char *display_name, - gboolean highlighted); -}; - - -POA_Evolution_LocalStorage__epv *evolution_local_storage_get_epv (void); - -GtkType evolution_local_storage_get_type (void); -void evolution_local_storage_construct (EvolutionLocalStorage *local_storage, - Evolution_LocalStorage corba_object, - const char *name); -EvolutionLocalStorage *evolution_local_storage_new (const char *name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_LOCAL_STORAGE_H__ */ diff --git a/shell/evolution-session.c b/shell/evolution-session.c deleted file mode 100644 index a53d98243f..0000000000 --- a/shell/evolution-session.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-session.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "Evolution.h" - -#include <gal/util/e-util.h> - -#include "evolution-session.h" - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionSessionPrivate { - int dummy; -}; - -enum { - LOAD_CONFIGURATION, - SAVE_CONFIGURATION, - LAST_SIGNAL -}; - -static int signals[LAST_SIGNAL]; - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionSession *session; - EvolutionSessionPrivate *priv; - - session = EVOLUTION_SESSION (object); - priv = session->priv; - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* CORBA interface implementation. */ - -static void -impl_Evolution_Session_save_configuration (PortableServer_Servant servant, - const CORBA_char *prefix, - CORBA_Environment *ev) -{ - BonoboObject *self; - - self = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (self), signals[SAVE_CONFIGURATION], prefix); -} - -static void -impl_Evolution_Session_load_configuration (PortableServer_Servant servant, - const CORBA_char *prefix, - CORBA_Environment *ev) -{ - BonoboObject *self; - - self = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (self), signals[LOAD_CONFIGURATION], prefix); -} - - -/* Initialization. */ - -static POA_Evolution_Session__vepv Evolution_Session_vepv; - -static void -corba_class_init (void) -{ - POA_Evolution_Session__vepv *vepv; - POA_Evolution_Session__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_Session__epv, 1); - epv->save_configuration = impl_Evolution_Session_save_configuration; - epv->load_configuration = impl_Evolution_Session_load_configuration; - - vepv = &Evolution_Session_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_Session_epv = epv; -} - -static void -class_init (EvolutionSessionClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = impl_destroy; - - signals[LOAD_CONFIGURATION] - = gtk_signal_new ("load_configuration", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionSessionClass, load_configuration), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - signals[SAVE_CONFIGURATION] - = gtk_signal_new ("save_configuration", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionSessionClass, save_configuration), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EvolutionSession *session) -{ - EvolutionSessionPrivate *priv; - - priv = g_new (EvolutionSessionPrivate, 1); - - session->priv = priv; -} - - -static Evolution_Session -create_corba_session (BonoboObject *object) -{ - POA_Evolution_Session *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_Session *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &Evolution_Session_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Session__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Session) bonobo_object_activate_servant (object, servant); -} - -void -evolution_session_construct (EvolutionSession *session, - CORBA_Object corba_session) -{ - g_return_if_fail (session != NULL); - g_return_if_fail (corba_session != CORBA_OBJECT_NIL); - - bonobo_object_construct (BONOBO_OBJECT (session), corba_session); -} - -EvolutionSession * -evolution_session_new (void) -{ - EvolutionSession *session; - Evolution_Session corba_session; - - session = gtk_type_new (evolution_session_get_type ()); - - corba_session = create_corba_session (BONOBO_OBJECT (session)); - if (corba_session == CORBA_OBJECT_NIL) { - bonobo_object_unref (BONOBO_OBJECT (session)); - return NULL; - } - - evolution_session_construct (session, corba_session); - return session; -} - - -E_MAKE_TYPE (evolution_session, "EvolutionSession", EvolutionSession, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-session.h b/shell/evolution-session.h deleted file mode 100644 index 93c0ebed2a..0000000000 --- a/shell/evolution-session.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-session.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_SESSION_H__ -#define __EVOLUTION_SESSION_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_SESSION (evolution_session_get_type ()) -#define EVOLUTION_SESSION(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SESSION, EvolutionSession)) -#define EVOLUTION_SESSION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SESSION, EvolutionSessionClass)) -#define EVOLUTION_IS_SESSION(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SESSION)) -#define EVOLUTION_IS_SESSION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SESSION)) - - -typedef struct _EvolutionSession EvolutionSession; -typedef struct _EvolutionSessionPrivate EvolutionSessionPrivate; -typedef struct _EvolutionSessionClass EvolutionSessionClass; - -struct _EvolutionSession { - BonoboObject parent; - - EvolutionSessionPrivate *priv; -}; - -struct _EvolutionSessionClass { - BonoboObjectClass parent_class; - - void (* save_configuration) (EvolutionSession *session, const char *prefix); - void (* load_configuration) (EvolutionSession *session, const char *prefix); -}; - - -GtkType evolution_session_get_type (void); -void evolution_session_construct (EvolutionSession *session, - CORBA_Object corba_session); -EvolutionSession *evolution_session_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_SESSION_H__ */ diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c deleted file mode 100644 index 7e32883439..0000000000 --- a/shell/evolution-shell-client.c +++ /dev/null @@ -1,370 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-client.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include <gal/util/e-util.h> - -#include "evolution-shell-client.h" - - -struct _EvolutionShellClientPrivate { - int dummy; -}; - -#define PARENT_TYPE bonobo_object_client_get_type () -static BonoboObjectClientClass *parent_class = NULL; - - -/* Easy-to-use wrapper for Evolution::user_select_folder. */ - -static PortableServer_ServantBase__epv FolderSelectionListener_base_epv; -static POA_Evolution_FolderSelectionListener__epv FolderSelectionListener_epv; -static POA_Evolution_FolderSelectionListener__vepv FolderSelectionListener_vepv; -static gboolean FolderSelectionListener_vtables_initialized = FALSE; - -struct _FolderSelectionListenerServant { - POA_Evolution_FolderSelectionListener servant; - char **uri_return; - char **physical_uri_return; -}; -typedef struct _FolderSelectionListenerServant FolderSelectionListenerServant; - -static void -impl_FolderSelectionListener_selected (PortableServer_Servant servant, - const CORBA_char *uri, - const CORBA_char *physical_uri, - CORBA_Environment *ev) -{ - FolderSelectionListenerServant *listener_servant; - - listener_servant = (FolderSelectionListenerServant *) servant; - - if (listener_servant->uri_return != NULL) - * (listener_servant->uri_return) = g_strdup (uri); - - if (listener_servant->physical_uri_return != NULL) - * (listener_servant->physical_uri_return) = g_strdup (physical_uri); - - gtk_main_quit (); -} - -static void -impl_FolderSelectionListener_cancel (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - FolderSelectionListenerServant *listener_servant; - - listener_servant = (FolderSelectionListenerServant *) servant; - - if (listener_servant->uri_return != NULL) - * (listener_servant->uri_return) = NULL; - - if (listener_servant->physical_uri_return != NULL) - * (listener_servant->physical_uri_return) = NULL; - - gtk_main_quit (); -} - -static void -init_FolderSelectionListener_vtables (void) -{ - FolderSelectionListener_base_epv._private = NULL; - FolderSelectionListener_base_epv.finalize = NULL; - FolderSelectionListener_base_epv.default_POA = NULL; - - FolderSelectionListener_epv.selected = impl_FolderSelectionListener_selected; - FolderSelectionListener_epv.cancel = impl_FolderSelectionListener_cancel; - - FolderSelectionListener_vepv._base_epv = &FolderSelectionListener_base_epv; - FolderSelectionListener_vepv.Evolution_FolderSelectionListener_epv = &FolderSelectionListener_epv; - - FolderSelectionListener_vtables_initialized = TRUE; -} - -static Evolution_FolderSelectionListener -create_folder_selection_listener_interface (char **result, - char **uri_return, - char **physical_uri_return) -{ - Evolution_FolderSelectionListener corba_interface; - CORBA_Environment ev; - FolderSelectionListenerServant *servant; - PortableServer_Servant listener_servant; - - if (! FolderSelectionListener_vtables_initialized) - init_FolderSelectionListener_vtables (); - - servant = g_new0 (FolderSelectionListenerServant, 1); - servant->servant.vepv = &FolderSelectionListener_vepv; - servant->uri_return = uri_return; - servant->physical_uri_return = physical_uri_return; - - listener_servant = (PortableServer_Servant) servant; - - CORBA_exception_init (&ev); - - POA_Evolution_FolderSelectionListener__init (listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free(servant); - return CORBA_OBJECT_NIL; - } - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), listener_servant, &ev)); - - corba_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - corba_interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - - return corba_interface; -} - -static int -count_string_items (const char *list[]) -{ - int i; - - if (list == NULL) - return 0; - - for (i = 0; list[i] != NULL; i++) - ; - - return i; -} - -static void -user_select_folder (EvolutionShellClient *shell_client, - const char *title, - const char *default_folder, - const char *possible_types[], - char **uri_return, - char **physical_uri_return) -{ - Evolution_FolderSelectionListener listener_interface; - Evolution_Shell corba_shell; - CORBA_Environment ev; - Evolution_Shell_FolderTypeList corba_type_list; - int num_possible_types; - char *result; - - result = NULL; - - listener_interface = create_folder_selection_listener_interface (&result, uri_return, - physical_uri_return); - if (listener_interface == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - num_possible_types = count_string_items (possible_types); - - corba_type_list._length = num_possible_types; - corba_type_list._maximum = num_possible_types; - corba_type_list._buffer = (CORBA_char **) possible_types; - - Evolution_Shell_user_select_folder (corba_shell, listener_interface, - title, default_folder, &corba_type_list, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - - if (uri_return != NULL) - *uri_return = NULL; - if (physical_uri_return != NULL) - *physical_uri_return = NULL; - - return; - } - - gtk_main(); - - CORBA_Object_release (listener_interface, &ev); - - CORBA_exception_free (&ev); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EvolutionShellClient *shell_client; - EvolutionShellClientPrivate *priv; - - shell_client = EVOLUTION_SHELL_CLIENT (object); - priv = shell_client->priv; - - /* Nothing to do here. */ - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EvolutionShellClientClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - - object_class->destroy = destroy; -} - -static void -init (EvolutionShellClient *shell_client) -{ - EvolutionShellClientPrivate *priv; - - priv = g_new (EvolutionShellClientPrivate, 1); - priv->dummy = 0; - - shell_client->priv = priv; -} - - -/** - * evolution_shell_client_construct: - * @shell_client: - * @corba_shell: - * - * Construct @shell_client associating it to @corba_shell. - **/ -void -evolution_shell_client_construct (EvolutionShellClient *shell_client, - Evolution_Shell corba_shell) -{ - g_return_if_fail (shell_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client)); - g_return_if_fail (corba_shell != CORBA_OBJECT_NIL); - - bonobo_object_construct (BONOBO_OBJECT (shell_client), (CORBA_Object) corba_shell); -} - -/** - * evolution_shell_client_new: - * @corba_shell: A pointer to the CORBA Evolution::Shell interface. - * - * Create a new client object for @corba_shell. - * - * Return value: A pointer to the Evolution::Shell client BonoboObject. - **/ -EvolutionShellClient * -evolution_shell_client_new (Evolution_Shell corba_shell) -{ - EvolutionShellClient *shell_client; - - shell_client = gtk_type_new (evolution_shell_client_get_type ()); - - evolution_shell_client_construct (shell_client, corba_shell); - - if (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)) == CORBA_OBJECT_NIL) { - bonobo_object_unref (BONOBO_OBJECT (shell_client)); - return NULL; - } - - return shell_client; -} - - -/** - * evolution_shell_client_user_select_folder: - * @shell_client: A EvolutionShellClient object - * @title: The title for the folder selection dialog - * @default_folder: URI (physical or evolution:) of the folder initially selected on the dialog - * @uri_return: - * @physical_uri_return: - * - * Pop up the shell's folder selection dialog with the specified @title and - * @default_folder as the initially selected folder. On return, set *@uri and - * *@physical_uri to the evolution: URI and the physical URI of the selected - * folder (or %NULL if the user cancelled the dialog). (The dialog is modal.) - **/ -void -evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client, - const char *title, - const char *default_folder, - const char *possible_types[], - char **uri_return, - char **physical_uri_return) -{ - g_return_if_fail (shell_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client)); - g_return_if_fail (title != NULL); - g_return_if_fail (default_folder != NULL); - - user_select_folder (shell_client, title, default_folder, possible_types, - uri_return, physical_uri_return); -} - - -/** - * evolution_shell_client_get_local_storage: - * @shell_client: An EvolutionShellClient object - * - * Retrieve the local storage interface for this shell. - * - * Return value: a pointer to the CORBA object implementing the local storage - * in the shell associated with @shell_client. - **/ -Evolution_LocalStorage -evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client) -{ - Evolution_Shell corba_shell; - Evolution_LocalStorage corba_local_storage; - CORBA_Environment ev; - - g_return_val_if_fail (shell_client != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client), CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - if (corba_shell == CORBA_OBJECT_NIL) - return CORBA_OBJECT_NIL; - - corba_local_storage = Evolution_Shell_get_local_storage (corba_shell, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - return corba_local_storage; -} - - -E_MAKE_TYPE (evolution_shell_client, "EvolutionShellClient", EvolutionShellClient, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-shell-client.h b/shell/evolution-shell-client.h deleted file mode 100644 index 151f18f9b7..0000000000 --- a/shell/evolution-shell-client.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-client.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_SHELL_CLIENT_H__ -#define __EVOLUTION_SHELL_CLIENT_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object-client.h> - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_SHELL_CLIENT (evolution_shell_client_get_type ()) -#define EVOLUTION_SHELL_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClient)) -#define EVOLUTION_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClientClass)) -#define EVOLUTION_IS_SHELL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) -#define EVOLUTION_IS_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) - - -typedef struct _EvolutionShellClient EvolutionShellClient; -typedef struct _EvolutionShellClientPrivate EvolutionShellClientPrivate; -typedef struct _EvolutionShellClientClass EvolutionShellClientClass; - -struct _EvolutionShellClient { - BonoboObjectClient parent; - - EvolutionShellClientPrivate *priv; -}; - -struct _EvolutionShellClientClass { - BonoboObjectClientClass parent_class; -}; - - -GtkType evolution_shell_client_get_type (void); -void evolution_shell_client_construct (EvolutionShellClient *shell_client, - Evolution_Shell corba_shell); -EvolutionShellClient *evolution_shell_client_new (Evolution_Shell shell); - -void evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client, - const char *title, - const char *default_folder, - const char *possible_types[], - char **uri_return, - char **physical_uri_return); - -Evolution_LocalStorage evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_SHELL_CLIENT_H__ */ diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c deleted file mode 100644 index 26b2733620..0000000000 --- a/shell/evolution-shell-component-client.c +++ /dev/null @@ -1,528 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-client.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-widget.h> - -#include <liboaf/liboaf.h> - -#include <gal/util/e-util.h> - -#include "evolution-shell-component-client.h" - - -#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionShellComponentClientPrivate { - EvolutionShellComponentClientCallback callback; - void *callback_data; - - Evolution_ShellComponentListener listener_interface; - PortableServer_Servant listener_servant; -}; - - -#define RETURN_ERROR_IF_FAIL(cond) \ - g_return_val_if_fail ((cond), EVOLUTION_SHELL_COMPONENT_INVALIDARG) - - -/* Utility functions. */ - -static EvolutionShellComponentResult -corba_exception_to_result (const CORBA_Environment *ev) -{ - if (ev->_major == CORBA_NO_EXCEPTION) - return EVOLUTION_SHELL_COMPONENT_OK; - - if (ev->_major == CORBA_USER_EXCEPTION) { - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_AlreadyOwned) == 0) - return EVOLUTION_SHELL_COMPONENT_ALREADYOWNED; - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_NotOwned) == 0) - return EVOLUTION_SHELL_COMPONENT_NOTOWNED; - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_NotFound) == 0) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_UnsupportedType) == 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_InternalError) == 0) - return EVOLUTION_SHELL_COMPONENT_INTERNALERROR; - if (strcmp (ev->_repo_id, ex_Evolution_ShellComponent_Busy) == 0) - return EVOLUTION_SHELL_COMPONENT_BUSY; - - return EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR; - } else { - /* FIXME maybe we need something more specific here. */ - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; - } -} - -static void -dispatch_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result) -{ - EvolutionShellComponentClientPrivate *priv; - EvolutionShellComponentClientCallback callback; - PortableServer_ObjectId *oid; - void *callback_data; - CORBA_Environment ev; - - priv = shell_component_client->priv; - - g_return_if_fail (priv->callback != NULL); - g_return_if_fail (priv->listener_servant != NULL); - - /* Notice that we destroy the interface and reset the callback information before - dispatching the callback so that the callback can generate another request. */ - - CORBA_exception_init (&ev); - - oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev); - POA_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev); - CORBA_free (oid); - - CORBA_Object_release (priv->listener_interface, &ev); - - CORBA_exception_free (&ev); - - priv->listener_servant = NULL; - priv->listener_interface = CORBA_OBJECT_NIL; - - callback = priv->callback; - callback_data = priv->callback_data; - - priv->callback = NULL; - priv->callback_data = NULL; - - (* callback) (shell_component_client, result, callback_data); -} - - -/* CORBA listener interface implementation. */ - -static PortableServer_ServantBase__epv ShellComponentListener_base_epv; -static POA_Evolution_ShellComponentListener__epv ShellComponentListener_epv; -static POA_Evolution_ShellComponentListener__vepv ShellComponentListener_vepv; -static gboolean ShellComponentListener_vepv_initialized = FALSE; - -struct _ShellComponentListenerServant { - POA_Evolution_ShellComponentListener servant; - EvolutionShellComponentClient *component_client; -}; -typedef struct _ShellComponentListenerServant ShellComponentListenerServant; - -static EvolutionShellComponentClient * -component_client_from_ShellComponentListener_servant (PortableServer_Servant servant) -{ - ShellComponentListenerServant *listener_servant; - - listener_servant = (ShellComponentListenerServant *) servant; - return listener_servant->component_client; -} - -static EvolutionShellComponentResult -result_from_async_corba_result (Evolution_ShellComponentListener_Result async_corba_result) -{ - switch (async_corba_result) { - case Evolution_ShellComponentListener_OK: - return EVOLUTION_SHELL_COMPONENT_OK; - case Evolution_ShellComponentListener_UNSUPPORTED_OPERATION: - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION; - case Evolution_ShellComponentListener_EXISTS: - return EVOLUTION_SHELL_COMPONENT_EXISTS; - case Evolution_ShellComponentListener_INVALID_URI: - return EVOLUTION_SHELL_COMPONENT_INVALIDURI; - case Evolution_ShellComponentListener_PERMISSION_DENIED: - return EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED; - case Evolution_ShellComponentListener_HAS_SUBFOLDERS: - return EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS; - case Evolution_ShellComponentListener_NO_SPACE: - return EVOLUTION_SHELL_COMPONENT_NOSPACE; - default: - return EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR; - } -} - -static void -impl_ShellComponentListener_report_result (PortableServer_Servant servant, - const Evolution_ShellComponentListener_Result result, - CORBA_Environment *ev) -{ - EvolutionShellComponentClient *component_client; - - component_client = component_client_from_ShellComponentListener_servant (servant); - dispatch_callback (component_client, result_from_async_corba_result (result)); -} - -static void -ShellComponentListener_vepv_initialize (void) -{ - ShellComponentListener_base_epv._private = NULL; - ShellComponentListener_base_epv.finalize = NULL; - ShellComponentListener_base_epv.default_POA = NULL; - - ShellComponentListener_epv.report_result = impl_ShellComponentListener_report_result; - - ShellComponentListener_vepv._base_epv = & ShellComponentListener_base_epv; - ShellComponentListener_vepv.Evolution_ShellComponentListener_epv = & ShellComponentListener_epv; - - ShellComponentListener_vepv_initialized = TRUE; -} - -static PortableServer_Servant * -create_ShellComponentListener_servant (EvolutionShellComponentClient *component_client) -{ - ShellComponentListenerServant *servant; - - if (! ShellComponentListener_vepv_initialized) - ShellComponentListener_vepv_initialize (); - - servant = g_new0 (ShellComponentListenerServant, 1); - servant->servant.vepv = &ShellComponentListener_vepv; - servant->component_client = component_client; - - return (PortableServer_Servant) servant; -} - -static void -free_ShellComponentListener_servant (PortableServer_Servant servant) -{ - g_free (servant); -} - -static void -create_listener_interface (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - PortableServer_Servant listener_servant; - Evolution_ShellComponentListener corba_interface; - CORBA_Environment ev; - - priv = shell_component_client->priv; - - listener_servant = create_ShellComponentListener_servant (shell_component_client); - - CORBA_exception_init (&ev); - - POA_Evolution_ShellComponentListener__init (listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - free_ShellComponentListener_servant (listener_servant); - return; - } - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), listener_servant, &ev)); - - corba_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - corba_interface = CORBA_OBJECT_NIL; - free_ShellComponentListener_servant (listener_servant); - } - - CORBA_exception_free (&ev); - - priv->listener_servant = listener_servant; - priv->listener_interface = corba_interface; -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionShellComponentClient *shell_component_client; - EvolutionShellComponentClientPrivate *priv; - - shell_component_client = EVOLUTION_SHELL_COMPONENT_CLIENT (object); - priv = shell_component_client->priv; - - if (priv->callback != NULL) - dispatch_callback (shell_component_client, EVOLUTION_SHELL_COMPONENT_INTERRUPTED); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EvolutionShellComponentClientClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; -} - -static void -init (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - - priv = g_new (EvolutionShellComponentClientPrivate, 1); - priv->listener_interface = CORBA_OBJECT_NIL; - priv->listener_servant = NULL; - priv->callback = NULL; - priv->callback_data = NULL; - - shell_component_client->priv = priv; -} - - -/* Construction. */ - -void -evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client, - CORBA_Object corba_object) -{ - g_return_if_fail (shell_component_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - - bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (shell_component_client), - corba_object); -} - -EvolutionShellComponentClient * -evolution_shell_component_client_new (const char *id) -{ - EvolutionShellComponentClient *new; - CORBA_Environment ev; - CORBA_Object corba_object; - - g_return_val_if_fail (id != NULL, NULL); - - CORBA_exception_init (&ev); - - corba_object = oaf_activate_from_id ((char *) id, 0, NULL, &ev); /* Yuck. */ - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Could not start up component for %s. " - "(See previous error messages?)", id); - return NULL; - } - CORBA_exception_free (&ev); - - if (corba_object == CORBA_OBJECT_NIL) { - g_warning ("Could not activate component %s. " - "(Maybe you need to set OAF_INFO_PATH?)", id); - return NULL; - } - - new = gtk_type_new (evolution_shell_component_client_get_type ()); - evolution_shell_component_client_construct (new, corba_object); - - return new; -} - - -/* Synchronous operations. */ - -EvolutionShellComponentResult -evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client, - Evolution_Shell shell, - const char *evolution_homedir) -{ - EvolutionShellComponentResult result; - CORBA_Environment ev; - - RETURN_ERROR_IF_FAIL (shell_component_client != NULL); - RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - RETURN_ERROR_IF_FAIL (shell != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - Evolution_ShellComponent_set_owner (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - shell, evolution_homedir, &ev); - - result = corba_exception_to_result (&ev); - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionShellComponentResult -evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client, - Evolution_Shell shell) -{ - EvolutionShellComponentResult result; - Evolution_ShellComponent corba_component; - CORBA_Environment ev; - - RETURN_ERROR_IF_FAIL (shell_component_client != NULL); - RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - RETURN_ERROR_IF_FAIL (shell != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - - corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - - Evolution_ShellComponent_unset_owner (corba_component, &ev); - - result = corba_exception_to_result (&ev); - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionShellComponentResult -evolution_shell_component_client_create_view (EvolutionShellComponentClient *shell_component_client, - BonoboUIComponent *uih, - const char *physical_uri, - const char *type_string, - BonoboControl **control_return) -{ - EvolutionShellComponentResult result; - CORBA_Environment ev; - Evolution_ShellComponent corba_component; - Bonobo_Control corba_control; - - RETURN_ERROR_IF_FAIL (shell_component_client != NULL); - RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - RETURN_ERROR_IF_FAIL (uih != NULL); - RETURN_ERROR_IF_FAIL (BONOBO_IS_UI_COMPONENT (uih)); - RETURN_ERROR_IF_FAIL (physical_uri != NULL); - RETURN_ERROR_IF_FAIL (type_string != NULL); - RETURN_ERROR_IF_FAIL (control_return != NULL); - - CORBA_exception_init (&ev); - - corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - corba_control = Evolution_ShellComponent_create_view (corba_component, physical_uri, type_string, &ev); - - result = corba_exception_to_result (&ev); - - if (result != EVOLUTION_SHELL_COMPONENT_OK) { - *control_return = NULL; - } else { - Bonobo_UIContainer corba_uih; - - corba_uih = bonobo_object_corba_objref (BONOBO_OBJECT (uih)); - *control_return = BONOBO_CONTROL (bonobo_widget_new_control_from_objref (corba_control, - corba_uih)); - } - - CORBA_exception_free (&ev); - - return result; -} - - -/* Asyncronous operations. */ - -void -evolution_shell_component_client_async_create_folder (EvolutionShellComponentClient *shell_component_client, - const char *physical_uri, - const char *type, - EvolutionShellComponentClientCallback callback, - void *data) -{ - EvolutionShellComponentClientPrivate *priv; - Evolution_ShellComponent corba_shell_component; - CORBA_Environment ev; - - g_return_if_fail (shell_component_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - g_return_if_fail (physical_uri != NULL); - g_return_if_fail (type != NULL); - g_return_if_fail (callback != NULL); - - priv = shell_component_client->priv; - - if (priv->callback != NULL) { - (* callback) (shell_component_client, EVOLUTION_SHELL_COMPONENT_BUSY, data); - return; - } - - create_listener_interface (shell_component_client); - - CORBA_exception_init (&ev); - - corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - - priv->callback = callback; - priv->callback_data = data; - - Evolution_ShellComponent_async_create_folder (corba_shell_component, - priv->listener_interface, - physical_uri, type, - &ev); - - CORBA_exception_free (&ev); -} - -void -evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client, - const char *physical_uri, - EvolutionShellComponentClientCallback callback, - void *data) -{ - /* FIXME to do. */ -} - -void -evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, - BonoboUIComponent *uih, - const char *physical_uri, - const char *type) -{ - Bonobo_UIContainer corba_uih; - EvolutionShellComponentClientPrivate *priv; - Evolution_ShellComponent corba_shell_component; - CORBA_Environment ev; - - g_return_if_fail (shell_component_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - g_return_if_fail (physical_uri != NULL); - g_return_if_fail (type != NULL); - - priv = shell_component_client->priv; - - CORBA_exception_init (&ev); - - corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - corba_uih = bonobo_object_corba_objref (BONOBO_OBJECT (uih)); - - Evolution_ShellComponent_populate_folder_context_menu (corba_shell_component, - corba_uih, - physical_uri, - type, - &ev); - - CORBA_exception_free (&ev); -} - - -E_MAKE_TYPE (evolution_shell_component_client, "EvolutionShellComponentClient", - EvolutionShellComponentClient, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h deleted file mode 100644 index 1a0eab5cd7..0000000000 --- a/shell/evolution-shell-component-client.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-client.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef EVOLUTION_SHELL_COMPONENT_CLIENT_H -#define EVOLUTION_SHELL_COMPONENT_CLIENT_H - -#include <bonobo/bonobo-object-client.h> - -#include "evolution-shell-component.h" - -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT (evolution_shell_component_client_get_type ()) -#define EVOLUTION_SHELL_COMPONENT_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT, EvolutionShellComponentClient)) -#define EVOLUTION_SHELL_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT, EvolutionShellComponentClientClass)) -#define EVOLUTION_IS_SHELL_COMPONENT_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT)) -#define EVOLUTION_IS_SHELL_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT_CLIENT)) - - -typedef struct _EvolutionShellComponentClient EvolutionShellComponentClient; -typedef struct _EvolutionShellComponentClientPrivate EvolutionShellComponentClientPrivate; -typedef struct _EvolutionShellComponentClientClass EvolutionShellComponentClientClass; - -struct _EvolutionShellComponentClient { - BonoboObjectClient parent; - - EvolutionShellComponentClientPrivate *priv; -}; - -struct _EvolutionShellComponentClientClass { - BonoboObjectClientClass parent_class; -}; - -typedef void (* EvolutionShellComponentClientCallback) (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result, - void *data); - - -/* Construction. */ -GtkType evolution_shell_component_client_get_type (void); -void evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client, - CORBA_Object corba_object); -EvolutionShellComponentClient *evolution_shell_component_client_new (const char *id); - -/* Synchronous operations. */ -EvolutionShellComponentResult evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client, - Evolution_Shell shell, - const char *evolution_homedir); -EvolutionShellComponentResult evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client, - Evolution_Shell shell); -EvolutionShellComponentResult evolution_shell_component_client_create_view (EvolutionShellComponentClient *shell_component_client, - BonoboUIComponent *uih, - const char *physical_uri, - const char *type_string, - BonoboControl **control_return); - -/* Asyncronous operations. */ -void evolution_shell_component_client_async_create_folder (EvolutionShellComponentClient *shell_component_client, - const char *physical_uri, - const char *type, - EvolutionShellComponentClientCallback callback, - void *data); -void evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client, - const char *physical_uri, - EvolutionShellComponentClientCallback callback, - void *data); - -void evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, - BonoboUIComponent *uih, - const char *physical_uri, - const char *type); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* EVOLUTION_SHELL_COMPONENT_CLIENT_H */ diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c deleted file mode 100644 index 8e149f11fb..0000000000 --- a/shell/evolution-shell-component.c +++ /dev/null @@ -1,500 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "Evolution.h" - -#include <gal/util/e-util.h> - -#include "evolution-shell-component.h" - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionShellComponentPrivate { - GList *folder_types; /* EvolutionShellComponentFolderType */ - - EvolutionShellComponentCreateViewFn create_view_fn; - EvolutionShellComponentCreateFolderFn create_folder_fn; - EvolutionShellComponentRemoveFolderFn remove_folder_fn; - EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn; - - EvolutionShellClient *owner_client; - - void *closure; -}; - -enum { - OWNER_SET, - OWNER_UNSET, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* CORBA interface implementation. */ - -static POA_Evolution_ShellComponent__vepv ShellComponent_vepv; - -static POA_Evolution_ShellComponent * -create_servant (void) -{ - POA_Evolution_ShellComponent *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_ShellComponent *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &ShellComponent_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_ShellComponent__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static Evolution_FolderTypeList * -impl_ShellComponent__get_supported_types (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - Evolution_FolderTypeList *folder_type_list; - unsigned int i; - GList *p; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - folder_type_list = Evolution_FolderTypeList__alloc (); - folder_type_list->_length = g_list_length (priv->folder_types); - folder_type_list->_maximum = folder_type_list->_length; - folder_type_list->_buffer = CORBA_sequence_Evolution_FolderType_allocbuf (folder_type_list->_maximum); - - for (p = priv->folder_types, i = 0; p != NULL; p = p->next, i++) { - Evolution_FolderType *corba_folder_type; - EvolutionShellComponentFolderType *folder_type; - - folder_type = (EvolutionShellComponentFolderType *) p->data; - - corba_folder_type = folder_type_list->_buffer + i; - corba_folder_type->name = CORBA_string_dup (folder_type->name); - corba_folder_type->icon_name = CORBA_string_dup (folder_type->icon_name); - } - - return folder_type_list; -} - -static void -impl_ShellComponent_set_owner (PortableServer_Servant servant, - const Evolution_Shell shell, - const CORBA_char *evolution_homedir, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - Evolution_Shell shell_duplicate; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->owner_client != NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_ShellComponent_AlreadyOwned, NULL); - return; - } - - shell_duplicate = CORBA_Object_duplicate (shell, ev); - - if (ev->_major == CORBA_NO_EXCEPTION) { - priv->owner_client = evolution_shell_client_new (shell_duplicate); - gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->owner_client, evolution_homedir); - } -} - -static void -impl_ShellComponent_unset_owner (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->owner_client == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_ShellComponent_NotOwned, NULL); - return; - } - - bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); - priv->owner_client = NULL; - - gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_UNSET]); -} - -static Bonobo_Control -impl_ShellComponent_create_view (PortableServer_Servant servant, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - EvolutionShellComponentResult result; - BonoboControl *control; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - result = (* priv->create_view_fn) (shell_component, physical_uri, type, - &control, priv->closure); - - if (result != EVOLUTION_SHELL_COMPONENT_OK) { - switch (result) { - case EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_ShellComponent_UnsupportedType, - NULL); - break; - case EVOLUTION_SHELL_COMPONENT_INTERNALERROR: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_ShellComponent_InternalError, - NULL); - break; - default: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_ShellComponent_NotFound, - NULL); - } - - return CORBA_OBJECT_NIL; - } - - return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev); -} - -static void -impl_ShellComponent_async_create_folder (PortableServer_Servant servant, - const Evolution_ShellComponentListener listener, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->create_folder_fn == NULL) { - Evolution_ShellComponentListener_report_result (listener, - Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->create_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); -} - -static void -impl_ShellComponent_async_remove_folder (PortableServer_Servant servant, - const Evolution_ShellComponentListener listener, - const CORBA_char *physical_uri, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->remove_folder_fn == NULL) { - Evolution_ShellComponentListener_report_result (listener, - Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->remove_folder_fn) (shell_component, physical_uri, listener, priv->closure); -} - -static void -impl_ShellComponent_populate_folder_context_menu (PortableServer_Servant servant, - const Bonobo_UIContainer corba_uih, - const CORBA_char *physical_uri, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - BonoboUIComponent *uic; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - priv = shell_component->priv; - - if (priv->populate_folder_context_menu_fn == NULL) - return; - - uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (uic, corba_uih); - bonobo_object_release_unref (corba_uih, NULL); - - (* priv->populate_folder_context_menu_fn) (shell_component, uic, physical_uri, type, priv->closure); - - bonobo_object_unref (BONOBO_OBJECT (uic)); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - CORBA_Environment ev; - GList *p; - - shell_component = EVOLUTION_SHELL_COMPONENT (object); - - priv = shell_component->priv; - - CORBA_exception_init (&ev); - - if (priv->owner_client != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); - - CORBA_exception_free (&ev); - - for (p = priv->folder_types; p != NULL; p = p->next) { - EvolutionShellComponentFolderType *folder_type; - - folder_type = (EvolutionShellComponentFolderType *) p->data; - - g_free (folder_type->name); - g_free (folder_type->icon_name); - g_free (folder_type); - } - g_list_free (priv->folder_types); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -corba_class_init (void) -{ - POA_Evolution_ShellComponent__vepv *vepv; - POA_Evolution_ShellComponent__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_ShellComponent__epv, 1); - epv->_get_supported_types = impl_ShellComponent__get_supported_types; - epv->set_owner = impl_ShellComponent_set_owner; - epv->unset_owner = impl_ShellComponent_unset_owner; - epv->create_view = impl_ShellComponent_create_view; - epv->async_create_folder = impl_ShellComponent_async_create_folder; - epv->async_remove_folder = impl_ShellComponent_async_remove_folder; - epv->populate_folder_context_menu = impl_ShellComponent_populate_folder_context_menu; - - vepv = &ShellComponent_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_ShellComponent_epv = epv; -} - -static void -class_init (EvolutionShellComponentClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[OWNER_SET] - = gtk_signal_new ("owner_set", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, owner_set), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - signals[OWNER_UNSET] - = gtk_signal_new ("owner_unset", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, owner_unset), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - parent_class = gtk_type_class (PARENT_TYPE); - - corba_class_init (); -} - -static void -init (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - - priv = g_new (EvolutionShellComponentPrivate, 1); - - priv->folder_types = NULL; - priv->create_view_fn = NULL; - priv->create_folder_fn = NULL; - priv->remove_folder_fn = NULL; - priv->populate_folder_context_menu_fn = NULL; - - priv->owner_client = NULL; - priv->closure = NULL; - - shell_component->priv = priv; -} - - -void -evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - Evolution_ShellComponent corba_object, - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn, - void *closure) -{ - EvolutionShellComponentPrivate *priv; - int i; - - g_return_if_fail (shell_component != NULL); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - - bonobo_object_construct (BONOBO_OBJECT (shell_component), corba_object); - - priv = shell_component->priv; - - priv->create_view_fn = create_view_fn; - priv->create_folder_fn = create_folder_fn; - priv->remove_folder_fn = remove_folder_fn; - priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn; - - priv->closure = closure; - - for (i = 0; folder_types[i].name != NULL; i++) { - EvolutionShellComponentFolderType *new; - - if (folder_types[i].icon_name == NULL - || folder_types[i].name[0] == '\0' - || folder_types[i].icon_name[0] == '\0') - continue; - - new = g_new (EvolutionShellComponentFolderType, 1); - new->name = g_strdup (folder_types[i].name); - new->icon_name = g_strdup (folder_types[i].icon_name); - - priv->folder_types = g_list_prepend (priv->folder_types, new); - } - - if (priv->folder_types == NULL) - g_warning ("No valid folder types constructing EShellComponent %p", shell_component); -} - -EvolutionShellComponent * -evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn, - void *closure) -{ - EvolutionShellComponent *new; - POA_Evolution_ShellComponent *servant; - Evolution_ShellComponent corba_object; - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (evolution_shell_component_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - evolution_shell_component_construct (new, folder_types, corba_object, - create_view_fn, create_folder_fn, remove_folder_fn, - populate_folder_context_menu_fn, - closure); - - return new; -} - -EvolutionShellClient * -evolution_shell_component_get_owner (EvolutionShellComponent *shell_component) -{ - g_return_val_if_fail (shell_component != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component), NULL); - - return shell_component->priv->owner_client; -} - - -E_MAKE_TYPE (evolution_shell_component, "EvolutionShellComponent", EvolutionShellComponent, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h deleted file mode 100644 index bceb6a47cf..0000000000 --- a/shell/evolution-shell-component.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef EVOLUTION_SHELL_COMPONENT_H -#define EVOLUTION_SHELL_COMPONENT_H - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-control.h> - -#include "Evolution.h" - -#include "evolution-shell-client.h" - -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_SHELL_COMPONENT (evolution_shell_component_get_type ()) -#define EVOLUTION_SHELL_COMPONENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponent)) -#define EVOLUTION_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_COMPONENT, EvolutionShellComponentClass)) -#define EVOLUTION_IS_SHELL_COMPONENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) -#define EVOLUTION_IS_SHELL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_COMPONENT)) - - -typedef struct _EvolutionShellComponent EvolutionShellComponent; -typedef struct _EvolutionShellComponentPrivate EvolutionShellComponentPrivate; -typedef struct _EvolutionShellComponentClass EvolutionShellComponentClass; - -enum _EvolutionShellComponentResult { - EVOLUTION_SHELL_COMPONENT_OK, - EVOLUTION_SHELL_COMPONENT_CORBAERROR, - EVOLUTION_SHELL_COMPONENT_INTERRUPTED, - EVOLUTION_SHELL_COMPONENT_INVALIDARG, - EVOLUTION_SHELL_COMPONENT_ALREADYOWNED, - EVOLUTION_SHELL_COMPONENT_NOTOWNED, - EVOLUTION_SHELL_COMPONENT_NOTFOUND, - EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE, - EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION, - EVOLUTION_SHELL_COMPONENT_INTERNALERROR, - EVOLUTION_SHELL_COMPONENT_BUSY, - EVOLUTION_SHELL_COMPONENT_EXISTS, - EVOLUTION_SHELL_COMPONENT_INVALIDURI, - EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED, - EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS, - EVOLUTION_SHELL_COMPONENT_NOSPACE, - EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR -}; -typedef enum _EvolutionShellComponentResult EvolutionShellComponentResult; - -typedef EvolutionShellComponentResult (* EvolutionShellComponentCreateViewFn) - (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - BonoboControl **control_return, - void *closure); -typedef void (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - const Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentPopulateFolderContextMenu) (EvolutionShellComponent *shell_component, - BonoboUIComponent *uic, - const char *physical_uri, - const char *type, - void *closure); - -struct _EvolutionShellComponentFolderType { - char *name; - char *icon_name; -}; -typedef struct _EvolutionShellComponentFolderType EvolutionShellComponentFolderType; - -struct _EvolutionShellComponent { - BonoboObject parent; - - EvolutionShellComponentPrivate *priv; -}; - -struct _EvolutionShellComponentClass { - BonoboObjectClass parent_class; - - /* Signals. */ - - void (* owner_set) (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir); - void (* owner_unset) (EvolutionShellComponent *shell_component); -}; - - -GtkType evolution_shell_component_get_type (void); -void evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - Evolution_ShellComponent corba_object, - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn, - void *closure); -EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn, - void *closure); -EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* EVOLUTION_SHELL_COMPONENT_H */ diff --git a/shell/evolution-shell-view.c b/shell/evolution-shell-view.c deleted file mode 100644 index 46a59030d7..0000000000 --- a/shell/evolution-shell-view.c +++ /dev/null @@ -1,274 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> - -#include <gal/util/e-util.h> - -#include "evolution-shell-view.h" - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionShellViewPrivate { - int dummy; -}; - -enum { - SET_MESSAGE, - UNSET_MESSAGE, - CHANGE_VIEW, - SET_TITLE, - LAST_SIGNAL -}; -static int signals[LAST_SIGNAL] = { 0 }; - - -/* CORBA interface implementation. */ - -static POA_Evolution_ShellView__vepv ShellView_vepv; - -static POA_Evolution_ShellView * -create_servant (void) -{ - POA_Evolution_ShellView *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_ShellView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &ShellView_vepv; - CORBA_exception_init (&ev); - - POA_Evolution_ShellView__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static void -impl_ShellView_set_message (PortableServer_Servant servant, - const CORBA_char *message, - const CORBA_boolean busy, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[SET_MESSAGE], message, busy); -} - -static void -impl_ShellView_unset_message (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[UNSET_MESSAGE]); -} - -static void -impl_ShellView_change_current_view (PortableServer_Servant servant, - CORBA_char *uri, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[CHANGE_VIEW], - uri); -} - -static void -impl_ShellView_set_title (PortableServer_Servant servant, - CORBA_char *title, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[SET_TITLE], - title); -} - - -/* GtkObject methods. */ -static void -destroy (GtkObject *object) -{ - EvolutionShellView *shell_view; - EvolutionShellViewPrivate *priv; - - shell_view = EVOLUTION_SHELL_VIEW (object); - priv = shell_view->priv; - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_ShellView__vepv *vepv; - POA_Evolution_ShellView__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_ShellView__epv, 1); - epv->set_message = impl_ShellView_set_message; - epv->unset_message = impl_ShellView_unset_message; - epv->change_current_view = impl_ShellView_change_current_view; - epv->set_title = impl_ShellView_set_title; - - vepv = &ShellView_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_ShellView_epv = epv; -} - -static void -class_init (EvolutionShellViewClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[SET_MESSAGE] - = gtk_signal_new ("set_message", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellViewClass, set_message), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, - GTK_TYPE_BOOL); - - signals[UNSET_MESSAGE] - = gtk_signal_new ("unset_message", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellViewClass, unset_message), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[CHANGE_VIEW] - = gtk_signal_new ("change_current_view", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellViewClass, change_current_view), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - signals[SET_TITLE] - = gtk_signal_new ("set_title", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellViewClass, set_title), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - corba_class_init (); -} - -static void -init (EvolutionShellView *shell_view) -{ - EvolutionShellViewPrivate *priv; - - priv = g_new (EvolutionShellViewPrivate, 1); - priv->dummy = 0; - - shell_view->priv = priv; -} - - -/** - * evolution_shell_view_construct: - * @shell_view: - * @corba_object: - * - * Construct @shell_view with the specified @corba_object. - **/ -void -evolution_shell_view_construct (EvolutionShellView *shell_view, - Evolution_ShellView corba_object) -{ - g_return_if_fail (shell_view != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_VIEW (shell_view)); - - bonobo_object_construct (BONOBO_OBJECT (shell_view), corba_object); -} - -/** - * evolution_shell_view_new: - * - * Create a new EvolutionShellView object. - * - * Return value: The new EvolutionShellView object. - **/ -EvolutionShellView * -evolution_shell_view_new (void) -{ - POA_Evolution_ShellView *servant; - Evolution_ShellView corba_object; - EvolutionShellView *new; - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (evolution_shell_view_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - - evolution_shell_view_construct (new, corba_object); - - return new; -} - - -E_MAKE_TYPE (evolution_shell_view, "EvolutionShellView", EvolutionShellView, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-shell-view.h b/shell/evolution-shell-view.h deleted file mode 100644 index 546a1a9640..0000000000 --- a/shell/evolution-shell-view.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_SHELL_VIEW_H__ -#define __EVOLUTION_SHELL_VIEW_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_SHELL_VIEW (evolution_shell_view_get_type ()) -#define EVOLUTION_SHELL_VIEW(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_VIEW, EvolutionShellView)) -#define EVOLUTION_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_VIEW, EvolutionShellViewClass)) -#define EVOLUTION_IS_SHELL_VIEW(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_VIEW)) -#define EVOLUTION_IS_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_VIEW)) - - -typedef struct _EvolutionShellView EvolutionShellView; -typedef struct _EvolutionShellViewPrivate EvolutionShellViewPrivate; -typedef struct _EvolutionShellViewClass EvolutionShellViewClass; - -struct _EvolutionShellView { - BonoboObject parent; - - EvolutionShellViewPrivate *priv; -}; - -struct _EvolutionShellViewClass { - BonoboObjectClass parent_class; - - /* Signals. */ - - void (* set_message) (EvolutionShellView *shell_view, const char *message, gboolean busy); - void (* unset_message) (EvolutionShellView *shell_view); - void (* change_current_view) (EvolutionShellView *shell_view, const char *uri); - void (* set_title) (EvolutionShellView *shell_view, const char *message); -}; - - -GtkType evolution_shell_view_get_type (void); -void evolution_shell_view_construct (EvolutionShellView *shell_view, - Evolution_ShellView corba_object); -EvolutionShellView *evolution_shell_view_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_SHELL_VIEW_H__ */ diff --git a/shell/evolution-storage-listener.c b/shell/evolution-storage-listener.c deleted file mode 100644 index d841987ba7..0000000000 --- a/shell/evolution-storage-listener.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-listener.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> - -#include <gal/util/e-util.h> - -#include "evolution-storage-listener.h" - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -struct _EvolutionStorageListenerPrivate { - Evolution_StorageListener corba_objref; - EvolutionStorageListenerServant *servant; -}; - - -enum { - DESTROYED, - NEW_FOLDER, - UPDATE_FOLDER, - REMOVED_FOLDER, - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Evolution::StorageListener implementation. */ - -static POA_Evolution_StorageListener__vepv my_Evolution_StorageListener_vepv; - -static EvolutionStorageListener * -gtk_object_from_servant (PortableServer_Servant servant) -{ - EvolutionStorageListenerServant *my_servant; - - my_servant = (EvolutionStorageListenerServant *) servant; - return my_servant->gtk_object; -} - -static void -impl_Evolution_StorageListener_destroyed (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionStorageListener *listener; - EvolutionStorageListenerPrivate *priv; - - listener = gtk_object_from_servant (servant); - priv = listener->priv; - - gtk_signal_emit (GTK_OBJECT (listener), signals[DESTROYED]); -} - -static void -impl_Evolution_StorageListener_new_folder (PortableServer_Servant servant, - const CORBA_char *path, - const Evolution_Folder *folder, - CORBA_Environment *ev) -{ - EvolutionStorageListener *listener; - EvolutionStorageListenerPrivate *priv; - - listener = gtk_object_from_servant (servant); - priv = listener->priv; - - gtk_signal_emit (GTK_OBJECT (listener), signals[NEW_FOLDER], path, folder); -} - -static void -impl_Evolution_StorageListener_update_folder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_boolean highlighted, - CORBA_Environment *ev) -{ - EvolutionStorageListener *listener; - EvolutionStorageListenerPrivate *priv; - - listener = gtk_object_from_servant (servant); - priv = listener->priv; - - gtk_signal_emit (GTK_OBJECT (listener), signals[UPDATE_FOLDER], path, - display_name, highlighted); -} - -static void -impl_Evolution_StorageListener_removed_folder (PortableServer_Servant servant, - const CORBA_char *path, - CORBA_Environment *ev) -{ - EvolutionStorageListener *listener; - EvolutionStorageListenerPrivate *priv; - - listener = gtk_object_from_servant (servant); - priv = listener->priv; - - gtk_signal_emit (GTK_OBJECT (listener), signals[REMOVED_FOLDER], path); -} - -static EvolutionStorageListenerServant * -create_servant (EvolutionStorageListener *listener) -{ - EvolutionStorageListenerServant *servant; - POA_Evolution_StorageListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EvolutionStorageListenerServant, 1); - corba_servant = (POA_Evolution_StorageListener *) servant; - - corba_servant->vepv = &my_Evolution_StorageListener_vepv; - POA_Evolution_StorageListener__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->gtk_object = listener; - - CORBA_exception_free (&ev); - - return servant; -} - -static Evolution_StorageListener -activate_servant (EvolutionStorageListener *listener, - POA_Evolution_StorageListener *servant) -{ - Evolution_StorageListener corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionStorageListener *storage_listener; - EvolutionStorageListenerPrivate *priv; - CORBA_Environment ev; - - storage_listener = EVOLUTION_STORAGE_LISTENER (object); - priv = storage_listener->priv; - - CORBA_exception_init (&ev); - - if (priv->corba_objref != CORBA_OBJECT_NIL) - CORBA_Object_release (priv->corba_objref, &ev); - - if (priv->servant != NULL) { - PortableServer_ObjectId *object_id; - - object_id = PortableServer_POA_servant_to_id (bonobo_poa(), priv->servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev); - CORBA_free (object_id); - - POA_Evolution_StorageListener__fini (priv->servant, &ev); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_StorageListener__vepv *vepv; - POA_Evolution_StorageListener__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_StorageListener__epv, 1); - epv->destroyed = impl_Evolution_StorageListener_destroyed; - epv->new_folder = impl_Evolution_StorageListener_new_folder; - epv->update_folder = impl_Evolution_StorageListener_update_folder; - epv->removed_folder = impl_Evolution_StorageListener_removed_folder; - - vepv = & my_Evolution_StorageListener_vepv; - vepv->_base_epv = base_epv; - vepv->Evolution_StorageListener_epv = epv; -} - -static void -class_init (EvolutionStorageListenerClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - signals[DESTROYED] = gtk_signal_new ("destroyed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageListenerClass, destroyed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[NEW_FOLDER] = gtk_signal_new ("new_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageListenerClass, new_folder), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, - GTK_TYPE_POINTER); - - signals[UPDATE_FOLDER] = gtk_signal_new ("update_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageListenerClass, update_folder), - e_marshal_NONE__POINTER_POINTER_INT, - GTK_TYPE_NONE, 3, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_BOOL); - - signals[REMOVED_FOLDER] = gtk_signal_new ("removed_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageListenerClass, removed_folder), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EvolutionStorageListener *storage_listener) -{ - EvolutionStorageListenerPrivate *priv; - - priv = g_new (EvolutionStorageListenerPrivate, 1); - priv->corba_objref = CORBA_OBJECT_NIL; - - storage_listener->priv = priv; -} - - -void -evolution_storage_listener_construct (EvolutionStorageListener *listener, - Evolution_StorageListener corba_objref) -{ - EvolutionStorageListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); - - priv = listener->priv; - - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (listener), GTK_FLOATING); -} - -EvolutionStorageListener * -evolution_storage_listener_new (void) -{ - EvolutionStorageListener *new; - EvolutionStorageListenerPrivate *priv; - Evolution_StorageListener corba_objref; - - new = gtk_type_new (evolution_storage_listener_get_type ()); - priv = new->priv; - - priv->servant = create_servant (new); - corba_objref = activate_servant (new, (POA_Evolution_StorageListener *) priv->servant); - - evolution_storage_listener_construct (new, corba_objref); - - return new; -} - - -/** - * evolution_storage_listener_corba_objref: - * @listener: A pointer to an EvolutionStorageListener - * - * Get the CORBA object reference for the interface embedded in this GTK+ - * object wrapper. - * - * Return value: A pointer to the CORBA object reference. - **/ -Evolution_StorageListener -evolution_storage_listener_corba_objref (EvolutionStorageListener *listener) -{ - EvolutionStorageListenerPrivate *priv; - - g_return_val_if_fail (listener != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_STORAGE_LISTENER (listener), CORBA_OBJECT_NIL); - - priv = listener->priv; - return priv->corba_objref; -} - - -E_MAKE_TYPE (evolution_storage_listener, "EvolutionStorageListener", EvolutionStorageListener, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-storage-listener.h b/shell/evolution-storage-listener.h deleted file mode 100644 index 50a1ef7f72..0000000000 --- a/shell/evolution-storage-listener.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-listener.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_STORAGE_LISTENER_H__ -#define __EVOLUTION_STORAGE_LISTENER_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE_LISTENER (evolution_storage_listener_get_type ()) -#define EVOLUTION_STORAGE_LISTENER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_STORAGE_LISTENER, EvolutionStorageListener)) -#define EVOLUTION_STORAGE_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE_LISTENER, EvolutionStorageListenerClass)) -#define EVOLUTION_IS_STORAGE_LISTENER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_STORAGE_LISTENER)) -#define EVOLUTION_IS_STORAGE_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE_LISTENER)) - - -typedef struct _EvolutionStorageListener EvolutionStorageListener; -typedef struct _EvolutionStorageListenerPrivate EvolutionStorageListenerPrivate; -typedef struct _EvolutionStorageListenerClass EvolutionStorageListenerClass; - -struct _EvolutionStorageListener { - GtkObject parent; - - EvolutionStorageListenerPrivate *priv; -}; - -struct _EvolutionStorageListenerClass { - GtkObjectClass parent_class; - - /* Signals. */ - void (* destroyed) (EvolutionStorageListener *storage_listener); - void (* new_folder) (EvolutionStorageListener *storage_listener, - const char *path, - const Evolution_Folder *folder); - void (* update_folder) (EvolutionStorageListener *storage_listener, - const char *path, - const char *display_name); - void (* removed_folder) (EvolutionStorageListener *storage_listener, - const char *path); -}; - - -struct _EvolutionStorageListenerServant { - POA_Evolution_StorageListener servant_placeholder; - EvolutionStorageListener *gtk_object; -}; -typedef struct _EvolutionStorageListenerServant EvolutionStorageListenerServant; - - -GtkType evolution_storage_listener_get_type (void); -void evolution_storage_listener_construct (EvolutionStorageListener *listener, - Evolution_StorageListener corba_objref); -EvolutionStorageListener *evolution_storage_listener_new (void); - -Evolution_StorageListener evolution_storage_listener_corba_objref (EvolutionStorageListener *listener); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_STORAGE_LISTENER_H__ */ diff --git a/shell/evolution-storage-set-view-factory.c b/shell/evolution-storage-set-view-factory.c deleted file mode 100644 index 93359def10..0000000000 --- a/shell/evolution-storage-set-view-factory.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-factory.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-storage-set-view.h" -#include "e-shell.h" -#include "evolution-storage-set-view.h" - -#include "evolution-storage-set-view-factory.h" - - -BonoboControl * -evolution_storage_set_view_factory_new_view (EShell *shell) -{ - EStorageSet *storage_set; - GtkWidget *storage_set_view; - BonoboControl *control; - EvolutionStorageSetView *storage_set_view_interface; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - storage_set = e_shell_get_storage_set (shell); - storage_set_view = e_storage_set_view_new (storage_set); - gtk_widget_show (storage_set_view); - - storage_set_view_interface = evolution_storage_set_view_new (E_STORAGE_SET_VIEW (storage_set_view)); - if (storage_set_view_interface == NULL) { - gtk_widget_destroy (storage_set_view); - return NULL; - } - - control = bonobo_control_new (storage_set_view); - bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (storage_set_view_interface)); - - return control; -} diff --git a/shell/evolution-storage-set-view-factory.h b/shell/evolution-storage-set-view-factory.h deleted file mode 100644 index 85710e6cd1..0000000000 --- a/shell/evolution-storage-set-view-factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-factory.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H -#define _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H - -#include "e-shell.h" - -BonoboControl *evolution_storage_set_view_factory_new_view (EShell *shell); - -#endif /* _EVOLUTION_STORAGE_SET_VIEW_FACTORY_H */ diff --git a/shell/evolution-storage-set-view-listener.c b/shell/evolution-storage-set-view-listener.c deleted file mode 100644 index a6b6d89f8e..0000000000 --- a/shell/evolution-storage-set-view-listener.c +++ /dev/null @@ -1,289 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-listener.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> - -#include <gal/util/e-util.h> - -#include "evolution-storage-set-view-listener.h" - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -struct _EvolutionStorageSetViewListenerPrivate { - Evolution_StorageSetViewListener corba_listener; - EvolutionStorageSetViewListenerServant *servant; -}; - -enum { - FOLDER_SELECTED, - STORAGE_SELECTED, - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Evolution::StorageSetViewListener implementation. */ - -static POA_Evolution_StorageSetViewListener__vepv my_Evolution_StorageSetViewListener_vepv; - -static EvolutionStorageSetViewListener * -gtk_object_from_servant (PortableServer_Servant servant) -{ - EvolutionStorageSetViewListenerServant *my_servant; - - my_servant = (EvolutionStorageSetViewListenerServant *) servant; - return my_servant->gtk_object; -} - -static void -impl_Evolution_StorageSetViewListener_folder_selected (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - EvolutionStorageSetViewListener *listener; - - listener = gtk_object_from_servant (servant); - - gtk_signal_emit (GTK_OBJECT (listener), signals[FOLDER_SELECTED], uri); -} - -static void -impl_Evolution_StorageSetViewListener_storage_selected (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - EvolutionStorageSetViewListener *listener; - - listener = gtk_object_from_servant (servant); - - gtk_signal_emit (GTK_OBJECT (listener), signals[STORAGE_SELECTED], uri); -} - -static EvolutionStorageSetViewListenerServant * -create_servant (EvolutionStorageSetViewListener *listener) -{ - EvolutionStorageSetViewListenerServant *servant; - POA_Evolution_StorageSetViewListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EvolutionStorageSetViewListenerServant, 1); - corba_servant = (POA_Evolution_StorageSetViewListener *) servant; - - corba_servant->vepv = &my_Evolution_StorageSetViewListener_vepv; - POA_Evolution_StorageSetViewListener__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->gtk_object = listener; - - CORBA_exception_free (&ev); - - return servant; -} - -static Evolution_StorageSetViewListener -activate_servant (EvolutionStorageSetViewListener *listener, - POA_Evolution_StorageSetViewListener *servant) -{ - Evolution_StorageSetViewListener corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; -} - - -static void -impl_destroy (GtkObject *object) -{ - EvolutionStorageSetViewListener *listener; - EvolutionStorageSetViewListenerPrivate *priv; - CORBA_Environment ev; - - listener = EVOLUTION_STORAGE_SET_VIEW_LISTENER (object); - priv = listener->priv; - - CORBA_exception_init (&ev); - - if (priv->corba_listener != CORBA_OBJECT_NIL) - CORBA_Object_release (priv->corba_listener, &ev); - - if (priv->servant != NULL) { - PortableServer_ObjectId *object_id; - - object_id = PortableServer_POA_servant_to_id (bonobo_poa(), priv->servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev); - CORBA_free (object_id); - - POA_Evolution_StorageSetViewListener__fini (priv->servant, &ev); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_StorageSetViewListener__vepv *vepv; - POA_Evolution_StorageSetViewListener__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_StorageSetViewListener__epv, 1); - epv->folder_selected = impl_Evolution_StorageSetViewListener_folder_selected; - epv->storage_selected = impl_Evolution_StorageSetViewListener_storage_selected; - - vepv = & my_Evolution_StorageSetViewListener_vepv; - vepv->_base_epv = base_epv; - vepv->Evolution_StorageSetViewListener_epv = epv; -} - -static void -class_init (EvolutionStorageSetViewListenerClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - signals[FOLDER_SELECTED] = gtk_signal_new ("folder_selected", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageSetViewListenerClass, folder_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - signals[STORAGE_SELECTED] = gtk_signal_new ("storage_selected", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageSetViewListenerClass, storage_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EvolutionStorageSetViewListener *storage_set_view_listener) -{ - EvolutionStorageSetViewListenerPrivate *priv; - - priv = g_new (EvolutionStorageSetViewListenerPrivate, 1); - priv->corba_listener = CORBA_OBJECT_NIL; - - storage_set_view_listener->priv = priv; -} - - -void -evolution_storage_set_view_listener_construct (EvolutionStorageSetViewListener *listener, - Evolution_StorageSetViewListener corba_listener) -{ - EvolutionStorageSetViewListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (EVOLUTION_IS_STORAGE_SET_VIEW_LISTENER (listener)); - g_return_if_fail (corba_listener != CORBA_OBJECT_NIL); - - priv = listener->priv; - - g_return_if_fail (priv->corba_listener == CORBA_OBJECT_NIL); - - priv->corba_listener = corba_listener; - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (listener), GTK_FLOATING); -} - -EvolutionStorageSetViewListener * -evolution_storage_set_view_listener_new (void) -{ - EvolutionStorageSetViewListener *new; - EvolutionStorageSetViewListenerPrivate *priv; - Evolution_StorageSetViewListener corba_listener; - - new = gtk_type_new (evolution_storage_set_view_listener_get_type ()); - priv = new->priv; - - priv->servant = create_servant (new); - corba_listener = activate_servant (new, (POA_Evolution_StorageSetViewListener *) priv->servant); - - evolution_storage_set_view_listener_construct (new, corba_listener); - - return new; -} - -Evolution_StorageSetViewListener -evolution_storage_set_view_listener_corba_objref (EvolutionStorageSetViewListener *listener) -{ - EvolutionStorageSetViewListenerPrivate *priv; - - g_return_val_if_fail (listener != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_STORAGE_SET_VIEW_LISTENER (listener), CORBA_OBJECT_NIL); - - priv = listener->priv; - return priv->corba_listener; -} - - -E_MAKE_TYPE (evolution_storage_set_view_listener, "EvolutionStorageSetViewListener", EvolutionStorageSetViewListener, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-storage-set-view-listener.h b/shell/evolution-storage-set-view-listener.h deleted file mode 100644 index 662acc8f4c..0000000000 --- a/shell/evolution-storage-set-view-listener.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-listener.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _EVOLUTION_STORAGE_SET_VIEW_LISTENER_H_ -#define _EVOLUTION_STORAGE_SET_VIEW_LISTENER_H_ - -#include <gtk/gtkobject.h> - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE_SET_VIEW_LISTENER (evolution_storage_set_view_listener_get_type ()) -#define EVOLUTION_STORAGE_SET_VIEW_LISTENER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW_LISTENER, EvolutionStorageSetViewListener)) -#define EVOLUTION_STORAGE_SET_VIEW_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE_SET_VIEW_LISTENER, EvolutionStorageSetViewListenerClass)) -#define EVOLUTION_IS_STORAGE_SET_VIEW_LISTENER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW_LISTENER)) -#define EVOLUTION_IS_STORAGE_SET_VIEW_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW_LISTENER)) - - -typedef struct _EvolutionStorageSetViewListener EvolutionStorageSetViewListener; -typedef struct _EvolutionStorageSetViewListenerPrivate EvolutionStorageSetViewListenerPrivate; -typedef struct _EvolutionStorageSetViewListenerClass EvolutionStorageSetViewListenerClass; - -struct _EvolutionStorageSetViewListener { - GtkObject parent; - - EvolutionStorageSetViewListenerPrivate *priv; -}; - -struct _EvolutionStorageSetViewListenerClass { - GtkObjectClass parent_class; - - void (* folder_selected) (EvolutionStorageSetViewListener *listener, - const char *uri); - void (* storage_selected) (EvolutionStorageSetViewListener *listener, - const char *uri); -}; - - -struct _EvolutionStorageSetViewListenerServant { - POA_Evolution_StorageSetViewListener servant_placeholder; - EvolutionStorageSetViewListener *gtk_object; -}; -typedef struct _EvolutionStorageSetViewListenerServant EvolutionStorageSetViewListenerServant; - - -GtkType evolution_storage_set_view_listener_get_type (void); -void evolution_storage_set_view_listener_construct (EvolutionStorageSetViewListener *listener, - Evolution_StorageSetViewListener corba_objref); -EvolutionStorageSetViewListener *evolution_storage_set_view_listener_new (void); - -Evolution_StorageSetViewListener evolution_storage_set_view_listener_corba_objref (EvolutionStorageSetViewListener *listener); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _EVOLUTION_STORAGE_SET_VIEW_LISTENER_H_ */ diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c deleted file mode 100644 index 70892c686d..0000000000 --- a/shell/evolution-storage-set-view.c +++ /dev/null @@ -1,403 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include "evolution-storage-set-view.h" - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionStorageSetViewPrivate { - GtkWidget *storage_set_view_widget; - GList *listeners; -}; - - -/* EStorageSet widget callbacks. */ - -static void -storage_set_view_widget_folder_selected_cb (EStorageSetView *storage_set_view_widget, - const char *uri, - void *data) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - for (p = priv->listeners; p != NULL; p = p->next) { - CORBA_Environment ev; - Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (Evolution_StorageSetViewListener) p->data; - Evolution_StorageSetViewListener_folder_selected (listener, uri, &ev); - - /* FIXME: What if we fail? */ - - CORBA_exception_free (&ev); - } -} - -static void -storage_set_view_widget_storage_selected_cb (EStorageSetView *storage_set_view_widget, - const char *uri, - void *data) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - for (p = priv->listeners; p != NULL; p = p->next) { - CORBA_Environment ev; - Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (Evolution_StorageSetViewListener) p->data; - Evolution_StorageSetViewListener_storage_selected (listener, uri, &ev); - - /* FIXME: What if we fail? */ - - CORBA_exception_free (&ev); - } -} - - -/* Listener handling. */ - -static GList * -find_listener_in_list (Evolution_StorageSetViewListener listener, - GList *list) -{ - CORBA_Environment ev; - GList *p; - - CORBA_exception_init (&ev); - - for (p = list; p != NULL; p = p->next) { - Evolution_StorageSetViewListener listener_item; - - listener_item = (Evolution_StorageSetViewListener) p->data; - if (CORBA_Object_is_equivalent (listener, listener_item, &ev)) - break; - } - - CORBA_exception_free (&ev); - - return p; -} - -static gboolean -add_listener (EvolutionStorageSetView *storage_set_view, - Evolution_StorageSetViewListener listener) -{ - EvolutionStorageSetViewPrivate *priv; - CORBA_Environment ev; - const char *current_uri; - Evolution_StorageSetViewListener copy_of_listener; - - priv = storage_set_view->priv; - - if (find_listener_in_list (listener, priv->listeners) != NULL) - return FALSE; - - CORBA_exception_init (&ev); - - copy_of_listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return FALSE; - } - - priv->listeners = g_list_prepend (priv->listeners, copy_of_listener); - - current_uri = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view_widget)); - if (current_uri != NULL) - Evolution_StorageSetViewListener_folder_selected (listener, current_uri, &ev); - - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -remove_listener (EvolutionStorageSetView *storage_set_view, - Evolution_StorageSetViewListener listener) -{ - EvolutionStorageSetViewPrivate *priv; - GList *listener_node; - CORBA_Environment ev; - - priv = storage_set_view->priv; - - listener_node = find_listener_in_list (listener, priv->listeners); - if (listener_node == NULL) - return FALSE; - - CORBA_exception_init (&ev); - CORBA_Object_release ((CORBA_Object) listener_node->data, &ev); - CORBA_exception_free (&ev); - - priv->listeners = g_list_remove_link (priv->listeners, listener_node); - - return TRUE; -} - - -/* CORBA interface implementation. */ - -static POA_Evolution_StorageSetView__vepv StorageSetView_vepv; - -static POA_Evolution_StorageSetView * -create_servant (void) -{ - POA_Evolution_StorageSetView *servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = (POA_Evolution_StorageSetView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &StorageSetView_vepv; - - POA_Evolution_StorageSetView__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - servant = NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static void -impl_StorageSetView_add_listener (PortableServer_Servant servant, - const Evolution_StorageSetViewListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - - if (! add_listener (storage_set_view, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_StorageSetView_AlreadyListening, NULL); -} - -static void -impl_StorageSetView_remove_listener (PortableServer_Servant servant, - const Evolution_StorageSetViewListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - - if (! remove_listener (storage_set_view, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_StorageSetView_NotFound, NULL); -} - -static CORBA_boolean -impl_StorageSetView__get_show_folders (PortableServer_Servant servant, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - return (CORBA_boolean)e_storage_set_view_get_show_folders ( - E_STORAGE_SET_VIEW(priv->storage_set_view_widget)); -} - -static void -impl_StorageSetView__set_show_folders (PortableServer_Servant servant, - const CORBA_boolean value, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object); - priv = storage_set_view->priv; - - e_storage_set_view_set_show_folders ( - E_STORAGE_SET_VIEW(priv->storage_set_view_widget), - (gboolean)value); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionStorageSetView *storage_set_view; - EvolutionStorageSetViewPrivate *priv; - CORBA_Environment ev; - GList *p; - - storage_set_view = EVOLUTION_STORAGE_SET_VIEW (object); - priv = storage_set_view->priv; - - CORBA_exception_init (&ev); - - for (p = priv->listeners; p != NULL; p = p->next) { - Evolution_StorageSetViewListener listener; - - listener = (Evolution_StorageSetViewListener) p->data; - CORBA_Object_release (listener, &ev); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_StorageSetView__vepv *vepv; - POA_Evolution_StorageSetView__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_StorageSetView__epv, 1); - epv->add_listener = impl_StorageSetView_add_listener; - epv->remove_listener = impl_StorageSetView_remove_listener; - epv->_set_show_folders = impl_StorageSetView__set_show_folders; - epv->_get_show_folders = impl_StorageSetView__get_show_folders; - - vepv = &StorageSetView_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_StorageSetView_epv = epv; -} - -static void -class_init (EvolutionStorageSetViewClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - corba_class_init (); -} - -static void -init (EvolutionStorageSetView *storage_set_view) -{ - EvolutionStorageSetViewPrivate *priv; - - priv = g_new (EvolutionStorageSetViewPrivate, 1); - priv->storage_set_view_widget = NULL; - priv->listeners = NULL; - - storage_set_view->priv = priv; -} - - -void -evolution_storage_set_view_construct (EvolutionStorageSetView *storage_set_view, - Evolution_StorageSetView corba_object, - EStorageSetView *storage_set_view_widget) -{ - EvolutionStorageSetViewPrivate *priv; - - g_return_if_fail (storage_set_view != NULL); - g_return_if_fail (EVOLUTION_IS_STORAGE_SET_VIEW (storage_set_view)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - g_return_if_fail (storage_set_view_widget != NULL); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view_widget)); - - priv = storage_set_view->priv; - - bonobo_object_construct (BONOBO_OBJECT (storage_set_view), corba_object); - - g_assert (priv->storage_set_view_widget == NULL); - priv->storage_set_view_widget = GTK_WIDGET (storage_set_view_widget); - - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view_widget), "folder_selected", - GTK_SIGNAL_FUNC (storage_set_view_widget_folder_selected_cb), storage_set_view); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view_widget), "storage_selected", - GTK_SIGNAL_FUNC (storage_set_view_widget_storage_selected_cb), storage_set_view); -} - -EvolutionStorageSetView * -evolution_storage_set_view_new (EStorageSetView *storage_set_view_widget) -{ - POA_Evolution_StorageSetView *servant; - Evolution_StorageSetView corba_object; - EvolutionStorageSetView *new; - - g_return_val_if_fail (storage_set_view_widget != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view_widget), NULL); - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (evolution_storage_set_view_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - - evolution_storage_set_view_construct (new, corba_object, storage_set_view_widget); - - return new; -} - - -E_MAKE_TYPE (evolution_storage_set_view, "EvolutionStorageSetView", EvolutionStorageSetView, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-storage-set-view.h b/shell/evolution-storage-set-view.h deleted file mode 100644 index 1f3a9f84bf..0000000000 --- a/shell/evolution-storage-set-view.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _EVOLUTION_STORAGE_SET_VIEW_H_ -#define _EVOLUTION_STORAGE_SET_VIEW_H_ - -#include <bonobo/bonobo-object.h> - -#include "e-storage-set-view.h" - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE_SET_VIEW (evolution_storage_set_view_get_type ()) -#define EVOLUTION_STORAGE_SET_VIEW(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW, EvolutionStorageSetView)) -#define EVOLUTION_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE_SET_VIEW, EvolutionStorageSetViewClass)) -#define EVOLUTION_IS_STORAGE_SET_VIEW(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW)) -#define EVOLUTION_IS_STORAGE_SET_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE_SET_VIEW)) - - -typedef struct _EvolutionStorageSetView EvolutionStorageSetView; -typedef struct _EvolutionStorageSetViewPrivate EvolutionStorageSetViewPrivate; -typedef struct _EvolutionStorageSetViewClass EvolutionStorageSetViewClass; - -struct _EvolutionStorageSetView { - BonoboObject parent; - - EvolutionStorageSetViewPrivate *priv; -}; - -struct _EvolutionStorageSetViewClass { - BonoboObjectClass parent_class; -}; - - -GtkType evolution_storage_set_view_get_type (void); -void evolution_storage_set_view_construct (EvolutionStorageSetView *storage_set_view, - Evolution_StorageSetView corba_object, - EStorageSetView *storage_set_view_widget); -EvolutionStorageSetView *evolution_storage_set_view_new (EStorageSetView *storage_set_view_widget); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _EVOLUTION_STORAGE_SET_VIEW_H_ */ diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c deleted file mode 100644 index f9127c56c0..0000000000 --- a/shell/evolution-storage.c +++ /dev/null @@ -1,665 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "Evolution.h" - -#include <gal/util/e-util.h> - -#include "e-folder-tree.h" - -#include "evolution-storage.h" - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionStoragePrivate { - char *name; - - EFolderTree *folder_tree; - - GList *corba_storage_listeners; -}; - - -/* Utility functions. */ - -static void -list_through_listener_foreach (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - const Evolution_Folder *corba_folder; - Evolution_StorageListener corba_listener; - CORBA_Environment ev; - - corba_folder = (Evolution_Folder *) data; - corba_listener = (Evolution_StorageListener) closure; - - /* The root folder has no data. */ - if (corba_folder == NULL) - return; - - CORBA_exception_init (&ev); - Evolution_StorageListener_new_folder (corba_listener, path, corba_folder, &ev); - CORBA_exception_free (&ev); -} - -static void -list_through_listener (EvolutionStorage *storage, - Evolution_StorageListener listener, - CORBA_Environment *ev) -{ - EvolutionStoragePrivate *priv; - - priv = storage->priv; - - e_folder_tree_foreach (priv->folder_tree, - list_through_listener_foreach, - listener); -} - -static GList * -find_listener_in_list (const Evolution_StorageListener listener, - GList *list) -{ - CORBA_Environment ev; - GList *p; - - CORBA_exception_init (&ev); - - for (p = list; p != NULL; p = p->next) { - Evolution_StorageListener listener_item; - - listener_item = (Evolution_StorageListener) p->data; - - if (CORBA_Object_is_equivalent (listener_item, listener, &ev) && ev._major == CORBA_NO_EXCEPTION) - return p; - } - - CORBA_exception_free (&ev); - - return NULL; -} - -static gboolean -add_listener (EvolutionStorage *storage, - const Evolution_StorageListener listener) -{ - EvolutionStoragePrivate *priv; - Evolution_StorageListener listener_copy; - CORBA_Environment ev; - - priv = storage->priv; - - if (find_listener_in_list (listener, priv->corba_storage_listeners) != NULL) - return FALSE; - - CORBA_exception_init (&ev); - - listener_copy = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - /* Panic. */ - g_warning ("EvolutionStorage -- Cannot duplicate listener."); - CORBA_exception_free (&ev); - - /* FIXME this will cause the ::add_listener implementation to - incorrectly raise `AlreadyListening' */ - return FALSE; - } - - priv->corba_storage_listeners = g_list_prepend (priv->corba_storage_listeners, - listener_copy); - - list_through_listener (storage, listener_copy, &ev); - - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -remove_listener (EvolutionStorage *storage, - const Evolution_StorageListener listener) -{ - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GList *p; - - priv = storage->priv; - - p = find_listener_in_list (listener, priv->corba_storage_listeners); - if (p == NULL) - return FALSE; - - CORBA_exception_init (&ev); - CORBA_Object_release ((CORBA_Object) p->data, &ev); - CORBA_exception_free (&ev); - - priv->corba_storage_listeners = g_list_remove_link (priv->corba_storage_listeners, p); - - return TRUE; -} - - -/* Functions for the EFolderTree in the storage. */ - -static void -folder_destroy_notify (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - Evolution_Folder *corba_folder; - - corba_folder = (Evolution_Folder *) data; - CORBA_free (data); -} - - -/* CORBA interface implementation. */ - -static POA_Evolution_Storage__vepv Storage_vepv; - -static POA_Evolution_Storage * -create_servant (void) -{ - POA_Evolution_Storage *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_Storage *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &Storage_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Storage__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static CORBA_char * -impl_Storage__get_name (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorage *storage; - EvolutionStoragePrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - priv = storage->priv; - - return CORBA_string_dup (priv->name); -} - -static void -impl_Storage_add_listener (PortableServer_Servant servant, - const Evolution_StorageListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorage *storage; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - - if (! add_listener (storage, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_Storage_AlreadyListening, NULL); -} - -static void -impl_Storage_remove_listener (PortableServer_Servant servant, - const Evolution_StorageListener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorage *storage; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - - if (! remove_listener (storage, listener)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_Storage_NotFound, NULL); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EvolutionStorage *storage; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GList *p; - - storage = EVOLUTION_STORAGE (object); - priv = storage->priv; - - g_free (priv->name); - - if (priv->folder_tree != NULL) - e_folder_tree_destroy (priv->folder_tree); - - CORBA_exception_init (&ev); - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - Evolution_StorageListener listener; - - listener = p->data; - - Evolution_StorageListener_destroyed (listener, &ev); - - /* (This is not a Bonobo object, so no unref.) */ - CORBA_Object_release (listener, &ev); - } - - g_list_free (priv->corba_storage_listeners); - - CORBA_exception_free (&ev); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -corba_class_init (void) -{ - POA_Evolution_Storage__vepv *vepv; - - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - vepv = &Storage_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_Storage_epv = evolution_storage_get_epv (); -} - -static void -class_init (EvolutionStorageClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - corba_class_init (); -} - -static void -init (EvolutionStorage *storage) -{ - EvolutionStoragePrivate *priv; - - priv = g_new (EvolutionStoragePrivate, 1); - priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage); - priv->name = NULL; - priv->corba_storage_listeners = NULL; - - storage->priv = priv; -} - - -POA_Evolution_Storage__epv * -evolution_storage_get_epv (void) -{ - POA_Evolution_Storage__epv *epv; - - epv = g_new0 (POA_Evolution_Storage__epv, 1); - epv->_get_name = impl_Storage__get_name; - epv->add_listener = impl_Storage_add_listener; - epv->remove_listener = impl_Storage_remove_listener; - - return epv; -} - -void -evolution_storage_construct (EvolutionStorage *storage, - Evolution_Storage corba_object, - const char *name) -{ - EvolutionStoragePrivate *priv; - - g_return_if_fail (storage != NULL); - g_return_if_fail (EVOLUTION_IS_STORAGE (storage)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - g_return_if_fail (name != NULL); - g_return_if_fail (name[0] != '\0'); - - bonobo_object_construct (BONOBO_OBJECT (storage), corba_object); - - priv = storage->priv; - priv->name = g_strdup (name); -} - -EvolutionStorage * -evolution_storage_new (const char *name) -{ - EvolutionStorage *new; - POA_Evolution_Storage *servant; - Evolution_Storage corba_object; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (name[0] != '\0', NULL); - - servant = create_servant (); - if (servant == NULL) - return NULL; - - new = gtk_type_new (evolution_storage_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - evolution_storage_construct (new, corba_object, name); - - return new; -} - -EvolutionStorageResult -evolution_storage_register (EvolutionStorage *evolution_storage, - Evolution_StorageRegistry corba_storage_registry) -{ - EvolutionStorageResult result; - Evolution_StorageListener corba_storage_listener; - Evolution_Storage corba_storage; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - - g_return_val_if_fail (evolution_storage != NULL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (corba_storage_registry != CORBA_OBJECT_NIL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - priv = evolution_storage->priv; - - if (priv->corba_storage_listeners != NULL) - return EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED; - - CORBA_exception_init (&ev); - - corba_storage = bonobo_object_corba_objref (BONOBO_OBJECT (evolution_storage)); - corba_storage_listener = Evolution_StorageRegistry_register_storage (corba_storage_registry, - corba_storage, - priv->name, &ev); - - if (ev._major == CORBA_NO_EXCEPTION) { - add_listener (evolution_storage, corba_storage_listener); - result = EVOLUTION_STORAGE_OK; - } else { - if (ev._major != CORBA_USER_EXCEPTION) - result = EVOLUTION_STORAGE_ERROR_CORBA; - else if (strcmp (CORBA_exception_id (&ev), ex_Evolution_StorageRegistry_Exists) == 0) - result = EVOLUTION_STORAGE_ERROR_EXISTS; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - } - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionStorageResult -evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, - Evolution_Shell corba_shell) -{ - Evolution_StorageRegistry corba_storage_registry; - EvolutionStorageResult result; - CORBA_Environment ev; - - g_return_val_if_fail (evolution_storage != NULL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (corba_shell != CORBA_OBJECT_NIL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - CORBA_exception_init (&ev); - - corba_storage_registry = Bonobo_Unknown_queryInterface (corba_shell, - "IDL:Evolution/StorageRegistry:1.0", - &ev); - if (corba_storage_registry == CORBA_OBJECT_NIL || ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return EVOLUTION_STORAGE_ERROR_NOREGISTRY; - } - - result = evolution_storage_register (evolution_storage, corba_storage_registry); - - Bonobo_Unknown_unref (corba_storage_registry, &ev); - CORBA_Object_release (corba_storage_registry, &ev); - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionStorageResult -evolution_storage_new_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - const char *type, - const char *physical_uri, - const char *description, - gboolean highlighted) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - Evolution_Folder *corba_folder; - CORBA_Environment ev; - GList *p; - - g_return_val_if_fail (evolution_storage != NULL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (path != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (type != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (physical_uri != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - if (description == NULL) - description = ""; - - priv = evolution_storage->priv; - - CORBA_exception_init (&ev); - - corba_folder = Evolution_Folder__alloc (); - corba_folder->display_name = CORBA_string_dup (display_name); - corba_folder->description = CORBA_string_dup (description); - corba_folder->type = CORBA_string_dup (type); - corba_folder->physical_uri = CORBA_string_dup (physical_uri); - corba_folder->highlighted = highlighted; - - result = EVOLUTION_STORAGE_OK; - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - Evolution_StorageListener listener; - - listener = p->data; - Evolution_StorageListener_new_folder (listener, path, corba_folder, &ev); - - if (ev._major == CORBA_NO_EXCEPTION) - continue; - - if (ev._major != CORBA_USER_EXCEPTION) - result = EVOLUTION_STORAGE_ERROR_CORBA; - else if (strcmp (CORBA_exception_id (&ev), ex_Evolution_StorageListener_Exists) == 0) - result = EVOLUTION_STORAGE_ERROR_EXISTS; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - - break; - } - - CORBA_exception_free (&ev); - - if (result == EVOLUTION_STORAGE_OK) { - if (! e_folder_tree_add (priv->folder_tree, path, corba_folder)) - result = EVOLUTION_STORAGE_ERROR_EXISTS; - } - - return result; -} - -EvolutionStorageResult -evolution_storage_update_folder (EvolutionStorage *evolution_storage, - const char *path, const char *display_name, - gboolean highlighted) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GList *p; - Evolution_Folder *corba_folder; - - g_return_val_if_fail (evolution_storage != NULL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (path != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - priv = evolution_storage->priv; - - if (priv->corba_storage_listeners == NULL) - return EVOLUTION_STORAGE_ERROR_NOTREGISTERED; - - CORBA_exception_init (&ev); - - result = EVOLUTION_STORAGE_OK; - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - Evolution_StorageListener listener; - - listener = p->data; - Evolution_StorageListener_update_folder (listener, path, display_name, highlighted, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - continue; - - if (ev._major != CORBA_USER_EXCEPTION) - result = EVOLUTION_STORAGE_ERROR_CORBA; - else if (strcmp (CORBA_exception_id (&ev), ex_Evolution_StorageListener_NotFound) == 0) - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - - break; - } - - CORBA_exception_free (&ev); - - if (result == EVOLUTION_STORAGE_OK) { - corba_folder = e_folder_tree_get_folder (priv->folder_tree, path); - if (corba_folder != NULL) { - CORBA_free (corba_folder->display_name); - corba_folder->display_name = CORBA_string_dup (display_name); - corba_folder->highlighted = highlighted; - } else - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - } - - return result; -} - -EvolutionStorageResult -evolution_storage_removed_folder (EvolutionStorage *evolution_storage, - const char *path) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GList *p; - - g_return_val_if_fail (evolution_storage != NULL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (path != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - g_return_val_if_fail (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - priv = evolution_storage->priv; - - if (priv->corba_storage_listeners == NULL) - return EVOLUTION_STORAGE_ERROR_NOTREGISTERED; - - CORBA_exception_init (&ev); - - result = EVOLUTION_STORAGE_OK; - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - Evolution_StorageListener listener; - - listener = p->data; - Evolution_StorageListener_removed_folder (listener, path, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - continue; - - if (ev._major != CORBA_USER_EXCEPTION) - result = EVOLUTION_STORAGE_ERROR_CORBA; - else if (strcmp (CORBA_exception_id (&ev), ex_Evolution_StorageListener_NotFound) == 0) - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - - break; - } - - CORBA_exception_free (&ev); - - if (result == EVOLUTION_STORAGE_OK) { - if (! e_folder_tree_remove (priv->folder_tree, path)) - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - } - - return result; -} - - -E_MAKE_TYPE (evolution_storage, "EvolutionStorage", EvolutionStorage, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h deleted file mode 100644 index 91b34c4efe..0000000000 --- a/shell/evolution-storage.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __EVOLUTION_STORAGE_H__ -#define __EVOLUTION_STORAGE_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object.h> - -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_STORAGE (evolution_storage_get_type ()) -#define EVOLUTION_STORAGE(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_STORAGE, EvolutionStorage)) -#define EVOLUTION_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_STORAGE, EvolutionStorageClass)) -#define EVOLUTION_IS_STORAGE(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_STORAGE)) -#define EVOLUTION_IS_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_STORAGE)) - - -typedef struct _EvolutionStorage EvolutionStorage; -typedef struct _EvolutionStoragePrivate EvolutionStoragePrivate; -typedef struct _EvolutionStorageClass EvolutionStorageClass; - -enum _EvolutionStorageResult { - EVOLUTION_STORAGE_OK, - EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED, - EVOLUTION_STORAGE_ERROR_NOTREGISTERED, - EVOLUTION_STORAGE_ERROR_NOREGISTRY, - EVOLUTION_STORAGE_ERROR_CORBA, - EVOLUTION_STORAGE_ERROR_EXISTS, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER, - EVOLUTION_STORAGE_ERROR_NOTFOUND, - EVOLUTION_STORAGE_ERROR_GENERIC -}; -typedef enum _EvolutionStorageResult EvolutionStorageResult; - -struct _EvolutionStorage { - BonoboObject parent; - - EvolutionStoragePrivate *priv; -}; - -struct _EvolutionStorageClass { - BonoboObjectClass parent_class; -}; - - -POA_Evolution_Storage__epv *evolution_storage_get_epv (void); - -GtkType evolution_storage_get_type (void); -void evolution_storage_construct (EvolutionStorage *storage, - Evolution_Storage corba_object, - const char *name); -EvolutionStorage *evolution_storage_new (const char *name); - -EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage, - Evolution_StorageRegistry corba_registry); -EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, - Evolution_Shell corba_shell); -EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - const char *type, - const char *physical_uri, - const char *description, - gboolean highlighted); -EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - gboolean highlighted); -EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage, - const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_STORAGE_H__ */ diff --git a/shell/glade/.cvsignore b/shell/glade/.cvsignore deleted file mode 100644 index 3045c518dc..0000000000 --- a/shell/glade/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.deps -.libs -Makefile.in -Makefile diff --git a/shell/glade/Makefile.am b/shell/glade/Makefile.am deleted file mode 100644 index 9ef3238360..0000000000 --- a/shell/glade/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -gladedir = $(datadir)/evolution/glade - -glade_DATA = e-shell-folder-creation-dialog.glade - -EXTRA_DIST = $(glade_DATA) diff --git a/shell/glade/e-shell-folder-creation-dialog.glade b/shell/glade/e-shell-folder-creation-dialog.glade deleted file mode 100644 index 55319a6505..0000000000 --- a/shell/glade/e-shell-folder-creation-dialog.glade +++ /dev/null @@ -1,169 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Shell</name> - <program_name>shell</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GnomeDialog</class> - <name>create_folder_dialog</name> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <default_width>350</default_width> - <default_height>410</default_height> - <allow_shrink>True</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>ok_button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>cancel_button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>main_vbox</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>folder_name_label</name> - <label>Folder name:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>folder_name_entry</name> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>folder_type_label</name> - <label>Folder type:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>folder_type_option_menu</name> - <can_focus>True</can_focus> - <items></items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>creation_position_label</name> - <label>Specify where to create the folder:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/shell/main.c b/shell/main.c deleted file mode 100644 index f71c0ce40d..0000000000 --- a/shell/main.c +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* main.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> -#include <libgnomeui/gnome-window-icon.h> -#include <glade/glade.h> -#include <liboaf/liboaf.h> -#include <unicode.h> - -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-cursors.h> -#include "e-setup.h" - -#include "e-shell.h" - -#define STARTUP_URI "evolution:/local/Inbox" - -static EShell *shell = NULL; -static char *evolution_directory = NULL; -static gboolean no_splash = FALSE; - -static void -no_views_left_cb (EShell *shell, gpointer data) -{ - e_shell_quit (shell); - gtk_main_quit (); -} - -static void -destroy_cb (GtkObject *object, gpointer data) -{ - gtk_main_quit (); -} - -static void -development_warning () -{ - GtkWidget *label, *warning_dialog; - int ret; - - warning_dialog = gnome_dialog_new ( - "Evolution" VERSION, - GNOME_STOCK_BUTTON_OK, - NULL); - - label = gtk_label_new ( - _( - "Hi. Thanks for taking the time to download this preview release\n" - "of the Evolution groupware suite.\n" - "\n" - "Over the last month and a half, our focus has been on making\n" - "Evolution usable. Many of the Evolution developers are now using\n" - "Evolution to read their mail full time. You could too. (Just\n" - "be sure to keep a backup.)\n" - "\n" - "But while we have fixed many bugs affecting its stability and\n" - "security, you still get the disclaimer: Evolution will: crash,\n" - "lose your mail when you don't want it to, refuse to delete your\n" - "mail when you do want it to, leave stray processes running,\n" - "consume 100% CPU, race, lock, send HTML mail to random mailing\n" - "lists, and embarass you in front of your friends and co-workers.\n" - "Use only as directed.\n" - "\n" - "We hope that you enjoy the results of our hard work, and we eagerly\n" - "await your contributions!\n" - )); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 4); - - label = gtk_label_new ( - _( - "Thanks\n" - "The Evolution Team\n" - )); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment(GTK_MISC(label), 1, .5); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - - ret = gnome_dialog_run (GNOME_DIALOG (warning_dialog)); - if (ret != -1) - gtk_object_destroy (GTK_OBJECT (warning_dialog)); -} - -static gint -idle_cb (gpointer data) -{ - EShellView *view; - - shell = e_shell_new (evolution_directory, ! no_splash); - g_free (evolution_directory); - - if (shell == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Evolution shell.")); - exit (1); - } - - gtk_signal_connect (GTK_OBJECT (shell), "no_views_left", - GTK_SIGNAL_FUNC (no_views_left_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (destroy_cb), NULL); - - if (! e_shell_restore_from_settings (shell)) - view = e_shell_new_view (shell, STARTUP_URI); - - if (!getenv ("EVOLVE_ME_HARDER")) - development_warning (); - - return FALSE; -} - -int -main (int argc, char **argv) -{ - struct poptOption options[] = { - { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable."), NULL }, - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL }, - POPT_AUTOHELP - { NULL, '\0', 0, NULL, 0, NULL, NULL } - }; - -#ifdef ENABLE_NLS - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); -#endif - - gnome_init_with_popt_table ("Evolution", VERSION, argc, argv, options, 0, NULL); - oaf_init (argc, argv); - - glade_gnome_init (); - unicode_init (); - e_cursors_init (); - - gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png"); - - if (! bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Bonobo component system.")); - exit (1); - } - - /* FIXME */ - evolution_directory = g_concat_dir_and_file (g_get_home_dir (), "evolution"); - - if (! e_setup (evolution_directory)) { - g_free (evolution_directory); - exit (1); - } - - gtk_idle_add (idle_cb, evolution_directory); - - bonobo_main (); - - return 0; -} - |