diff options
author | nobody <nobody@localhost> | 2001-09-17 12:32:38 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2001-09-17 12:32:38 +0800 |
commit | 4f2abf579ec022b1eaffddd95c361040f9891878 (patch) | |
tree | 6f31e70927858f2bafcfc481e337a665090bdb8e /shell | |
parent | 169d9ae19a0eb165edc757eca753a757a02f60f7 (diff) | |
download | gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar.gz gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar.bz2 gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar.lz gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar.xz gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.tar.zst gsoc2013-evolution-4f2abf579ec022b1eaffddd95c361040f9891878.zip |
This commit was manufactured by cvs2svn to create tagGTKHTML_0_13_0
'GTKHTML_0_13_0'.
svn path=/tags/GTKHTML_0_13_0/; revision=12884
Diffstat (limited to 'shell')
140 files changed, 0 insertions, 45444 deletions
diff --git a/shell/.cvsignore b/shell/.cvsignore deleted file mode 100644 index dc7b762b85..0000000000 --- a/shell/.cvsignore +++ /dev/null @@ -1,16 +0,0 @@ -*.lo -.deps -.libs -.pure -Evolution-common.c -Evolution-skels.c -Evolution-stubs.c -Evolution.h -GNOME_Evolution_Shell.oaf -ID -Makefile -Makefile.in -evolution -evolution-test-component -evolution.pure -libeshell.la diff --git a/shell/ChangeLog b/shell/ChangeLog deleted file mode 100644 index aa3490349c..0000000000 --- a/shell/ChangeLog +++ /dev/null @@ -1,8200 +0,0 @@ -2001-09-16 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (etree_get_node_by_id): Made save_id const - here. - -2001-09-14 Ettore Perazzoli <ettore@ximian.com> - - [Automake 1.5 fixes pointed out by Richard Boulton - <richard@tartarus.org>, as per #9258.] - - * importer/Makefile.am (CLEANFILES): Assign directly using `=', - instead of `+='. - * Makefile.am (CLEANFILES): Likewise. - -2001-09-14 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (impl_Shell_getLocalStorage): Return a proper value. - (impl_Shell_createStorageSetView): Likewise. - (impl_Shell_setLineStatus): Likewise. - (impl_Shell__get_displayName): Likewise. - (impl_Shell_getComponentByType): Likewise. - (impl_Shell_createNewView): Likewise. - (impl_Shell_handleURI): Likewise. - -2001-09-14 Iain Holmes <iain@ximian.com> - - * e-shell-importer.c (start_import): Only check for local path if the - folderpath != NULL. - - * e-shell-startup-wizard.c (prepare_importer_page): Remove GTK_CLIST - cast. - -2001-09-12 Iain Holmes <iain@ximian.com> - - * evolution-wizard.c: Remove spewage. - -2001-09-14 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-importer.c (start_import): Removed unused variable. - -2001-09-14 Ettore Perazzoli <ettore@ximian.com> - - [Fix #8204 and the other bugs caused by allowing invocations on - the ::Shell interface to happen before the shell is actually fully - initialized. This is a lame hack and not a nice, complete - solution for the problem, but it should do for now.] - - * e-shell.c: New member `is_initialized' in `EShellPrivate'. - (init): Initialize to %FALSE. - (e_shell_construct): Set `is_initialized' to %TRUE after the - initialization sequence is finished. - (raise_exception_if_not_ready): New utility function to raise the - notReady exception if the shell is not ready. - (impl_Shell__get_displayName): Call it. - (impl_Shell_getComponentByType): Likewise. - (impl_Shell_createNewView): Likewise. - (impl_Shell_handleURI): Likewise. - (impl_Shell_selectUserFolder): Likewise. - (impl_Shell_getLocalStorage): Likewise. - (impl_Shell_createStorageSetView): Likewise. - (impl_Shell_setLineStatus): Likewise. - (e_shell_construct): Print out the repo_id of the exception from - `bonobo_get_object()' if it fails. Also, register on OAF just - before displaying the splash. - - * Evolution-Shell.idl: New exception `NotReady'. All the CORBA - methods on ::Shell can now raise this exception. - -2001-09-13 Ettore Perazzoli <ettore@ximian.com> - - [Fix #5990, Remembering Evolution window geometry.] - - * e-shell.c (impl_Shell_createNewView): gtk_widget_show() the new - view returned by `e_shell_create_view()'. - (e_shell_restore_from_settings): Same here, after loading the - settings. - - * e-shell-view.c (activate_shortcut_cb): gtk_widget_show() the new - view returned by `e_shell_create_view()'. - - * e-shell-view-menu.c (command_open_folder_in_new_window): - gtk_widget_show() the view returned by `e_shell_create_view()'. - - * e-shell-folder-commands.c - (e_shell_command_open_folder_in_other_window): gtk_widget_show() - the view returned by `e_shell_create_view()'. - - * e-shell.c (e_shell_create_view): Don't show the view - automatically anymore. - - * e-shell-view.c (e_shell_view_save_settings): Save the width and - height of the window. - (e_shell_view_load_settings): Restore the width and the height and - gtk_window_set_default_size() based on them. - -2001-09-13 Ettore Perazzoli <ettore@ximian.com> - - [Remove a bunch of debugging messages, as per #7741.] - - * evolution-wizard.c (impl_GNOME_Evolution_Wizard_notifyAction): - Removed debugging messages. - - * e-storage-set.c (storage_removed_folder_cb): Removed debugging - message. - - * e-storage-set-view.c (tree_drag_begin): Removed debugging - message. - (tree_drag_data_received): Removed debugging messages. - - * e-shortcuts.c (idle_cb): Removed debugging message. - - * e-shortcuts-view-model.c (get_icon_for_item): Removed debugging - message. - - * e-shell.c (setup_components): Removed debugging message. - - * e-shell-startup-wizard.c (druid_event_notify_cb): Removed - debugging message. - (e_shell_startup_wizard_create): Removed debugging message. - - * e-shell-offline-handler.c (finalize_offline_hash_foreach): - Removed debugging message. - - * e-shell-importer.c (start_import): Removed debugging message. - (item_selected): Same here. - - * e-local-storage.c (async_xfer_folder_step): Removed debugging - message. - - * e-corba-storage.c (impl_StorageListener_notifyFolderCreated): - Changed the error from a g_print() into a g_warning(). Removed - debugging message. - - * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): - Removed debugging message. - (impl_StorageRegistry_removeStorageByName): Likewise. - - * e-component-registry.c (component_free): Removed debugging - message. - (register_component): Don't printf() about the registered folder - type. - (register_component): Don't printf() about the registered schema - type. - -2001-09-13 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (pop_up_folder_bar): Disable DnD on the - EStorageSetView to avoid strange behaviors. - (reparent_storage_set_view_box_and_destroy_popup): Re-enable DnD - here. - (popdown_transient_folder_bar): And here as well. - - * evolution-storage-set-view-factory.c - (evolution_storage_set_view_factory_new_view): Disable DnD on the - EStorageSetView. - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_construct): Disable DnD on the - EStorageSetView. - - * e-shell-folder-creation-dialog.c (add_storage_set_view): Disable - DnD on the EStorageSetView. - - * e-storage-set-view.c: New member `allow_dnd' in - `EStorageSetViewPrivate'. - (init): Init to `allow_dnd' %TRUE. - (tree_start_drag): If `allow_dnd' is false, don't start the drag - and return %FALSE. - (tree_drag_motion): If `allow_dnd' is false, return %FALSE. - (e_storage_set_view_get_allow_dnd): New. - (e_storage_set_view_set_allow_dnd): New. - -2001-09-12 Ettore Perazzoli <ettore@ximian.com> - - * main.c (main): Add SUB_VERSION to the version string passed to - `gnome_init_with_popt_table()'. - -2001-09-12 Chris Toshok <toshok@ximian.com> - - * e-shell-importer.c (start_import): only allow importing to - /local folders. - -2001-09-12 Ettore Perazzoli <ettore@ximian.com> - - [Fix #4962, "Highlighting is left after a drag".] - - * e-storage-set-view.c (tree_drag_motion): Only highlight when - moving over allowed targets. - -2001-09-12 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c (unrealize): Only - gtk_widget_destroy() the icon_widget if it's not NULL. - -2001-09-12 Iain Holmes <iain@ximian.com> - - * importers/evolution-importer-client.c - (evolution_importer_client_process_item): Remove spew. - -2001-09-10 Dan Winship <danw@ximian.com> - - * e-shell-view.c (socket_destroy_cb): Oops. Remove duplicate free. - -2001-09-09 Dan Winship <danw@ximian.com> - - Purify run. All small leaks. - - * e-shell-folder-commands.c - (folder_selection_dialog_folder_selected_callback): Free the - folder_command_data when destroying the dialog. - - * e-local-storage.c (remove_folder): Free physical_uri if we - allocated it. - - * e-shortcuts-view.c (pop_up_right_click_menu_for_group): Unref - the popup menu, don't destroy it. - (destroy_group_cb): Free the question string. - (rename_group_cb): Free the new_name. - - * e-shell-importer.c (create_plugin_menu): Free the list of - importers. - (get_iid_for_filetype): Likewise. - (import_druid_finish): #ifdef out some g_strdups that are only - used by other #ifdef'ed-out code. - - * e-shell-view.c: Make sure the keys in the uri_to_view hash get - freed. - - * e-shell-folder-title-bar.c (set_title_bar_label_style): Unref - the style after setting it on the widget. - - * e-shell-offline-handler.c (impl_destroy): free priv. - - * e-storage-set-view.c (tree_drag_data_received): Make sure - target_type always gets freed. - - * e-shell-folder-creation-dialog.c (add_folder_types): Don't leak - the type names. - -2001-09-07 Iain Holmes <iain@ximian.com> - - * e-shell-startup-wizard.c (prepare_importer_page): New design. - (make_importer_page): Remove the extra widgets for the new design. - -2001-09-07 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (tree_start_drag): Changed this to use the - new ETable/ETree drag stuff. - -2001-09-07 Dan Winship <danw@ximian.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_new): Remove the "see previous - error messages?" comment from the error message when starting a - component, since oafd eats the output of the components it - launches now, so it's just misleading. - -2001-09-06 Chris Toshok <toshok@ximian.com> - - * evolution-storage.c (impl_Storage_async_remove_folder): change - to match create_folder. - (e_marshal_NONE__POINTER_POINTER_POINTER): new marshaller for - remove_folder. - (class_init): make sure to use the right marshaller for - create/remove_folder. - - * evolution-storage.h: change the signature of both the - create_folder and remove_folder signals to be more in line with - what's in evolution-storage.c. They both take a Bonobo_Listener - which the signal func notifies, instead of synchronously returning - the result. - -2001-09-06 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c (evolution_activity_client_update): - Allow a value of -1.0 for @progress [which means "unknown - progress"]. - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - [Fix #958, ShellComponents should not be created by factories, for - the test component.] - - * GNOME_Evolution_TestComponent.oaf: Remove the factory. - - * evolution-test-component.c (COMPONENT_FACTORY_ID): Removed. - (component_factory_init): Removed. - (register_component): Rename from `component_fn'. No args, no - return value. Register the thing on OAF by yourself instead of - using a factory. - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view.c (get_shortcut_info): New. - (get_efolder_from_shortcut): Removed. - (impl_shortcut_dropped): Use `get_shortcut_info()' instead. - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - * main.c (development_warning): s/Evolution/Ximian Evolution/. - (idle_cb): Likewise. - - * e-splash.c (e_splash_construct): s/Evolution/Ximian Evolution/. - - * e-shell-view.c (e_shell_view_construct): s/Evolution/Ximian - Evolution/. - (update_for_current_uri): Likewise. - (update_offline_toggle_status): Likewise. - - * e-shell-view-menu.c (command_about_box): s/Evolution/Ximian - Evolution/. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - [Fix #6474 and friends, crash when selecting things from the - context activity context menu.] - - * e-activity-handler.c: New member `menu' in struct - `ActivityInfo'. - (activity_info_new): Init to NULL. - (show_cancellation_popup): Set the `menu' member to point to this - newly created pop-up, use `gnome_popup_menu_do_popup_modal()' - instead of `gnome_popup_menu_do_popup()', and set the `menu' - member to NULL when the menu is gone. - (activity_info_free): Destroy `menu' member. - (impl_requestDialog): Return - `GNOME_Evolution_Activity_DIALOG_ACTION_ERROR' instead of nothing. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - [Fix #6971, Default folder should be the Summary.] - - * main.c (idle_cb): s/DEFAULT_URI/E_SHELL_VIEW_DEFAULT_URI/. - - * e-shell.c (e_shell_create_view): - s/DEFAULT_URI/E_SHELL_VIEW_DEFAULT_URI/. - - * e-shell-view.c (socket_destroy_cb): - s/DEFAULT_URI/E_SHELL_VIEW_DEFAULT_URI/. - (e_shell_view_save_settings): Likewise. - - * e-shell-folder-commands.c (e_shell_command_delete_folder): - s/DEFAULT_URI/E_SHELL_VIEW_DEFAULT_URI/. - - * e-shell-view.h (DEFAULT_URI): Rename to - `E_SHELL_VIEW_DEFAULT_URI'. Change from "evolution:/local/Inbox" - to be "evolution:/summary". - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - [Fix ^#7675, Crashes trying to empty trash folder.] - - * e-shortcuts.c (e_shortcuts_construct): Use - `gtk_signal_connect_while_alive()' so we don't invoke the - callbacks on dead EShortcuts objects. - -2001-09-04 Iain Holmes <iain@ximian.com> - - * e-shell-importer.c (start_importer): Report errors in a dialog. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - * e-activity-handler.c (impl_operationProgressing): Just ignore - the request if the activity handler has the GTK_OBJECT_DESTROYED() - flag set. This should prevent crashes like #7542 and friends when - the components are not well-behaved enough to respect the Bonobo - refcounting. - (impl_operationStarted): Likewise. - (impl_operationFinished): Likewise. - (impl_requestDialog): Likewise. - -2001-09-04 Iain Holmes <iain@ximian.com> - - * e-shell-importer.c (start_import): Check the file exists before trying - to do anything. - -2001-09-04 Iain Holmes <iain@ximian.com> - - * e-shell.c (e_shell_construct): Make the other components shut down - correctly when the first time dialog is cancelled. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (tree_drag_motion): Remove debugging - message. - (tree_drag_motion): Likewise. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - [Patch from Richard Boulton <richard@tartarus.org> to fix #8497, - "Warning when shutting view: RootNode not found".] - - * e-storage-set-view.c (e_storage_set_view_construct): Add the - root node to the hash. - (e_storage_set_view_set_show_folders): Likewise. - -2001-08-30 Peter Williams <peterw@ximian.com> - - * e-local-storage.c (async_xfer_folder_complete): Remove the folder from - the EvolutionStorage as well as the EStorage. - -2001-08-29 Peter Williams <peterw@ximian.com> - - * e-storage-set-view.c (etree_node_destroy_func): Only call - remove_node_from_hash if it's not the root node. - (removed_storage_cb): Don't remove the node from the hash here, - because it will be removed in the node_destroyed callback. - (removed_folder_cb): Same. - - * e-shell-view.c (e_shell_view_remove_control_for_uri): Disconnect - from the destroy signal so as not to confuse ourselves. Also, the - page remove in the notebook destroys the control and the socket, so don't - do that explicitly. - - * e-shell-folder-commands.c - (folder_selection_dialog_folder_selected_callback): Remove the control - for the source view if we're moving. - -2001-08-31 Zbigniew Chyla <cyba@gnome.pl> - - * e-local-storage.c - (setup_folder_as_stock): Don't convert folder name to UTF-8 manually... - (setup_stock_folders): ... just use U_() here. - (impl_get_display_name): Marked string for translation (with U_). - - * e-storage-set-view.c - (storage_sort_callback): s/strcasecmp/g_utf8_collate/ - (folder_sort_callback): ditto - - * e-summary-storage.c (impl_get_display_name): - Marked string for translation (with U_). - -2001-08-29 Iain Holmes <iain@ximian.com> - - * e-local-storage.c (notify_listener): Function to create CORBAany - and notify listeners. - (component_async_create_folder_callback): Notify the listener again. - (create_folder): Handle the Bonobo_Listener again and make it async. - (impl_async_create_folder): Pass CORBA_OBJECT_NIL as the listener. - (bonobo_interface_create_folder_cb): Make async. - - * evolution-storage.c (notify_bonobo_listener): Removed this broken - broken function. - (impl_Storage_async_create_folder): Make async, duplicate the listener - instead of notifying it. - (impl_Storage_async_remove_folder): Notify listener by hand. - (e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER): Return of the - worst signal marshaller in Scotland. - (class_init): Use the above marshaller for the create_folder signal. - -2001-08-30 Jeffrey Stedfast <fejj@ximian.com> - - * e-shell-folder-creation-dialog.c (entry_name_is_valid): Check - for \r in the folder name, this is an invalid char. Also take a - "reason" argument so we can inform the user why his folder name is - invalid. - (dialog_clicked_cb): Tell the user why the folder name is invalid. - -2001-08-28 Ettore Perazzoli <ettore@ximian.com> - - [Fix #8125, Evolution crashes while starting.] - - * e-shortcuts.c (load_shortcuts): Handle the case when there is no - URI without crashing. Only add shortcuts when they are evolution: - URIs. - -2001-08-27 Ettore Perazzoli <ettore@ximian.com> - - * Evolution-ShellComponent.idl: Studlycapsize all the IDs that are - not. - * Evolution-common.idl: Likewise. - * evolution-activity-client.c: Updated accordingly. - * evolution-shell-component.c: Likewise. - * evolution-storage.c: Likewise. - * e-activity-handler.c: Likewise. - * e-component-registry.c: Likewise. - * e-corba-storage.c: Likewise. - * e-shell-user-creatable-items-handlers.c: Likewise. - - * e-local-storage.c (remove_folder): Remove unused variable. - - * e-shell-view.c (update_for_current_uri): Assign zero to - `unread_count', not NULL. - - * e-shell-importer.c (import_druid_finish): Remove unused - variable. - - * e-shell-user-creatable-items-handler.c: #include - "e-corba-utils.h". - - * e-shell-startup-wizard.c: #include "e-shell-startup-wizard.h". - - * e-shell-startup-wizard.h: #include <glib.h> - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (update_for_current_uri): Also display the unread - count in the title bar. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-setup.c (copy_default_stuff): Remove the stupid "do you want - me to initialize stuff?" dialog. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c: Change the `selected_row_path' to be - non-const. - (destroy): Free it. - (e_storage_set_view_set_current_folder): Set the selected_row_path - to be this path. - (tree_drag_begin): Free the selected_row_path and strdup() the - value we assign. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (e_shell_view_remove_control_for_uri): Ooops. - Save the pointer to the control for use after the view struct is - freed. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: New struct `View'. Replace `uri_to_control' in - `EShellViewPrivate' with `uri_to_view'. - (view_new): New. - (hash_forall_destroy_view): New, replacing - `hash_forall_destroy_control'. - (destroy): Updated to match the uri_to_control -> uri_to_view - changes. - (socket_destroy_cb): Likewise. - (get_view_for_uri): Renamed from `get_control_for_uri'. Return a - View instead of a GtkWidget. - (show_existing_view): Updated to use `get_view_from_uri', get a - @view instead of a @control. - (e_shell_view_display_uri): Updated to use `uri_to_view' instead - of `uri_to_control'. - (e_shell_view_remove_control_for_uri): Likewise. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (update_folder_title_bar): Changed to get a - @title and a @type. - (update_for_current_uri): Updated accordingly. - (update_window_icon): Get a @type instead of a @folder. - (update_for_current_uri): Updated accordingly. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - [Fix #5978, "If a component dies, it's toolbar buttons remain".] - - * e-shell-view.c (socket_destroy_cb): If the view belongs to a - toplevel storage node, get the right type information with - `e_storage_get_toplevel_node_uri()' instead of trying to get the - [non-existing] folder for it. - -2001-08-24 Iain Holmes <iain@ximian.com> - - * e-shell-startup-wizard.c (druid_event_notify_cb): Implement the other - missing events. - (make_identity_page): - (make_receive_page): - (make_extra_page): - (make_transport_page): - (make_management_page): Add the GnomeDruidPages to the page_list. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view.c: Added accelerators for the right-click - shortcut menu. - -2001-08-23 Zbigniew Chyla <cyba@gnome.pl> - - * e-shortcuts.c (e_shortcuts_add_default_group): Convert names of the - default group and shortcuts to UTF-8 (still no U_ :(). - -2001-08-23 Zbigniew Chyla <cyba@gnome.pl> - - * e-shortcuts-view.c (destroy_group_cb): Convert the name of the group - to GTK+ locale before displaying it in a dialog. - -2001-08-23 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (tree_drag_data_received): If we get no - data, don't notify the receiving component at all. - -2001-08-23 Ettore Perazzoli <ettore@ximian.com> - - [Fix #5736, crashing when copying a message with drag and drop.] - - * e-storage-set-view.c (tree_drag_data_received): Handle NULL data - gracefully. - -2001-08-22 Ettore Perazzoli <ettore@ximian.com> - - * e-storage.c (e_storage_async_xfer_folder): If the remove_source - is %TRUE and destination is a descendant of the parent, pass an - `E_STORAGE_CANTMOVETODESCENDANT' error code to the callback. - - * e-storage.h: New value `E_STORAGE_CANTMOVETODESCENDANT' in - `EStorageResult'. - -2001-08-22 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-commands.c - (folder_selection_dialog_folder_selected_callback): Actually - return if the folder is being moved into one of its descendants. - -2001-08-22 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c (label_realize_callback): `#if 0'ed - out. - (make_bold): Likewise. - (e_shell_folder_title_bar_construct): Don't call it. - - * e-local-storage.c (component_async_remove_folder_callback): Only - remove the directory if the component succeeds. - -2001-08-22 Peter Williams <peterw@ximian.com> - - * e-local-storage.c (async_xfer_folder_callback): Fix the improper - construction of the new folder's physical URI. - -2001-08-22 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c (remove_folder): Don't remove the folder - directory here. - (component_async_remove_folder_callback): Remove it here instead. - -2001-08-22 Ettore Perazzoli <ettore@ximian.com> - - [Fix #7775, crash trying to do New Task] - - * e-shell-user-creatable-items-handler.c (verb_fn): Make sure we - don't pass NULL strings to - `GNOME_Evolution_ShellComponent_userCreateNewItem()'. - -2001-08-21 Damon Chaplin <damon@ximian.com> - - * e-gray-bar.c (endarken_style): unref the rc_style. - -2001-08-21 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c: #include "e-shell-startup-wizard.h". - - * e-shell-startup-wizard.h: New. - -2001-08-21 Iain Holmes <iain@ximian.com> - - * e-shell-startup-wizard.c (make_mail_dialog_pages): Show an error - window if mailer doesn't respond. - -2001-08-21 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c (label_realize_callback): Fix a leak: - unref the EFont after we have used it. Also, don't crash if - `e_font_to_gdk_font()' returns NULL. [This should fix #7666, - Folder View crashes Evo.] - -2001-08-21 Iain Holmes <iain@ximian.com> - - * e-shell-importer.c (start_import): Don't print a NULL. - -2001-08-20 Iain Holmes <iain@ximian.com> - - * e-shell-importer.c (import_druid_finish): Do the correct thing when - the new folder button is clicked. - (folder_selected): Import the file. - (folder_cancelled): Kill the dialog. - -2001-08-18 Iain Holmes <iain@ximian.com> - - * e-shell-startup-wizard.c (make_identity_page): - (make_receive_page): - (make_extra_page): - (make_transport_page): - (make_management_page): Check that the mailer has been inited correctly. - (e_shell_startup_wizard_create): If some of the pages could not be - created, just stop trying to show the startup wizard. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (e_shell_view_load_settings): Don't set the - paneds' positions if the respective left-hand elements [i.e. the - shortcut bar and the folder bar] are hidden. - (e_shell_view_show_folder_bar): Set the paned position to zero - when hiding. - (e_shell_view_show_shortcut_bar): Likewise. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-startup-wizard.c (finish_func): Don't free the returned - displayname. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (pop_up_folder_bar): Make sure we display a pin - when we are popped up. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (setup_widgets): Don't set the paned tree - position. - -2001-08-19 Chris Toshok <toshok@ximian.com> - - * evolution-shell-component.c (impl__get_supported_types): fill - the corba sequence for the accepted_dnd_types. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (setup_storage_set_subwindow): Don't show the - vbox here. - (setup_widgets): Don't show the storage_set_view_box here. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c: Added display_name and description - to the type. - - * evolution-shell-component.c (impl__get_supported_types): Pass - `display_name' and `description' here. - (evolution_shell_component_construct): Likewise. - - * evolution-shell-component.h: New members `display_name', - `description' in `EvolutionShellComponentFolderType'. - - * e-component-registry.c (register_type): New args @description - and @display_name. Pass to - `e_folder_type_registry_register_type()'. - (register_component): Pass the values returned in the sequence - from __get_supported_types. - - * e-folder-type-registry.c: New members `display_name' and - `description' in `struct _FolderType'. - (folder_type_new): New args @description and @display_name. - Initialize the respective fields in the `FolderType' accordingly. - (folder_type_free): Free `display_name' and `description'. - (register_folder_type): New args @display_name, @description. - (e_folder_type_registry_register_type): New args @display_name, - @description. - (e_folder_type_registry_get_description_for_type): New. - (e_folder_type_registry_get_display_name_for_type): New. - - * Evolution-ShellComponent.idl: Added `display_name' and - `description' fields to the `FolderType' struct. - -2001-08-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (destroy): Put the bonobo_object_release_unref() for - the db at the top in an attempt to fix #7542. - -2001-08-19 Ettore Perazzoli <ettore@ximian.com> - - * e-summary-storage.c (e_summary_storage_new): Change type of - toplevel node from "Summary" to "summary". [All the other folder - types use lowercase names.] - - * e-shortcuts.c (load_shortcuts): Also use the display name for - the storage. - -2001-08-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts.c (load_shortcuts): Use xmlMemStrdup() to override - the type as it's expected to be allocated by libxml later on. - Also, get the icon for the storage if the shortcut points to a - storage. - - * e-storage-set-view.c (etree_icon_at): Don't special case the - Summary storage. Rather, use `e_storage_get_toplevel_node_type()' - for getting the type of the node. - - * e-shortcuts-view-model.c (get_icon_for_item): New helper - function. - (shortcuts_update_shortcut_cb): Use it. - (shortcuts_new_shortcut_cb): Use it. - (load_group_into_model): Use it. - -2001-08-18 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: New constant `MIN_POPUP_TREE_WIDTH'. - (pop_up_folder_bar): Make sure the pop-up is always this size or - more. - (setup_widgets): Pass %FALSE for @shrink to `e_paned_pack1()'. - (reparent_storage_set_view_box_and_destroy_popup): Likewise. - -2001-08-18 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (shortcut_bar_visibility_changed_cb): New, - replacing `shortcut_bar_mode_changed_cb'. - (folder_bar_visibility_changed_cb): New, replacing - `folder_bar_mode_changed_cb'. - (command_toggle_folder_bar): Use `e_shell_view_show_folder_bar()' - instead of `e_shell_view_set_folder_bar_mode()'. - (command_toggle_shortcut_bar): Use - `e_shell_view_show_shortcut_bar()' instead of - `e_shell_view_set_shortcut_bar_mode()'. - (e_shell_view_menu_setup): Updated for the - "shortcut_bar_visibility_changed" and - "folder_bar_visibility_changed" signals and the above changes. - - * e-shell-view.c: New member `folder_bar_popup' in - `EShellViewPrivate'. Replaced `folder_bar_mode' and - `shortcut_bar_mode' with `folder_bar_shown' and - `shortcut_bar_shown', respectively. - (init): Updated to initialize these correctly. - (reparent): New helper function. - (reparent_storage_set_view_box_and_destroy_popup): New helper - function. - (popdown_transient_folder_bar): Updated to use the - `folder_bar_popup'. - (folder_bar_popup_map_callback): Renamed from - `storage_set_view_box_map_cb'. - (e_shell_view_set_shortcut_bar_mode): Removed. - (e_shell_view_set_folder_bar_mode): Removed. - (e_shell_view_show_shortcut_bar): New. All the calls to - `e_shell_view_set_shortcut_bar_mode()' replaced with calls to this - one. - (e_shell_view_show_folder_bar): New. All the calls to - `e_shell_view_set_folder_bar_mode()' replaced with calls to this - one. - (e_shell_view_folder_bar_shown): New. All the calls to - `e_shell_view_get_folder_bar_mode()' replaced with calls to this - one. - (e_shell_view_shortcut_bar_shown): New. All the calls to - `e_shell_view_get_shortcut_bar_mode()' replaced with calls to this - one. - (class_init): Replace signal `folder_bar_mode_changed' with - `folder_bar_visibility_changed' and `shortcut_bar_mode_changed' - with `shortcut_visibility_changed'. - (e_shell_view_save_settings): Use keys "ShortcutBarShown" and - "FolderBarShown" instead of "ShortcutBarMode" and "FolderBarMode", - respectively. - (e_shell_view_load_settings): Likewise. - - * e-shell-view.h: Removed enum `EShellViewSubwindowMode'. Renamed - signal `shortcut_bar_mode_changed' to - `shortcut_bar_visibility_changed' and `folder_bar_mode_changed' to - `folder_bar_visibility_changed'. - -2001-08-17 Iain Holmes <iain@ximian.com> - - * Makefile.am: Add the Evolution-Wizard.idl file - -2001-08-17 Iain Holmes <iain@ximian.com> - - * e-shell-folder-selection-dialog.c (folder_creation_dialog_result_cb): - Check the priv isn't NULL before dereferencing it. - -2001-08-17 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-client.c - (evolution_shell_client_set_line_status): g_return_if_fail(), not - g_return_val_if_fail(). - -2001-08-17 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-client.c - (evolution_shell_client_get_local_storage): Added some g_warnings - for when we return CORBA_OBJECT_NIL; this might help to figure out - what is wrong with bug #6625. Also, added a missing - CORBA_exception_free(). - -2001-08-17 Jeffrey Stedfast <fejj@ximian.com> - - * e-shell.c (e_shell_construct): Don't destroy the splash twice. - - * e-local-storage.c (setup_folder_as_stock): utf_name should not - be const as e_utf8_from_locale_string() returns an allocated - buffer. - -3001-08-17 Iain Holmes <iain@ximian.com> - - * Evolution.idl: Add Evolution-Wizard.idl - - * Evolution-Wizard.idl: New file implementing a wizard interface. - - * Makefile.am: Add the wizard stuff and the startup dialog stuff - - * e-shell.c (e_shell_construct): Hide the splash screen and try to - start the startup assistant. - - * glade/Makefile.am: Add the evolution-startup-wizard.glade - -2001-08-16 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c (authors): Add myself. - - * e-shell-view.c (folder_selected_cb): Desensitize the - move/copy/delete/rename in the menus (including right click) for - stock folders. - - * Evolution-Icon.idl: Actually remove this file from CVS (its - contents are now in Evolution-common.idl). - -2001-08-16 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Remove the Help menu verbs and add a - "HelpFAQ" verb. - (command_help): Removed. - (command_help_faq): New, implementation for the "HelpFAQ" verb. - -2001-08-16 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c (label_realize_callback): New - callback for the realize signal. - (make_bold): New. Hooks up the label_realize_callback. - (e_shell_folder_title_bar_construct): Make the name of the folder - bold using it. - -o2001-08-16 Ettore Perazzoli <ettore@ximian.com> - - * e-gray-bar.c (endarken_style): Just hardcode the colors. - - * e-shell-folder-title-bar.c (set_title_bar_label_style): New. - (e_shell_folder_title_bar_construct): Call it on the labels here, - so we get nice white labels. - -2001-08-16 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (e_shell_component_maybe_crashed): s/the view for `%s' - have/the views for `%s' have/. - -2001-08-16 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (etree_icon_at): Remove debugging message. - -2001-08-15 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c (command_help): Don't hardcode/build a help - URI here, use gnome_help_display() instead, which will figure out - what language the user needs, etc. - (help_verbs): Adapt these menu items to above changes, they don't - need to pass "evolution/foo.html" to command_help, just - "foo.html". - - * e-folder.c (e_folder_set_child_highlight): Emit a "changed" - signal at the end of this function. Bug #7232. - -2001-08-15 Aaron Weber <aaron@ximian.com> - - * e-shell-view-menu.c (command_about_box): Changed help menus to - point to evolution/ and not evolution-guide/. - -2001-08-15 Iain Holmes <iain@ximian.com> - - * e-summary-storage.c: s/My Evolution/Summary - - * e-storage-set-view.c: s/My Evolution/Summary - -2001-08-15 Jason Leach <jleach@ximian.com> - - * Evolution-Shell.idl: Add a new IDL function, - Evolution::Shell::setLineStatus (in boolean). Bug #3030. - - * e-shell.c (impl_Shell_setLineStatus): Implementation of the - above. - - * evolution-shell-client.c - (evolution_shell_client_set_line_status): A wrapper function for - the above, this is what a component can call to set the shell - on/offline. - -2001-08-14 Dan Winship <danw@ximian.com> - - * evolution-storage.c (evolution_storage_new_folder): Use the - passed-in unread_count. - - * e-corba-storage.c (impl_StorageListener_notifyFolderCreated): - Pass the passed-in unread_count to e_storage_new_folder. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * e-gray-bar.c (impl_style_set): Chain to the parent class. - (endarken_style): Hardcode the colors here. - -2001-08-13 Anna Marie Dirks <anna@ximian.com> - - * importer/intelligent.c : Changed the "Evolution has found the - following data sources" text in the import dialog to "Evolution - can import data from the following files" in an attempt to - increase user-friendliness. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (setup_widgets): Add some little padding to the - title bar so it looks nicer. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - [Fix #7109, Evolution crashes when the splash screen dialog is - killed by clicking the "X" button.] - - * e-shell.c (e_shell_construct): Connect - `gtk_widget_hide_on_delete()' correctly. - -2001-08-13 Anna Marie Dirks <anna@ximian.com> - - * importer/import.glade : Changed all instances of "druid" - and "wizard" to "assistant". - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * main.c (idle_cb): Replaced the chained `if' statements with a - `switch' statement for clarity. Also, don't ref the created - shell, and release the object reference properly. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * e-corba-shortcuts.c (shortcut_list_to_corba): set_release on the - sequence, not the buffer. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (view_destroy_cb): Restore the shell reffing/unreffing - here. - -2001-08-13 Peter Williams <peterw@ximian.com> - - * e-corba-shortcuts.c (shortcut_list_to_corba): Don't cause an abort - if the shortcut group is empty. - -2001-08-13 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (IDLS): Add `Evolution-common.idl'. - -2001-08-13 Dan Winship <danw@ximian.com> - - * evolution-shell-component.c (init): Initialize - priv->user_creatable_item_types. [Score: g_new: 0, g_new0: 2] - -2001-08-13 Jason Leach <jleach@ximian.com> - - * e-local-storage.c (remove_folder_directory): Remove unused - variable @folder. - - * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): - Give icons to shortcuts added via Right-click->Add to Shortcut - Bar. - -2001-08-12 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_construct): Grab focus on the - storage set view. - -2001-08-12 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c (setup_folder_as_stock): Use utf 8 to set the - name. - -2001-08-12 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (etree_value_at): Remove debugging message. - -2001-08-12 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (setup_widgets): Put the folder title bar into an - EGrayBar. - - * e-gray-bar.c: New. - * e-gray-bar.h: New. - -2001-08-12 Ettore Perazzoli <ettore@ximian.com> - - [Finally! Fix #413, "Support for stock folders", and #786, "i18n: - default folder names are not translated".] - - * e-local-storage.c (setup_folder_as_stock): New helper function. - (setup_stock_folders): Use it to set the default folders as - "stock" folders. This will give them a translated name and also - make them unmodifiable. - (load_all_folders): Call `setup_stock_folders()' here. - - * e-shell-folder-commands.c (delete_cb): Display an error dialog - if the deletion fails. - (e_shell_command_delete_folder): Pass the shell view to the delete - callback. - - * e-storage.c (e_storage_result_to_string): Add a string for - `E_STORAGE_CANTCHANGESTOCKFOLDER' as well. - - * e-local-storage.c (remove_folder): Don't allow a stock folder to - be removed. - (impl_async_xfer_folder): Don't allow a stock folder to be moved. - - * e-corba-storage.c (async_remove_folder): Don't allow a stock - folder to be removed. - - * e-storage.h: New enum value `E_STORAGE_CANTCHANGESTOCKFOLDER' in - `EStorageResult'. - - * e-folder.c: Make member `self_highlight' a :1 int. New :1 int - member `is_stock'. - (init): Init `is_stock' to %FALSE. - (e_folder_set_is_stock): New. - (e_folder_get_is_stock): New. - - * e-local-storage.c (bonobo_interface_update_folder_cb): For now, - don't set the display name. - -2001-08-10 Ettore Perazzoli <ettore@ximian.com> - - * Evolution-common.idl: Add Folder struct here. - - * Evolution-Storage.idl: Removed Folder struct. - - * Evolution.idl: #include <Evolution-common.idl>, not - <Evolution-Icon.idl>. - - * Evolution-common.idl: New. - - * Evolution-Icon.idl: Removed. - -2001-08-10 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-commands.c (rename_clicked): `#if 0'ed out. - (rename_cb): Likewise. - - * evolution-shell-component.c (destroy): Fixed a confusion between - GList and GSList. - -2001-08-10 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-user-creatable-items-handler.c (component_free): Only - free the `type_list' if not NULL. - (setup_menu_xml): Deal with the case of `type_list' being NULL - gracefully. - (verb_fn): Same here. - (add_verbs_to_ui_component): Likewise. - -2001-08-10 Ettore Perazzoli <ettore@ximian.com> - - [Fix #6787, Removing a storage with children and then re-adding it - causes a crash.] - - * e-storage-set-view.c (convert_corba_drag_action_set_to_gdk): - Removed `#if 0'ed function. - (etree_node_destroy_func): New destroy function. - (e_storage_set_view_construct): Set this as the new destroy - function on the ETreeMemory. - -2001-08-09 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c (user_create_new_item_callback): - Updated to display the parent folder's URI and its type as well. - - * evolution-shell-component.c (impl_userCreateNewItem): Updated to - get the @parent_folder_physical_uri and the @parent_folder_type. - (class_init): Update the "user_create_new_item" signal to have - @parent_folder_physical_uri and @parent_folder_type args. - - * e-shell-view.c (get_type_for_folder): Don't bork on a NULL - @physical_uri_return. - (e_shell_view_get_current_physical_uri): New. - (e_shell_view_get_current_folder_type): New. - - * e-shell-user-creatable-items-handler.c - (e_shell_user_creatable_items_handler_setup_menus): Replace - @ui_component arg with a @shell_view arg. Set it on the - UIComponent using gtk_object_set_data(). - (verb_fn): Pass the type and physical URI of the current folder; - retrieve that from the shell_view got with gtk_object_get_data(). - - * Evolution-ShellComponent.idl - (userCreateNewItem): New args @parent_folder_uri, - @parent_folder_type. - -2001-08-09 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view.c (show_new_group_dialog): Cast the toplevel to - be passed to `e_request_string()' to GtkWindow, not GtkWidget. - Also, remove unused variables. - (get_efolder_from_shortcut): Constify @item_url. - (get_storage_set_path_from_uri): Removed. - - * evolution-shell-component.c (destroy): `p' shall be a GList, not - a GSList. - -2001-08-09 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (e_shell_view_construct): Add the menu items - using the EShellUserCreatableItemsHandler. - - * e-shell-user-creatable-items-handler.c: New. - * e-shell-user-creatable-items-handler.h: New. - - * e-shell.c: New member `user_creatable_items_handler' in - `EShellPrivate'. - (init): Initialize to NULL. - (destroy): Unref. - (e_shell_construct): Create here. - (e_shell_get_user_creatable_items_handler): New accessor. - (setup_components): Add the registered components to the - user_creatable_items_handler. - - * evolution-test-component.c (factory_fn): Add a couple sample - user-creatable items. - (user_create_new_item_callback): New callback for the - "user_create_new_item" signal on the EvolutionShellComponent. - (factory_fn): Connect. - - * e-shell.c (e_shell_get_component_registry): New. - - * evolution-shell-component.c: New enum value - `USER_CREATE_NEW_ITEM'. New member `user_create_item_types' in - `_EvolutionShellComponentPrivate'. - (init): Init to NULL. - (impl_destroy): Free it. - (user_creatable_item_type_free): New helper function. - (user_creatable_item_type_new): New helper function. - (impl_userCreateNewItem): New, implementation for - ::userCreateNewItem. - (class_init): Install the "user_create_new_item" signal and the - userCreateNewItem impl. - (impl__get_external_uri_schemas): Renamed from - `impl_ShellComponent__get_external_uri_schemas'. - (impl___get_supported_types): Renamed from - `impl_ShellComponent__get_supported_types'. - (impl__get_user_creatable_item_types): New, implementation for the - `user_creatable_item_types' attribute. - (class_init): Install it. - (evolution_shell_component_add_user_creatable_item): New. - - * evolution-shell-component.h: Added signal - `user_create_new_item'. - - * Evolution-ShellComponent.idl: Added typedefs - `UserCreatableItemType', `UserCreatableItemTypeList'. New - attribute `user_creatable_item_types'. - (userCreateNewItem): New. - -2001-08-09 Federico Mena Quintero <federico@ximian.com> - - * e-component-registry.c (destroy): Chain to the destroy handler - in the parent class! - - * e-shortcuts-view-model.c (impl_destroy): Likewise. Sigh. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - [Fixes, among other things, #5705, "Ampersands not handled - correctly in drag + drop". Thanks to Nat for actually discovering - the problem.] - - * e-shortcuts.c (save_shortcuts): Use `xmlNewTextChild()' instead - of `xmlNewChild()'. - - * e-local-folder.c (save_metadata): Use `xmlNewTextChild' instead - of `xmlNewChild()'. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c - (fill_corba_sequence_from_null_terminated_string_array): Set the - release flag on the sequence, and CORBA_string_dup() the strings - anyway. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c - (impl_ShellComponent__get_supported_types): Set the release flag - on the returned folder type list too. - - * evolution-activity-client.c (create_icon_from_pixbuf): Set the - release flag on the sequence, not the struct that contains it. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * e-corba-shortcuts.c (shortcut_list_to_corba): Set the release - flag for the newly allocated sequence. - - * e-activity-handler.c (impl_operationStarted): Unref the - icon_pixbuf. - - * e-task-widget.c (impl_destroy): g_free the private struct. - -2001-08-08 Jason Leach <jleach@ximian.com> - - * e-storage-set-view.c (etree_icon_at): Set the My Evolution icon - for the folder tree correctly. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c - (impl_ShellComponent__get_supported_types): Fill the CORBA - sequence once. - - * e-activity-handler.c (activity_info_free): Unref the icon. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * e-task-bar.c (e_task_bar_prepend_task): Sigh. If the function - says "prepend", of course the function to call is - `g_list_prepend()', not `g_list_append()'. You dumbass. - -2001-08-08 Jason Leach <jleach@ximian.com> - - * e-shell-folder-creation-dialog.c - (storage_set_view_storage_selected_cb): Set the sensitivity for - the OK button when a storage is selected too. Bug #6473. - -2001-08-08 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c (create_icon_from_pixbuf): Set the - release flag on the returned icon to %TRUE. - -2001-08-07 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts.c (load_shortcuts): If the shortcut points to some - folder in the storage set, get the type from it. - - * e-storage-set.c (signal_new_folder_for_all_folders_under_paths): - New helper function. - (signal_new_folder_for_all_folders_in_storage): New helper - function. - (e_storage_set_add_storage): Call the latter to emit a - "new_folder" signal for all the folders contained in the newly - added storage. - -2001-08-07 Ettore Perazzoli <ettore@ximian.com> - - [This should fix #5407, application crash on re-opening.] - - * e-shell.c (e_shell_construct): Call - `gtk_widget_hide_on_delete()' on the splash. - - * e-splash.c (e_splash_add_icon): Don't check for destruction - here. - (e_splash_set_icon_highlight): Not even here. - (button_press_event): Use a GTK+ cast. - -2001-08-07 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view-model.c (load_group_into_model): Get the icon - from the folder type registry. - (shortcuts_new_shortcut_cb): Likewise. - (shortcuts_update_shortcut_cb): Likewise. - - * e-shortcuts-view.c (icon_callback): Removed. - (e_shortcuts_view_construct): Don't set the icon callback anymore. - -2001-08-07 Jason Leach <jleach@ximian.com> - - * e-storage-set-view.c (etree_value_at): Don't use a leaky hash to - get folder names with unread count, use gtk_object_set_data_full - and gtk_object_get_data on the EFolder. - (etree_icon_at): Give the "My Evolution" storage an icon through a - non-generic way. Will be replaced by a generic method when other - storages get icons too. - -2001-08-07 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c - (evolution_activity_client_construct): Free the CORBA version of - the animated icon. - -2001-08-07 Not Zed <NotZed@Ximian.com> - - * evolution-activity-client.c (impl_destroy): Unref the listener - when done. - -2001-08-06 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c: Remove member `hbox' from `struct - _EShellFolderTitleBarPrivate'. - (make_icon_pixmap): Removed. - (rgb_from_gdk_color): Removed. - (endarken_style): Removed. - (set_style_cb): Removed. - (create_arrow_pixmap): Renamed from `create_icon_pixmap'. - (get_max_clipped_label_width): New helper function. - (size_allocate_icon): New helper function. - (size_allocate_button): New helper function. - (size_allocate_label): New helper function. - (add_icon_widget): New helper function. - (realize): Changed to use `add_icon_widget()'. - (size_allocate): New function, handler for the ::size_allocate - method. - (class_init): Install it. - (e_shell_folder_title_bar_construct): Changed so that the widget - get added to this widget instead of adding an hbox to it and - adding the widgets to the hbox. - (e_shell_folder_title_bar_set_icon): Changed to use - `add_icon_widget()'. - - * e-shell-folder-title-bar.h, e-shell-folder-title-bar.c: Changed - to derive from GtkHBox, not GtkEventBox. - -2001-08-06 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (tree_drag_motion): Turn on highlighting on - a row by row basis. - -2001-08-04 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Add some padding to the label so that the title doesn't move - around when you switch between pop-up and non-pop-up folder bar. - Also, change all the GtkLabels to be GtkClippedLabels instead. - (e_shell_folder_title_bar_set_title): Updated to use - EClippedLabels instead of GtkLabels. - (e_shell_folder_title_bar_set_folder_bar_label): Likewise. - - * e-shell.c (impl_Shell__get_displayName): New, implementation for - the `displayName' attribute. - - * Evolution-Shell.idl: Added readonly attribute `displayName' to - get the canonicalized X11 display name for the shell. - - * e-shell.c (e_shell_construct): Ooops. Return - `E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER' if the OAF registration - fails, not `E_SHELL_CONSTRUCT_RESULT_GENERICERROR'. - - * e-shortcuts-view.c (rename_group_cb): Get the toplevel from the - shortcuts view, not the widget. - (rename_shortcut_cb): Likewise. - (show_new_group_dialog): Changed to use `e_request_string()'. - - * evolution-test-component.c: Add the %FALSE value for the - `user_creatable' field in the `folder_types' entry. - - * evolution-shell-client.c: New member `shortcuts_interface' in - `EvolutionShellClientPrivate'. - (destroy): Unref it if not CORBA_OBJECT_NIL. - (init): Init to CORBA_OBJECT_NIL. - (query_shell_interface): New helper function to query an interface - on the shell and spit out warnings if it fails. - (evolution_shell_client_construct): Use it to query the ::Activity - interface. Also query the ::Shortcuts interface and set the - `shortcuts_interface' member to point to it. - - * e-shell.c: New member `corba_shortcuts' in `EShellPrivate'. - (init): Init to NULL. - (setup_shortcuts_interface): Helper function to add the - ::Shortcuts CORBA interface to the shell. - (e_shell_construct): Call it. - - * e-corba-shortcuts.c, e-corba-shortcuts.h: New objects - implementing the `Evolution::Shortcuts' CORBA interface. - - * Evolution-Shortcuts.idl: New interface for accessing the - shortcuts in the shell. - - * e-shell.c (e_shell_get_config_db): Moved down. - -2001-08-03 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (tree_drag_data_received): Some paths here - don't set handled properly so lets initialize it to FALSE. - (update_folder_with_unread_hash, etree_value_at): constified - folder_name here. - (init): Initialize priv->drag_path here to NULL. - -2001-08-03 Jason Leach <jleach@ximian.com> - - [Removing Evolution::LocalStorage interface, abstracting the - unread counts from a folder's name, also abstract unread counts - from a shortcut's name. Fixes #4489 and #5497] - - * e-shortcuts.c (shortcut_item_new): Take an unread_count argument - now. - (shortcut_item_update): Ditto. - - * e-shortcuts-view-model.c (get_name_with_unread): Get a string - containing a shortcut name and it's unread, because these are - abstracted now. - (load_group_into_model): Use the above function to make shortcuts - that have unread counts. - - * e-storage-set-view.c (update_folder_with_unread_hash): Keep a - hash of folder names with unread counts, because the folder name - and it's unread count are to be separated, only the ETree is - supposed to present it as one string. - - * e-shell-view.c: Renamed EShellView::view_title_bar to - folder_title_bar, to closer match the - - * e-shell-view-menu.c (new_shortcut_dialog_folder_selected_cb): - Make a shortcut with the unread count. - - * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): - Make a shortcut with the unread count. - - * e-local-storage.c: Updated for API changes. - - * e-folder.c (e_folder_get_unread_count): New function, does what - it says. - (e_folder_set_unread_count): Ditto. - - * e-corba-storage.c (impl_StorageListener_new_folder): Renamed to - match the IDL function name. - (impl_StorageListener_update_folder): Ditto. - (impl_StorageListener_removed_folder): Ditto. - - * Evolution-Storage.idl (struct Folder): Replace the boolean - highlighted with a long unread_count. - (updateFolder): Brought in from the now dead - Evolution::LocalStorage. - - * Evolution-Shell.idl (getLocalStorage): Return a Storage instead - of a LocalStorage. - - * Evolution-LocalStorage.idl: Removed, no longer needed, only used - function, updateFolder, has been moved into Evolution::Storage - interface. - - * evolution-local-storage.[ch]: Ditto. - - * evolution-storage.c (impl_Storage_updateFolder): Implementation - of the updateFolder taken from ::LocalStorage. - (class_init): New "update_folder" signal, taken from - evolution-local-storage.c too. - (evolution_storage_update_folder): Take an @unread_count int - instead of a @highlighted boolean. - (evolution_storage_new_folder): Same for here. - (evolution_storage_update_folder_by_uri): And here. - - * evolution-storage-listener.h: "update_folder" signal no longer - sends a @highlighted boolean. - -2001-08-03 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c (update_offline_menu_item): Use Jakub's new - "Work Online" icon and fix a typo. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - [Fix #6232, the thirty-four-splash-screens-at-startup bug.] - - * e-shell.c (setup_local_storage): Add an E_STORAGE() cast to - prevent a warning. - - * main.c (idle_cb): Only try to activate from the shell ID if the - result is `E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER'; if there is a - different error, spit out a dialog box with a description of it - and exit instead. - - * e-shell.c (e_shell_construct): Return an `EShellConstructResult' - describing what kind of result we had. Show the splash after the - DB has been reached, not before. - (e_shell_construct_result_to_string): New function to get a - descriptive string out of an `EShellConstructResult'. - (e_shell_new): New arg @construct_result_return to return a - description of the result of the operation. - - * e-shell.h: New enum `EShellConstructResult'. - - * e-shell.c (impl_Shell_createNewView): Raise `InternalError' - instead of crashing if the shell_view returns a CORBA_OBJECT_NIL. - - * Evolution-Shell.idl: New exception `InternalError'. - `createNewView' and `handleURI' can raise it. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (storage_sort_callback): Put the storage - named E_SUMMARY_STORAGE_NAME on top. - - * e-shell.c: New member `summary_storage' in `EShellPrivate'. - (init): Init to NULL. - (destroy): Unref if not NULL. - - * e-summary-storage.c: New. - * e-summary-storage.h: New. - - * e-storage-set-view.c: New #define `ROOT_NODE_NAME', defined to - be "/RootNode". - (e_storage_set_view_set_show_folders): Use that instead of "My - Evolution". - (e_storage_set_view_construct): Hide the root node. Use - `ROOT_NODE_NAME' instead of "My Evolution". - - * e-shortcuts-view.c (icon_callback): No bad special hack for "My - Evolution" here. - - * e-shell-view.c (update_window_icon): Remove kludgey - @is_my_evolution arg and stop doing special "My Evolution" things. - (update_folder_title_bar): Likewise. - (update_for_current_uri): Don't do special "My Evolution" things - here either. - (get_control_for_uri): Don't do the "My Evolution" hack here. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (tree_drag_data_received): Call - `gtk_drag_finish()' here. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c (progress_listener_servant_free): - Actually __fini the servant and deactivate the object too. - (component_info_free): Updated accordingly [i.e. don't do the - deactivation stuff here]. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - [Fixes #4663, startup crash.] - - * e-shell.c (e_shell_construct): Make sure the pointer to the db - object is CORBA_OBJECT_NIL if `bonobo_get_object()' raises an - exception. - -2001-08-03 Ettore Perazzoli <ettore@ximian.com> - - [Fixes #3818, crash when going off-line.] - - * e-shell-offline-handler.c (component_info_free): Also call - `PortableServer_POA_deactivate_object()' on the progress listener - object so it gets deactivated. - -2001-08-02 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (e_shell_construct): Spit out a warning if we cannot - resolve "Bonobo/ConfigDatabase" on "wombat:". Also, register on - OAF only after we are sure we are not going to return FALSE. - -2001-08-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (switch_on_folder_tree_click): Set the - `set_folder_uri' to NULL when freeing it. - - * e-task-bar.c (e_task_bar_remove_task): Just destroy the widget. - No need to `gtk_container_remove()' it. - -2001-08-01 Jeffrey Stedfast <fejj@ximian.com> - - * e-shell-view-menu.c (command_new_folder): Do a NULL-check on - current_uri - socket is being closed? (as per the comments for the - NULL-check in e-shell-view.c:socket_destroy_cb). - -2001-07-31 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c: Removed debugging messages. - -2001-07-31 Not Zed <NotZed@Ximian.com> - - * evolution-activity-client.c (evolution_activity_client_update): - Also update have_pending_update before calling corba, as below. - -2001-07-30 Ettore Perazzoli <ettore@ximian.com> - - [This should fix #5110, shell crash when switching folders.] - - * evolution-activity-client.c (update_timeout_callback): Set the - `have_pending_update' flag before doing the CORBA call. - (evolution_activity_client_update): Set the timeout before doing - the CORBA call. - -2001-07-30 Jason Leach <jleach@ximian.com> - - * e-shortcuts-view.c (rename_group_cb): Remember the current group - so after renaming a group it doesn't flip to the next group. Bug - #3857. - - * e-shortcuts.c (e_shortcuts_rename_group): Comparing two - separately allocated strings, use strcmp() instead of !=. - -2001-07-30 Jason Leach <jleach@ximian.com> - - * e-shell-folder-creation-dialog.c (async_create_cb): If we can't - create a folder because it already exists, select that folder that - exists. Bug #1716. - -2001-07-30 Frederic Crozat <fcrozat@mandrakesoft.com> - - * main.c (main): call gconf_init if gtkhtml is compiled with gconf - support. - - * Makefile.am (INCLUDES): add $(GTKHTML_CFLAGS) since we might - need to link with GConf (if gtkhtml is compiled with GConf - support) - -2001-07-26 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c (impl_destroy): Remove the source - for the timeout *before* invoking the CORBA method, as we might - get the timeout callback while invoking the CORBA method, thus - screwing things up. - - * evolution-shell-component-client.c (destroy_listener_interface): - New helper function. - (dispatch_callback): Use it. - (impl_destroy): Call it when destroying the listener interface - instead of just freeing the servant. - -2001-07-26 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c (update_offline_menu_item): Little UI thing: - capitalize the words Offline/Online for the File menu. - -2001-07-25 Jason Leach <jleach@ximian.com> - - * e-shell-folder-selection-dialog.c (folder_selected_cb): New - function. When a folder is selected set the OK button to be - sensitive (but before that have it desensitized). Bug #5483. - -2001-07-25 Jason Leach <jleach@ximian.com> - - * e-shortcuts-view.c (icon_callback): A warning fix from Jacob. - Bug #5057. - - * Makefile.am (INCLUDES): $(BONOBO_CONF_CFLAGS) was here twice, - took out one of them. - - * e-shell-view.c (socket_destroy_cb): Mem leak fix. Thanks to the - amazing Jacob B. Bug #5054. - -2001-07-25 Jason Leach <jleach@ximian.com> - - * e-task-widget.c: #include <libgnome/gnome-defs.h> and - <libgnome/gnome-i18n.h> instead of the full <libgnome/libgnome.h>, - as noted by a comment here. - -2001-07-24 Jason Leach <jleach@ximian.com> - - * e-storage-set-view.c (e_storage_set_view_construct): Add the - "/My Evolution" path to the path_to_etree_node hash so that - storage_set_view_set_current_folder() can select the My Evolution - node when it's the current one. Fixes #5114 and #3956. - -2001-07-23 Ettore Perazzoli <ettore@ximian.com> - - * main.c (development_warning): Only show the warning dialog - instead of using `gnome_dialog_run()' so it is not modal. Modal - would be nice, but unfortunately it works bad with Bonobo. Plus - Sawfish doesn't like to keep the modal dialog on top, so it gets - very confusing for users. - -2001-07-23 Ettore Perazzoli <ettore@ximian.com> - - * e-task-widget.c (e_task_widget_construct): Uhm, set the usize to - `1, -1' instead. - -2001-07-23 Ettore Perazzoli <ettore@ximian.com> - - * e-task-widget.c (e_task_widget_construct): Set the usize for the - contained hbox to 0x0. - -2001-07-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Get the manuals from the `evolution-guide' - dir as that's where they get installed. - -2001-07-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (storage_set_view_box_button_release_event_cb): - Don't handle button events whose button number is not 1. - -2001-07-22 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c (remove_folder): Pass the folder type to - `evolution_shell_component_client_async_remove_folder()'. - (async_xfer_folder_step): Likewise with - `evolution_shell_component_client_async_xfer_folder()'. - - * evolution-shell-component-client.c - (evolution_shell_component_client_async_remove_folder): New arg - @type. Pass it to the `ShellComponent::removeFolder' CORBA - method. - (evolution_shell_component_client_async_xfer_folder): Likewise - with `::xferFolder'. - - * evolution-shell-component.c (impl_removeFolderAsync): Add @type - arg according to the IDL. - (impl_xferFolderAsync): Likewise. - - * evolution-shell-component.h: Add arg @type to - `EvolutionShellComponentRemoveFolderFn' and - EvolutionShellComponentXferFolderFn'. - - * Evolution-ShellComponent.idl: Add @type arg to - `::removeFolderAsync' and `::xferFolderAsync'. - -2001-07-21 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-creation-dialog.c (add_folder_types): Only put - the types that are user-creatable in the folder type option menu. - - * evolution-shell-component.c - (impl_ShellComponent__get_supported_types): Set the - `user_creatable' member too. - (evolution_shell_component_construct): Copy the `user_creatable' - member too. - - * evolution-shell-component.h: New member `user_creatable' in - `EvolutionShellComponentFolderType'. - - * e-component-registry.c (register_type): Pass the user_creatable - member of the CORBA FolderType struct. - - * e-folder-type-registry.c: New member `user_creatable' in struct - FolderType. - (e_folder_type_registry_register_type): New arg @user_creatable. - (register_folder_type): Likewise. - (folder_type_new): Likewise. - (e_folder_type_registry_type_is_user_creatable): New. - - * Evolution-ShellComponent.idl: New member `user_creatable' in - `struct FolderType'. - -2001-07-21 Ettore Perazzoli <ettore@ximian.com> - - * evolution-activity-client.c (impl_destroy): Use - `g_source_remove()' instead of `gtk_timeout_remove()' here, as we - are using `g_timeout_add()' and not `gtk_timeout_add()' to set up - the timeout callback. - (update_timeout_callback): Reset `have_pending_update' when - returning %TRUE. Set the timeout id to zero when returning - %FALSE. - -2001-07-20 Jason Leach <jleach@ximian.com> - - [Fix a crash if you start evolution with a bad URI.] - - * e-shell.c (e_shell_create_view): If we can't display the URI, - display the default uri. This is because it's necessary for - e_shell_view_display_uri() to run all the way through so corba - interfaces get setup. - - * e-shell-view.c (e_shell_view_display_uri): If we fail to create - a new view for a URI (happens if you pass in an invalid URI), be - sure to return FALSE. - -2001-07-20 Jason Leach <jleach@ximian.com> - - [This is a better way to have "Local Folders" be shown as the - local storage name without breaking current user's shortcuts.] - - * e-corba-storage.c (get_display_name): Implement this, but it's - only returning the real name now. Need to change the IDL soon to - let corba storages have separated display names. - - * e-shortcuts.c (e_shortcuts_add_default_group): Set these default - shortcut URI's back to evolution:/local/ - - * e-shell-view.h (DEFAULT_URI): Set this back to - "evolution:/local/Inbox" - - * e-storage-set-view.c (etree_value_at): Get the display name for - a storage rather than it's true name. - - * e-local-storage.c (impl_get_display_name): Implemented for the - local folder (to return a translated "Local Folders"). - - * e-storage.c (e_storage_get_display_name): New virtual function - for retrieving the display name. - -2001-07-19 Jason Leach <jleach@ximian.com> - - * e-local-storage.h: Make the local storage name "Local Folders" - instead of "local", looks better with "My Evolution", "VFolders", - and "Other Contacts". - - * e-shell-view.h: Put the #define DEFAULT_URI here instead of in - e-shell-view.c. - - * main.c: Remove the duplicated #define STARTUP_URI, actually make - use of the nice defines. - - * e-shell-folder-commands.c (e_shell_command_delete_folder): Use - the DEFAULT_URI here instead of a hard coded string. - - * e-shortcuts.c (e_shortcuts_add_default_group): Fix the URI's - here to use "Local Folder". - -2001-07-19 Jason Leach <jleach@ximian.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_construct): - Line up the padding for the folder title bar labels when you have - the folder bar enabled or disabled (previously when disabled it - was padding ~8 pixels to the right while the other had 0). - - * e-shell-view.c (setup_widgets): Take out a 2 pixel padding - around the vbox containing the title bar, folder bar, message list - and mail display. Also remove 2 more extra pixels of padding on - the bottom. - -2001-07-16 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts.c - (override_shortcut_name_and_type_from_storage_set): Removed. - (load_shortcuts): Don't call it. - -2001-07-15 Ettore Perazzoli <ettore@ximian.com> - - [Fix #4387, Shortcut bar items don't keep the name after rename.] - - * e-shortcuts.c (update_shortcuts_by_path): Do not change the name - of the shortcut if the folder's name changes. - -2001-07-15 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (etree_icon_at): Return an icon for depths - greater than 2 as well. - -2001-07-15 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (e_shell_view_menu_setup): Connect the - "line_status_changed" signal with - `gtk_signal_connect_while_alive()' for the shell views, so we - don't crash if a view gets destroyed. - * e-shell-view.c (e_shell_view_construct): Likewise. - -2001-07-12 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c (command_submit_bug): Because - bugzilla.ximian does have a mail gateway now, we can have - Help->Submit Bug Report open up bug-buddy. - -2001-07-12 Iain Holmes <iain@ximian.com> - - * importers/intelligent.c (create_gui): Remove the g_warnings as - they are an annoying red herring - -2001-07-12 Dan Winship <danw@ximian.com> - - * e-shell.c (init): Initialize priv->db and priv->iid so that - destroy() won't crash if e_shell_construct bails out before - setting them. Reduces bug #4173 to #4169. - -2001-07-11 Iain Holmes <iain@ximian.com> - - * importers/intelligent.c (intelligent_importer_init): Sync the config - so that the Don't Ask Again gets saved. - -2001-07-11 Kjartan Maraas <kmaraas@gnome.org> - - * importers/intelligent.c: Mark a string for translation. - -2001-07-11 Jason Leach <jleach@ximian.com> - - * e-shell-view.c (e_shell_view_save_settings): Make sure to create - ~/evolution/config/ if it doesn't exist. (ShellView settings get - saved before component settings, so when the mailer comes around - to saving ETree stuff, this dir will be there). Fixes bug #4279. - -2001-07-10 Jason Leach <jleach@ximian.com> - - * e-setup.c (copy_default_stuff): Add a temporary block of code to - not use the $GNOME/share/evolution/default_user/shortcuts.xml for - users who might be upgrading, so they'll get the shell-generated - default set of shortcuts. See notes on #4394. - -2001-07-09 Larry Ewing <lewing@ximian.com> - - * e-shell-folder-commands.c (delete_dialog): convert the folder - name from utf8 before displaying them in the dialog and set the - dialog parent. - -2001-07-09 Federico Mena Quintero <federico@ximian.com> - - * e-shortcuts-view.c: Make the "Rename" item be a - GNOMEUIINFO_ITEM_NONE() since we don't have a stock icon; likewise - for the "Open in New Window". This gets rid of warnings from - gnome-libs. Use a better stock icon for the "Remove" command, and - add a stock icon to the "Open" command. - -2001-07-09 Jason Leach <jleach@ximian.com> - - * e-shell-view.c (updated_folder_cb): It's very possible that - get_storage_set_path_from_uri() returns NULL (5 of the 6 return - cases), so check that it's not NULL before trying to strcmp() it. - Fixes a startup crash. - -2001-07-06 Dan Winship <danw@ximian.com> - - * e-shortcuts.c (shortcut_item_update): Return a gboolean saying - whether or not the shortcut changed. Use strcmp rather than - pointer comparisons to determine this. - (update_shortcut_and_emit_signal): propagate the gboolean from - shortcut_item_update (and only emit the signal if it's TRUE). - (update_shortcuts_by_path): Only call make_dirty if something - changed. - (storage_set_new_folder_callback, - storage_set_updated_folder_callback): Don't call make_dirty: - update_shortcuts_by_path will have called it if necessary. - - * e-shell-view.c (updated_folder_cb): Don't call - update_for_current_uri if the folder that was updated isn't the - one being displayed. - -2001-07-06 Jason Leach <jleach@ximian.com> - - * e-shortcuts-view.c: Little UI tweak for right click menu, - pronouns shouldn't be capitalized ("This" in this case). - - [Misc fixes and part of #2228, There should be no dialog boxes - during startup.] - - * e-setup.c (e_setup): Check for searches.xml instead of - shortcuts.xml, since shortcuts.xml doesn't really need to exist - (and thus wouldn't be a necessary test whether ~/evolution was - invalid) because shell can generate shortcuts. - (copy_default_stuff): For first time users, only present a dialog - if a problem occurred. We've already clicked "Ok" on a dialog - about copying files. - (check_evolution_directory): Take out the "successfully installed" - dialog on updates too. - -2001-07-06 Ettore Perazzoli <ettore@ximian.com> - - [This should fix #3873, Bizzarre crash after deleting a few - folders.] - - * e-local-storage.c (remove_folder): Don't free the - `physical_path' on error, as it gets freed when freeing the - callback data. - -2001-07-06 Ettore Perazzoli <ettore@ximian.com> - - [Fix #3959, copying a folder over itself crashes Evolution.] - - * e-shell-folder-commands.c - (folder_selection_dialog_folder_selected_callback): Sanity checks: - don't allow copying a folder over itself, or moving it under one - of its descendants. In such cases, pop up an error dialog. - -2001-07-05 Iain Holmes <iain@ximian.com> - - * e-shortcuts-view.c (icon_callback): Special case the evolution:/My - Evolution uri. - -2001-07-05 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Removed handler for verb - "ChangeFolderProperties". - (command_folder_properties): Removed. - - * e-shell-folder-commands.c (e_shell_command_folder_properties): - Removed. - -2001-07-03 Ettore Perazzoli <ettore@ximian.com> - - * main.c (development_warning): Use both `VERSION' and - `SUB_VERSION' here. - (main): Likewise. - -2001-07-04 Gediminas Paulauskas <menesis@delfi.lt> - - * evolution-shell-component-utils.c (e_pixmaps_update): set - "pixname" value only if pixbuf was loaded successfully. Otherwise - component crashes if image is not found. Should be checked for - sanity in bonobo_ui_component_set_prop IMHO. - -2001-07-03 Aaron Weber <aaron@ximian.com> - - * main.c (development_warning): Revised to make it less scary. - -2001-07-03 Ettore Perazzoli <ettore@ximian.com> - - [Fix a problem with not being able to save a newly created - `shortcuts.xml' file, and another bug that caused the default - group to be added at every start-up, even there were groups - already.] - - * e-shortcuts.c (e_shortcuts_new): If loading the shortcuts fails, - set the file_name. - (load_shortcuts): Update `num_groups'. - -2001-07-03 Iain Holmes <iain@ximian.com> - - * importer/Makefile.am: Add bonobo-conf stuff - -2001-07-03 Ettore Perazzoli <ettore@ximian.com> - - [The following makes the shell able to create the `shortcuts.xml' - file by itself when the file is not present or corrupted. Fixes - #3668, failure to handle malformed shortcuts.xml file.] - - * e-shell.c (e_shell_construct): If the `e_shortcuts_new()' - returns an object with no shortcuts in it, fill it in with - `e_shortcuts_add_default_group()'. - - * e-shortcuts.c: New member `num_groups' in EShortcutsPrivate. - (init): Init to zero. - (e_shortcuts_add_group): Increment. - (e_shortcuts_remove_group): Decrement. - (e_shortcuts_get_num_groups): New. - (e_shortcuts_add_default_group): New function to set up the - default shortcuts. - (e_shortcuts_new): Return an empty EShortcuts object if loading - the file files, instead of returning NULL. - -2001-07-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c - (e_shell_offline_handler_put_components_offline): Ref/unref the - handler so the signal handlers can unref it safely. Also, if - `prepare_for_offline()' fails, don't say that there was an - internal error, as that's confusing. Just say we couldn't put the - components off-line. - - [Fix #3758, clicking on the online/offline button crashed - Evolution.] - - * Evolution-Offline.idl: Don't derive OfflineProgressListener from - Bonobo::Unknown. - -2001-07-03 Ettore Perazzoli <ettore@ximian.com> - - [Fixed #3643, Shell crash when component crashed] - - * e-shell-view.c (socket_destroy_cb): Fix Jason's broken fix for - #3205 that was causing #3643. It is not safe to strcmp() the - return value from `e_shell_view_get_current_uri()' as it might be - NULL already. - -2001-07-02 Christopher James Lahey <clahey@ximian.com> - - * Makefile.am (INCLUDES): Added $(BONOBO_CONF_CFLAGS). - (evolution_LDADD): Added $(BONOBO_CONF_LIBS). - -2001-07-02 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (popup_folder_menu): Don't assert that - there is a handler, so we don't crash if user clicks on a folder - whose type we cannot handle for some reason [such as an - uninstalled component]. - - * evolution-test-component.c (activity_client_cancel_callback): - New callback for the "cancel" signal on the - EvolutionActivityClient object. - (activity_client_show_details_callback): New callback for the - "show_details" signal. - (timeout_callback_1): Connect these two signal handlers. - - * e-activity-handler.c (task_widget_button_press_event_callback): - Ahem, right-click is button 3, not button 2. - (show_cancellation_popup): Actually pop up the menu. - (get_corba_null_value): New helper function to create a CORBA_any - null value. - (report_task_event): New helper function to report events to the - listener. - (task_widget_cancel_callback): Use it. Report "Cancel" instead of - "Cancelled". - (task_widget_show_details_callback): New, callback for the "Show - Details" right-click menu item. - - * evolution-activity-client.c: Updated to dispatch the "Cancel" - and "ShowDetails" events as "cancel" and "show_details" signals. - (class_init): Install the signals. - (listener_callback): Updated to update the signals corresponding - to the "ShowDetails" and "Cancel" events. - - * Evolution-Activity.idl: Changed the docs about the events sent - to the Bonobo::Listener. We now only have "ShowDetails" and - "Cancelled". - - * evolution-test-component.c (timeout_callback_1): Make the - activity cancellable so we can test the right-click cancel menu - too. - - * main.c (idle_cb): Actually exit if we cannot reach to the shell. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-uri-schema-registry.c (init): Unset the FLOATING flag on the - object. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: Fixing a bug that could cause Evolution to crash - if a new ShellView was created and then destroyed, and then a new - folder would appear in the folder tree. Sigh, this code with the - delayed_selection is pretty messed up, but at least this will add - some consistency to it and make it safe. - (cleanup_delayed_selection): New function to disconnect the - "new_folder_cb" callback if the `delayed_selection' is not NULL, - and also free the `delayed_selection' itself. - (new_folder_cb): Use it. - (destroy): Call it here, otherwise we might [a] leak [b] cause a - crash as soon as a new folder appears in the folder tree, as - "new_folder" gets emitted and our connected signal handler has no - EShellView to handle the signal on. - (e_shell_view_display_uri): Call it here before re-setting the - `delayed_selection'. - - * e-shortcuts-view.c (open_shortcut_in_new_window_cb): Add - invocation for `open_shortcut_helper()' back in [it was gone, for - unknown reasons]. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (tree_drag_begin): If the node doesn't have - a component, just don't start the whole CORBA drag thing instead - of crashing with an assertion. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (command_new_shortcut): New, implementation - for the "New Shortcut" command create a new shortcut. - (goto_folder_dialog_cancelled_cb): Renamed from - `folder_selection_dialog_cancelled_callback'. - (goto_folder_dialog_folder_selected_cb): Renamed from - `folder_selection_dialog_cancelled_callback'. - - * e-shell-folder-selection-dialog.c: New member `allow_creation' - in `EShellFolderSelectionDialogPrivate'. - (e_shell_folder_selection_dialog_get_allow_creation): New; return - the value of `allow_creation'. - (e_shell_folder_selection_dialog_set_allow_creation): New; hide or - show the "New" button according to the @allow_creation arg. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view.c: Added "Rename Group" command to the - right-click group menu item. - (rename_group_cb): New callback for the "Rename Group" command. - - * e-shortcuts-view-model.c (shortcuts_rename_group_cb): New, - callback for the EShortcuts::rename_group signal. It renames the - group by removing it and creating a new one which is the same; - this sucks, but there is no other way with the current shortcut - bar widget. - (e_shortcuts_view_model_construct): Connect it. - - * e-shortcuts.c - (class_init): Install signal "rename_group". - (e_shortcuts_rename_group): New. - - * e-shortcuts.h: New signal "rename_group". - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts.c: Removed `title_to_group' hash from - `EShortcutsPrivate'. - (init): Don't initialize it anymore. - (unload_shortcuts): Don't remove the groups from the hash, and - don't destroy/realloc the hash. - (load_shortcuts): Don't check for duplicate group names. Don't - add the groups to the hash. - (destroy): Don't free the hash. - (e_shortcuts_get_shortcuts_in_group): Changed to get a @group_num - instead of a @group_title. - - * e-shortcuts-view-model.c (load_group_into_model): Updated to - pass the group number to `e_shortcuts_get_shortcuts_in_group()'. - Removed arg @group_title. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view.c: Added a "Rename" right-click command. - (rename_shortcut_cb): New function, implementation for the "Rename - command". - (rename_shortcut_dialog_cb): Callback for the gnome_request_dialog - function to ask the new name. - - * e-shortcuts.c (e_shortcuts_update_shortcut): Call `make_dirty()' - so we get saved too. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (activate_shortcut_cb): Receive an @in_new_window - arg as well. - - * e-shortcuts-view.c: Added a new "Open in New Window" right-click - menu item. Renamed "Activate" to "Open". - (class_init): Update the installation of the "activate_shortcut" - signal for the additional @in_new_window_arg. - (open_shortcut_helper): New helper function. - (open_shortcut_cb): Renamed from `open_shortcut_cb'. Changed to - use `open_shortcut_helper' - (open_shortcut_in_new_window_cb): New. - (item_selected): Pass %FALSE as the @in_new_window arg for - "activate_shortcut". - - * e-shortcuts.c (save_shortcuts): Set the "name" and "type" - properties for the <item> nodes too. - (load_shortcuts): Change `shortcut_group_title' to be an `xmlChar - (shortcut_set): New helper function. - (shortcut_update): New helper function. - (update_shortcut_and_emit_signal): New helper function. - (e_shortcuts_update_shortcut): Use it. - -2001-07-01 Ettore Perazzoli <ettore@ximian.com> - - This is a first shoot at making shortcuts renameable [#3719]; - unfinished. Also, it causes the shortcut bar to stop displaying - message unread count, but this is unfixable until we get rid of - the ::LocalStorage interface, which should hopefully happen soon. - - * e-shortcuts-view.c (icon_callback): Get the icon from the type - member of the shortcut item instead of going to the actual folder. - - * e-shell-view.c (updated_folder_cb): Don't update the shortcuts - here for now. - - * e-shortcuts-view.c (item_selected): Use - `e_shortcuts_get_shortcut()' instead of `e_shortcuts_get_uri()'. - (impl_shortcut_dropped): Pass a NULL @name and @type. - - * e-shortcuts-view-model.c (load_group_into_model): Updated to - match the new `e_shortcuts_get_shortcuts_in_group()' function that - doesn't allocate the list anymore and returns a list of - EShortcutItems instead of a list of strings. - (load_group_into_model): Likewise. - (load_all_shortcuts_into_model): Likewise. - (shortcuts_new_shortcut_cb): Get the URI and the name from the - EShortcutItem instead of retrieving them from the storage. - (shortcuts_update_shortcut_cb): Likewise. - (get_storage_set_path_from_uri): Removed [now unused]. - - * e-shortcuts.c: Define the shortcuts to be EShortcutItems instead - of just strings. - (shortcut_new): New helper function to allocate a Shortcut. - (shortcut_free): New helper function to free a Shortcut. - (shortcut_group_new): New helper function to allocate a - ShortcutGroup. - (shortcut_group_free): New helper function to free a - ShortcutGroup. - (load_shortcuts): Use `shortcut_group_new()' here. - (e_shortcuts_add_group): Same here. - (unload_shortcuts): Use `shortcut_group_free()' here. - (e_shortcuts_remove_group): Here too. - (load_shortcuts): Update to handle `Shortcut's instead of simple - `char *'s representing the URIs. - (save_shortcuts): Likewise. - (e_shortcuts_get_shortcuts_in_group): Likewise. The returned list - now doesn't belong to the caller anymore; the return type is now - const. - (removed_folder_cb): Removed. - (e_shortcuts_construct): Don't connect. - (e_shortcuts_get_group_titles): Dont' re-allocate the string. - (e_shortcuts_get_uri): Removed. - (e_shortcuts_get_shortcut): New. - (e_shortcuts_add_shortcut): new args @name, @type. - (e_shortcuts_update_shortcut_by_uri): Remove. - (e_shortcuts_remove_shortcut_by_uri): Remove. - (get_item): New helper function. - (e_shortcuts_get_shortcut): Use it. - (find_positions_by_uri): Removed. - - * e-shortcuts.h: New typedef EShortcutItem. - -2001-06-30 Federico Mena Quintero <federico@ximian.com> - - * e-storage-set-view.c (popup_folder_menu): Pass the event time to - gtk_menu_popup() so that we can release the button and have the - menu stay up. - -2001-06-29 Christopher James Lahey <clahey@ximian.com> - - * e-shortcuts-view-model.c (load_all_shortcuts_into_model): - Replaced GList with GSList here to fix a type mismatch. - -2001-06-29 Christopher James Lahey <clahey@ximian.com> - - * Makefile.am (INCLUDES): Changed $(datadir)/evolution/etspec to - "$(etspecdir)" here. - -2001-06-29 Christopher James Lahey <clahey@ximian.com> - - * e-shortcuts-view-model.c (load_group_into_model): Replaced GList - with GSList here to fix a type mismatch. - -2001-06-29 Ettore Perazzoli <ettore@ximian.com> - - * e-shortcuts-view-model.c (load_group_into_model): Updated to - match the fact that `e_shortcuts_in_group()' now returns a GSList - instead of a GList. - (load_all_shortcuts_into_model): Likewise for - `e_shortcuts_get_group_titles()'. - - * e-shortcuts.c: Change all `groups' and `views' from GLists to - GSLists in EShortcutsPrivate. - (e_shortcuts_get_group_titles): Return a GSList instead of a - GList. - (e_shortcuts_get_shortcuts_in_group): Likewise. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - [Fix #3756, `--debug' option not working anymore.] - - * main.c (main): Get the URI list from popt with `poptGetArgs' - instead of just using argv. Sigh, I am rusty. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - [Fix #3382, shortcut bar crashes when checking mail, and all the - different incarnations involving updates to an shortcut bar having - shortcuts to non-existent folders. Also, this fixes #1643, - shortcuts not visible until you enable an IMAP account, and #2436, - misbehavior of shortcut groups when IMAP or invalid shortcuts are - involved.] - - * e-shortcuts-view-model.c (load_group_into_model): Add the - shortcuts that point to folders that don't exist yet, too. - -2001-06-28 Dan Winship <danw@ximian.com> - - * e-storage.c (e_storage_new_folder): Call folder_changed_cb after - adding the new folder so that if it was added highlighted, its - parent will get its child_highlight set. - (e_storage_new_folder): Move the folder_changed_cb() call to avoid - a g_warning. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (e_shell_create_view): Renamed from - `e_shell_new_view'. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - * main.c (idle_cb): Re-implemented to get a GSList of URIs and - open them on a running shell [if any] or on a newly created shell. - If no args are provided [i.e. the list is NULL], it either - restores from settings [if any], or it just opens the Inbox. - (main): Set up the GSList of arguments and have it passed to the - idle callback. - - * e-shell.c (init): Ooops. Init `uri_schema_registry' to NULL as - well. - - * evolution-shell-component-client.c - (evolution_shell_component_client_handle_external_uri): New. - (corba_exception_to_result): Handle the `UnsupportedSchema' - exception too. - - * evolution-shell-component.h: New - EvolutionShellComponentResult value - `EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDSCHEMA'. - - * Evolution-ShellComponent.idl: New exception `UnsupportedSchema'. - (handleExternalURI): This can now raise `NotFound', - `UnsupportedSchema' and `InternalError'. - (createView): This can now raise `UnsupportedSchema' too. - - * e-shell.c (impl_Shell_handleURI): Finish implementation. - (class_init): Install it. - - * e-uri-schema-registry.c - (e_uri_schema_registry_get_handler_for_schema): Ooops. Rename - from `e_uri_schema_get_handler_for_schema'. Also, return NULL if - no handler is found. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * e-component-registry.c (register_component): Get the supported - schemas and register them into the schema registry. - - * e-shell.c: New member `uri_schema_registry' in `EShellPrivate'. - (e_shell_construct): Init. - (destroy): Unref. - (impl_Shell_createNewView): Raise exception `UnsupportedSchema' if - it's not an `evolution:' URI. Raise exception `NotFound' if - `e_shell_new_view()' returns NULL. - (impl_Shell_handleURI): New, implementation for the `::handleURI' - method. - (e_shell_get_uri_schema_registry): New. - - * Evolution-Shell.idl: New exceptions `UnsupportedSchema' and - `InvalidURI'. - (createNewView): Make this able to raise `NotFound', - `UnsupportedSchema' and `InvalidURI'. - (handleURI): New method. - - * e-uri-schema-registry.h: New. - * e-uri-schema-registry.c: New. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component-client.c: Remove redundant declaration - for `free_ShellComponentListener_servant()'. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c (impl_handleExternalURI): - Implementation for the `::handleExternalURI' CORBA method; just - emit the `HANDLE_EXTERNAL_URI' signal. - (class_init): Install. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c (impl_setOwner): Renamed from - `impl_ShellComponent_set_owner'. - (impl_unsetOwner): Renamed from `impl_ShellComponent_unset_owner'. - (impl_debug): Renamed from `impl_ShellComponent_debug'. - (impl_createView): Renamed from `impl_ShellComponent_create_view'. - (impl_createFolderAsync): Renamed from - `impl_ShellComponent_async_create_folder'. - (impl_removeFolderAsync): Renamed from - `impl_ShellComponent_async_remove_folder'. - (impl_xferFolderAsync): Renamed from - `impl_ShellComponent_async_xfer_folder'. - (impl_populateFolderContextMenu): Renamed from - `impl_ShellComponent_populate_folder_context_menu'. - (class_init): Updated accordingly. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c (factory_fn): Pass NULL as the - @external_uri_schemas arg to `evolution_shell_component_new'. - - * evolution-shell-component.c: New enum value - `HANDLE_EXTERNAL_URI'. New member `external_uri_schemas' in - `EvolutionShellComponentPrivate'. - (init): Initialize `external_uri_schemas' to NULL. - (destroy): Free it. - (destroy): - (class_init): Add the "handler_external_uri" signal. - (evolution_shell_component_new): Added precondition on - @folder_types. New arg @external_uri_schemas. - (evolution_shell_component_construct): Added preconditions. New - arg @external_uri_schemas. Initialize the `external_uri_schemas' - member in the EvolutionShellComponentPrivate part. - (impl_ShellComponent__get_external_uri_schemas): New, - implementation for reading the `external_uri_schemas' attribute. - (class_init): Install it in the EPV. - - * evolution-shell-component.h: New signal `handle_external_uri'. - - * Evolution-ShellComponent.idl: New attribute `extra_uri_schemas'. - (handleExternalURI): New method. - -2001-06-26 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (etree_value_at): Don't strdup "My - Evolution"! It was getting leaked every time the e-table wanted - to read the value this way. - -2001-06-26 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c: Removed member `BonoboListener' from - `AsyncCreateFolderCallbackData' and - `AsyncRemoveFolderCallbackData'. - (bonobo_interface_remove_folder_cb) : Return the value from - `create_folder()'. - (bonobo_interface_remove_folder_cb): Return the value from - `remove_folder()'. - (notify_bonobo_listener): Removed. - (component_async_create_folder_callback): Don't notify the - listener here. - (component_async_remove_folder_callback): Ditto. - (create_folder): Removed @listener arg. Not here either. Return - a valid E_STORAGE error code instead. Also, don't set the - `listener' field in `callback_data'. - (remove_folder): Likewise. - (bonobo_interface_create_folder_cb): Remove @listener arg. - (bonobo_interface_remove_folder_cb): Likewise. - -2001-06-25 jacob berkman <jacob@ximian.com> - - * e-shell-view.c: (set_folder_timeout): display a selected uri in - a timeout rather than right away, so the UI feels a bit more - responsive, and the tree is more navigable via keyboard - (switch_on_folder_tree_click): use the timeout rather than setting - the URI right away - (destroy): remove the timeout if it still exists - (update_for_current_uri): if there is a timeout set, don't update - (e_shell_view_display_uri): remove the timeout if it exists - -2001-06-25 Ettore Perazzoli <ettore@ximian.com> - - * main.c (no_views_left_cb): Call `e_shell_unregister_all()'. - - * e-shell.c (e_shell_unregister_all): New. - -2001-06-25 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (convert_gdk_drag_action_to_corba): Remove - trailing "\n" from g_warning. - (convert_corba_drag_action_to_gdk): Likewise. - (tree_drag_data_received): Likewise. - (new_folder_cb): Likewise. - - * e-shortcuts-view-model.c (load_group_into_model): Remove - trailing "\n" from g_warning. - -2001-06-25 Ettore Perazzoli <ettore@ximian.com> - - * main.c (no_views_left_cb): Unref the shell here. - - * e-storage-set.c (destroy): Use - `name_to_named_storage_foreach_destroy()' as the function argument - to `g_hash_table_foreach()', not `named_storage_destroy()', which - is just plainly wrong. - - * e-shell.c (setup_corba_storages): Don't ref the - corba_storage_registry here. - (destroy): Don't unref here. - (setup_activity_interface): Don't ref the activity_handler either. - (destroy): Don't unref it here. - - * e-component-registry.c (e_component_registry_construct): Don't - ref the shell here. - (destroy): Don't unref it here. - -2001-06-25 Ettore Perazzoli <ettore@ximian.com> - - * main.c (no_views_left_cb): Don't call `e_shell_quit()' anymore. - - * e-shell-view-menu.c (command_quit): Call - `e_shell_destroy_all_views()' instead of `e_shell_quit()', which - does not exist anymore. - - * e-shell.c (e_shell_quit): Removed. - (e_shell_destroy_all_views): New. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am: s/\.oafinfo/.oaf/g. - - * GNOME_Evolution_TestComponent.oafinfo: Renamed to - `GNOME_Evolution_TestComponent.oaf'. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c: New member `iid' in EShellPrivate. - (init): Init to NULL. - (e_shell_construct): Set it to the value of the @iid argument. - (destroy): Unregister that IID. - (register_shell): Removed. - (e_shell_construct): Just do all the work here. The function was - too simple to really be useful as separate. - - * e-shell.c, e-shell.h: Changed to derive from BonoboXObject - instead of deriving from BonoboObject and doing all the nasty - CORBA work by hand. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c (activity_client_clicked_callback): - New callback for the "clicked" signal on the EActivityClient. - Just spit out a warning now, for testing purposes. - (timeout_callback_1): Connect it. - - * evolution-activity-client.c (listener_callback): Emit the - "clicked" signal if we get the "Clicked" event from the Bonobo - listener. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-commands.c: #include <gtk/gtklabel.h>. - (delete_dialog): Constify @folder_name properly. - (delete_cb): Change the first arg to be an EStorageSet as expected - for EStorageSetResultCallbacks. - (rename_dialog): #if 0. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * e-task-widget.h, e-task-widget.c: Changed to derive from - GtkEventBox. - - * e-activity-handler.c (task_widget_button_press_event_callback): - New callback for the "button_press_event" signal on the - ETaskWidgets. Dispatch the "Clicked" event through the Bonobo - listener. - (task_widget_new_from_activity_info): Connect here. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c: Changed to use the - `EvolutionActivityClient' object. New global static variable - `activity_client'. - (create_animated_icon): Removed. - (create_icon_from_pixbuf): Removed. - (task_bar_event_listener_callback): Removed. - (timeout_callback_1): Create an EvolutionActivityClient object and - put a pointer to it into `activity_client'. Lower the timeout - delay from 1000 msecs to 100 msecs, so we can stress-test the - speed control code in EvolutionActivityClient. - (timeout_callback_2): Use the EvolutionActivityClient. Increment - progress by 1, instead of 10. - (timeout_callback_3): Destroy the EvolutionActivityClient. - - * Makefile.am (libeshell_la_SOURCES): Add - `evolution-activity-client.c'. - (eshellinclude_HEADERS): Add `evolution-activity-client.h'. - - * evolution-activity-client.c: New. - * evolution-activity-client.h: New. - - * e-activity-handler.c: Updated all instances of `ActivityID' with - `ActivityId'. - - * Evolution-Activity.idl: Renamed `ActivityID' to `ActivityID'. - Added value `DIALOG_ACTION_ERROR' to `DialogAction'. - -2001-06-24 Ettore Perazzoli <ettore@ximian.com> - - * evolution-test-component.c: Remove the `activity_interface' - global. - (timeout_callback_3): Get the ::Activity interface using - `evolution_shell_client_get_activity_interface()' on - `parent_shell' instead. - (timeout_callback_2): Likewise. - (timeout_callback_2): Likewise. - (timeout_callback_1): Likewise. - (owner_set_callback): Don't query interface here. Check if the - shell has an ::Activity interface by using - `evolution_shell_client_get_activity_interface()' here as well. - - * evolution-shell-client.c: New member `activity_interface' in - `EvolutionShellClientPrivate'. - (destroy): unref/release it. - (evolution_shell_client_construct): Initialize it by querying the - shell CORBA Object for the ::Activity interface. - (evolution_shell_client_get_activity_interface): New. - -2001-06-23 Jason Leach <jleach@ximian.com> - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_construct): Make the folder tree - have a similar expanded state as the shell's folder tree. - - * e-local-storage.c (remove_folder): New function that does the - meat of actual deletion stuff. - (remove_folder_directory): A helper function that remove_folder() - uses. - (component_async_remove_folder_callback): A new callback to do the - removing stuff from shell (if there weren't errors from the - component). - (impl_async_remove_folder): Implemented this. - - * evolution-shell-component-client.c - (evolution_shell_component_client_async_remove_folder): - Implemented this. - - * e-shell-view.c (e_shell_view_remove_control_for_uri): New - function. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (e_shell_view_set_current_shortcuts_group_num): - Moved at the bottom, as it's public API. Also add preconditions. - (e_shell_view_get_current_shortcuts_group_num): Likewise. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: Get rid of some `#if 0'ed code. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (corba_interface_set_message_cb): Replaced with - an empty stub, as the "set_message" method is going to be - deprecated. - (corba_interface_unset_message_cb): Likewise for the - "unset_message" method. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c (e_shell_construct): Set `splash' to NULL when - @show_splash is false, so the compiler doesn't complain. - - * e-shell-view-menu.c: #include <gtk/gtkmain.h>. - - * e-setup.c: #include <unistd.h>. - - * importer/intelligent.c: #include <gtk/gtkhbox.h> and - <gtk/gtkdrawingarea.h>. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: New member `menu_hint_label' in - `EShellViewPrivate'. - (init): Init to NULL. - (ui_engine_add_hint_callback): Set the label in the menu hint - label, show the menu hint label, hide the task bar. - (ui_engine_remove_hint_callback): New callback for the - "remove_hint" signal on the BonoboUIEngine; hide the hint label, - show the task bar. - (setup_statusbar_hints): Connect it. - (setup_menu_hint_label): New helper function to create the menu - hint label. - (create_status_bar): Call it. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (command_quit): Add a `gtk_main_quit()' at - the end here. - -2001-06-23 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am: Add rules to build the test component and an - `install-test-component' target to install it. - - * GNOME_Evolution_TestComponent.oafinfo: New OAF file for the test - component. - - * evolution-test-component.c: New component, currently to test the - activity interfaces. We will be able use it for testing more - things in the future. - - * e-shell.c: New member `activity_handler' in `EShellViewPrivate'. - (init): Init here. - (class_init): Unref. - (setup_activity_interface): New helper function to create an - `EActivityHandler' object and aggregate it to the `EShell'. - (e_shell_construct): Call here. - (e_shell_new_view): Attach the task bar of the newly created view - to the activity handler by using - `e_activity_handler_attach_task_bar()'. - - * e-shell-view.c: Removed old progress bar code. New members - `status_bar' and `task_bar' in EShellViewPrivagte; removed member - `progress_bar'. - (init): Initialize the new fields; remove initialization for - `progress_bar'. - (impl_destroy): Handle the new fields here too. - (setup_task_bar): New helper function to set up an ETaskBar. - (create_status_bar): New helper function to create the status bar - with an ETaskBar in it. - (ui_engine_add_hint_callback): New callback for the "add_int" - BonoboUIEngine signal. - (setup_statusbar_hints): New helper function to set up the menu - hints for the status bar; connect `ui_engine_add_hint_callback()' - here. - (setup_widgets): Call `create_status_bar()' and - `setup_statusbar_hints()'; pack the status bar in a vbox instead - of using the Bonobo status bar stuff, which is kinda broken. - (e_shell_view_get_task_bar): New. - (get_type_for_folder): No use to get the EFolderTypeRegistry here. - - * Evolution.idl: #include <Evolution-Activity.idl> and - <Evolution-Icon.idl>. - - * Evolution-Activity.idl: New. - - * Evolution-Icon.idl: New. - - * e-activity-handler.c: New. - * e-activity-handler.h: New. - - * e-task-bar.c: New. - * e-task-bar.h: New. - - * e-task-widget.c: New. - * e-task-widget.h: New. - -2001-06-21 Jason Leach <jleach@ximian.com> - - * evolution-storage.c (evolution_storage_deregister_on_shell): New - function, uses the StorageRegistry::removeStoragebyName corba call - to properly make the storage vanish from the shell. - -2001-06-18 Dan Winship <danw@ximian.com> - - * Makefile.am (evolution_LDADD): Remove DB3_LDADD - - * e-shell-view-menu.c: Fix the help URLs - -2001-06-13 Not Zed <NotZed@Ximian.com> - - * e-shell-view.c (switch_on_folder_tree_click): Check priv->uri - isn't null before strcmp'ing it here too. - -2001-06-11 Dan Winship <danw@ximian.com> - - * e-shell-view.c (destroy): Don't destroy the - offline_toggle_pixmap: the offline_toggle 0wnz it. - (update_for_current_uri): Check priv->uri isn't NULL before - strcmp()ing it. - -2001-06-11 Jason Leach <jleach@ximian.com> - - * evolution-storage.c (impl_Storage_async_create_folder): Fixed - folder creation on IMAP storages (by notifying bonobo listener - with the result). - - * evolution-storage-listener.c: Some cleaning. - -2001-06-08 Iain Holmes <iain@ximian.com> - - * e-setup.c (check_dir_recur): Don't copy the old Executive-Summary dir. - (e_setup): If there is an Executive-Summary dir in ~/evolution/local - ask it the user wants to remove it. - (e_shell_rm_dir): Function to completely delete a directory. - -2001-06-07 Iain Holmes <iain@ximian.com> - - * evolution-storage.c (impl_Storage_async_create_folder): Removed - debug spew. - - * e-shell-importer.c (start_import): Removed spew. - - * e-shell-view.c (update_window_icon): Take a gboolean to say if - the folder is my evolution. Do special cased things for My Evolution. - (update_folder_title_bar): Same. - (update_for_current_uri): Find out if the uri is the my evolution one - and act accordingly. - (get_control_for_uri): Handle the toplevel My Evolution. - - * e-storage-set-view.c (etree_icon_at): Get an icon for the toplevel - My Evolution. - (etree_value_at): Default is to return "My Evolution" - (e_storage_set_view_construct): Set the toplevel to be called "My - Evolution" and show it. - (e_storage_set_view_set_show_folders): Same. - -2001-06-08 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): - Allow a NULL @shell_view arg. - -2001-06-08 Jason Leach <jleach@ximian.com> - - * e-shell.c (e_shell_construct): Fix splash setup to keep it from - giving two Gtk-CRITICAL assertions when you do --no-splash. - -2001-06-06 Jon Trowbridge <trow@ximian.com> - - * evolution-storage.c (impl_Storage_async_create_folder): Changed - purely informational debug spew from a g_warning to a g_message. - - * e-shell-importer.c (show_import_wizard): The import wizard - defined in import.glade only has three pages... yet we were trying - to manipulate "page4" as the finish page, with the expected bad - results. My guess is that the .glade file got changed, but the - code didn't get updated. - (start_import): We were trying to bonobo_object_unref - (BONOBO_OBJECT (icd->client)), which is fine except for the - fact that icd->client is just a GtkObject, not a BonoboObject. - Changed to a gtk_object_unref. - (start_import): Changed a purely informational bit of debug - spew from a g_warning to a g_message. - -2001-06-06 Iain Holmes <iain@ximian.com> - - * importers/intelligent.c (create_gui): Make a few boxes, and make - the whole dialog horizontal. Add better buttons, and a "Don't ask - again button" (And the world rejoices). - Fixed the notebook so it displayed the blank page on startup. - (intelligent_importer_init): Handle the "Don't ask me again" button. - -2001-06-06 Jason Leach <jleach@ximian.com> - - (Fix bug #3205: Component crash causes folder switch even when not - needed) - - * e-shell-view.c (socket_destroy_cb): Only flip around the - ShellView to different folders when we're currently viewing the - URI that's being closed/crashed. - -2001-06-06 Jason Leach <jleach@ximian.com> - - (Fix bug #418: Save state of folder tree view) - - * e-shell-view.c (e_shell_view_save_settings): Changed the char * - @prefix argument to an int @view_num. - (e_shell_view_load_settings): Ditto. - (get_local_prefix_for_view): New function that gets us a prefix - from a view_num. - - * e-shell-view.c (e_shell_view_save_settings): Save the - expanded/collapsed information for each storage-set-view here. - (e_shell_view_load_settings): Load it here. - - * e-storage-set-view.c (e_storage_set_view_construct): Make it so - new storage set views have their storages expanded by default, but - will respsect the expanded state information that we load into it. - (insert_storages): Minor change here too. - (new_folder_cb): Ditto. - -2001-06-05 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c: Plug in all the folder tree right click - menu verbs so bonobo-warnings aren't emitted (even though the - respective implementation functions are currently unimplemented). - (command_delete_folder): New function, see above. - (command_rename_folder): Ditto. - (command_folder_properties): Ditto. - - * e-shell-folder-commands.c (e_shell_command_delete_folder): New - function, currently unimplemented. - -2001-06-04 Jason Leach <jleach@ximian.com> - - (Fixing bug #1299: Shell saves shortcuts when display name - changes) - - * e-shortcuts.c (class_init): New signal: "update_shortcut". - - * e-shortcuts-view-model.c (e_shortcuts_view_model_construct): - Connect thew new signal here. - - * e-shortcuts-view-model.c (shortcuts_update_shortcut_cb): New - function, uses the new e_shortcut_model_update_item(). - - * e-shell-view.c (corba_interface_set_folder_bar_label): Fix a - warning here. - -2001-06-03 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (evolution_LDADD): Move `$(DB3_LDADD)' before - libeutil. - -2001-06-01 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (evolution_LDADD): Add `$(DB3_LDADD)'. - -2001-05-30 Jason Leach <jleach@ximian.com> - - * e-shell-view.c (e_shell_view_set_current_shortcuts_group_num): - New function (probably should just be static). - (e_shell_view_load_settings): Load the current shortcut group here - using the above new function. - (e_shell_view_save_settings): Save current shortcut group in here. - -2001-05-30 Jason Leach <jleach@ximian.com> - - * e-shell-folder-title-bar.c: New 'folder_bar_label' member for - EShellFolderTitleBar, it's for information that's shown to the - left of the icon like the dates in the calendar (or, potentially - total and unread numbers for mailer). - (e_shell_folder_title_bar_set_folder_bar_label): New function, - lets others set the title bar extra label. - - * Evolution-ShellView.idl: New method 'setFolderBarLabel' for our - exposed ShellView interface. - - * evolution-shell-view.h: New signal "set_folder_bar_label" for - EvolutionShellView. - - * evolution-shell-view.c (impl_ShellView_set_message): Emit the - new signal here. - - * e-shell-view.c (setup_corba_interface): Connect the signal here. - - * e-shell-view.c (corba_interface_set_folder_bar_label): New - function, callback for the above signals, does the actual extra - label setting for the folder title bar. - - * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): - Fix a warning here. - -2001-05-30 Jason Leach <jleach@ximian.com> - - * e-shell.c (e_shell_construct): Removed an unecessary sleep(2) - call, so evolution will start up 2 seconds faster now. - -2001-05-30 Jason Leach <jleach@ximian.com> - - * e-shell-view-menu.c: Connect the AddFolderToShortcutBar verb to - their implementation functions. - - * e-shell-view.c (e_shell_view_get_current_shortcuts_group_num): - New function, use it to find out which shourtcut group is - currently open on the shortcut bar. - - * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): - Implement this using new function described above. - -2001-05-29 Federico Mena Quintero <federico@ximian.com> - - * e-shell-view.c (setup_progress_bar): Added missing castt. - (setup_offline_toggle): Likewise. - -2001-05-29 JP Rosevear <jpr@ximian.com> - - * e-shell-view.c (setup_progress_bar): unref the control when - finished with it - (setup_offline_toggle): ditto - (destroy): destroy offline and progress widgets - -2001-05-28 Dan Winship <danw@ximian.com> - - * e-storage-set-view.c (new_storage_cb): Call - e_tree_node_set_expanded on the storage_set_view, not the - storage_set (which is not an ETree). - -2001-05-27 Dan Winship <danw@ximian.com> - - * evolution-shell-component-utils.c: New file. - (e_pixmaps_update): Moved here from e-util to break e-util bonobo - dependency. - - * e-shell-view-menu.c: #include - "evolution-shell-component-utils.h" instead of "e-gui-utils.h" - - * Makefile.am (libeshell_la_SOURCES, eshellinclude_HEADERS): Add - evolution-shell-component-utils.[ch] - -2001-05-26 Dan Winship <danw@ximian.com> - - * e-storage-set-view.c (destroy): Don't free the hash keys in - priv->path_to_etree_node, because they're owned by the ETree now. - (e_storage_set_view_set_show_folders): Likewise. - -2001-05-25 Peter Williams <peterw@ximian.com> - - * Makefile.am: Change libeshell from a noinst_LIBRARIES to - a lib_LTLIBRARIES. Install its headers in - $includedir/evolution/shell. - - * evolution-storage.c (safe_corba_string): New, copy of e_safe_corba_string - in libeutil. This way libeshell doesn't have a missing symbol when programs - that don't have libeutil link to it. - (evolution_storage_register): s,e_safe_corba_string,safe_corba_string,g. - -2001-05-25 jacob berkman <jacob@ximian.com> - - * e-shell-view.c (setup_widgets): place the shortcut bar in a - frame - -2001-05-21 Christopher James Lahey <clahey@ximian.com> - - * Makefile.am (INCLUDES): Added ETSPECDIR. Added - e-storage-set-view.etspec to get installed. - - * e-local-storage.c (remove_folder_directory): Commented out this - function since it is unused. - - * e-shell-folder-commands.c - (folder_selection_dialog_folder_selected_callback), e-shell-view.c - (update_offline_toggle_status): Fixed warnings here by adding a - return; after the g_assert_not_reached();. - - * e-shell-importer.c (start_import): Got rid of real_folderpath - here and just reused folderpath (It was causing uninitialized - variable warnings.) - - * e-shell.c (impl_Shell_getLocalStorage): Use - bonobo_object_dup_ref here. It makes things simpler. - - * e-storage-set-view.c: Removed ETREE_SPEC since it's no longer - needed. - (convert_corba_drag_action_set_to_gdk, - folder_context_menu_activate_cb, remove_cb, - folder_context_menu_remove_cb): Commented out these functions - since they're unused. - (new_storage_cb, new_folder_cb, insert_folders, insert_storages): - Don't bother using insert_id here since it no longer does - anything. - (new_storage_cb, removed_storage_cb, removed_folder_cb): Don't - free the data returned from e_tree_memory_node_remove. - (e_storage_set_view_construct): Set the destroy func here so that - memory will automatically get freed when nodes are destroyed. - g_strdup the root node string here. Use - e_tree_construct_from_spec_file here to use an external file. - (e_storage_set_view_set_show_folders): g_strdup the root node - string here. - - * e-storage-set-view.etspec: New etspec file. - - * evolution-shell-component-client.c - (free_ShellComponentListener_servant): Added a prototype here. - -2001-05-23 Chris Toshok <toshok@ximian.com> - - * evolution-shell-component.h - (EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER): track change to the - path to the ComponentPlaceholder. - -2001-05-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: New static members `offline_pixmap', - `offline_mask', `online_pixmap', `online_mask'. Add members - `tooltips', `offline_toggle' and `offline_toggle_pixmap' to - `EShellViewPrivate'. - (init): Init to NULL. Also init the `progress_bar' member to NULL - as well, as we were not initializing it. - (destroy): Unref the tooltips. - (load_images): New static function to load the offline and online - icons into the pixmaps/masks. - (class_init): Call it. - (update_offline_toggle_status): New. - (shell_line_status_changed_cb): Call it. - (offline_toggle_clicked_cb): New, callback for the "clicked" - signal on the offline/online button. - (setup_offline_button): New function to set up the - `offline_button'. - (setup_widgets): Call it. - (setup_progress_bar): Changed to get an `EShellView' pointer, - instead of an `EShellViewPriv' pointer. - (setup_widgets): Updated accordingly. - -2001-05-20 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Define the verb for "CopyFolder" as well. - (command_copy_folder): Implementation for the "CopyFolder" verb. - - * e-shell-folder-commands.c: New struct `FolderCommandData'. - (folder_command_data_new): New function to allocate and initialize - it. - (folder_command_data_free): New function to free it. - (e_shell_command_move_folder): Pass a pointer to a filled-in - `FolderCommandData' struct to the callbacks instead of just - passing a pointer to the shell object. - (move_folder_selected_callback): Removed. - (move_folder_cancelled_callback): Removed. - (folder_selection_dialog_folder_selected_callback): New generic - callback for the folder selection dialog. - (folder_selection_dialog_cancelled_callback): New generic callback - for the folder selection dialog. - (connect_folder_selection_dialog_signals): New function to connect - these two handlers to a folder selection dialog. - (xfer_result_callback): New callback for the async xfer function. - (get_folder_name): New utility function. - (e_shell_command_copy_folder): Implement. - -2001-05-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-commands.c - (e_shell_command_create_new_folder): Changed to use - `e_shell_view_get_current_path()' to get the default path, instead - of computing it itself. - (move_folder_cancelled_callback) (move_folder_selected_callback): - New, callbacks for the "cancelled" and "folder_selected" signals - on the folder selection dialog for the "Move folder" operation. - (e_shell_command_move_folder): Implemented. - - * e-shell-view-menu.c (command_move_folder): New, implementation - for the "MoveFolder" verb. - - * e-shell-view.c (e_shell_view_get_current_path): New. - -2001-05-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-selection-dialog.h: Rename @default_path to - @default_uri. - - * e-shell.c (impl_Shell_selectUserFolder): Pass a NULL @caption to - `e_shell_folder_selection_dialog_new()'. - - * e-shell-importer.c (import_druid_finish): Add a caption to the - folder selection dialog. Constify local variable `foldername', - and avoid g_strdupping/g_freeing it, as it's useless. - - * e-shell-view-menu.c (command_goto_folder): Add a caption to - the folder selection dialog. - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_new): New arg @caption. - (e_shell_folder_selection_dialog_construct): Likewise. Also - cleaned up a bit. - -2001-05-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Removed "NewView" verb. Added - `folder_verbs', with "OpenFolderInNewWindow" in it. - (e_shell_view_menu_setup): Set up the `folder_verbs' too. - (command_new_view): Renamed to - `command_open_folder_in_new_window'. - - * e-shell-folder-commands.c - (e_shell_command_open_folder_in_other_window): Implement. - -2001-05-19 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (command_create_folder): Call - `e_shell_command_create_new_folder()' implemented in - `e-shell-folder-commands.c'. - - * e-shell-folder-commands.c: New. - * e-shell-folder-commands.h: New. - -2001-05-17 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c - (populate_folder_context_menu_with_common_items): Removed. - (popup_folder_menu): Instead of creating the component and the - folder popup definition here, just do `bonobo_window_add_popup()' - and assume that "/popups/FolderPopup" is defined in the toplevel - window's UI xml file. - -2001-05-16 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component-client.c: Moved some functions around - to avoid the warning about the static - `free_ShellComponentListener_servant()' function being used prior - to declaration. - -2001-05-15 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c (command_run_bugbuddy): `#if 0'ed out. - (command_submit_bug): New. Just fire up the web browser with - `http://bugzilla.ximian.com' in it. - (menu_do_misc): Associate the latter instead of the former to the - "HelpSubmitBug" verb. - -2001-05-15 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Add an `HelpFAQ' verb. - -2001-05-14 jacob berkman <jacob@ximian.com> - - * e-folder-tree.c (remove_folder): set the subfolder's parent to - NULL so the subfolder list doesn't change whilst we are using it - (folder_remove_subfolder): this function didn't used to work at - all - -2001-05-12 Chris Toshok <toshok@ximian.com> - - * e-storage-set-view.c (tree_drag_data_received): implement the - CORBA side of dragging. - (convert_gdk_drag_action_set_to_corba): rename - convert_gdk_drag_action_to_corba to this. - (convert_corba_drag_action_set_to_gdk): rename - convert_corba_drag_action_to_gdk to this. - (convert_gdk_drag_action_to_corba): new function that doesn't - build a bitmask, useful for the Action types, instead of - ActionSet. - (convert_corba_drag_action_to_gdk): same. - -2001-05-11 Chris Toshok <toshok@ximian.com> - - * e-storage-set-view.c - (populate_folder_context_menu_with_common_items): add RemoveFolder - menu item and verb. - (folder_context_menu_remove_cb): new function, call - e_storage_set_async_remove_folder. - (remove_cb): callack for e_storage_set_async_remove_folder. - - * evolution-shell-component-client.c - (evolution_shell_component_client_populate_folder_context_menu): - fix prototype to reflect Component -> Container. - - * evolution-shell-component-client.h: same. - -2001-05-11 Chris Toshok <toshok@ximian.com> - - * evolution-shell-component.h - (EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER): add this define for - the xml path to use when adding menu items to the folder popup. - - * e-storage-set-view.c - (populate_folder_context_menu_with_common_items): add (#ifdef - DEBUG_XML) a menu item to dump the bonobo xml. - (popup_folder_menu): pass the BonoboUIContainer to the - populate_folder_context_menu CORBA call, instead of the component. - Also, reorder things a bit so the component doesn't get an error - when setting xml the first time. - -2001-05-11 Iain Holmes <iain@ximian.com> - - * e-shell-folder-selection-dialog.c (dbl_click_cb): Use gnome_dialog_close - instead of gtk_widget_destroy. - (impl_clicked): Use gnome_dialog_close instead of gtk_widget_destroy. - - * e-shell-view-menu.c: #include e-shell-importer.h instead of importer/importer.h - - * importer/Makefile.am: Remove importer.c and importer.h. - - * importer/importer.[ch]: Moved these to e-shell-importer.[ch] - - * e-shell-importer.c (start_import): Take a folderpath to import into. - (importer_druid_finish): Show the EShellFolderSelectionDialog to get a folder to - import into. - -2001-05-11 JP Rosevear <jpr@ximian.com> - - * e-component-registry.c (register_component): component_new refs - the object itself, so unref ours when we finish with it - - * e-shell.c (e_shell_construct): There is no need to explicitly - ref the folder type registry, storage set and shortcuts because we - are the creator and hold the initial ref count of 1. - -2001-05-11 Dan Winship <danw@ximian.com> - - * e-local-storage.c (load_folder): Lots of people seem to have - "broken" local storage hierarchies. So ignore errors (like the old - code did) and just print a warning. - -2001-05-11 Chris Toshok <toshok@ximian.com> - - * evolution-storage-set-view-factory.c - (evolution_storage_set_view_factory_new_view): the only - problematic area - pass NULL for now in as the BonoboUIContainer. - how do we pass this container to the control? - - * e-storage-set-view.c (folder_context_menu_activate): un-#if 0 - this function. - (populate_folder_context_menu_with_common_items): build our popup - using the new xml bonobo stuffs. - (popup_folder_menu): convert to using the new xml bonobo stuffs. - (right_click): only do the popup menu if we have a - BonoboUIContainer. - (e_storage_set_view_new): add BonoboUIContainer* arg. - (e_storage_set_view_construct): same. - - * e-storage-set-view.h: add BonoboUIContainer* args to - e_storage_set_view_new and e_storage_set_view_construct. - - * e-shell-folder-creation-dialog.c (add_storage_set_view): pass - NULL for the BonoboUIContainer, since we shouldn't (?) have a - popup in this dialog. - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_construct): pass NULL for the - BonoboUIContainer, since we shouldn't (?) have a popup in this - dialog. - - * e-storage-set.h: add BonoboUIContainer* arg to - e_storage_set_new_view. - - * e-storage-set.c (e_storage_set_new_view): add arg, and track - change to e_storage_set_view_new. - - * e-shell-view.h: add prototype for - e_shell_view_get_bonobo_ui_container. - - * e-shell-view.c (setup_storage_set_subwindow): track change to - e_storage_set_view_new. - (e_shell_view_construct): the BonoboUIContainer is now part of our - private structure. - (e_shell_view_get_bonobo_ui_container): new function. - -2001-05-09 Christopher James Lahey <clahey@ximian.com> - - * importer/intelligent.c (create_gui): Made this function static. - Removed the unused variable placeholder. - (intelligent_importer_init): Cast from gpointer to int here - properly using GPOINTER_TO_INT. - -2001-05-09 Dan Winship <danw@ximian.com> - - * e-local-storage.c: Remove get_physical_path and load_folders, - and replace the calls to them with calls to the e_path_* functions - they inspired. - -2001-05-08 Dan Winship <danw@ximian.com> - - * glade/e-active-connection-dialog.glade: Rename "port" to "type" - here too. - -2001-05-08 Iain Holmes <iain@ximian.com> - - * importer/evolution-importer-client.c (evolution_importer_client_load_file): - Actually use the duplicated value. - - * e-local-storage.c (create_folder_directory): Assign - physical_path_return before trying to create the directory. - (create_folder): Return the physical_path even if the directory - creation failed. Free the physical path. - - * importer/evolution-importer-client.[ch]: Make EvolutionImporterClient - from a GtkObject instead of a BonoboObject. - - * importer/importer.c: Use gtk_object_unref instead of - bonobo_object_unref on the clients. - - * importer/intelligent.c: New prettier dialog, and multiple importers - done in the same window. - -2001-05-07 Dan Winship <danw@ximian.com> - - * e-shell-offline-handler.c (update_dialog_clist_hash_foreach): - Fix a free of non-malloc'ed memory introduced by my last change. - -2001-05-07 Jon Trowbridge <trow@ximian.com> - - * e-shell-view-menu.c (update_offline_menu_item): Changed some - references to /commands/WorkOffline to /commands/ToggleOffline. - -2001-05-04 Chris Toshok <toshok@ximian.com> - - * evolution-shell-component-dnd.c - (impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleMotion): - take a physical_uri and pass it to the callback. - (impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleDrop): - same. - - * evolution-shell-component-dnd.h: add physical_uri args to the - destination folder HandleMotion and HandleDrop types. - - * Evolution-ShellComponentDnd.idl: add "in string physical_uri" to - DestinationFolder::handleMotion and DestinationFolder::handleDrop. - - * e-storage-set-view.c (tree_drag_motion): pass the physical uri - of the folder to handleMotion. - -2001-05-04 Dan Winship <danw@ximian.com> - - * e-shell-offline-handler.c (update_dialog_clist_hash_foreach, - (duplicate_connection_list): Use type instead of portNumber. - (e_shell_offline_handler_put_components_offline): Fix the logic of - when to show the connection dialog here. (Show it when there *are* - connections, not when there aren't.) - - * Evolution-Offline.idl: Have a "string type" instead of "short - portNumber" in Connection. - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c - (e_shell_offline_handler_put_components_offline): Only display the - dialog if there are active connections. [It was displaying it all - the time before just for testing purposes.] - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * evolution-storage.c (evolution_storage_new_folder): Ooops. The - `corba_folder' is needed after returning; don't free it. - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * evolution-storage.c (evolution_storage_new_folder): Free the - `corba_folder' when not needed anymore. - - * e-local-storage.c (create_folder_directory): Free the parent - path, and don't allocate it when we don't need it. - - * evolution-shell-component-client.c (dispatch_callback): Free the - listener servant too. - (impl_destroy): Release the listener object and free the servant - if it exists. - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Don't - strdup `path' before copying it into the `dialog_data'. - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * importer/intelligent.c (get_intelligent_importers): Free the - `info_list' returned by `oaf_query()', thus plugging a leak. - -2001-05-04 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-utils.c (get_icon_path): Don't use - `gnome_pixmap_file()', which is broken as it looks in the current - working directory first. Instead, if the path is not absolute, - just look up the file in the `EVOLUTION_IMAGES' directory. - -2001-05-03 Ettore Perazzoli <ettore@ximian.com> - - * glade/e-active-connection-dialog.c: Change the GtkCList mode to - GTK_BROWSE_SINGLE. - -2001-05-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c - (impl_OfflineProgressListener_updateProgress): Update the GtkCList - before emitting the "offline_procedure_finished" signal. In fact, - we might be destroyed from within the signal handlers and then - things would get messy. - - * evolution-shell-component-client.c - (evolution_shell_component_client_get_offline_interface): - "IDL:GNOME/Evolution/Offline:1.0", not - "IDL:GNOME/Evolution/ShellComponent/Offline:1.0". Sigh. - - * e-shell-view-menu.c: Update to match the rename of the - `WorkOffline' menu item in the `File' menu into `ToggleOffline'. - Now the `WorkOffline' verb actually puts the shell offline, while - `WorkOnline' puts in online, so we don't use one single verb to - toggle the online/offline status. - (command_work_offline): Only go offline. - (command_work_online): New. Make the shell go online. - (update_offline_menu_item): New. - (shell_line_status_changed_cb): New, callback for the - "line_status_changed" signal on the associated EShell. - -2001-05-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c: New member `dialog_gui' in - `EShellOfflineHandlerPrivate'. - (impl_destroy): Unref here if not NULL. - (init): Init to NULL. - (update_dialog_clist_hash_foreach): New. - (update_dialog_clist): New. - (dialog_clicked_cb): New, callback for the "clicked" signal on the - active connection dialog. - (pop_up_confirmation_dialog): Implemented. - (init): Init `procedure_in_progress' to `FALSE' instead of `TRUE'. - (cancel_offline): Emit `offline_procedure_finished'. - (impl_OfflineProgressListener_updateProgress): Call - `update_dialog_clist()'. - - * glade/e-active-connection-dialog.glade: New. - - * e-shell-view-menu.c: Update to use the `WorkOffline' verb - instead of the `WorkOffLine' one. - (command_work_offline): New, temporary implementation for the - "WorkOffline" verb. - - * e-shell-view.c (shell_line_status_changed_cb): New, callback for - the shell's `line_status_changed' signal. - (e_shell_view_construct): Connect it. - - * e-shell.c: New member `line_status' in `EShellPrivate'. - (init): Init to `E_SHELL_LINE_STATUS_ONLINE'. - (class_init): Set up the `line_status_changed' signal. - (e_shell_is_offline): Removed. - (e_shell_get_line_status): New. - (e_shell_go_online): Set the `line_status' member to - `E_SHELL_LINE_STATUS_ONLINE' and emit `line_status_changed'. - (offline_procedure_started_cb): New, signal for the - `offline_procedure_started' signal in EShellOfflineHandler. - (offline_procedure_finished_cb): New, signal for the - `offline_procedure_finished' signal in EShellOfflineHandler. - (e_shell_go_offline): Implemented. - - * e-shell.h: New enum `EShellLineStatus'. New signal - `line_status_changed'. - -2001-05-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-offline-handler.c (e_shell_offline_handler_construct): - Unset the `GTK_FLOATING' flag. - -2001-05-02 Ettore Perazzoli <ettore@ximian.com> - - * e-shell.c: New members `is_offline' and `offline_handler' in - `EShellPrivate'. - (init): Init `is_offline' to %FALSE, `offline_handler' to %NULL. - (e_shell_is_offline): New. - (e_shell_go_online): New. - (e_shell_go_offline): New. - - * e-shell-offline-handler.c: New. - * e-shell-offline-handler.h: New. - - * evolution-shell-component-client.c: New member - `offline_interface' in `EvolutionShellComponentClientPrivate'. - (init): Init to `CORBA_OBJECT_NIL'. - (impl_destroy): Unref/release if not NIL. - (evolution_shell_component_client_get_offline_interface): New. - - * Evolution-Offline.idl: New. - -2001-05-02 Chris Toshok <toshok@ximian.com> - - * evolution-shell-component-dnd.c: new file. - - * evolution-shell-component-dnd.h: new file. - - * Makefile.am (libeshell_a_SOURCES): add - evolution-shell-component-dnd.[ch]. - -2001-04-25 Dan Winship <danw@ximian.com> - - * Makefile.am (evolution_LDADD): Remove $(UNICODE_LIBS). - - * main.c (main): Remove call to unicode_init. - -2001-04-25 JP Rosevear <jpr@ximian.com> - - * evolution-shell-client.c (destroy): free the private member - -2001-04-25 Kjartan Maraas <kmaraas@gnome.org> - - * e-component-register.c, e-corba-storage.c, e-folder-tree.c, - e-folder-tree.h, e-folder.c, e-local-folder.c, e-shell.c, - e-shortcuts-view-model.c, e-shortcuts.c, e-splash.c, - e-storage-set-view.c, e-storage-set.c, evolution-local-storage.c, - evolution-shell-component-client.c, evolution-shell-component.c, - evolution-storage.[ch], importer/evolution-importer-client.[ch], - importer/evolution-importer-listener.[ch], - importer/evolution-importer.[ch], - importer/evolution-intelligent-importer.[ch], importer/intelligent.c: - #include <glib.h> and move corresponding local includes to the top. - -2001-04-23 Jeffrey Stedfast <fejj@ximian.com> - - * e-splash.c: #include gnome-window-icon.h - -2001-04-21 Duncan Mak <duncan@ximian.com> - - * e-splash.c (e_splash_construct): Set window_icon to - "evolution.png" in the splash screen. - -2001-04-18 Ettore Perazzoli <ettore@ximian.com> - - * e-local-folder.c: #include <unistd.h>. - -2001-04-17 Christopher James Lahey <clahey@ximian.com> - - * e-shell-view.c (storage_set_view_box_event_cb): Proxy events to - the tooltip object properly. - -2001-04-15 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-selection-dialog.c - (folder_creation_dialog_result_cb): Set the current folder only if - @result is `E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS'. - - * e-shell-folder-creation-dialog.c (folder_name_entry_changed_cb): - Changed to get a pointer to the DialogData instead of just a - pointer to the dialog itself. Don't set the OK button sensitive - if there is no folder selected in the storage set view. - (setup_folder_name_entry): Don't connect - `folder_name_entry_changed_cb' anymore. - (e_shell_show_folder_creation_dialog): Connect here instead. - (storage_set_view_folder_selected_cb): New callback for the - "folder_selected" signal in the EStorageSetView. Make the OK - button sensitive if the entry is non-empty. - (e_shell_show_folder_creation_dialog): Connect it. - -2001-04-14 Michael Meeks <michael@ximian.com> - - * Makefile.am (dist-hook): remove built sources from dist. - -2001-04-13 Ettore Perazzoli <ettore@ximian.com> - - * e-splash.c (impl_destroy): Call the parent class' ::destroy - method. - -2001-04-12 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (etree_has_get_node_by_id, - etree_get_node_by_id): Implemented these. - -2001-04-11 Dan Winship <danw@ximian.com> - - * e-shell-view.c (switch_on_folder_tree_click): Don't get into an - infinite loop when clicking on an IMAP storage. Might not be the - best fix? - -2001-04-08 Chris Toshok <toshok@ximian.com> - - * e-storage-set-view.c (tree_drag_motion): fix type. we want the - destination interface, not source. - -2001-04-04 Kjartan Maraas <kmaraas@gnome.org> - - * e-local-folder.c: Fix headers. - * e-shell-view.c: Same here. - * e-shortcuts-view.c: Same here. - * e-shortcuts.c: Same here. - * e-storage-set-view.c: Same here. - -2001-04-04 Gediminas Paulauskas <menesis@delfi.lt> - - * importer/importer.c (create_html): copied newer and fixed function - from mail/mail-config-druid.c. - (html_new, put_html): removed. - (show_import_wizard): use create_html instead of html_new/put_html pair. - * importer/importer.glade: a try to set logo. removed source generation - options. - -2001-04-03 Dan Winship <danw@ximian.com> - - * main.c: - * evolution-shell-component-client.c: Don't declare debug_log as - extern in evolution-shell-component-client.c, because that's part - of libeshell and so gets linked into the other components. - Instead, declare it there and extern it from main.c. - (Noticed by Peter Williams) - -2001-04-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (get_control_for_uri): Change `! folder_type' - with `folder_type == NULL'. - - * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): If - the toplevel node URI or the toplevel node type are an empty - string, use NULL Instead. - -2001-04-03 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c: Fix bug #1878 "folder sometimes fails to - display?". Thanks to Dan for finding out an explanation for the - problem. - (e_shell_view_display_uri): Don't set `priv->uri' here. - (show_existing_view): Set it here instead, and before showing the - control. - (create_new_view_for_uri): And here, likewise. - -2001-04-03 Christopher James Lahey <clahey@ximian.com> - - * e-shell-folder-selection-dialog.c (dbl_click_cb): Made double - clicking not crash here. - -2001-04-02 Ettore Perazzoli <ettore@ximian.com> - - * e-setup.c (e_setup): If we have a local folder named "Trash" of - type "mail", rename it to "Trash.old" so that the new - vfolder-based trash type gets installed. - -2001-04-03 Gediminas Paulauskas <menesis@delfi.lt> - - * importer/evolution-importer-client.c (evolution_importer_client_load_file): - fix Iain's fix which did nothing. closes #1914. - -2001-03-31 Christopher James Lahey <clahey@ximian.com> - - * evolution-storage-set-view.c: Include <gal/util/e-util.h> here. - -2001-04-01 Gediminas Paulauskas <menesis@delfi.lt> - - * e-shell-view-menu.c: set up menu icons for new folder, import and work - offline. - -2001-03-30 Iain Holmes <iain@ximian.com> - - * importer/importer.c (start_import): If the importer can't be started, then - don't continue. - -2001-03-29 Iain Holmes <iain@ximian.com> - - * importer/evolution-importer-client.c (evolution_importer_client_load_file): - Duplicate the folderpath, or set it to \0 - -2001-03-30 Christopher James Lahey <clahey@ximian.com> - - * e-shell-folder-selection-dialog.c (dbl_click_cb): Since this is - an ETree now, the signature of the double click callback has - changed. - -2001-03-30 Dan Winship <danw@ximian.com> - - * Evolution-ShellComponent.idl: add a "debug" method to tell a - component to output debugging messages to a given file. - - * main.c (main): Add a "--debug filename" argument, to direct - debugging output for all components to a file. Redirect the - shell's stdout/stderr to that file if this argument is used. - - * evolution-shell-component-client.c - (evolution_shell_component_client_set_owner): If debug_log is set, - call the component's debug method as well. - - * evolution-shell-component.c (impl_ShellComponent_debug): - redirect stdout/stderr to the named file and emit a "debug" - signal. - -2001-03-29 Kjartan Maraas <kmaraas@gnome.org> - - * e-component-registry.c: Remove/replace unneeded includes and - move around stuff so that system headers are included first. - * e-corba-storage.c: Replace #include <bonobo.h> - * e-folder-tree.c: Shuffle. - * e-folder.c: Remove #include <gtk/gtkobject.h> - * e-local-storage.c: Replace #include <gnome.h> and <bonobo.h> - * e-setup.c: Replace #include <glib.h> and <gnome.h> - * e-shell-folder-creation-dialog.c: Replace #include <gnome.h> - * e-shell-folder-title-bar.c: Replace <gnome.h> - * e-shell-utils.c: Same here. - * e-shell-view-menu.c: Same here (and <bonobo.h>) - * e-shell-view.c: Replace <gnome.h> and <bonobo.h> - * e-shell.c: Replace <gnome.h> - * e-shell.h: Shuffle. - * e-shortcuts-view-model.c: Replace <gnome.h> - * e-shortcuts-view.c: Remove #include <gnome.h> - * e-shortcuts.c: Move <string.h> up. - * e-splash.c: Replace <gnome.h> - * e-storage-set-view.c: Replace <gnome.h> - * e-storage-set.c: Shuffle - * e-storage.c: Replace <gnome.h> - * evolution-local-storage.c: Same here - * evolution-local-storage.h: And here. - * evolution-session.c: Same here too. - * evolution-session.h: Replace <bonobo.h> - * evolution-shell-client.c: Here too. - * evolution-shell-component-client.c: Shuffle. - * evolution-shell-component.c: Replace <bonobo.h> - * evolution-shell-view.c: Remove #include <bonobo.h> - * evolution-shell-view.h: Replace <gnome.h> - * evolution-storage-listener.c: Replace <gnome.h> and <bonobo.h> - * evolution-storage-listener.h: Replace <gnome.h> - * evolution-storage-set-view-listener.c: Replace <gnome.h> and <bonobo.h> - * evolution-storage-set-view.c: Remove <gnome.h> - * evolution-storage.c: Replace <bonobo.h> - * main.c: Replace <gnome.h> and <bonobo.h> - * importer/importer.c: Replace <gnome.h> - * importer/intelligent.c: Replace <gnome.h>. Add prototype for - intelligent_importer_init(). - * importer/intelligent.h: Added this file. - -2001-03-28 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (folder_sort_callback): Use - `g_strcasecmp()' instead of `strcasecmp()'. - -2001-03-28 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (storage_sort_callback, - folder_sort_callback): Use strcasecmp instead of strcmp. - -2001-03-28 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c (async_xfer_folder_callback): - s/new_folder/destination_folder/ where appropriate, idiot. - -2001-03-28 Jon Trowbridge <trow@gnu.org> - - * e-shell-view-menu.c: In a fit of egomania, added myself to the - authors array. - -2001-03-26 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component-client.c - (shell_component_result_from_corba_exception): Implement. - -2001-03-26 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component-client.c - (evolution_shell_component_client_async_xfer_folder): Handle CORBA - exception. - (evolution_shell_component_client_async_create_folder): Likewise. - - * e-local-storage.c (create_folder_directory): Create the - `subfolders' directory if it doesn't exist. - - * e-storage-set-view.c (tree_drag_data_received): Build the - correct target path by appending the basename from the source - path. - - * evolution-shell-component.c - (impl_ShellComponent_async_xfer_folder): Enabled again. - (class_init): Install it. - - * e-local-folder.c (METADATA_FILE_NAME_LEN): Removed #define. - (METADATA_FILE_NAME): Removed #define. - (save_metadata): Use the public - `E_LOCAL_FOLDER_METADATA_FILE_NAME' value instead. - (construct_loading_metadata): Likewise. - - * e-local-folder.h (E_LOCAL_FOLDER_METADATA_FILE_NAME_LEN): New - #define. - (E_LOCAL_FOLDER_METADATA_FILE_NAME): New #define. - - * e-local-storage.c (remove_folder_directory): New helper - function. - (async_xfer_folder_step): New. - (async_xfer_complete): New. - (async_xfer_folder_callback): New. - (impl_async_xfer_folder): Implement. - - * e-storage.h: Added value `E_STORAGE_NOTEMPTY' to - `EStorageResult'. - - * evolution-shell-component-client.c - (evolution_shell_component_clinet_async_xfer_folder): New. - -2001-03-23 Ettore Perazzoli <ettore@ximian.com> - - * e-local-storage.c (impl_async_xfer_folder): New, implementation - for `EStorage::async_xfer_folder'. - (class_init): Install it. - (check_valid_name): Removed. Conflicts shouldn't be handled this - way, and hardcoding the names is *bad*. - (create_folder_directory): New helper function. - (real_do_folder_create): Removed. - (create_folder): New. Do things here using - `create_folder_directory'. - (impl_async_create_folder): Use `create_folder'. - (notify_bonobo_listener): Renamed from `notify_listener'. Moved - on top for clarity. - -2001-03-22 Iain Holmes <iain@ximian.com> - - * importer/evolution-importer-listener.c (evolution_importer_listener_new): - Remove the usage of the corba_object thing. - (evolution_importer_listener_construct): Ditto. - - * e-local-storage.c (real_do_folder_create): Revert the e_mkdir_hier call - to two seperate calls to mkdir. If the directory exists, just call the - callback and notify the listener. - - * importer/GNOME_Evolution_Importer.idl: Add a folderpath paramater to the - loadFile method. - - * importer/evolution-importer.[ch]: Update for the new folderpath param. - - * importer/evolution-importer-client.[ch]: Ditto. - - * importer/importer.c: Ditto. - -2001-03-22 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (motion_notify_event): Unref the target - list we create on the fly. - -2001-03-22 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-creation-dialog.c (async_create_cb): Changed - signature to match `EStorageSetResultCallback' instead of - `EStorageResultCallback', to match the changes in the async_create - API call. - -2001-03-22 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c: Removed some unused static variables. - (set_evolution_path_selection): Removed unused variable - `evolution_path'. - - * e-storage-set.c (e_storage_set_async_xfer_folder): Get an - `EStorageSetResultCallback', instead of an - `EStorageResultCallback'. - (e_storage_set_async_remove_folder): Likewise. - (e_storage_set_async_create_folder): Likewise. - (storage_callback_converter): New callback to convert from the - EStorageResultCallback to the EStorageSetResultCallback. - - * e-storage-set.h: New typedef `EStorageSetResultCallback'. - - * Evolution-ShellComponent.idl: Renamed `copyFolderAsync' into - `xferFolderAsync' for consistency. - - * e-storage-set-view.c (tree_drag_data_received): Updated to use - `e_storage_set_async_xfer_folder()' instead of - `e_storage_set_async_move_folder()' or - `e_storage_set_async_copy_folder()'. - (folder_xfer_callback): New, callback for the xfer function. - - * e-storage-set.c (e_storage_set_async_move_folder): Removed. - (e_storage_set_async_copy_folder): Removed. - (e_storage_set_async_xfer_folder): New. - -2001-03-22 Ettore Perazzoli <ettore@ximian.com> - - * e-storage.c (e_storage_async_xfer_folder): New. - (impl_async_xfer_folder): New, default implementation for the - `async_xfer_folder' method. - (class_init): Install it. - - * e-storage.h: New virtual method `async_xfer_folder'. - - * evolution-storage.c (impl_Storage_async_xfer_folder): New. Just - a stub for now. - (evolution_storage_get_epv): Install it as the implementation for - the `asyncXferFolder' method. - - * Evolution-Storage.idl: New method `asyncXferFolder'. - -2001-03-22 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c: Removed `source_drag_types', - `num_source_drag_types', `destination_drag_types', - `num_destination_drag_types', `target_list'. - (E_SHORTCUT_TARGET_TYPE): Renamed from "E_SHORTCUT_TYPE". - (EVOLUTION_PATH_TARGET_TYPE): Define to "_EVOLUTION_PRIVATE_PATH". - (find_matching_target_for_drag_context): If any of the targets - matches it, return it. - (handle_evolution_path_drag_motion): New. - (tree_drag_motion): Use it if we are matching an - `EVOLUTION_PATH_TARGET_TYPE' target. - (e_storage_set_view_construct): Call `e_tree_drag_dest_set()' on - the view so that we become a possible DnD target. - (get_folder_at_node): Don't die if you don't find a folder there. - (create_target_entries_from_dnd_type_list): Make the first entry - an `EVOLUTION_PATH_TARGET_TYPE', the second one an - `E_SHORTCUT_TYPE', and the following ones the ones defined by the - folder. - (set_evolution_path_selection): New function to set the private - Evolution path selection. - (set_e_shortcut_selection): Assert @selection_data to be not NULL. - (class_init): Don't set up the `target_list' anymore. - (storage_sort_callback): Actually compare the two nodes, not the - first node with itself. - - * e-storage-set.c (e_storage_set_async_copy_folder): New. - (e_storage_set_async_move_folder): New. - -2001-03-22 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (etree_get_save_id): Changed get_save_id to - just return a strdup of the path. - (new_storage_cb, new_folder_cb, insert_folders, insert_storages): - Call e_tree_memory_sort_node. - -2001-03-21 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (etree_get_save_id): If we have no - associated StorageSet yet, just return "root". [This can happen - when this function is called at construction time.] - -2001-03-21 Ettore Perazzoli <ettore@ximian.com> - - * Evolution-ShellComponentDnd.idl: StudlyCapsify struct members to - match the new IDL naming standards. - * e-storage-set-view.c: Updated accordingly. - -2001-03-21 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (tree_drag_data_get): Get the target type - from the atom, and pass it through the `SourceFolder::getData' - invocation. Also, signal an error by passing `-1' as the length - value to `gtk_selection_data_set()'. - (find_matching_target_for_drag_context): New helper function. - (tree_drag_motion): Use it to figure out a suitable type for the - drop action, and pass it to the `DestinationFolder::handleMotion' - method. - - * e-storage-set-view.c (get_component_at_node): New helper - function. - (table_drag_begin): Use it. - (convert_corba_drag_action_to_gdk): New helper function. - (table_drag_motion): Use the `DestinationFolder::handleMotion' - method to handle the "drag_motion" signal. - - * Evolution-ShellComponentDnd.idl: Change the signature for the - `handleMotion' method so that it only has @suggested_action - parameter. - -2001-03-20 JP Rosevear <jpr@ximian.com> - - * importer/Makefile.am: make sure intelligent.h gets disted - -2001-03-19 Christopher James Lahey <clahey@ximian.com> - - * Merged e-tree-rework-branch: - - 2001-03-19 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (etree_get_save_id): Made "root" detection - deal properly with removed nodes. - - 2001-03-18 Christopher James Lahey <clahey@ximian.com> - - * e-shell-view.c (e_shell_view_save_settings): Added some unused - code to implement saving of the expanded state. - - * e-storage-set-view.c: Added has_save_id and get_save_id methods. - - 2001-03-13 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c (ETREE_SPEC): Set draw-grid here to false. - - 2001-03-09 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c, e-storage-set-view.h: Chaned this to use - ETree instead of ETable. - -2001-03-19 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component-client.c: New members - `dnd_source_folder_interface' and - `dnd_destination_folder_interface' in - `EvolutionShellCompoentClientPrivate'. - (init): Initialize. - (impl_destroy): Clean up. - (evolution_shell_component_client_get_dnd_source_interface): New. - (evolution_shell_component_client_get_dnd_destination_interface): - New. - -2001-03-19 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (init): Ooops. Initialize the - `drag_corba_source_context' member. correctly. - (table_drag_begin): Don't crash if queryInterface returns - `CORBA_OBJECT_NIL'. - (table_drag_end): Don't do anything if the - `drag_corba_source_interface' is `CORBA_OBJECT_NIL'. - -2001-03-19 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c New members `drag_data', - `drag_corba_source_interface' and `drag_corba_source_context in - `EStorageSetViewPrivate'. - (init): Init the new members. - (destroy): Clean up the new members. - (table_drag_begin): Query for the - `EvolutionShellComponentDnd::SourceFolder' interface on the - handler for the folder we are dragging from, and initialize all - the CORBA context information for the drag, after invoking - `::beginDrag()' on it. - (convert_gdk_drag_action_to_corba): New helper function. - (table_drag_data_get): Get the data using - `::SourceFolder::getData'. - (table_drag_end): New, override for the "ETable::table_drag_end" - signal. Invoke `::endDrag' on the SourceFolder interface, - unref/release the interface, and clean up the source context. - (table_drag_data_delete): New, override for the - "ETable::table_drag_data_delete" signal. - (class_init): Install `table_drag_end' and - `table_drag_data_delete'. - - * Evolution-ShellComponentDnd.idl: Derive `::DestinationFolder' - and `SourceFolder' from `Bonobo::Unknown'. - -2001-03-19 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (table_drag_data_get): Don't get the - selection through - `evolution_shell_component_client_get_dnd_selection()'. - - * evolution-shell-component.c - (impl_ShellComponent_getDndSelection): Removed. - (class_init): Don't install. - - * evolution-shell-component-client.c - (evolution_shell_component_client_get_dnd_selection): Removed. - - * Evolution-ShellComponentDnd.idl: New file with the DnD stuff. - - * Evolution-ShellComponent.idl: Removed the dnd stuff. - -2001-03-15 Pablo Saratxaga <pablo@mandrakesoft.com> - - * main.c: fixed a no-c-format tag - -2001-03-14 Ettore Perazzoli <ettore@ximian.com> - - * importer/Makefile.am (INCLUDES): Remove `-g Wall' and friends. - Use `$(EXTRA_GNOME_CFLAGS)' instead of `$(GNOME_INCLUDEDIR)'. Add - `-I$(top_builddir)/shell'. - -2001-03-13 Iain Holmes <iain@ximian.com> - - * importer/intelligent.c (start_importer): Add a "Don't ask me again" - checkbox and don't ask about an importer if the box was ticked. - -2001-03-12 Iain Holmes <iain@ximian.com> - - * Evolution-Storage.idl: Add a FolderResult structure. - - * e-local-storage.c (struct _AsyncCreateFolderCallbackData): Add a - Bonobo_Listener. - (notify_listener): Function to...notify the listener. - (component_async_create_folder_callback): Use the notify_listener - function. - (real_do_folder_create): New prototype. Replace all returns with - a call to notify_listener. Make the directory with a call to - e_mkdir_hier instead of multiple calls to mkdir. Only emit a fail - on a bad error, not on EEXIST. - (bonobo_interface_create_folder_cb): Namespace create_folder_cb to match - the others. - - e-shell.c: Run the intelligent importer. - - evolution-storage.c (impl_Storage_async_create_folder): Just emit the signal, - not the callback. - (e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER): Lovely signal - marshaller. - (class_init): Change the signal definition for the create_folder signal. - - importer/GNOME_Evolution_Importer.idl: Add an IntelligentImporter inteface. - - importer/Makefile.am: Add the evolution-intelligent-importer.c, intelligent.c - and evolution-intelligent-importer.h to the files. - - importer/evolution-importer-listener.[ch]: Convert to BonoboXObject. - - importer/evolution-importer.[ch]: BonoboXObjectification. - - importer/evolution-intelligent-importer.[ch]: BonoboXObject for the - GNOME:Evolution:IntelligentImporter interface. - - importer/intelligent.c: Code for running the intelligent importers. - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (get_folder_at_row): New helper function. - (create_target_list_for_row): Use it. - (table_drag_data_get): Get the selection from the shell component - using `evolution_shell_component_client_get_dnd_selection()'. - (set_e_shortcut_selection): Turn a `g_return_if_fail()' into a - `g_assert()'. - - * evolution-shell-component.c: New member `get_dnd_selection_fn' - in `EvolutionShellComponentPrivate'. - (evolution_shell_component_construct): New arg - @get_dnd_selection_fn. - (evolution_shell_component_new): Likewise. - (impl_ShellComponent_getDndSelection): New, implementation for - `ShellComponent::getDndSelection'. - (class_init): Install it. - - * evolution-shell-component-client.c - (evolution_shell_component_client_get_dnd_selection): New, wrapper - for `ShellComponent::getDndSelection'. - - * evolution-shell-component.h: Renamed - `EvolutionShellComponentPopulateFolderContextMenu' into - `EvolutionShellComponentPopulateFolderContextMenuFn'. New - function pointer typedef `EvolutionShellComponentGetDndSelectionFn'. - - * Evolution-ShellComponent.idl: New method - `ShellComponent::getDndSelection'. - - * e-storage-set-view.c (create_target_entries_from_dnd_type_list): - Always add an `E_SHORTCUT_TYPE' type at least. - (create_target_list_for_row): Don't return NULL if the list of - exported DND types is NULL. Don't create an unused target list. - Actually return the created target list. - (table_drag_data_get): If the @info is zero, set the e-shortcut - selection. - (set_uri_list_selection): Temporarily disabled. - -2001-03-07 Ettore Perazzoli <ettore@ximian.com> - - * e-component-registry.c (register_type): New args - @num_exported_dnd_types, @exported_dnd_types, - @num_accepted_dnd_types, @accepted_dnd_types. Pass them to - `e_folder_type_registry_register_type()'. - (register_component): Updated accordingly, getting the values from - the CORBA `GNOME::Evolution::FolderType' struct. - - * e-folder-type-registry.c: New members `accepted_dnd_types' and - `exported_dnd_types' in `struct _FolderType'. - (e_folder_type_registry_register_type): New args - @num_accepted_dnd_types, @accepted_dnd_types, - @num_exported_dnd_types, @exported_dnd_types. - (register_folder_type): Likewise. - (folder_type_new): Likewise. Use them to initialize - `accepted_dnd_types' and `exported_dnd_types' in the newly created - `FolderType' struct. - (e_folder_type_registry_get_accepted_dnd_types_for_type): New. - (e_folder_type_registry_get_exported_dnd_types_for_type): New. - - * e-storage-set-view.c: New #defined constant `DRAG_RESISTANCE'. - New members `drag_x', `drag_y', `drag_column', `drag_row' in - `EStorageSetViewPrivate'. - (init): Initialize them. - (button_press_event): New function, overriding for the - `::button_press_event' method. - (motion_notify_event): New function, overriding for the - `::motion_notify_event' method. - (class_init): Install them. - - * evolution-shell-component.c - (duplicate_null_terminated_string_array): New helper function. - (evolution_shell_component_construct): Copy the values for - `accepted_dnd_types' and `exported_dnd_types' from the original - folder type list using it. - (destroy): Free the `exported_dnd_types' and `accepted_dnd_types' - members too. - (fill_corba_sequence_from_null_terminated_string_array): New - helper function. - (impl_ShellComponent__get_supported_types): Also set the - `exported_dnd_types' and `accepted_dnd_types' values in the folder - type elements we return. - - * evolution-shell-component.h: Added `accepted_dnd_types' and - `exported_dnd_types' members to `EvolutionShellComponentFolderType'. - - * Evolution-ShellComponent.idl: Renamed `accepted_dnd_mime_types' - to `accepted_dnd_types' and `exported_dnd_mime_types' to - `exported_dnd_types'. These are not necessarily MIME types. - -2001-03-05 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c: Override cursor_activated signal instead - of cursor_changed signal. - -2001-02-27 Dan Winship <danw@ximian.com> - - * main.c (development_warning): Update this again. - -2001-02-26 Ettore Perazzoli <ettore@ximian.com> - - * Evolution-Shell.idl: Rename `FolderTypeList' to - `FolderTypeNameList' as it was confusing. - - * Evolution-ShellComponent.idl: New members - `accepted_dnd_mime_types' and `exported_dnd_mime_types' in `struct - FolderType'. - -2001-02-24 Jeffrey Stedfast <fejj@ximian.com> - - * e-storage.c (folder_changed_cb): Don't free a const pointer. - -2001-02-23 Iain Holmes <iain@ximian.com> - - * e-local-storage.c (construct): Connect to the create-folder signal. - (impl_async_create_folder): Move this into the real_do_folder_create - function. - (real_do_folder_create): Function that creates the folder. - (create_folder_cb): Creates the folder form a callback. - -2001-02-21 Michael Meeks <michael@ximian.com> - - * importer/importer.c: add include. - (show_import_wizard): update signature to that of a verb. - - * evolution-shell-component.c (corba_class_init): move into - (class_init): here & upd. - (evolution_shell_component_construct): upd. - (create_servant): kill. - (E_MAKE_TYPE) -> E_MAKE_X_TYPE. - -2001-02-20 Dan Winship <danw@ximian.com> - - * e-folder.c (_EFolderPrivate): split "highlighted" into - self_highlight and child_highligh. - (e_folder_get_highlighted): Return TRUE if either self_highlight - is true or any child is highlighted. - (e_folder_set_child_highlight): New function to tell the folder - about a child highlight change. - - * e-storage.c (folder_changed_cb): Update child highlights - correctly on folders so that folders will be highlighted whenever - their children are. - -2001-02-17 Christopher James Lahey <clahey@ximian.com> - - * e-shell-view-menu.c (file_verbs): Cast this fucntion pointer. - - * e-storage-set-view.c (ETABLE_SPEC): Turn on horizontal scrolling - here. - - * evolution-shell-component.c - (impl_ShellComponent_async_copy_folder): Commented out this unused - function. - - * evolution-storage.c (storage_gtk_to_corba_result): Removed an - unused variable here. - - * importer/importer.c: Include gal/widets/e-gui-utils.h. - -2001-02-14 Dan Winship <danw@ximian.com> - - * Evolution-Storage.idl: add asyncCreateFolder and - asyncRemoveFolder interfaces. (Use Bonobo::Listener rather than - creating a new listener interface.) - - * Evolution-LocalStorage.idl: Remove the - Evolution::LocalStorageOpsListener interface, which wasn't being - used. - - * evolution-storage.c (impl_Storage_async_create_folder, - impl_Storage_async_remove_folder): implement by emitting signals - on the EvolutionStorage object. Convert from - EvolutionStorageResult to GNOME_Evolution_Storage_Result (blah!) - (class_init): Set up the new "create_folder" and "remove_folder" - signals. - - * e-corba-storage.c (async_create_folder, async_remove_folder): - Implement, using the new Evolution::Storage IDL. Convert from - GNOME_Evolution_Storage_Result to EStorageResult (blah!) - - * e-storage-set.c (e_storage_set_async_create_folder): Don't allow - a NULL description (since it doesn't allow a NULL anythign else). - - * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Pass "" - rather than NULL for the description. - -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> - - * Makefile.am: xml-i18n-tools setup. - * GNOME_Evolution_Shell.oaf.in: Mark strings for translation. - -2001-02-10 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view-menu.c: Moved the author list to the top of the - file. - (command_about_box): Display the `SUB_VERSION' as well. - -2001-02-08 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Destroy - the dialog instead of using `gnome_dialog_close()'. - (dialog_clicked_cb): Likewise. - (dialog_close_cb): Removed. - (e_shell_show_folder_creation_dialog): Don't connect to the - "close" signal anymore. - - * e-shell-folder-selection-dialog.c - (folder_creation_dialog_result_cb): New callback. Set the default - folder to be the newly created one. - (impl_clicked): Use it. - - * e-shell-folder-creation-dialog.c: Add members `folder_path', - `result_callback' and `result_callback_data' to `struct - _DialogData'. - (e_shell_show_folder_creation_dialog): New args @result_callback - and @result_callback_data. - (async_create_cb): Notify the result through the specified - callback. - (dialog_clicked_cb): Likewise. Set the `folder_path' in the - DialogData so that we can pass it over when we get the async - notification of the result of the operation. - - * e-shell-folder-creation-dialog.h: New type - `EShellFolderCreationDialogCallback'. - - * e-storage-set-view.c (e_storage_set_view_set_current_folder): - Show the node too, using `e_tree_model_show_node()'. - -2001-02-05 Ettore Perazzoli <ettore@ximian.com> - - * e-setup.c (copy_default_stuff): s/first time you run/first time - you are running/. - -2001-02-02 Ettore Perazzoli <ettore@ximian.com> - - * e-component-registry.h: Don't #include <config.h>. - * e-corba-storage-registry.h: Likewise. - * e-corba-storage.h: Likewise. - * e-folder-type-registry.h: Likewise. - * e-folder.h: Likewise. - * e-local-folder.h: Likewise. - * e-local-storage.h: Likewise. - * e-shell-folder-title-bar.h: Likewise. - * e-shell-view.h: Likewise. - * e-shell.h: Likewise. - * e-shortcuts-view.h: Likewise. - * e-shortcuts.h: Likewise. - * e-splash.h: Likewise. - * e-storage-set-view.h: Likewise. - * e-storage-set.h: Likewise. - * e-storage.h: Likewise. - * evolution-local-storage.h: Likewise. - * evolution-session.h: Likewise. - * evolution-shell-client.h: Likewise. - * evolution-shell-component.h: Likewise. - * evolution-shell-view.h: Likewise. - * evolution-storage-listener.h: Likewise. - * evolution-storage.h: Likewise. - -2001-02-02 Iain Holmes <iain@ximian.com> - - * importer/evolution-importer-client.c: - (evolution_importer_client_new_from_id): Free the CORBA_Environment. - -2001-01-30 Iain Holmes <iain@ximian.com> - - * importer/importer.c: (start_import): Added a notice if there is no - importer that can handle the file. - (get_iid_for_filetype): Free the list of multiple items before returning. - (importer_timeout_fn): Removed notice. - (import_cb): Removed notice. - -2001-01-30 Iain Holmes <iain@ximian.com> - - * importer/importer.c: Added a nasty hack to change the druids Finish - button to be Import. - - * importer/import.glade: Remove the FIXME warning. - -2001-01-30 Kjartan Maraas <kmaraas@gnome.org> - - * importer/importer.c: Fixed some typos. - -2001-01-28 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-creation-dialog.c (add_storage_set_view): Set the - shadow type to be `GTK_SHADOW_IN' in the EScrollFrame. - -2001-01-27 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (storage_set_view_box_button_release_event_cb): - Don't pop down the folder bar if the button release happens in the - e-paned's handle. - (storage_set_view_box_button_release_event_cb): Changed the return - value to be int. Stupid me. - -2001-01-27 Jason Leach <jasonleach@usa.net> - - * e-shortcuts-view.h: Fix #include to point to gal instead of - widgets/shortcut-bar/ - - * e-shortcuts.c: Here too. - * e-shortcuts-view-model.h: And lastly here. - - * Makefile.am (evolution_LDADD): Don't link with the old - widgets/shortcut-bar/libshortcut-bar.la anymore, gal has the new - shortcut-bar. - -2001-01-27 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (get_pixbuf_for_folder): Don't scale if the - size is the same. `gdk_pixbuf_scale()' seems to be blurring the - image even if the scaling factor is 1.0. - -2001-01-26 Ettore Perazzoli <ettore@ximian.com> - - * e-corba-storage.c: Remove all instances of `__FUNCTION__'. - * e-folder-tree.c: Likewise. - * e-folder-type-registry.c: Likewise. - * e-shell-view.c: Likewise. - * e-shell-view-menu.c: Likewise. - -2001-01-25 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (e_shell_view_construct): Connect the - "updated_folder" with `gtk_signal_connect_while_alive()' so that - it gets disconnected when the shell view dies. - -2001-01-24 Jason Leach <jasonleach@usa.net> - - (Fix #1252: Need a File->Close way to close a view) - - * e-shell-view-menu.c (command_close): New function, destroys the - current view. - - * e-shell.c (view_destroy_cb): Make sure shell settings get saved - when the last view is destroyed. - -2001-01-24 Kjartan Maraas <kmaraas@gnome.org> - - * importer/GNOME_Evolution_Importer.idl: Fix missing ';'. - -2001-01-23 Ettore Perazzoli <ettore@ximian.com> - - * e-corba-storage.c (impl_StorageListener_update_folder): Don't - call `e_storage_updated_folder()' as it's supposed to happen - automatically now. - - * e-storage.c (e_storage_updated_folder): Removed. - (folder_changed_cb): New callback for the "changed" signal on the - EFolders. - (e_storage_new_folder): Connect it. - - * e-folder-tree.c: New member `data_to_path' in `EFolderTree'. - (e_folder_tree_new): Init here. - (e_folder_tree_destroy): Destroy it here. - (e_folder_tree_add): Add to the `data_to_path' hash. Make sure - we are not adding the same folder twice. - (remove_folder): Remove from the `data_to_path' hash. - (e_folder_tree_get_path_for_folder): New. - - * e-shell-view.c (e_shell_view_construct): Don't connect to the - "folder_updated" signal of the local storage anymore. - (folder_updated_cb): Removed. - (updated_folder_cb): New. - (e_shell_view_construct): Connect it to the "updated_folder" - signal. - - * e-local-storage.c: Remove `FOLDER_UPDATED' enum value and the - `signals' variable, as we don't want to define any custom signals - here anymore. - (bonobo_interface_update_folder_cb): No need to emit the - "folder_updated" signal here. The base class will take care of - this already. - (class_init): Don't install the "folder_updated" signal here. - - * e-local-storage.h: Removed signal "folder_updated". It is not - necessary, as we already have an `updated_folder' in `EStorage', - which is the parent class of `ELocalStorage'. - -2001-01-24 Iain Holmes <iain@ximian.com> - - * importer/GNOME_Evolution_Importer.idl: Removed the busy exception. - -2001-01-19 Iain Holmes <iain@ximian.com> - - * importer/GNOME_Evolution_Importer.idl: Make the processItem oneway. - Make the Listener interface inherit from Bonobo::Unknown. - - * importer/evolution-importer-client.[ch]: Remove all the crap to deal - with creating the Listener object. - - * importer/evolution-importer-listener.[ch]: A new bonobo object to - implement the ImporterListener interface. - - * importer/importer.c: Fix it up to use the new Listener object. - -2001-01-18 Iain Holmes <iain@ximian.com> - - * e-shortcuts-view.c (show_new_group_dialog): Don't make the dialog - modal. - -2001-01-16 Iain Holmes <iain@ximian.com> - - * importer/GNOME_Evolution_Importer.idl: Removed the ImporterFactory - interface and put the methods from it into the Importer interface. - - * importer/evolution-importer-factory.[ch]: Removed. - - * importer/evolution-importer.[ch]: Added the new methods. - Added inline documentation for all public functions. - - * importer/evolution-importer-client.[ch]: Added new client support for - the new methods. - Added inline documentation for all public functions. - - * importer/importer.c (create_plugin_menu): Changed the query to look for - IDL:GNOME/Evolution/Importer:1.0. - (start_import): Do all CORBA methods through the EvolutionImporterClient. - (get_iid_for_filetype): Change query to search for - IDL:GNOME/Evolution/Importer:1.0. - -2001-01-19 Dan Winship <danw@ximian.com> - - * evolution-storage.c (evolution_storage_folder_exists): New - function. Obvious. - -2001-01-19 Jason Leach <jasonleach@usa.net> - - (Bug #883: Shortcut bar does not update when a folders display - name changes) - - * e-local-storage.c (class_init): Define a new "folder_updated" - signal here. - (bonobo_interface_update_folder_cb): Emit the new folder_updated - signal here. - - * e-shell-view.c (e_shell_view_construct): Connect the - EShell::ELocalStorage folder_updated signal here. Also connect - the updated_folder signal coming from EShell::EStorageSet to the - new callback. - - * e-shell-view.c (folder_updated_cb): Callback that actually - initiates the shell updating. - - * e-shortcuts.c (e_shortcuts_update_shortcut_by_uri): New - function. Given a URI for a shortcut bar item, we'll update it. - - * e-shortcuts.c (e_shortcuts_remove_shortcut_by_uri): New - function. Given a URI for a shortcut bar item, we'll remove it. - - * e-shortcuts.c (removed_folder_cb): Connect this callback that - will remove a renamed vfolder from the shortcut bar. Temporary - fix to the problem of renaming vfolders and having the shortcut - bar think the old vfolder still exists. - - (Bug #1168: Shortcut bar and icon size persistence) - - * e-shell-view.c (save_shortcut_bar_icon_modes): New static - function, save the icon modes (for all shortcut bar groups, even - though we only have one group now). - (load_shortcut_bar_icon_modes): New static function, load the - saved shortcut bar group icon modes and apply them to our shortcut - bar. - -2001-01-17 Federico Mena Quintero <federico@ximian.com> - - * importer/evolution-importer.h: Use "typedef enum { ... } Blah;" - instead of "typedef enum _Blah Blah; enum _Blah { ... };" so that - gtk-doc can parse it. Sigh. - -2001-01-17 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-folder-selection-dialog.c - (e_shell_folder_selection_dialog_construct): Set the shadow type - for the EScrollFrame. Also, make the EStorageSetView widget grab - the focus. For some reason it doesnt' seem to work, but I'll - blame ETree for now. - -2001-01-17 Ettore Perazzoli <ettore@ximian.com> - - * e-shell-view.c (update_for_current_uri): Display the folder name - before "Evolution" instead of after it. Also, display the - sub-version string if it was defined when configuring. - -2001-01-17 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (table_drag_drop): Don't emit the - "dnd_action" signal here. Instead, do a `gtk_drag_get_data()' to - retrieve information about the drop. - (table_drag_data_received): New, implementation for - `ETable::table_drag_data_received'. - (class_init): Install it. - (table_drag_data_get): Use `unsigned int' instead of `guint' for - consistency. - (table_drag_motion): Same here. Also use `int' instead of `gint'. - (table_drag_drop): Likewise. - (treepath_compare): Likewise. - (marshal_NONE__ENUM_STRING_STRING_STRING): Removed. - (marshal_NONE__GDKDRAGACTION_STRING_STRING_STRING): New. - (class_init): Use it; update signal "dnd_action" so that it passes - a `GdkDragAction *' instead of . - - * e-storage-set-view.h: Change signal "::dnd_action" so that it - provides a `GdkDragContext' instead of just a `GdkDragAction'. - -2001-01-16 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (e_shell_view_construct): set config - path on window. - -2001-01-16 JP Rosevear <jpr@ximian.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_new): pop the - visual/cm after the construct - -2001-01-15 JP Rosevear <jpr@ximian.com> - - * e-shell-folder-title-bar.c (e_shell_folder_title_bar_new): push/pop - the color map - (e_shell_folder_title_bar_new): and the visual... - -2001-01-15 Iain Holmes <iain@ximian.com> - - * importer/importer.c (import_druid_cancel): Just destroy the wizard. - All other freeing code is moved into import_druid_destroy. - (show_import_wizard): Connect the destroy signal to import_druid_destroy. - (start_import): Connect to the destroy signal of the dialog and the - clicked as well. - (dialog_destroy_cb): Stop the import after the current item has finished. - (dialog_clicked_cb): Stop the import. - (import_cb): Only process the next item if the dialog hasn't been stopped. - Destroy the dialog if it hasn't been destroyed already. - - * e-splash.c (e_splash_construct): Set the window title to Evolution. - -2001-01-13 Jason Leach <jasonleach@usa.net> - - (Fix bug #934: Add Right-click item to hide the shortcut bar) - - * e-shortcuts-view.c (class_init): Create a new hide_requested - signal. - (hide_shortcut_bar_cb): New function that gets called from the - right click menu items, it emits the hide_requested signal. - - * e-shell-view.c (setup_widgets): Connect the hide_requested from - the shortcut bar. - (hide_requested_cb): New function. - -2001-01-13 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.h: New signal `dnd_action'. - - * e-storage-set-view.c: Renamed `drag_types' to - `source_drag_types' and `num_drag_types' to - `num_source_drag_types'. New variables `destination_drag_types' - and `num_destination_drag_types'. - (e_storage_set_view_construct): Set the ETree as a drag - destination. Allow both GDK_ACTION_MOVE and GDK_ACTION_COPY. - - * e-storage-set-view.c (table_drag_begin): Renamed from - `etable_drag_begin'. - (table_drag_data_get): Renamed from `etable_drag_data_get'. - Changed to be a method override instead of a signal handler. - (table_drag_motion): New; implementation for the - `ETable::table_drag_motion' method. Changed to be a method - override instead of a signal handler. - (table_drag_drop): New, implementation for `::table_drag_drop'. - (cursor_change): Renamed from `on_cursor_change'. - (e_storage_set_view_construct): Don't connect the signals here. - (class_init): Instead, override the methods here. Also, install - our override for `::table_drag_motion' and for - `::table_drag_drop'. - (right_click): Changed to be a method instead of a signal handler. - (cursor_change): Likewise. - -2001-01-13 Miguel de Icaza <miguel@gnu.org> - - * e-shell.c (e_shell_construct): Unref our copy, and then destroy. - - * e-splash.c (e_splash_set_icon_highlight): Do not execute code if - we have been destroyed. - (e_splash_add_icon): ditto. - -2001-01-12 Miguel de Icaza <miguel@gnu.org> - - * e-splash.c (e_splash_construct): Ok, talked to Ettore. Going - back to TOPLEVEL non-POPUP. - (e_splash_construct): Remove nice toplevel window. - -2001-01-12 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c: Add member `copy_folder_fn' to - `EvolutionShellComponentPrivate'. - (init): Init to NULL. - (impl_ShellComponent_async_copy_folder): New function, - implementation for `::asyncCopyFolder'. - (evolution_shell_component_construct): New arg @copy_folder_fn. - Set the corresponding member in `EvolutionShellComponentPrivate'. - (evolution_shell_component_new): New arg @copy_folder_fn. Pass it - to `evolution_shell_component_construct'. - - * evolution-shell-component.h: New type - `EvolutionShellComponentCopyFolderFn'. - -2001-01-12 Ettore Perazzoli <ettore@helixcode.com> - - * Evolution-ShellComponent.idl: Add method `::removeFolderAsync'. - -2001-01-12 Ettore Perazzoli <ettore@ximian.com> - - * evolution-shell-component.c (corba_class_init): - s/addFolderAsync/createFolderAsync/. - - * evolution-shell-component-client.c - (evolution_shell_component_client_async_create_folder): - s/addFolderAsync/createFolderAsync/. - - * Evolution-ShellComponent.idl: Rename `addFolder' into - `createFolder'. - -2001-01-12 Dan Winship <danw@ximian.com> - - * importer/.cvsignore: Create - -2001-01-12 Miguel de Icaza <miguel@ximian.com> - - * e-storage-set-view.c: Added translation strings. - - * e-shell-view-menu.c (command_about_box): Update our name - (command_new_mail_message): Remove "window" - from the moniker path. - - * e-splash.c (e_splash_construct): Make the spalsh screen a - toplevel instead of a popup. - -2001-01-11 Dan Winship <danw@ximian.com> - - * e-shell-view.c (show_existing_view): Remove the "Already have - view for..." message. People keep assuming it's an error. - -2001-01-11 Iain Holmes <iain@ximian.com> - - * importer/*: New directory containing the importer framework. - - * e-shell-view-menu.c (file_verbs): Add the FileImporter verb. - -2001-01-10 Miguel de Icaza <miguel@helixcode.com> - - * e-shell-view-menu.c (command_goto_folder): Fix prototype - (command_new_view): ditto. - (command_new_mail_message): Implement command_new_mail_message. - - verbs: Use BONOBO_UI_VERB instead of BONOBO_UI_UNSAFE_VERB - -2001-01-04 Dan Winship <danw@helixcode.com> - - * evolution-storage.c (evolution_storage_update_folder_by_uri): - New function to update a folder given its URI. Plus associated - changes to other functions to keep track of the path<->URI - mappings. - -2000-12-28 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-client.c (user_select_folder): Make sure the - `*uri_return' and `*physical_uri_return' are always initialized on - return, as that's what the caller expects. - -2000-12-23 Jason Leach <jasonleach@usa.net> - - * e-shell-view-menu.c (command_run_bugbuddy): Fix a crash when the - user tries to "Submit bug report" but doesn't have bug-buddy - installed. Bug #633. - -2000-12-23 Jason Leach <jasonleach@usa.net> - - * e-setup.c (copy_default_stuff): Make the "Evolution - installation" dialog resizable. Bug #742. - (check_evolution_directory): Here too. - -2000-12-14 Iain Holmes <iain@helixcode.com> - - * e-shell-folder-selection-dialog.c (dbl_click_cb): Modify to suit the - new double click callback signature. Destroy the dialog after the double - click as well. - -2000-12-14 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (development_warning): Slightly updated the text for the - release. - -2000-12-14 Ettore Perazzoli <ettore@helixcode.com> - - * e-splash.c (ICON_Y): Update for the size of the new splash. - -2000-12-12 Jeffrey Stedfast <fejj@helixcode.com> - - * e-splash.c (button_press_event): Return TRUE as we have handled - the event. - -2000-12-12 Dan Winship <danw@helixcode.com> - - * e-shell-view.c (get_control_for_uri): Pass path+1 rather than - path to get_type_for_storage, to match the convention used by its - other callers. - -2000-12-11 Jeffrey Stedfast <fejj@helixcode.com> - - * e-splash.c (e_splash_construct): Connect a button-press-event - signal on the splash screen so users can click it to hide it. - (button_press_event): New callback to hide the splash screen. - -2000-12-11 Dan Winship <danw@helixcode.com> - - * e-shell-view.c (get_type_for_{folder,storage}): return NULL if - no {folder,storage} is found. - (get_control_for_uri): return NULL if no folder_type is found. - -2000-12-08 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts-view.c (e_shortcuts_view_construct): Ooops. We were - reffing a bogus pointer that was not assigned yet. - - * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): - Updated according to the new IDL. - - * e-local-storage.c (construct): Pass `NULL' to - `e_storage_construct' as the @toplevel_node_type arg. - - * evolution-shell-component-client.c - (evolution_shell_component_client_new_for_objref): New. - (evolution_shell_component_client_new): Refactored to use it. - - * e-corba-storage.c (e_corba_storage_construct): New arg - @toplevel_node_type. Pass it to `e_storage_construct'. - (e_corba_storage_new): New arg @toplevel_node_type. Pass it to - `e_corba_storage_construct'. - - * e-storage.c: New member `toplevel_node_uri_type' in - `EStoragePrivate'. - (init): Init to NULL. - (destroy): Unref. - (e_storage_construct): New arg @toplevel_node_type. Set the - private member value accordingly. - (e_storage_new): New arg @toplevel_node_type. Pass to - `e_storage_construct'. - (e_storage_get_toplevel_node_type): New. - - * e-shell-view.c (get_physical_uri_for_evolution_uri): New arg - @shell_view. - (get_physical_uri_for_storage): Filled in. New arg @shell_view. - (get_physical_uri_for_folder): Filled in. New arg @shell_view. - - * evolution-local-storage.c (evolution_local_storage_construct): - Pass `NULL' as the @toplevel_node_type arg to - `evolution_storage_construct'. - - * evolution-storage.c: New member `toplevel_node_type' in - `EvolutionStoragePrivate'. - (destroy): Free. - (init): Init to NULL. - (evolution_storage_construct): New arg @toplevel_node_handler - to initialize the corresponding field in `->priv'. - (evolution_storage_new): New arg @toplevel_node_type. Pass - it to `evolution_storage_construct'. - (evolution_storage_register): Pass the @toplevel_node_type - arg to `::addStorage'. - - * Evolution-Storage.idl: Add arg @toplevel_node_type to - `StorageRegistry::addStorage'. - - * main.c (new_view_on_running_shell): Deal with an exception in - `::createNewView' gracefully. - - * e-shell-view.c (switch_on_folder_tree_click): New. - (folder_selected_cb): Refactored to use it. - (storage_selected_cb): Use it. - -2000-12-07 Michael Meeks <michael@helixcode.com> - - * Makefile.am (oaf_DATA): update to GNOME_Evolution_Shell.oafinfo - - * e-shell.h: upd. - -2000-12-04 Ettore Perazzoli <ettore@helixcode.com> - - * Evolution-StorageSetView.idl: Arg @uri renamed to @name in - `StorageSetViewListener::notifyStorageSelected'. - - * evolution-storage-set-view.c - (storage_set_view_widget_storage_selected_cb): Renamed arg @uri to - @name. - - * e-storage-set-view.c (on_cursor_change): Only emit the name of - the storage for the "storage_selected" signal [i.e. remove the - leading slash]. - - * e-shell-view.c (storage_selected_cb): New callback for the - "storage_selected" signal on the EStorageSetView used for the - folder tree. - (setup_storage_set_subwindow): Connect it. - - * evolution-local-storage.c (evolution_local_storage_construct): - Pass NULL as the @toplevel_node_uri arg to - `evolution_storage_construct()'. - - * evolution-storage.c: New member `toplevel_node_uri' in - `EvolutionStoragePrivate'. - (init): Init to NULL. - (destroy): Free. - (evolution_storage_construct): New arg @toplevel_node_uri. Set - the @toplevel_node_uri member in the private part to its value. - (evolution_storage_new): New arg @toplevel_node_uri. Pass it to - `evolution_storage_construct()'. - (evolution_storage_register): Pass the @toplevel_node_uri value to - the `::addStorage' CORBA method. - - * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): - New arg @toplevel_node_uri, to go with the IDL change. - - * Evolution-Storage.idl (StorageRegistry::addStorage): New arg - @toplevel_node_uri. - - * e-local-storage.c (construct): Pass NULL as the - @toplevel_node_uri arg to `e_storage_construct()'. - - * e-corba-storage.c (e_corba_storage_construct): New arg - @toplevel_node_uri. Pass it to `e_storage_construct()'. - (e_corba_storage_new): New arg @toplevel_node_uri. Pass it to - `e_corba_storage_construct()'. - - * e-storage.c: New member `toplevel_node_uri' in - `EStoragePrivate'. - (init): Init to NULL. - (destroy): Free. - (e_storage_construct): New arg @toplevel_node_uri. Set the - `toplevel_node_uri' member in the private part to its value. - (e_storage_new): New arg @toplevel_node_uri. Pass it to - `e_storage_construct()'. - (e_storage_get_toplevel_node_uri): New. - - * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): - Renamed from `impl_StorageRegistry_register_storage'. - (impl_StorageRegistry_removeStorageByName): Renamed from - `impl_StorageRegistry_unregister_storage'. - (corba_class_init): Updated accordingly. - -2000-12-04 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (new_view_on_running_shell): Don't crash if the object - returned from `oaf_activate_from_id' is NIL and the exception - isn't set. Just handle this as a normal error condition. - -2000-12-04 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (get_control_for_uri): return NULL if we can't - create a view. - (setup_evolution_shell_view_interface): add precondition. - -2000-12-04 Ettore Perazzoli <ettore@helixcode.com> - - * e-shortcuts-view.c (e_shortcuts_view_construct): Ref the - shortcuts. - - * main.c (new_view_on_running_shell): New. - (idle_cb): If the shell cannot be created, then call - `new_view_on_running_shell'. - - * e-shell-view.c: New member `shell_view_interface' in - `EShellViewPrivate'. - (init): Init to NULL. - (setup_evolution_shell_view_interface): Set up. - (destroy): Unref. - - * e-shell.c (impl_Shell_getComponentByType): Renamed from - `impl_Shell_get_component_for_type'. - (impl_Shell_selectUserFolder): Renamed from - `impl_Shell_user_select_folder'. - (impl_Shell_getLocalStorage): Renamed from - `impl_Shell_get_local_storage'. - (impl_Shell_createStorageSetView): Renamed from - `impl_Shell_create_storage_set_view'. - (corba_class_init): Updated accordingly. - (impl_Shell_createNewView): New, implementation for the - `createNewView' CORBA method. - (corba_class_init): Install it. - - * Evolution-Shell.idl: New method `::createNewView'. - - * e-shell.c (register_shell): New. - (e_shell_construct): Return value changed to `gboolean'. New arg - @iid. Construct the Bonobo object before displaying the splash, - then try to register it with the specified @iid. If registration - fails, return %FALSE. Otherwise, just do everything normally and - return %TRUE. - (e_shell_new): Pass the OAFIID to `e_shell_construct()'. If it - fails, unref the object and return NULL. - - * evolution.oafinfo: New. - -2000-11-27 JP Rosevear <jpr@helixcode.com> - - * e-shell-view-menu.c (command_about_box): Add myself, anna, jesse - -2000-11-15 Michael Meeks <michael@helixcode.com> - - * e-shell.c (e_shell_component_maybe_crashed): de-register - a component's UI if it dies. - -2000-11-25 Peter Williams <peterw@helixcode.com> - - * Makefile.am (idldir): Install our IDL's into $(datadir)/idl. - -2000-11-25 Federico Mena Quintero <federico@helixcode.com> - - * e-setup.c (check_dir_recur): Plug leaks of the fullname and - fulldefaultname. - (check_evolution_directory): Plug leaks of defaultdir and newfiles - and the list's data; made the code have a single return point. - - * e-shell.c (e_shell_restore_from_settings): Plug leak of prefix. - (corba_class_init): Plug leak; we were not assigning the - vepv->_base_epv. - - * evolution-storage.c (corba_class_init): Likewise. - - * evolution-local-storage.c (corba_class_init): Likewise. - -2000-11-24 Federico Mena Quintero <federico@helixcode.com> - - * evolution-shell-component.c - (impl_ShellComponent__get_supported_types): Plug leak; mark the - CORBA sequence so that it will be released. - -2000-11-14 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (unmerge_on_error): add - (e_shell_view_construct): hook up to system_exception on - ui_container. - -2000-11-11 Matt Bissiri <bissiri@eecs.umich.edu> - - * e-shell.c: (setup_components), (save_settings_for_component): - * evolution-storage.c: (evolution_storage_register_on_shell): - Update the remaining "IDL:Evolution*" to "IDL:GNOME/Evolution*" - to sync up with yesterday's IDL re-scoping. - -2000-11-06 Michael Meeks <michael@helixcode.com> - - * e-shell-view.c (unrealize): remove. - (e_shell_view_construct): ditto. - -2000-11-09 Christopher James Lahey <clahey@helixcode.com> - - * e-shell-view.c: Make the panes of the EPaned not shrinkable - beyond their minimum size. - -2000-11-08 Matt Bissiri <bissiri@eecs.umich.edu> - - * e-shell-folder-selection-dialog.c: Fix typo in a comment. - -2000-11-06 Dan Winship <danw@helixcode.com> - - * e-storage-set-view.c (insert_folders): Pass full_name, not - folder_name to callback. - -2000-11-06 Ettore Perazzoli <ettore@helixcode.com> - - * evolution-shell-view.c (impl_ShellView_change_current_view): - Constified @uri. - (impl_ShellView_set_title): Constified @title. - -2000-11-06 Ettore Perazzoli <ettore@helixcode.com> - - * e-shell.c: New member `crash_type_names' in `EShellPrivate'. - (init): Init to NULL. - (destroy): Free. - (e_shell_component_maybe_crashed): New. - -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-Activity.idl b/shell/Evolution-Activity.idl deleted file mode 100644 index de23d2c53b..0000000000 --- a/shell/Evolution-Activity.idl +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Activity management for Evolution. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -module GNOME { -module Evolution { - -interface Activity : Bonobo::Unknown { - typedef long ActivityId; - - enum DialogType { - DIALOG_TYPE_NONE, - DIALOG_TYPE_MESSAGE, - DIALOG_TYPE_WARNING, - DIALOG_TYPE_INPUT, - DIALOG_TYPE_ERROR - }; - - enum DialogAction { - DIALOG_ACTION_ERROR, - DIALOG_ACTION_DISPLAY, - DIALOG_ACTION_POSTPONE - }; - - exception InvalidIcon {}; - exception IdNotFound {}; - - /* Events propagated through the listener: - - - "ShowDetails": The user wants to know details about the - progressing operation. The component should display additional - information about the operation in progress, or raise a pending - alert dialog. - - - "Cancel": The user wants the operation to be cancelled. - */ - - /** - * operationStarted: - * @component_id: Id of the component starting the operation. - * @information: Informative string about the operation being performed. - * @cancellable: Whether this operation should be cancellable by - * the user from the shell view. - * @event_listener: Listener which the events for the activity - * widget will be passed to. - * @activity_id: A unique Id for the activity, to be used to update the - * status of the operation. - * @suggest_display: Whether displaying the dialog might be a nice idea. - */ - void operationStarted (in string component_id, - in AnimatedIcon icon, - in string information, - in boolean cancellable, - in Bonobo::Listener event_listener, - out ActivityId activity_id, - out boolean suggest_display) - raises (InvalidIcon); - - /** - * operationProgressing: - * @activity: The unique Id for the activity whose status we want to update. - * @information: New informative string. If empty, the informative string - * isn't changed. - * @progress: A float from 0.0 to 1.0 indicating the status of completion. - * - * Update the status of the specified @activity. - */ - void operationProgressing (in ActivityId activity, - in string information, - in float progress) - raises (IdNotFound); - - /** - * operationFinished: - * @activity: The unique Id for the activity that has been completed. - * - * Report that the specified @activity has been completed. After this - * method is invoked, @activity is not considered to be a valid Id - * anymore. - */ - void operationFinished (in ActivityId activity); - - /** - * requestDialog: - * - * Inform the shell that the specified @activity requires user input - * from a dialog. The returned value specifies whether the shell wants - * the dialog to be shown now (%DIALOG_ACTION_DISPLAY) or postponed - * (%DIALOG_ACTION_POSTPONE). If the return value is - * %DIALOG_ACTION_POSTPONE, the component should wait for the - * "DisplayDialog" event before proceeding further. In that case, the - * shell will flash the label related to this activity, and emit - * "DisplayDialog" through the event source when the user clicks on it. - */ - DialogAction requestDialog (in ActivityId activity, - in DialogType dialog_type); -}; - -}; -}; diff --git a/shell/Evolution-Offline.idl b/shell/Evolution-Offline.idl deleted file mode 100644 index 377132daa3..0000000000 --- a/shell/Evolution-Offline.idl +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface to allow components to switch between on-line and off-line mode. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - */ - -#include <Bonobo.h> - -module GNOME { -module Evolution { - -struct Connection { - string hostName; - string type; -}; -typedef sequence<Connection> ConnectionList; - -interface OfflineProgressListener { - /* Update the shell about the progress of going off-line. The - operation is considered completed when the ConnectionList is empty. */ - void updateProgress (in ConnectionList current_active_connections); -}; - -interface Offline : Bonobo::Unknown { - /* Whether the component is currently off-line. */ - attribute boolean isOffline; - - /* Ask the component to prepare to go into off-line mode. The - component must return a list of the current active connections. - After this call, the shell is expected to either invoke - `::goOffline()' (actually complete the operation and go off-line) or - `::goOnline()' (operation cancelled). */ - void prepareForOffline (out ConnectionList active_connection_list); - - /* Ask the component to go into off-line mode. This always comes after - a `::prepareForOffline' only. */ - void goOffline (in OfflineProgressListener listener); - - /* Tell the component to go into on-line mode. */ - void goOnline (); -}; - -}; -}; diff --git a/shell/Evolution-Session.idl b/shell/Evolution-Session.idl deleted file mode 100644 index eeb6116740..0000000000 --- a/shell/Evolution-Session.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for saving configuration information. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.h> - -module GNOME { -module Evolution { - - interface Session : Bonobo::Unknown { - exception Failed {}; - - /** - * saveConfiguration: - * @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 saveConfiguration (in string prefix) - raises (Failed); - - /** - * loadConfiguration: - * @prefix: A configuration path prefix. - * - * Load the saved configuration at the specified @prefix. - */ - void loadConfiguration (in string prefix) - raises (Failed); - }; - -}; -}; diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl deleted file mode 100644 index 7d8889b463..0000000000 --- a/shell/Evolution-Shell.idl +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - interface ShellComponent; - - interface FolderSelectionListener; - - interface Shell : Bonobo::Unknown { - exception NotReady {}; - exception NotFound {}; - exception UnsupportedSchema {}; - exception InvalidURI {}; - exception InternalError {}; - exception Busy {}; - - typedef sequence<string> FolderTypeNameList; - - /* The X display name. */ - readonly attribute string displayName; - - /** - * getComponentByType: - * @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 getComponentByType (in string type) - raises (NotReady, NotFound); - - /** - * createNewView: - * @uri: URI for the view to open - * - * Return value: the new view. - */ - ShellView createNewView (in string uri) - raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError); - - /** - * handleURI: - * @uri: URI to handle - * - * This handles the specified URI. It is different from - * `::createNewView' as it doesn't necessarily imply creating a - * new ShellView. (For example, a `mailto:' URI will invoke - * the message composer.) - */ - void handleURI (in string uri) - raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError); - - /** - * selectUserFolder: - * @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 selectUserFolder (in FolderSelectionListener listener, - in string title, - in string default_folder, - in FolderTypeNameList possible_types) - raises (NotReady, Busy); - - /** - * getLocalStorage: - * - * 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. */ - Storage getLocalStorage () - raises (NotReady); - - /** - * createStorageSetView: - * - * 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 createStorageSetView () - raises (NotReady); - - /** - * setLineStatus: - * - * Set the shell into on-line or off-line mode. - */ - void setLineStatus (in boolean online) - raises (NotReady); - }; - - interface FolderSelectionListener { - void notifySelected (in string uri, in string physical_uri); - void notifyCanceled (); - }; -}; -}; diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl deleted file mode 100644 index a5601f29ab..0000000000 --- a/shell/Evolution-ShellComponent.idl +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution components. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.h> - -module GNOME { -module Evolution { - interface Shell; - - struct FolderType { - string name; - string iconName; - - string displayName; - string description; - - boolean userCreatable; - - sequence<string> acceptedDndTypes; - sequence<string> exportedDndTypes; - }; - typedef sequence<FolderType> FolderTypeList; - - typedef string URISchema; - typedef sequence<URISchema> URISchemaList; - - struct UserCreatableItemType { - string id; - string description; - string menuDescription; - char menuShortcut; - }; - typedef sequence<UserCreatableItemType> UserCreatableItemTypeList; - - interface ShellComponentListener; - - interface ShellComponent : Bonobo::Unknown { - readonly attribute FolderTypeList supportedTypes; - readonly attribute URISchemaList externalUriSchemas ; - readonly attribute UserCreatableItemTypeList userCreatableItemTypes; - - /* FIXME: Can we use an attribute here? */ - exception AlreadyOwned {}; - - void setOwner (in Shell shell, in string evolution_homedir) - raises (AlreadyOwned); - - exception NotOwned {}; - - void unsetOwner () - raises (NotOwned); - - void debug (in string log_path); - - /* FIXME: We might want more exceptions here. */ - exception NotFound {}; - exception UnsupportedType {}; - exception UnsupportedSchema {}; - exception InternalError {}; - - Bonobo::Control createView (in string physical_uri, - in string type) - raises (NotFound, UnsupportedType, InternalError); - - void handleExternalURI (in string external_uri) - raises (NotFound, UnsupportedSchema, InternalError); - - exception Busy {}; - - void createFolderAsync (in ShellComponentListener listener, - in string physical_uri, - in string type) - raises (Busy); - - void removeFolderAsync (in ShellComponentListener listener, - in string physical_uri, - in string type) - raises (Busy); - - void xferFolderAsync (in ShellComponentListener listener, - in string source_physical_uri, - in string destination_physical_uri, - in string type, - in boolean remove_source) - raises (Busy); - - void populateFolderContextMenu (in Bonobo::UIContainer uih, - in string physical_uri, - in string type); - - void userCreateNewItem (in string id, - in string parent_folder_physical_uri, - in string parent_folder_type) - raises (UnsupportedType); - }; - - interface ShellComponentListener { - enum Result { - OK, - UNSUPPORTED_OPERATION, - UNSUPPORTED_TYPE, - EXISTS, - INVALID_URI, - PERMISSION_DENIED, - HAS_SUBFOLDERS, - NO_SPACE - }; - - void notifyResult (in Result result); - }; -}; -}; diff --git a/shell/Evolution-ShellComponentDnd.idl b/shell/Evolution-ShellComponentDnd.idl deleted file mode 100644 index 37322e85db..0000000000 --- a/shell/Evolution-ShellComponentDnd.idl +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution components that want to support Drag and Drop - * operations on their folders. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - */ - -#include <Bonobo.h> - -module GNOME { -module Evolution { -module ShellComponentDnd { - typedef short Action; - const Action ACTION_DEFAULT = 0; - const Action ACTION_COPY = 1 << 1; - const Action ACTION_MOVE = 1 << 2; - const Action ACTION_LINK = 1 << 3; - const Action ACTION_ASK = 1 << 4; - const Action ACTION_ANY = ACTION_COPY | ACTION_MOVE | ACTION_LINK | ACTION_ASK; - - typedef Action ActionSet; // For readability. - - struct Data { - short format; - short target; - sequence <octet> bytes; - }; - - exception NoData {}; - - interface SourceFolder : Bonobo::Unknown { - struct Context { - string physicalUri; - string folderType; - ActionSet possibleActions; - Action suggestedAction; - }; - - /* The user started a drag from this object. If the component - receives this while still in the middle of an existing drag - operation, it should stop the existing drag operation and - start a new one. */ - void beginDrag (in string physical_uri, - in string folder_type, - out ActionSet possible_actions, - out Action suggested_action); - - /* User released the mouse button and dropped the object - somewhere, so we now want to get the data for the current - context. */ - void getData (in Context source_context, - in Action action, - in string dnd_type, - out Data data) - raises (NoData); - - /* The target has finished processing the data, so we can - delete it. */ - void deleteData (in Context source_context); - - /* The drag is over. This should also clean up the data if - there was a `getData()' but no `deleteData()' after it. */ - void endDrag (in Context source_context); - }; - - interface DestinationFolder : Bonobo::Unknown { - struct Context { - string dndType; - ActionSet possibleActions; - Action suggestedAction; - }; - - /* The user is moving a dragged object over our folder. This - will return %FALSE if the specified object cannot be - dropped; otherwise, it will return %TRUE and then set the - @default_action and @non_default_action we want to be - performed when the drop happens. */ - boolean handleMotion (in string physical_uri, - in Context destination_context, - out Action suggested_action); - - /* Data is dropped. We are given the data for the dropped - object, and we are supposed to perform the operation - requested. */ - boolean handleDrop (in string physical_uri, - in Context destination_context, - in Action action, - in Data data); - }; -}; -}; -}; diff --git a/shell/Evolution-ShellView.idl b/shell/Evolution-ShellView.idl deleted file mode 100644 index 685604e601..0000000000 --- a/shell/Evolution-ShellView.idl +++ /dev/null @@ -1,24 +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@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - interface ShellView : Bonobo::Unknown { - void setMessage (in string message, - in boolean busy); - void unsetMessage (); - void changeCurrentView (in string uri); - void setTitle (in string title); - void setFolderBarLabel (in string text); - }; -}; -}; diff --git a/shell/Evolution-Shortcuts.idl b/shell/Evolution-Shortcuts.idl deleted file mode 100644 index 7ffb55a164..0000000000 --- a/shell/Evolution-Shortcuts.idl +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution shortcuts. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - - interface Shortcuts : Bonobo::Unknown { - - struct Shortcut { - string uri; - string name; - string type; - }; - typedef sequence <Shortcut> ShortcutList; - - struct Group { - string name; - ShortcutList shortcuts; - }; - typedef sequence<Group> GroupList; - - exception NotFound {}; - - readonly attribute GroupList groups; // FIXME: Could be non-readonly - - void add (in short group_num, in short position, in Shortcut shortcut) - raises (NotFound); - void remove (in short group_num, in short item_num) - raises (NotFound); - Shortcut get (in short group_num, in short item_num) - raises (NotFound); - - void addGroup (in short position, in string name); - void removeGroup (in short group_num) - raises (NotFound); - Group getGroup (in short group_num) - raises (NotFound); - - }; - -}; -}; diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl deleted file mode 100644 index 6d648b2938..0000000000 --- a/shell/Evolution-Storage.idl +++ /dev/null @@ -1,105 +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@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.h> - -module GNOME { -module Evolution { - interface Storage; - interface StorageListener; - - interface Storage : Bonobo::Unknown { - exception AlreadyListening {}; - exception NotFound {}; - - attribute string name; - - enum Result { - OK, - UNSUPPORTED_OPERATION, - UNSUPPORTED_TYPE, - INVALID_URI, - ALREADY_EXISTS, - DOES_NOT_EXIST, - PERMISSION_DENIED, - NO_SPACE, - NOT_EMPTY, - GENERIC_ERROR - }; - - struct FolderResult { - Result result; - string path; - }; - - void asyncCreateFolder (in string path, - in string type, - in string description, - in string parent_physical_uri, - in Bonobo::Listener listener); - - void asyncRemoveFolder (in string path, - in string physical_uri, - in Bonobo::Listener listener); - - void asyncXferFolder (in string source_path, - in string destination_path, - in boolean remove_source, - in Bonobo::Listener listener); - - void updateFolder (in string path, - in string display_name, - in long unread_count); - - void addListener (in StorageListener listener) - raises (AlreadyListening); - - void removeListener (in StorageListener listener) - raises (NotFound); - }; - - interface StorageListener { - exception Exists {}; - exception NotFound {}; - - void notifyDestroyed (); - - /* FIXME exceptions don't make much sense here... */ - - void notifyFolderCreated (in string path, - in Folder folder) - raises (Exists); - - void notifyFolderUpdated (in string path, - in string display_name, - in long unread_count) - raises (NotFound); - - void notifyFolderRemoved (in string path) - raises (NotFound); - }; - - interface StorageRegistry : Bonobo::Unknown { - exception Exists {}; - exception NotFound {}; - - /* FIXME: The toplevel attributes should probably be attributes - of the storage instead of being passed here. */ - StorageListener addStorage (in Storage storage, - in string name, - in string toplevel_node_uri, - in string toplevel_node_type) - raises (Exists); - - void removeStorageByName (in string name) - raises (NotFound); - }; -}; -}; diff --git a/shell/Evolution-StorageSetView.idl b/shell/Evolution-StorageSetView.idl deleted file mode 100644 index c9222c3d62..0000000000 --- a/shell/Evolution-StorageSetView.idl +++ /dev/null @@ -1,34 +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@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonoob.idl> - -module GNOME { -module Evolution { - interface StorageSetViewListener { - void notifyFolderSelected (in string uri); - void notifyStorageSelected (in string name); - }; - - /* FIXME: Maybe we should have a generic Bonobo::Listener interface. */ - interface StorageSetView : Bonobo::Unknown { - exception AlreadyListening {}; - exception NotFound {}; - - attribute boolean showFolders; - - void addListener (in StorageSetViewListener listener) - raises (AlreadyListening); - - void removeListener (in StorageSetViewListener listener) - raises (NotFound); - }; -}; -}; diff --git a/shell/Evolution-Wizard.idl b/shell/Evolution-Wizard.idl deleted file mode 100644 index 222830d737..0000000000 --- a/shell/Evolution-Wizard.idl +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for a wizard done through Bonobo. - * - * Authors: - * Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - - interface Wizard : Bonobo::Unknown { - - readonly attribute long pageCount; - enum Action { - NEXT, - PREPARE, - BACK, - FINISH, - CANCEL, - HELP - }; - - exception NoPage {}; - - Bonobo::Control getControl (in long pagenumber) - raises (NoPage); - - void notifyAction (in long pagenumber, in Action action) - raises (NoPage); - }; -}; -}; diff --git a/shell/Evolution-common.idl b/shell/Evolution-common.idl deleted file mode 100644 index 86cd774852..0000000000 --- a/shell/Evolution-common.idl +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Common definitions for the CORBA interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -module GNOME { -module Evolution { - -struct Folder { - string type; - string description; - string displayName; - string physicalUri; - long unreadCount; -}; - -struct Icon { - short width, height; - boolean hasAlpha; - sequence <octet> rgbaData; // Row-by-row, left-to-right, top-to-bottom RGBA bytes -}; - -typedef sequence <Icon> AnimatedIcon; - -}; -}; - diff --git a/shell/Evolution.idl b/shell/Evolution.idl deleted file mode 100644 index ff267c60ea..0000000000 --- a/shell/Evolution.idl +++ /dev/null @@ -1,25 +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@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <Bonobo.idl> - -#include <Evolution-common.idl> - -#include <Evolution-Activity.idl> -#include <Evolution-Session.idl> -#include <Evolution-ShellComponent.idl> -#include <Evolution-ShellComponentDnd.idl> -#include <Evolution-Offline.idl> -#include <Evolution-ShellView.idl> -#include <Evolution-Shortcuts.idl> -#include <Evolution-Storage.idl> -#include <Evolution-StorageSetView.idl> -#include <Evolution-Shell.idl> -#include <Evolution-Wizard.idl> diff --git a/shell/GNOME_Evolution_Shell.oaf.in b/shell/GNOME_Evolution_Shell.oaf.in deleted file mode 100644 index 1234d78139..0000000000 --- a/shell/GNOME_Evolution_Shell.oaf.in +++ /dev/null @@ -1,15 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Shell" - type="exe" - location="evolution"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Shell:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="The Evolution shell."/> -</oaf_server> - -</oaf_info> diff --git a/shell/GNOME_Evolution_TestComponent.oaf b/shell/GNOME_Evolution_TestComponent.oaf deleted file mode 100644 index d5ef5333be..0000000000 --- a/shell/GNOME_Evolution_TestComponent.oaf +++ /dev/null @@ -1,15 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_TestComponent_ShellComponent" - type="exe" - location="evolution-test-component"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution test component."/> -</oaf_server> - -</oaf_info> diff --git a/shell/Makefile.am b/shell/Makefile.am deleted file mode 100644 index 8829330db2..0000000000 --- a/shell/Makefile.am +++ /dev/null @@ -1,244 +0,0 @@ -SUBDIRS = glade importer - -INCLUDES = -O \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir) \ - $(BONOBO_GNOME_CFLAGS) \ - $(BONOBO_CONF_CFLAGS) \ - $(EXTRA_GNOME_CFLAGS) \ - $(GTKHTML_CFLAGS) \ - -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DG_LOG_DOMAIN=\"evolution-shell\" - -# CORBA stuff - -IDLS = \ - Evolution-Activity.idl \ - Evolution-Offline.idl \ - Evolution-Session.idl \ - Evolution-Shell.idl \ - Evolution-ShellComponent.idl \ - Evolution-ShellComponentDnd.idl \ - Evolution-ShellView.idl \ - Evolution-Shortcuts.idl \ - Evolution-Storage.idl \ - Evolution-StorageSetView.idl \ - Evolution-Wizard.idl \ - Evolution-common.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 $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(srcdir)/Evolution.idl - -# IDL install - -idldir = $(datadir)/idl - -idl_DATA = $(IDLS) - -# Shell library - -lib_LTLIBRARIES = \ - libeshell.la - -eshellincludedir = $(includedir)/evolution/shell - -eshellinclude_HEADERS = \ - Evolution.h \ - e-folder-tree.h \ - evolution-activity-client.h \ - evolution-session.h \ - evolution-shell-client.h \ - evolution-shell-component-client.h \ - evolution-shell-component.h \ - evolution-shell-component-dnd.h \ - evolution-shell-component-utils.h \ - evolution-shell-view.h \ - evolution-storage-listener.h \ - evolution-storage-set-view-listener.h \ - evolution-storage.h \ - evolution-wizard.h - -libeshell_la_SOURCES = \ - $(IDL_GENERATED) \ - e-folder-tree.c \ - evolution-activity-client.c \ - evolution-session.c \ - evolution-shell-client.c \ - evolution-shell-component-client.c \ - evolution-shell-component.c \ - evolution-shell-component-dnd.c \ - evolution-shell-component-utils.c \ - evolution-shell-view.c \ - evolution-storage-listener.c \ - evolution-storage-set-view-listener.c \ - evolution-storage.c \ - evolution-wizard.c \ - $(eshellinclude_HEADERS) - -# Evolution executable - -bin_PROGRAMS = evolution - -evolution_SOURCES = \ - e-activity-handler.c \ - e-activity-handler.h \ - e-component-registry.c \ - e-component-registry.h \ - e-corba-shortcuts.c \ - e-corba-shortcuts.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-gray-bar.c \ - e-gray-bar.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-commands.c \ - e-shell-folder-commands.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-importer.c \ - e-shell-importer.h \ - e-shell-offline-handler.c \ - e-shell-offline-handler.h \ - e-shell-startup-wizard.c \ - e-shell-startup-wizard.h \ - e-shell-user-creatable-items-handler.c \ - e-shell-user-creatable-items-handler.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 \ - e-summary-storage.c \ - e-summary-storage.h \ - e-task-bar.c \ - e-task-bar.h \ - e-task-widget.c \ - e-task-widget.h \ - e-uri-schema-registry.c \ - e-uri-schema-registry.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.la \ - importer/libevolution-importer.la \ - $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libical/src/libical/libical.la \ - $(EXTRA_GNOME_LIBS) \ - $(GNOME_PRINT_LIBS) \ - $(GTKHTML_LIBS) \ - $(BONOBO_CONF_LIBS) \ - $(BONOBO_GNOME_LIBS) - -# Test component - -noinst_PROGRAMS = \ - evolution-test-component - -evolution_test_component_SOURCES = \ - evolution-test-component.c - -evolution_test_component_LDADD = \ - libeshell.la \ - $(EXTRA_GNOME_LIBS) \ - $(GNOME_PRINT_LIBS) \ - $(GTKHTML_LIBS) \ - $(BONOBO_GNOME_LIBS) - -install-test-component: evolution-test-component - $(mkinstalldirs) $(DESTDIR)$(bindir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) evolution-test-component $(DESTDIR)$(bindir)/evolution-test-component - $(mkinstalldirs) $(DESTDIR)$(oafdir) - $(INSTALL_DATA) $(srcdir)/GNOME_Evolution_TestComponent.oaf $(DESTDIR)$(oafdir)/GNOME_Evolution_TestComponent.oaf - -# Misc stuff - -oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Shell.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -etspecdir = $(datadir)/evolution/etspec/ -etspec_DATA = e-storage-set-view.etspec - -@XML_I18N_MERGE_OAF_RULE@ - -EXTRA_DIST = \ - $(IDLS) \ - $(oaf_in_files) \ - $(oaf_DATA) \ - $(etspec_DATA) \ - GNOME_Evolution_TestComponent.oaf - -# 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 - -CLEANFILES = $(IDL_GENERATED) -BUILT_SOURCES = $(IDL_GENERATED) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - 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-activity-handler.c b/shell/e-activity-handler.c deleted file mode 100644 index fe3a944bcc..0000000000 --- a/shell/e-activity-handler.c +++ /dev/null @@ -1,608 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-activity-handler.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-activity-handler.h" - -#include <gtk/gtksignal.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-popup-menu.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-popup-menu.h> - - -#define PARENT_TYPE bonobo_x_object_get_type () -static BonoboXObjectClass *parent_class = NULL; - - -#define ICON_SIZE 16 - - -struct _ActivityInfo { - GdkPixbuf *icon_pixbuf; - GNOME_Evolution_Activity_ActivityId id; - CORBA_char *information; - CORBA_boolean cancellable; - Bonobo_Listener event_listener; - CORBA_float progress; - GtkWidget *menu; -}; -typedef struct _ActivityInfo ActivityInfo; - -struct _EActivityHandlerPrivate { - GNOME_Evolution_Activity_ActivityId next_activity_id; - GList *activity_infos; - GSList *task_bars; -}; - - -/* Utility functions. */ - -static GdkPixbuf * -create_gdk_pixbuf_from_corba_icon (const GNOME_Evolution_Icon *icon) -{ - GdkPixbuf *pixbuf; - GdkPixbuf *scaled_pixbuf; - unsigned char *p; - int src_offset; - int i, j; - int rowstride; - int total_width; - - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, icon->hasAlpha, 8, icon->width, icon->height); - - if (icon->hasAlpha) - total_width = 4 * icon->width; - else - total_width = 3 * icon->width; - - rowstride = gdk_pixbuf_get_rowstride (pixbuf); - src_offset = 0; - p = gdk_pixbuf_get_pixels (pixbuf); - - for (i = 0; i < icon->height; i++) { - for (j = 0; j < total_width; j++) - p[j] = icon->rgbaData._buffer[src_offset ++]; - p += rowstride; - } - - if (icon->width == ICON_SIZE && icon->height == ICON_SIZE) - return pixbuf; - - scaled_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, icon->hasAlpha, 8, ICON_SIZE, ICON_SIZE); - gdk_pixbuf_scale (pixbuf, scaled_pixbuf, - 0, 0, ICON_SIZE, ICON_SIZE, - 0, 0, (double) ICON_SIZE / icon->width, (double) ICON_SIZE / icon->height, - GDK_INTERP_HYPER); - - gdk_pixbuf_unref (pixbuf); - - return scaled_pixbuf; -} - -static unsigned int -get_new_activity_id (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - - priv = activity_handler->priv; - - return priv->next_activity_id ++; -} - -static GList * -lookup_activity (GList *list, - GNOME_Evolution_Activity_ActivityId activity_id, - int *order_number_return) -{ - GList *p; - int i; - - for (p = list, i = 0; p != NULL; p = p->next, i ++) { - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) p->data; - if (activity_info->id == activity_id) { - *order_number_return = i; - return p; - } - } - - *order_number_return = -1; - return NULL; -} - -static const CORBA_any * -get_corba_null_value (void) -{ - static CORBA_any *null_value = NULL; - - if (null_value == NULL) { - null_value = CORBA_any__alloc (); - null_value->_type = TC_null; - } - - return null_value; -} - -static void -report_task_event (ActivityInfo *activity_info, - const char *event_name) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Bonobo_Listener_event (activity_info->event_listener, event_name, get_corba_null_value (), &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EActivityHandler: Cannot event `%s' -- %s", event_name, ev._repo_id); - - CORBA_exception_free (&ev); -} - - -/* ETaskWidget actions. */ - -static void -task_widget_cancel_callback (GtkWidget *widget, - void *data) -{ - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) data; - report_task_event (activity_info, "Cancel"); -} - -static void -task_widget_show_details_callback (GtkWidget *widget, - void *data) -{ - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) data; - report_task_event (activity_info, "ShowDetails"); -} - -static void -show_cancellation_popup (ActivityInfo *activity_info, - GtkWidget *task_widget, - GdkEventButton *button_event) -{ - GtkMenu *popup; - EPopupMenu items[] = { - { N_("Show Details"), NULL, task_widget_show_details_callback, NULL, 0 }, - { "", NULL, NULL, NULL, 0 }, - { N_("Cancel Operation"), NULL, task_widget_cancel_callback, NULL, 0 }, - { NULL } - }; - - /* FIXME: We should gray out things properly here. */ - popup = e_popup_menu_create (items, 0, 0, activity_info); - - g_assert (activity_info->menu == NULL); - activity_info->menu = GTK_WIDGET (popup); - - gnome_popup_menu_do_popup_modal (GTK_WIDGET (popup), NULL, NULL, button_event, activity_info); - - activity_info->menu = NULL; -} - -static int -task_widget_button_press_event_callback (GtkWidget *widget, - GdkEventButton *button_event, - void *data) -{ - CORBA_Environment ev; - ActivityInfo *activity_info; - CORBA_any *null_value; - - activity_info = (ActivityInfo *) data; - - if (button_event->button == 3) { - if (! activity_info->cancellable) { - return FALSE; - } else { - show_cancellation_popup (activity_info, widget, button_event); - return TRUE; - } - } - - if (button_event->button != 1) - return FALSE; - - CORBA_exception_init (&ev); - - null_value = CORBA_any__alloc (); - null_value->_type = TC_null; - - Bonobo_Listener_event (activity_info->event_listener, "Clicked", null_value, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EActivityHandler: Cannot report `Clicked' event -- %s", - ev._repo_id); - - CORBA_free (null_value); - - CORBA_exception_free (&ev); - - return TRUE; -} - - -/* Creating and destroying ActivityInfos. */ - -static ActivityInfo * -activity_info_new (GNOME_Evolution_Activity_ActivityId id, - GdkPixbuf *icon, - const CORBA_char *information, - CORBA_boolean cancellable, - const Bonobo_Listener event_listener) -{ - ActivityInfo *info; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - info = g_new (ActivityInfo, 1); - info->id = id; - info->icon_pixbuf = gdk_pixbuf_ref (icon); - info->information = CORBA_string_dup (information); - info->cancellable = cancellable; - info->event_listener = CORBA_Object_duplicate (event_listener, &ev); - info->progress = -1.0; /* (Unknown) */ - info->menu = NULL; - - CORBA_exception_free (&ev); - - return info; -} - -static void -activity_info_free (ActivityInfo *info) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gdk_pixbuf_unref (info->icon_pixbuf); - CORBA_free (info->information); - CORBA_Object_release (info->event_listener, &ev); - - if (info->menu != NULL) - gtk_widget_destroy (info->menu); - - g_free (info); - - CORBA_exception_free (&ev); -} - -static ETaskWidget * -task_widget_new_from_activity_info (ActivityInfo *activity_info) -{ - GtkWidget *widget; - - widget = e_task_widget_new (activity_info->icon_pixbuf, activity_info->information); - gtk_widget_show (widget); - - gtk_signal_connect (GTK_OBJECT (widget), "button_press_event", - GTK_SIGNAL_FUNC (task_widget_button_press_event_callback), activity_info); - - return E_TASK_WIDGET (widget); -} - - -/* Task Bar handling. */ - -static void -setup_task_bar (EActivityHandler *activity_handler, - ETaskBar *task_bar) -{ - EActivityHandlerPrivate *priv; - GList *p; - - priv = activity_handler->priv; - - for (p = g_list_last (priv->activity_infos); p != NULL; p = p->prev) { - e_task_bar_prepend_task (task_bar, - task_widget_new_from_activity_info ((ActivityInfo *) p->data)); - } -} - -static void -task_bar_destroy_callback (GtkObject *task_bar_object, - void *data) -{ - ETaskBar *task_bar; - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; - - task_bar = E_TASK_BAR (task_bar_object); - - activity_handler = E_ACTIVITY_HANDLER (data); - priv = activity_handler->priv; - - priv->task_bars = g_slist_remove (priv->task_bars, task_bar); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EActivityHandler *handler; - EActivityHandlerPrivate *priv; - GList *p; - - handler = E_ACTIVITY_HANDLER (object); - priv = handler->priv; - - for (p = priv->activity_infos; p != NULL; p = p->next) { - ActivityInfo *info; - - info = (ActivityInfo *) p->data; - activity_info_free (info); - } - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* CORBA methods. */ - -static void -impl_operationStarted (PortableServer_Servant servant, - const CORBA_char *component_id, - const GNOME_Evolution_AnimatedIcon *icon, - const CORBA_char *information, - const CORBA_boolean cancellable, - const Bonobo_Listener event_listener, - GNOME_Evolution_Activity_ActivityId *activity_id_return, - CORBA_boolean *suggest_display_return, - CORBA_Environment *ev) -{ - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; - ActivityInfo *activity_info; - GdkPixbuf *icon_pixbuf; - unsigned int activity_id; - GSList *p; - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - if (GTK_OBJECT_DESTROYED (activity_handler)) - return; - - priv = activity_handler->priv; - - if (icon->_length == 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Activity_InvalidIcon, NULL); - return; - } - - if (icon->_length > 1) - g_warning ("Animated icons are not supported for activities (yet)."); - - icon_pixbuf = create_gdk_pixbuf_from_corba_icon (icon->_buffer); - - activity_id = get_new_activity_id (activity_handler); - - activity_info = activity_info_new (activity_id, icon_pixbuf, information, cancellable, event_listener); - - for (p = priv->task_bars; p != NULL; p = p->next) - e_task_bar_prepend_task (E_TASK_BAR (p->data), - task_widget_new_from_activity_info (activity_info)); - - gdk_pixbuf_unref (icon_pixbuf); - - priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info); - - *activity_id_return = activity_id; -} - -static void -impl_operationProgressing (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - const CORBA_char *information, - const CORBA_float progress, - CORBA_Environment *ev) -{ - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; - ActivityInfo *activity_info; - GList *p; - GSList *sp; - int order_number; - - /* FIXME? The complexity in this function sucks. */ - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - if (GTK_OBJECT_DESTROYED (activity_handler)) - return; - - priv = activity_handler->priv; - - p = lookup_activity (priv->activity_infos, activity_id, &order_number); - if (p == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Activity_IdNotFound, NULL); - return; - } - - activity_info = (ActivityInfo *) p->data; - - CORBA_free (activity_info->information); - activity_info->information = CORBA_string_dup (information); - - activity_info->progress = progress; - - for (sp = priv->task_bars; sp != NULL; sp = sp->next) { - ETaskBar *task_bar; - ETaskWidget *task_widget; - - task_bar = E_TASK_BAR (sp->data); - task_widget = e_task_bar_get_task_widget (task_bar, order_number); - - e_task_widget_update (task_widget, information, progress); - } -} - -static void -impl_operationFinished (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - CORBA_Environment *ev) -{ - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; - GList *p; - GSList *sp; - int order_number; - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - if (GTK_OBJECT_DESTROYED (activity_handler)) - return; - - priv = activity_handler->priv; - - p = lookup_activity (priv->activity_infos, activity_id, &order_number); - - activity_info_free ((ActivityInfo *) p->data); - priv->activity_infos = g_list_remove_link (priv->activity_infos, p); - - for (sp = priv->task_bars; sp != NULL; sp = sp->next) { - ETaskBar *task_bar; - - task_bar = E_TASK_BAR (sp->data); - e_task_bar_remove_task (task_bar, order_number); - } -} - -static GNOME_Evolution_Activity_DialogAction -impl_requestDialog (PortableServer_Servant servant, - const GNOME_Evolution_Activity_ActivityId activity_id, - const GNOME_Evolution_Activity_DialogType dialog_type, - CORBA_Environment *ev) -{ - EActivityHandler *activity_handler; - - activity_handler = E_ACTIVITY_HANDLER (bonobo_object_from_servant (servant)); - - if (GTK_OBJECT_DESTROYED (activity_handler)) - return GNOME_Evolution_Activity_DIALOG_ACTION_ERROR; - - /* FIXME implement. */ - g_warning ("Evolution::Activity::requestDialog not implemented"); - - return GNOME_Evolution_Activity_DIALOG_ACTION_DISPLAY; -} - - -/* GTK+ type stuff. */ - -static void -class_init (GtkObjectClass *object_class) -{ - EActivityHandlerClass *handler_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; - - handler_class = E_ACTIVITY_HANDLER_CLASS (object_class); - handler_class->epv.operationStarted = impl_operationStarted; - handler_class->epv.operationProgressing = impl_operationProgressing; - handler_class->epv.operationFinished = impl_operationFinished; - handler_class->epv.requestDialog = impl_requestDialog; -} - -static void -init (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - - priv = g_new (EActivityHandlerPrivate, 1); - priv->next_activity_id = 0; - priv->activity_infos = NULL; - priv->task_bars = NULL; - - activity_handler->priv = priv; -} - - -void -e_activity_handler_construct (EActivityHandler *activity_handler) -{ - g_return_if_fail (activity_handler != NULL); - g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); - - /* Nothing to do here. */ -} - -EActivityHandler * -e_activity_handler_new (void) -{ - EActivityHandler *activity_handler; - - activity_handler = gtk_type_new (e_activity_handler_get_type ()); - e_activity_handler_construct (activity_handler); - - return activity_handler; -} - - -void -e_activity_handler_attach_task_bar (EActivityHandler *activity_handler, - ETaskBar *task_bar) -{ - EActivityHandlerPrivate *priv; - - g_return_if_fail (activity_handler != NULL); - g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - - priv = activity_handler->priv; - - gtk_signal_connect_while_alive (GTK_OBJECT (task_bar), "destroy", - GTK_SIGNAL_FUNC (task_bar_destroy_callback), activity_handler, - GTK_OBJECT (activity_handler)); - - priv->task_bars = g_slist_prepend (priv->task_bars, task_bar); - - setup_task_bar (activity_handler, task_bar); -} - - -E_MAKE_X_TYPE (e_activity_handler, "EActivityHandler", EActivityHandler, class_init, init, PARENT_TYPE, - POA_GNOME_Evolution_Activity__init, - GTK_STRUCT_OFFSET (EActivityHandlerClass, epv)) diff --git a/shell/e-activity-handler.h b/shell/e-activity-handler.h deleted file mode 100644 index 0a131bc5e9..0000000000 --- a/shell/e-activity-handler.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-activity-handler.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_ACTIVITY_HANDLER_H_ -#define _E_ACTIVITY_HANDLER_H_ - -#include "Evolution.h" - -#include "e-task-bar.h" - -#include <bonobo/bonobo-xobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_ACTIVITY_HANDLER (e_activity_handler_get_type ()) -#define E_ACTIVITY_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_ACTIVITY_HANDLER, EActivityHandler)) -#define E_ACTIVITY_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_ACTIVITY_HANDLER, EActivityHandlerClass)) -#define E_IS_ACTIVITY_HANDLER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) -#define E_IS_ACTIVITY_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) - - -typedef struct _EActivityHandler EActivityHandler; -typedef struct _EActivityHandlerPrivate EActivityHandlerPrivate; -typedef struct _EActivityHandlerClass EActivityHandlerClass; - -struct _EActivityHandler { - BonoboXObject parent; - - EActivityHandlerPrivate *priv; -}; - -struct _EActivityHandlerClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Activity__epv epv; -}; - - -GtkType e_activity_handler_get_type (void); -void e_activity_handler_construct (EActivityHandler *activity_hanlder); -EActivityHandler *e_activity_handler_new (void); - -void e_activity_handler_attach_task_bar (EActivityHandler *activity_hanlder, - ETaskBar *task_bar); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_ACTIVITY_HANDLER_H_ */ diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c deleted file mode 100644 index 3851821741..0000000000 --- a/shell/e-component-registry.c +++ /dev/null @@ -1,403 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.c - * - * Copyright (C) 2000 Ximian, 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-component-registry.h" - -#include <glib.h> -#include <gtk/gtktypeutils.h> - -#include <gal/util/e-util.h> - -#include "Evolution.h" - -#include "e-shell-utils.h" -#include "evolution-shell-component-client.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) -{ - GNOME_Evolution_ShellComponent corba_shell_component; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (component->client)); - GNOME_Evolution_ShellComponent_unsetOwner (corba_shell_component, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Cannot unregister component -- %s", 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, - const char *display_name, - const char *description, - gboolean user_creatable, - int num_exported_dnd_types, - const char **exported_dnd_types, - int num_accepted_dnd_types, - const char **accepted_dnd_types, - 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, - display_name, description, - user_creatable, - num_exported_dnd_types, - exported_dnd_types, - num_accepted_dnd_types, - accepted_dnd_types)) { - 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; - GNOME_Evolution_ShellComponent component_corba_interface; - GNOME_Evolution_Shell shell_corba_interface; - GNOME_Evolution_FolderTypeList *supported_types; - GNOME_Evolution_URISchemaList *supported_schemas; - 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)); - - /* Register the supported folder types. */ - - supported_types = GNOME_Evolution_ShellComponent__get_supportedTypes (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); - bonobo_object_unref (BONOBO_OBJECT (client)); - - for (i = 0; i < supported_types->_length; i++) { - const GNOME_Evolution_FolderType *type; - - type = supported_types->_buffer + i; - - if (! register_type (component_registry, - type->name, type->iconName, - type->displayName, type->description, - type->userCreatable, - type->exportedDndTypes._length, - (const char **) type->exportedDndTypes._buffer, - type->acceptedDndTypes._length, - (const char **) type->acceptedDndTypes._buffer, - component)) { - g_warning ("Cannot register type `%s' for component %s", - type->name, component->id); - } - } - - CORBA_free (supported_types); - - /* Register the supported external URI schemas. */ - - supported_schemas = GNOME_Evolution_ShellComponent__get_externalUriSchemas (component_corba_interface, &ev); - if (ev._major == CORBA_NO_EXCEPTION) { - EUriSchemaRegistry *uri_schema_registry; - - uri_schema_registry = e_shell_get_uri_schema_registry (priv->shell); - - for (i = 0; i < supported_schemas->_length; i++) { - const CORBA_char *schema; - - schema = supported_schemas->_buffer[i]; - if (! e_uri_schema_registry_set_handler_for_schema (uri_schema_registry, schema, component->client)) - g_warning ("Cannot register schema `%s' for component %s", schema, component->id); - } - - CORBA_free (supported_schemas); - } - - 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; - - 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); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -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; - 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 280aef74a6..0000000000 --- a/shell/e-component-registry.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <gtk/gtkobject.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; - -#include "e-shell.h" -#include "evolution-shell-component-client.h" - -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-shortcuts.c b/shell/e-corba-shortcuts.c deleted file mode 100644 index 076b49d796..0000000000 --- a/shell/e-corba-shortcuts.c +++ /dev/null @@ -1,319 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-shortcuts.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -/* FIXME: Doesn't throw exceptions properly. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-corba-shortcuts.h" - -#include "e-util/e-corba-utils.h" - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE bonobo_x_object_get_type () -static BonoboXObjectClass *parent_class = NULL; - -struct _ECorbaShortcutsPrivate { - EShortcuts *shortcuts; -}; - - -/* Utility functions. */ - -static const char * -string_from_corba (CORBA_char *corba_string) -{ - if (corba_string[0] == '\0') - return NULL; - - return corba_string; -} - -static void -shortcut_list_to_corba (const GSList *shortcut_list, - GNOME_Evolution_Shortcuts_ShortcutList *shortcut_list_return) -{ - GNOME_Evolution_Shortcuts_Shortcut *buffer; - const GSList *p; - int num_shortcuts; - int i; - - num_shortcuts = g_slist_length ((GSList *) shortcut_list); /* safe cast, GLib sucks */ - - shortcut_list_return->_maximum = num_shortcuts; - shortcut_list_return->_length = num_shortcuts; - - buffer = CORBA_sequence_GNOME_Evolution_Shortcuts_Shortcut_allocbuf (num_shortcuts); - shortcut_list_return->_buffer = buffer; - - for (p = shortcut_list, i = 0; p != NULL; p = p->next, i++) { - const EShortcutItem *item; - - item = (const EShortcutItem *) p->data; - - buffer[i].uri = CORBA_string_dup (e_safe_corba_string (item->uri)); - buffer[i].name = CORBA_string_dup (e_safe_corba_string (item->name)); - buffer[i].type = CORBA_string_dup (e_safe_corba_string (item->type)); - } - - CORBA_sequence_set_release (shortcut_list_return, TRUE); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - - corba_shortcuts = E_CORBA_SHORTCUTS (object); - priv = corba_shortcuts->priv; - - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -impl_add (PortableServer_Servant servant, - const CORBA_short group_num, - const CORBA_short position, - const GNOME_Evolution_Shortcuts_Shortcut *shortcut, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - e_shortcuts_add_shortcut (priv->shortcuts, group_num, position, - string_from_corba (shortcut->uri), - string_from_corba (shortcut->name), - 0, - string_from_corba (shortcut->type)); -} - -static void -impl_remove (PortableServer_Servant servant, - const CORBA_short group_num, - const CORBA_short item_num, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - e_shortcuts_remove_shortcut (priv->shortcuts, group_num, item_num); -} - -static GNOME_Evolution_Shortcuts_Shortcut * -impl_get (PortableServer_Servant servant, - const CORBA_short group_num, - const CORBA_short item_num, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - GNOME_Evolution_Shortcuts_Shortcut *retval; - const EShortcutItem *item; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - item = e_shortcuts_get_shortcut (priv->shortcuts, group_num, item_num); - if (item == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shortcuts_NotFound, NULL); - return NULL; - } - - retval = GNOME_Evolution_Shortcuts_Shortcut__alloc (); - retval->uri = CORBA_string_dup (e_safe_corba_string (item->uri)); - retval->name = CORBA_string_dup (e_safe_corba_string (item->name)); - retval->type = CORBA_string_dup (e_safe_corba_string (item->type)); - - return retval; -} - -static void -impl_addGroup (PortableServer_Servant servant, - const CORBA_short position, - const CORBA_char *name, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - e_shortcuts_add_group (priv->shortcuts, position, name); -} - -static void -impl_removeGroup (PortableServer_Servant servant, - const CORBA_short group_num, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - e_shortcuts_remove_group (priv->shortcuts, group_num); -} - -static GNOME_Evolution_Shortcuts_Group * -impl_getGroup (PortableServer_Servant servant, - const CORBA_short group_num, - CORBA_Environment *ev) -{ - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - GNOME_Evolution_Shortcuts_Group *group; - const GSList *list; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - list = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, group_num); - - group = GNOME_Evolution_Shortcuts_Group__alloc (); - - group->name = CORBA_string_dup (e_shortcuts_get_group_title (priv->shortcuts, group_num)); - - shortcut_list_to_corba (list, & group->shortcuts); - - return group; -} - -static CORBA_sequence_GNOME_Evolution_Shortcuts_Group * -impl__get_groups (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - GNOME_Evolution_Shortcuts_GroupList *list; - ECorbaShortcuts *corba_shortcuts; - ECorbaShortcutsPrivate *priv; - GSList *group_titles; - const GSList *p; - int i; - - corba_shortcuts = E_CORBA_SHORTCUTS (bonobo_object_from_servant (servant)); - priv = corba_shortcuts->priv; - - list = GNOME_Evolution_Shortcuts_GroupList__alloc (); - list->_length = e_shortcuts_get_num_groups (priv->shortcuts); - list->_maximum = list->_length; - list->_buffer = CORBA_sequence_GNOME_Evolution_Shortcuts_Group_allocbuf (list->_maximum); - - CORBA_sequence_set_release (list, TRUE); - - group_titles = e_shortcuts_get_group_titles (priv->shortcuts); - for (p = group_titles, i = 0; p != NULL; p = p->next, i ++) { - char *group_title; - const GSList *shortcuts; - - group_title = (char *) p->data; - - shortcuts = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, i); - - list->_buffer[i].name = CORBA_string_dup (group_title); - shortcut_list_to_corba (shortcuts, &list->_buffer[i].shortcuts); - - g_free (group_title); - } - - g_slist_free (group_titles); - - return list; -} - - -static void -class_init (GtkObjectClass *object_class) -{ - ECorbaShortcutsClass *corba_shortcuts_class; - POA_GNOME_Evolution_Shortcuts__epv *epv; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; - - corba_shortcuts_class = E_CORBA_SHORTCUTS_CLASS (object_class); - - epv = & corba_shortcuts_class->epv; - epv->add = impl_add; - epv->remove = impl_remove; - epv->get = impl_get; - epv->addGroup = impl_addGroup; - epv->removeGroup = impl_removeGroup; - epv->getGroup = impl_getGroup; - epv->_get_groups = impl__get_groups; -} - -static void -init (ECorbaShortcuts *corba_shortcuts) -{ - ECorbaShortcutsPrivate *priv; - - priv = g_new (ECorbaShortcutsPrivate, 1); - priv->shortcuts = NULL; - - corba_shortcuts->priv = priv; -} - - -ECorbaShortcuts * -e_corba_shortcuts_new (EShortcuts *shortcuts) -{ - ECorbaShortcuts *corba_shortcuts; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - corba_shortcuts = gtk_type_new (e_corba_shortcuts_get_type ()); - - gtk_object_ref (GTK_OBJECT (shortcuts)); - corba_shortcuts->priv->shortcuts = shortcuts; - - return corba_shortcuts; -} - - -E_MAKE_X_TYPE (e_corba_shortcuts, "ECorbaShortcuts", ECorbaShortcuts, - class_init, init, PARENT_TYPE, - POA_GNOME_Evolution_Shortcuts__init, - GTK_STRUCT_OFFSET (ECorbaShortcutsClass, epv)) diff --git a/shell/e-corba-shortcuts.h b/shell/e-corba-shortcuts.h deleted file mode 100644 index f46ac2ed6d..0000000000 --- a/shell/e-corba-shortcuts.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-shortcuts.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_CORBA_SHORTCUTS_H_ -#define _E_CORBA_SHORTCUTS_H_ - -#include "e-shortcuts.h" - -#include <bonobo/bonobo-xobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_CORBA_SHORTCUTS (e_corba_shortcuts_get_type ()) -#define E_CORBA_SHORTCUTS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CORBA_SHORTCUTS, ECorbaShortcuts)) -#define E_CORBA_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_SHORTCUTS, ECorbaShortcutsClass)) -#define E_IS_CORBA_SHORTCUTS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CORBA_SHORTCUTS)) -#define E_IS_CORBA_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_SHORTCUTS)) - - -typedef struct _ECorbaShortcuts ECorbaShortcuts; -typedef struct _ECorbaShortcutsPrivate ECorbaShortcutsPrivate; -typedef struct _ECorbaShortcutsClass ECorbaShortcutsClass; - -struct _ECorbaShortcuts { - BonoboXObject parent; - - ECorbaShortcutsPrivate *priv; -}; - -struct _ECorbaShortcutsClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Shortcuts__epv epv; -}; - - -GtkType e_corba_shortcuts_get_type (void); -ECorbaShortcuts *e_corba_shortcuts_new (EShortcuts *shortcuts); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_CORBA_SHORTCUTS_H_ */ diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c deleted file mode 100644 index 5bca8583cd..0000000000 --- a/shell/e-corba-storage-registry.c +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage-registry.c - * - * Copyright (C) 2000 Ximian, 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_GNOME_Evolution_StorageRegistry__vepv storage_registry_vepv; - -static POA_GNOME_Evolution_StorageRegistry * -create_servant (void) -{ - POA_GNOME_Evolution_StorageRegistry *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_StorageRegistry *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &storage_registry_vepv; - - CORBA_exception_init (&ev); - - POA_GNOME_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 GNOME_Evolution_StorageListener -impl_StorageRegistry_addStorage (PortableServer_Servant servant, - const GNOME_Evolution_Storage storage_interface, - const CORBA_char *name, - const CORBA_char *toplevel_node_uri, - const CORBA_char *toplevel_node_type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ECorbaStorageRegistry *storage_registry; - ECorbaStorageRegistryPrivate *priv; - EStorage *storage; - GNOME_Evolution_StorageListener listener_interface; - - bonobo_object = bonobo_object_from_servant (servant); - storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object); - priv = storage_registry->priv; - - if (toplevel_node_uri[0] == '\0') - toplevel_node_uri = NULL; - if (toplevel_node_type[0] == '\0') - toplevel_node_type = NULL; - - storage = e_corba_storage_new (toplevel_node_uri, - toplevel_node_type, - storage_interface, - name); - - if (! e_storage_set_add_storage (priv->storage_set, storage)) { - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_GNOME_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_removeStorageByName (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_GNOME_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_GNOME_Evolution_StorageRegistry__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_StorageRegistry__epv, 1); - epv->addStorage = impl_StorageRegistry_addStorage; - epv->removeStorageByName = impl_StorageRegistry_removeStorageByName; - - vepv = &storage_registry_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_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, - GNOME_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_GNOME_Evolution_StorageRegistry *servant; - GNOME_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 66a9974627..0000000000 --- a/shell/e-corba-storage-registry.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage-registry.h - * - * Copyright (C) 2000 Ximian, 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__ - -#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, - GNOME_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 03fa1dd4a9..0000000000 --- a/shell/e-corba-storage.c +++ /dev/null @@ -1,545 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-corba-storage.c - * - * Copyright (C) 2000, 2001 Ximian, 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-corba-storage.h" - -#include <glib.h> -#include <bonobo/bonobo-main.h> -#include <gal/util/e-util.h> - -#include "Evolution.h" - - -#define PARENT_TYPE E_TYPE_STORAGE -static EStorageClass *parent_class = NULL; - -typedef struct _StorageListenerServant StorageListenerServant; - -struct _ECorbaStoragePrivate { - char *name; - - GNOME_Evolution_Storage storage_interface; - - /* The Evolution::StorageListener interface we expose. */ - - GNOME_Evolution_StorageListener storage_listener_interface; - StorageListenerServant *storage_listener_servant; -}; - - -/* Implementation of the CORBA Evolution::StorageListener interface. */ - -static POA_GNOME_Evolution_StorageListener__vepv storage_listener_vepv; - -struct _StorageListenerServant { - POA_GNOME_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_notifyFolderCreated (PortableServer_Servant servant, - const CORBA_char *path, - const GNOME_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->displayName, - folder->type, - folder->description); - - e_folder_set_physical_uri (e_folder, folder->physicalUri); - e_folder_set_unread_count (e_folder, folder->unreadCount); - - if (! e_storage_new_folder (storage, path, e_folder)) { - g_warning ("Cannot register folder -- %s %s\n", path, folder->displayName); - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_StorageListener_Exists, - NULL); - gtk_object_unref (GTK_OBJECT (e_folder)); - return; - } -} - -static void -impl_StorageListener_notifyFolderUpdated (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_long unread_count, - 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_GNOME_Evolution_StorageListener_NotFound, - NULL); - return; - } - - e_folder_set_name (e_folder, display_name); - e_folder_set_unread_count (e_folder, unread_count); -} - -static void -impl_StorageListener_notifyFolderRemoved (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_GNOME_Evolution_StorageListener_NotFound, - NULL); -} - - -static gboolean -setup_storage_listener (ECorbaStorage *corba_storage) -{ - StorageListenerServant *servant; - ECorbaStoragePrivate *priv; - GNOME_Evolution_StorageListener storage_listener_interface; - CORBA_Environment ev; - - priv = corba_storage->priv; - - servant = storage_listener_servant_new (corba_storage); - - CORBA_exception_init (&ev); - - POA_GNOME_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_GNOME_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 const char * -get_display_name (EStorage *storage) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - /* FIXME: Abstract a display_name, return it. Necessary - changes to the IDL and EvolutionStorage required. */ - return priv->name; -} - -struct async_folder_closure { - EStorageResultCallback callback; - EStorage *storage; - void *data; -}; - -static void -async_folder_cb (BonoboListener *listener, char *event_name, - CORBA_any *any, CORBA_Environment *ev, - gpointer user_data) -{ - struct async_folder_closure *closure = user_data; - GNOME_Evolution_Storage_Result *corba_result; - EStorageResult result; - - corba_result = any->_value; - switch (*corba_result) { - case GNOME_Evolution_Storage_OK: - result = E_STORAGE_OK; - break; - case GNOME_Evolution_Storage_UNSUPPORTED_OPERATION: - result = E_STORAGE_UNSUPPORTEDOPERATION; - break; - case GNOME_Evolution_Storage_UNSUPPORTED_TYPE: - result = E_STORAGE_UNSUPPORTEDTYPE; - break; - case GNOME_Evolution_Storage_ALREADY_EXISTS: - result = E_STORAGE_EXISTS; - break; - case GNOME_Evolution_Storage_DOES_NOT_EXIST: - result = E_STORAGE_NOTFOUND; - break; - case GNOME_Evolution_Storage_PERMISSION_DENIED: - result = E_STORAGE_PERMISSIONDENIED; - break; - case GNOME_Evolution_Storage_NO_SPACE: - result = E_STORAGE_NOSPACE; - break; - case GNOME_Evolution_Storage_INVALID_URI: - case GNOME_Evolution_Storage_NOT_EMPTY: - case GNOME_Evolution_Storage_GENERIC_ERROR: - default: - result = E_STORAGE_GENERICERROR; - break; - } - - closure->callback (closure->storage, result, closure->data); - bonobo_object_unref (BONOBO_OBJECT (listener)); - g_free (closure); -} - -static void -async_create_folder (EStorage *storage, const char *path, - const char *type, const char *description, - EStorageResultCallback callback, void *data) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - const char *parent_uri; - char *p; - BonoboListener *listener; - Bonobo_Listener corba_listener; - CORBA_Environment ev; - struct async_folder_closure *closure; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - p = strrchr (path, '/'); - if (p && p != path) { - char *parent_path; - EFolder *parent; - - parent_path = g_strndup (path, p - path); - parent = e_storage_get_folder (storage, parent_path); - parent_uri = e_folder_get_physical_uri (parent); - } else - parent_uri = ""; - - closure = g_new (struct async_folder_closure, 1); - closure->callback = callback; - closure->storage = storage; - closure->data = data; - listener = bonobo_listener_new (async_folder_cb, closure); - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_asyncCreateFolder (priv->storage_interface, - path, type, description, - parent_uri, - corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - callback (storage, E_STORAGE_GENERICERROR, data); - bonobo_object_unref (BONOBO_OBJECT (listener)); - g_free (closure); - } - CORBA_exception_free (&ev); -} - -static void -async_remove_folder (EStorage *storage, const char *path, - EStorageResultCallback callback, void *data) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - EFolder *folder; - BonoboListener *listener; - Bonobo_Listener corba_listener; - CORBA_Environment ev; - struct async_folder_closure *closure; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - folder = e_storage_get_folder (storage, path); - if (e_folder_get_is_stock (folder)) - (* callback) (storage, E_STORAGE_CANTCHANGESTOCKFOLDER, data); - - closure = g_new (struct async_folder_closure, 1); - closure->callback = callback; - closure->storage = storage; - closure->data = data; - listener = bonobo_listener_new (async_folder_cb, closure); - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_asyncRemoveFolder (priv->storage_interface, - path, - e_folder_get_physical_uri (folder), - corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - callback (storage, E_STORAGE_GENERICERROR, data); - bonobo_object_unref (BONOBO_OBJECT (listener)); - g_free (closure); - } - CORBA_exception_free (&ev); -} - - - -static void -corba_class_init (void) -{ - POA_GNOME_Evolution_StorageListener__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_StorageListener__epv, 1); - epv->notifyFolderCreated = impl_StorageListener_notifyFolderCreated; - epv->notifyFolderUpdated = impl_StorageListener_notifyFolderUpdated; - epv->notifyFolderRemoved = impl_StorageListener_notifyFolderRemoved; - - vepv = &storage_listener_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_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; - storage_class->get_display_name = get_display_name; - storage_class->async_create_folder = async_create_folder; - storage_class->async_remove_folder = async_remove_folder; - - 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 char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_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), toplevel_node_uri, toplevel_node_type); - - 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 ("e_corba_storage_construct() -- Cannot reference Bonobo object"); - 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 char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_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), - toplevel_node_uri, - toplevel_node_type, - storage_interface, name); - - return new; -} - - -const GNOME_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 8199ee3450..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 Ximian, 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__ - -#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 char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_Evolution_Storage storage_interface, - const char *name); -EStorage *e_corba_storage_new (const char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_Evolution_Storage storage_interface, - const char *name); - -/* FIXME: I don't like this call. */ -const GNOME_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 e878bd24d6..0000000000 --- a/shell/e-folder-tree.c +++ /dev/null @@ -1,416 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-set.c - * - * Copyright (C) 2000, 2001 Ximian, 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-folder-tree.h" - -#include <string.h> -#include <glib.h> - - -struct _Folder { - struct _Folder *parent; - char *path; - void *data; - GList *subfolders; -}; -typedef struct _Folder Folder; - -struct _EFolderTree { - GHashTable *path_to_folder; - GHashTable *data_to_path; - - 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) -{ - folder->subfolders = g_list_remove (folder->subfolders, subfolder); - subfolder->parent = NULL; -} - -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; - subfolder->parent = NULL; - remove_folder (folder_tree, subfolder); - } - - g_list_free (folder->subfolders); - folder->subfolders = NULL; - } - - g_hash_table_remove (folder_tree->path_to_folder, folder->path); - g_hash_table_remove (folder_tree->data_to_path, folder->data); - - 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); - new->data_to_path = g_hash_table_new (g_direct_hash, g_direct_equal); - - root_folder = folder_new (G_DIR_SEPARATOR_S, NULL); - g_hash_table_insert (new->path_to_folder, root_folder->path, root_folder); - g_hash_table_insert (new->data_to_path, root_folder->data, root_folder->path); - - 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_hash_table_destroy (folder_tree->data_to_path); - - 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; - const char *existing_path; - 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 ("e_folder_tree_add() -- Trying to add a subfolder to a path that does not exist yet -- %s", - parent_path); - return FALSE; - } - - folder = g_hash_table_lookup (folder_tree->path_to_folder, path); - if (folder != NULL) { - g_warning ("e_folder_tree_add() -- Trying to add a subfolder for a path that already exists -- %s", - path); - return FALSE; - } - - existing_path = g_hash_table_lookup (folder_tree->data_to_path, data); - if (existing_path != NULL) { - g_warning ("e_folder_tree_add() -- Trying to add a folder with duplicate data -- %s", - 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_hash_table_insert (folder_tree->data_to_path, data, folder->path); - - 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); -} - - -/** - * e_folder_tree_get_path_for_data: - * @folder_tree: A pointer to an EFolderTree - * @data: The data for the folder for which the path is needed - * - * Look up the path for the specified @data. - * - * Return value: The path for the folder that holds that @data. - **/ -const char * -e_folder_tree_get_path_for_data (EFolderTree *folder_tree, - const void *data) -{ - g_return_val_if_fail (folder_tree != NULL, NULL); - g_return_val_if_fail (data != NULL, NULL); - - return (const char *) g_hash_table_lookup (folder_tree->data_to_path, data); -} diff --git a/shell/e-folder-tree.h b/shell/e-folder-tree.h deleted file mode 100644 index 8f3f7fe31e..0000000000 --- a/shell/e-folder-tree.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-tree.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include <glib.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); - -const char *e_folder_tree_get_path_for_data (EFolderTree *folder_tree, - const 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 97fb7b4c25..0000000000 --- a/shell/e-folder-type-registry.c +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-registry.c - * - * Copyright (C) 2000, 2001 Ximian, 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; - - char *display_name; - char *description; - - gboolean user_creatable; - - GList *exported_dnd_types; /* char * */ - GList *accepted_dnd_types; /* char * */ - - 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, - const char *display_name, - const char *description, - gboolean user_creatable, - int num_exported_dnd_types, - const char **exported_dnd_types, - int num_accepted_dnd_types, - const char **accepted_dnd_types) -{ - FolderType *new; - char *icon_path; - int i; - - new = g_new (FolderType, 1); - - new->name = g_strdup (name); - new->icon_name = g_strdup (icon_name); - new->display_name = g_strdup (display_name); - new->description = g_strdup (description); - - new->user_creatable = user_creatable; - - new->exported_dnd_types = NULL; - for (i = 0; i < num_exported_dnd_types; i++) - new->exported_dnd_types = g_list_prepend (new->exported_dnd_types, - g_strdup (exported_dnd_types[i])); - new->exported_dnd_types = g_list_reverse (new->exported_dnd_types); - - new->accepted_dnd_types = NULL; - for (i = 0; i < num_accepted_dnd_types; i++) - new->accepted_dnd_types = g_list_prepend (new->accepted_dnd_types, - g_strdup (accepted_dnd_types[i])); - new->accepted_dnd_types = g_list_reverse (new->accepted_dnd_types); - - 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); - g_free (folder_type->display_name); - g_free (folder_type->description); - - 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, - const char *display_name, - const char *description, - gboolean user_creatable, - int num_exported_dnd_types, - const char **exported_dnd_types, - int num_accepted_dnd_types, - const char **accepted_dnd_types) -{ - 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, - display_name, description, - user_creatable, - num_exported_dnd_types, exported_dnd_types, - num_accepted_dnd_types, accepted_dnd_types); - 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, - const char *display_name, - const char *description, - gboolean user_creatable, - int num_exported_dnd_types, - const char **exported_dnd_types, - int num_accepted_dnd_types, - const char **accepted_dnd_types) -{ - 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, - display_name, description, user_creatable, - num_exported_dnd_types, exported_dnd_types, - num_accepted_dnd_types, accepted_dnd_types); -} - -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 ("e_folder_type_registry_get_icon_name_for_type() -- Unknown type `%s'", 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 ("e_folder_type_registry_get_icon_for_type() -- Unknown type `%s'", 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 ("e_folder_type_registry_get_handler_for_type() -- Unknown type `%s'", type_name); - return NULL; - } - - return folder_type->handler; -} - -gboolean -e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry, - const char *type_name) -{ - const FolderType *folder_type; - - 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); - - folder_type = get_folder_type (folder_type_registry, type_name); - if (folder_type == NULL) { - g_warning ("e_folder_type_registry_type_is_user_creatable() -- Unknown type `%s'", type_name); - return FALSE; - } - - return folder_type->user_creatable; -} - -const char * -e_folder_type_registry_get_display_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 ("e_folder_type_registry_type_get_display_name_for_type() -- Unknown type `%s'", type_name); - return FALSE; - } - - return folder_type->display_name; -} - -const char * -e_folder_type_registry_get_description_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 ("e_folder_type_registry_get_description_for_type() -- Unknown type `%s'", type_name); - return FALSE; - } - - return folder_type->description; -} - - -GList * -e_folder_type_registry_get_exported_dnd_types_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 ("e_folder_type_registry_get_exported_dnd_types_for_type() -- Unknown type `%s'", type_name); - return NULL; - } - - return folder_type->exported_dnd_types; -} - -GList * -e_folder_type_registry_get_accepted_dnd_types_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 ("e_folder_type_registry_get_accepted_dnd_types_for_type() -- Unknown type `%s'", type_name); - return NULL; - } - - return folder_type->accepted_dnd_types; -} - - -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 580bba4f41..0000000000 --- a/shell/e-folder-type-registry.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-registry.h - * - * Copyright (C) 2000 Ximian, 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_ - -#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, - const char *display_name, - const char *description, - gboolean user_creatable, - int num_exported_dnd_types, - const char **exported_dnd_types, - int num_accepted_dnd_types, - const char **accepted_dnd_types); -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); -gboolean e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry, - const char *type_name); -const char *e_folder_type_registry_get_display_name_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name); -const char *e_folder_type_registry_get_description_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name); - -GList *e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry, - const char *type_name); -GList *e_folder_type_registry_get_accepted_dnd_types_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 a73e0193f4..0000000000 --- a/shell/e-folder.c +++ /dev/null @@ -1,364 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.c - * - * Copyright (C) 2000 Ximian, 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-folder.h" - -#include <glib.h> -#include <gtk/gtksignal.h> - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _EFolderPrivate { - char *name; - char *type; - char *description; - char *physical_uri; - - int child_highlight; - int unread_count; - - int self_highlight : 1; - int is_stock : 1; -}; - -#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->child_highlight = 0; - priv->unread_count = 0; - priv->self_highlight = FALSE; - priv->is_stock = 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; -} - -int -e_folder_get_unread_count (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->unread_count; -} - -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->child_highlight || folder->priv->unread_count; -} - -gboolean -e_folder_get_is_stock (EFolder *folder) -{ - g_return_val_if_fail (folder != NULL, FALSE); - g_return_val_if_fail (E_IS_FOLDER (folder), FALSE); - - return folder->priv->is_stock; -} - - -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_unread_count (EFolder *folder, - gint unread_count) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->unread_count = unread_count; - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_child_highlight (EFolder *folder, - gboolean highlighted) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - if (highlighted) - folder->priv->child_highlight++; - else - folder->priv->child_highlight--; - - gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]); -} - -void -e_folder_set_is_stock (EFolder *folder, - gboolean is_stock) -{ - g_return_if_fail (folder != NULL); - g_return_if_fail (E_IS_FOLDER (folder)); - - folder->priv->is_stock = !! is_stock; - - 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 45e86c4064..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 Ximian, 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_ - -#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); -int e_folder_get_unread_count (EFolder *folder); -gboolean e_folder_get_highlighted (EFolder *folder); -gboolean e_folder_get_is_stock (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_unread_count (EFolder *folder, int unread_count); -void e_folder_set_child_highlight (EFolder *folder, gboolean highlighted); -void e_folder_set_is_stock (EFolder *folder, gboolean is_stock); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_H_ */ diff --git a/shell/e-gray-bar.c b/shell/e-gray-bar.c deleted file mode 100644 index 1a4c8a93f4..0000000000 --- a/shell/e-gray-bar.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-gray-bar.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-gray-bar.h" - -#include <gtk/gtkrc.h> -#include <gtk/gtktypeutils.h> -#include <gtk/gtkwidget.h> - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE gtk_event_box_get_type () -static GtkEventBoxClass *parent_class = NULL; - - -static void -endarken_style (GtkWidget *widget) -{ - GtkRcStyle *rc_style = gtk_rc_style_new(); - - rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG; - rc_style->bg[GTK_STATE_NORMAL].red = 0x8000; - rc_style->bg[GTK_STATE_NORMAL].green = 0x8000; - rc_style->bg[GTK_STATE_NORMAL].blue = 0x8000; - - gtk_widget_modify_style (widget, rc_style); - gtk_rc_style_unref (rc_style); -} - - -static void -impl_style_set (GtkWidget *widget, - GtkStyle *previous_style) -{ - static int in_style_set = 0; - - if (in_style_set > 0) - return; - - in_style_set ++; - - endarken_style (widget); - - in_style_set --; - - (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, previous_style); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - GtkWidgetClass *widget_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - widget_class = GTK_WIDGET_CLASS (object_class); - widget_class->style_set = impl_style_set; -} - -static void -init (EGrayBar *gray_bar) -{ -} - - -GtkWidget * -e_gray_bar_new (void) -{ - GtkWidget *new; - - new = gtk_type_new (e_gray_bar_get_type ()); - - return new; -} - - -E_MAKE_TYPE (e_gray_bar, "EGrayBar", EGrayBar, class_init, init, PARENT_TYPE) diff --git a/shell/e-gray-bar.h b/shell/e-gray-bar.h deleted file mode 100644 index 72a699ce0f..0000000000 --- a/shell/e-gray-bar.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-gray-bar.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_GRAY_BAR_H_ -#define _E_GRAY_BAR_H_ - -#include <gtk/gtkeventbox.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_GRAY_BAR (e_gray_bar_get_type ()) -#define E_GRAY_BAR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_GRAY_BAR, EGrayBar)) -#define E_GRAY_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_GRAY_BAR, EGrayBarClass)) -#define E_IS_GRAY_BAR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_GRAY_BAR)) -#define E_IS_GRAY_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_GRAY_BAR)) - - -typedef struct _EGrayBar EGrayBar; -typedef struct _EGrayBarPrivate EGrayBarPrivate; -typedef struct _EGrayBarClass EGrayBarClass; - -struct _EGrayBar { - GtkEventBox parent; -}; - -struct _EGrayBarClass { - GtkEventBoxClass parent_class; -}; - - -GtkType e_gray_bar_get_type (void); -GtkWidget *e_gray_bar_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_GRAY_BAR_H_ */ diff --git a/shell/e-local-folder.c b/shell/e-local-folder.c deleted file mode 100644 index 49fdc0ff22..0000000000 --- a/shell/e-local-folder.c +++ /dev/null @@ -1,558 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.c - * - * Copyright (C) 2000 Ximian, 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> - - <name>Inbox</name> - <name locale="it">Posta in Arrivo</name> - - <description>This is the default folder for incoming messages</description> - <description locale="it">Cartella che contiene i messaggi in arrivo</description> - - <homepage>http://www.somewhere.net</homepage> - </efolder> - - FIXME: Do we want to use a namespace for this? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <unistd.h> - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> - -#include <libgnome/gnome-util.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 - -/* This provides the name and the description for a specific locale. */ -struct _I18nInfo { - char *language_id; - char *name; - char *description; -}; -typedef struct _I18nInfo I18nInfo; - -struct _ELocalFolderPrivate { - GHashTable *language_id_to_i18n_info; -}; - - -/* Locale information. */ - -static char *global_language_id = NULL; - - -/* I18nInfo handling. */ - -static I18nInfo * -i18n_info_new (const char *language_id, - const char *name, - const char *description) -{ - I18nInfo *info; - - info = g_new (I18nInfo, 1); - info->language_id = g_strdup (language_id); - info->name = g_strdup (name); - info->description = g_strdup (description); - - return info; -} - -static void -i18n_info_free (I18nInfo *info) -{ - g_free (info->language_id); - g_free (info->name); - g_free (info->description); - - g_free (info); -} - - -/* Language ID -> I18nInfo hash table handling. */ - -static void -add_i18n_info_to_hash (GHashTable *language_id_to_i18n_info_hash, - I18nInfo *i18n_info) -{ - I18nInfo *existing_i18n_info; - - existing_i18n_info = (I18nInfo *) g_hash_table_lookup (language_id_to_i18n_info_hash, - i18n_info->language_id); - if (existing_i18n_info != NULL) { - g_hash_table_remove (language_id_to_i18n_info_hash, - i18n_info->language_id); - i18n_info_free (existing_i18n_info); - } - - g_hash_table_insert (language_id_to_i18n_info_hash, i18n_info->language_id, i18n_info); -} - -static void -language_id_to_i18n_info_hash_foreach_free (void *key, - void *value, - void *data) -{ - i18n_info_free ((I18nInfo *) value); -} - -static I18nInfo * -get_i18n_info_for_language (ELocalFolder *local_folder, - const char *language_id) -{ - ELocalFolderPrivate *priv; - I18nInfo *i18n_info; - - priv = local_folder->priv; - - if (language_id == NULL) - language_id = global_language_id; - - i18n_info = g_hash_table_lookup (priv->language_id_to_i18n_info, language_id); - - /* For locale info like `en_UK@yadda', we try to use `en' as a backup. */ - /* Note: this is exactly the same thing that gnome-config does with the - I18N value handling. I hope it works. */ - if (i18n_info == NULL) { - size_t n; - - n = strcspn (language_id, "@_"); - if (language_id[n] != '\0') { - char *simplified_language_id; - - simplified_language_id = g_strndup (language_id, n); - i18n_info = g_hash_table_lookup (priv->language_id_to_i18n_info, - simplified_language_id); - } - } - - return i18n_info; -} - - -/* Locale handling. */ - -static void -setup_global_language_id (void) -{ - /* FIXME: Implement. */ - global_language_id = "C"; -} - -/* Update the EFolder attributes according to the current locale. */ -static void -update_for_global_locale (ELocalFolder *local_folder) -{ - I18nInfo *i18n_info; - - i18n_info = get_i18n_info_for_language (local_folder, NULL); - - if (i18n_info == NULL) - i18n_info = get_i18n_info_for_language (local_folder, "C"); - - g_assert (i18n_info != NULL); - - e_folder_set_name (E_FOLDER (local_folder), i18n_info->name); - e_folder_set_description (E_FOLDER (local_folder), i18n_info->description); -} - - -/* XML tree handling. */ - -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, TRUE); - retval = g_strdup ((char *) xml_string); - xmlFree (xml_string); - - return retval; -} - -static void -retrieve_info_item (ELocalFolder *local_folder, - xmlNode *node) -{ - xmlChar *lang; - char *name; - char *description; - - lang = xmlGetProp (node, "lang"); - name = get_string_value (node, "name"); - description = get_string_value (node, "description"); - - if (lang == NULL) { - e_local_folder_add_i18n_info (local_folder, "C", name, description); - } else { - e_local_folder_add_i18n_info (local_folder, lang, name, description); - xmlFree (lang); - } - - g_free (name); - g_free (description); -} - -static void -retrieve_info (ELocalFolder *local_folder, - xmlNode *root_xml_node) -{ - ELocalFolderPrivate *priv; - xmlNode *p; - - priv = local_folder->priv; - - for (p = root_xml_node->childs; p != NULL; p = p->next) { - if (xmlStrcmp (p->name, "info") == 0) - retrieve_info_item (local_folder, p); - } -} - -static gboolean -construct_loading_metadata (ELocalFolder *local_folder, - const char *path) -{ - EFolder *folder; - xmlDoc *doc; - xmlNode *root; - char *type; - char *metadata_path; - char *physical_uri; - - folder = E_FOLDER (local_folder); - - metadata_path = g_concat_dir_and_file (path, E_LOCAL_FOLDER_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"); - if (type == NULL) { - g_free (metadata_path); - xmlFreeDoc (doc); - return FALSE; - } - - e_local_folder_construct (local_folder, g_basename (path), type, NULL); - g_free (type); - - retrieve_info (local_folder, root); - - 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) - xmlNewTextChild (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, E_LOCAL_FOLDER_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) -{ - ELocalFolder *local_folder; - ELocalFolderPrivate *priv; - - local_folder = E_LOCAL_FOLDER (object); - priv = local_folder->priv; - - g_hash_table_foreach (priv->language_id_to_i18n_info, - language_id_to_i18n_info_hash_foreach_free, - NULL); - g_hash_table_destroy (priv->language_id_to_i18n_info); - - g_free (priv); - - (* 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; - - setup_global_language_id (); -} - -static void -init (ELocalFolder *local_folder) -{ - ELocalFolderPrivate *priv; - - priv = g_new (ELocalFolderPrivate, 1); - priv->language_id_to_i18n_info = g_hash_table_new (g_str_hash, g_str_equal); - - local_folder->priv = priv; -} - - -void -e_local_folder_construct (ELocalFolder *local_folder, - const char *name, - const char *type, - const char *description) -{ - ELocalFolderPrivate *priv; - I18nInfo *i18n_info; - - 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); - - priv = local_folder->priv; - - e_folder_construct (E_FOLDER (local_folder), name, type, description); - - i18n_info = i18n_info_new ("C", name, description); - add_i18n_info_to_hash (priv->language_id_to_i18n_info, i18n_info); -} - -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_local_folder_add_i18n_info: - * @local_folder: A pointer to an ELocalFolder object - * @language_id: An I1I8N locale ID - * @name: Name for @local_folder in the specified @language_id - * @description: Description for @local_folder in the specified @language_id - * - * Set the @name and @description for the specified @language_id locale. - **/ -void -e_local_folder_add_i18n_info (ELocalFolder *local_folder, - const char *language_id, - const char *name, - const char *description) -{ - ELocalFolderPrivate *priv; - I18nInfo *info; - - g_return_if_fail (local_folder != NULL); - g_return_if_fail (E_IS_LOCAL_FOLDER (local_folder)); - g_return_if_fail (language_id != NULL); - g_return_if_fail (name != NULL || description != NULL); - - priv = local_folder->priv; - - info = i18n_info_new (language_id, name, description); - add_i18n_info_to_hash (priv->language_id_to_i18n_info, info); - - update_for_global_locale (local_folder); -} - -/** - * e_local_folder_get_i18n_info: - * @local_folder: A pointer to an ELocalFolder object - * @language_id: The ID of the language whose locale we want to retrieve name - * and description for - * @language_id_return: The actual locale ID that the name and description are - * saved under (e.g. if you ask for an "en_UK@yadda", we might give you the - * info for just "en") - * @name_return: A pointer to a pointer that will point to the i18nized name on - * return. Can be NULL. - * @description_return: A pointer to a pointer that will point to the i18n - * description on return. Can be NULL. - * - * Retrieve the name and description for @local_folder in the specified locale. - * - * Return value: %TRUE if some info is found for that @language_id, %FALSE - * otherwise. - **/ -gboolean -e_local_folder_get_i18n_info (ELocalFolder *local_folder, - const char *language_id, - const char **language_id_return, - const char **name_return, - const char **description_return) -{ - ELocalFolderPrivate *priv; - I18nInfo *i18n_info; - - 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 (language_id != NULL, FALSE); - - priv = local_folder->priv; - - i18n_info = get_i18n_info_for_language (local_folder, language_id); - - if (i18n_info == NULL) { - if (language_id_return != NULL) - *language_id_return = NULL; - if (name_return != NULL) - *name_return = NULL; - if (description_return != NULL) - *description_return = NULL; - - return FALSE; - } - - if (language_id_return != NULL) - *language_id_return = i18n_info->language_id; - if (name_return != NULL) - *name_return = i18n_info->name; - if (description_return != NULL) - *description_return = i18n_info->description; - - return TRUE; -} - - -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 b41e0608ab..0000000000 --- a/shell/e-local-folder.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.h - * - * Copyright (C) 2000, 2001 Ximian, 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_ - -#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)) - -#define E_LOCAL_FOLDER_METADATA_FILE_NAME "folder-metadata.xml" -#define E_LOCAL_FOLDER_METADATA_FILE_NAME_LEN 19 - -typedef struct _ELocalFolder ELocalFolder; -typedef struct _ELocalFolderClass ELocalFolderClass; -typedef struct _ELocalFolderPrivate ELocalFolderPrivate; - -struct _ELocalFolder { - EFolder parent; - - ELocalFolderPrivate *priv; -}; - -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); - -void e_local_folder_add_i18n_info (ELocalFolder *local_folder, - const char *language_id, - const char *name, - const char *description); -gboolean e_local_folder_get_i18n_info (ELocalFolder *local_folder, - const char *language_id, - const char **language_id_return, - const char **name_return, - const char **description_return); - -#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 94c7523756..0000000000 --- a/shell/e-local-storage.c +++ /dev/null @@ -1,1098 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.c - * - * Copyright (C) 2000, 2001 Ximian, 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. - */ - -#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 <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> -#include "e-util/e-path.h" -#include "e-util/e-unicode-i18n.h" -#include "e-local-folder.h" - -#include "evolution-storage.h" - -#include "e-local-storage.h" - -#include <bonobo/bonobo-exception.h> - -#define PARENT_TYPE E_TYPE_STORAGE -static EStorageClass *parent_class = NULL; - -struct _ELocalStoragePrivate { - EFolderTypeRegistry *folder_type_registry; - char *base_path; - EvolutionStorage *bonobo_interface; -}; - - -/* EStorageResult <-> errno mapping. */ - -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; - } -} - - -/* Utility functions. */ - -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_unread_count (folder)); -} - -static gboolean -setup_folder_as_stock (ELocalStorage *local_storage, - const char *path, - const char *name) -{ - EFolder *folder; - - folder = e_storage_get_folder (E_STORAGE (local_storage), path); - if (folder == NULL) - return FALSE; - - e_folder_set_name (folder, name); - e_folder_set_is_stock (folder, TRUE); - - return TRUE; -} - -static void -setup_stock_folders (ELocalStorage *local_storage) -{ - setup_folder_as_stock (local_storage, "/Calendar", U_("Calendar")); - setup_folder_as_stock (local_storage, "/Contacts", U_("Contacts")); - setup_folder_as_stock (local_storage, "/Drafts", U_("Drafts")); - setup_folder_as_stock (local_storage, "/Inbox", U_("Inbox")); - setup_folder_as_stock (local_storage, "/Outbox", U_("Outbox")); - setup_folder_as_stock (local_storage, "/Sent", U_("Sent")); - setup_folder_as_stock (local_storage, "/Tasks", U_("Tasks")); - setup_folder_as_stock (local_storage, "/Trash", U_("Trash")); -} - -static gboolean -load_folder (const char *physical_path, const char *path, gpointer data) -{ - ELocalStorage *local_storage = data; - EFolder *folder; - - folder = e_local_folder_new_from_path (physical_path); - if (folder == NULL) { - g_warning ("No folder metadata in %s... ignoring", physical_path); - return TRUE; - } - - new_folder (local_storage, path, folder); - return TRUE; -} - -static gboolean -load_all_folders (ELocalStorage *local_storage) -{ - const char *base_path; - - base_path = e_local_storage_get_base_path (local_storage); - - if (! e_path_find_folders (base_path, load_folder, local_storage)) - return FALSE; - - setup_stock_folders (local_storage); - - return TRUE; -} - - -/* Callbacks for the async methods invoked on the `Evolution::ShellComponent's. */ - -static void -notify_listener (const Bonobo_Listener listener, - EStorageResult result, - const char *physical_path) -{ - CORBA_any any; - GNOME_Evolution_Storage_FolderResult folder_result; - CORBA_Environment ev; - - folder_result.result = result; - folder_result.path = CORBA_string_dup (physical_path ? physical_path : ""); - any._type = TC_GNOME_Evolution_Storage_FolderResult; - any._value = &folder_result; - - CORBA_exception_init (&ev); - Bonobo_Listener_event (listener, "evolution-shell:folder_created", - &any, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Exception notifing listener: %s\n", - CORBA_exception_id (&ev)); - } - CORBA_exception_free (&ev); -} - -struct _AsyncCreateFolderCallbackData { - EStorage *storage; - Bonobo_Listener listener; - - 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; - EStorageResult storage_result; - - callback_data = (AsyncCreateFolderCallbackData *) data; - - storage_result = shell_component_result_to_storage_result (result); - - 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)); - storage_result = E_STORAGE_IOERROR; - } - } - - bonobo_object_unref (BONOBO_OBJECT (shell_component_client)); - - if (callback_data->listener != CORBA_OBJECT_NIL) - notify_listener (callback_data->listener, storage_result, - callback_data->physical_path); - - if (callback_data->callback != NULL) - (* callback_data->callback) (callback_data->storage, - storage_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); -} - - -/* Implementation for the folder operations. */ - -static EStorageResult -create_folder_directory (ELocalStorage *local_storage, - const char *path, - const char *type, - const char *description, - char **physical_path_return) -{ - EStorage *storage; - ELocalStoragePrivate *priv; - const char *folder_name; - char *physical_path; - - storage = E_STORAGE (local_storage); - priv = local_storage->priv; - - *physical_path_return = NULL; - g_assert (g_path_is_absolute (path)); - - folder_name = g_basename (path); - - if (folder_name != path + 1) { - char *subfolders_directory_physical_path; - char *parent_path; - - /* Create the `subfolders' subdirectory under the parent. */ - - parent_path = g_strndup (path, folder_name - path); - subfolders_directory_physical_path = e_path_to_physical (priv->base_path, parent_path); - g_free (parent_path); - - if (! g_file_exists (subfolders_directory_physical_path)) { - if (mkdir (subfolders_directory_physical_path, 0700) == -1) { - g_free (subfolders_directory_physical_path); - return errno_to_storage_result (); - } - } - g_free (subfolders_directory_physical_path); - } - - physical_path = e_path_to_physical (priv->base_path, path); - - /* Create the directory that holds the folder. */ - - *physical_path_return = physical_path; - if (mkdir (physical_path, 0700) == -1) { - return errno_to_storage_result (); - } - - return E_STORAGE_OK; -} - -static void -create_folder (ELocalStorage *local_storage, - const Bonobo_Listener listener, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - EStorage *storage; - ELocalStoragePrivate *priv; - EvolutionShellComponentClient *component_client; - AsyncCreateFolderCallbackData *callback_data; - EStorageResult result; - const char *folder_name; - char *physical_path; - char *physical_uri; - - storage = E_STORAGE (local_storage); - priv = local_storage->priv; - component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, - type); - if (component_client == NULL) { - if (listener != CORBA_OBJECT_NIL) - notify_listener (listener, E_STORAGE_INVALIDTYPE, NULL); - if (callback != NULL) - (* callback) (storage, E_STORAGE_INVALIDTYPE, data); - return; - } - - g_assert (g_path_is_absolute (path)); - - result = create_folder_directory (local_storage, path, type, description, &physical_path); - if (result != E_STORAGE_OK) { - if (callback != NULL) - (* callback) (storage, result, data); - if (listener != CORBA_OBJECT_NIL) - notify_listener (listener, result, NULL); - - g_free (physical_path); - return; - } - - folder_name = g_basename (path); - - /* 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 = E_STORAGE (local_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->listener = listener; - 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_uri, - type, - component_async_create_folder_callback, - callback_data); -} - -struct _AsyncRemoveFolderCallbackData { - EStorage *storage; - - char *path; - char *physical_path; -}; -typedef struct _AsyncRemoveFolderCallbackData AsyncRemoveFolderCallbackData; - -static EStorageResult -remove_folder_directory (ELocalStorage *local_storage, - const char *path) -{ - EStorage *storage; - ELocalStoragePrivate *priv; - const char *folder_name; - char *file_name; - char *physical_path; - - priv = local_storage->priv; - - storage = E_STORAGE (local_storage); - folder_name = g_basename (path); - - /* Delete the metadata file associated with this folder. */ - physical_path = e_path_to_physical (priv->base_path, path); - file_name = g_concat_dir_and_file (physical_path, E_LOCAL_FOLDER_METADATA_FILE_NAME); - unlink (file_name); - g_free (file_name); - - /* Delete the physical directory. */ - if (rmdir (physical_path) == -1) { - g_free (physical_path); - return E_STORAGE_GENERICERROR; - } - - g_free (physical_path); - - /* Delete the 'subfolders' directory that this folder lies in */ - if (folder_name != path + 1) { - char *subfolders_directory_physical_path; - char *parent_path; - - parent_path = g_strndup (path, folder_name - path); - subfolders_directory_physical_path = e_path_to_physical (priv->base_path, parent_path); - g_free (parent_path); - - rmdir (subfolders_directory_physical_path); - g_free (subfolders_directory_physical_path); - } - - return E_STORAGE_OK; -} - -static void -component_async_remove_folder_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result, - void *data) -{ - AsyncRemoveFolderCallbackData *callback_data; - EStorageResult storage_result; - - callback_data = (AsyncRemoveFolderCallbackData *) data; - - storage_result = shell_component_result_to_storage_result (result); - - /* If result == HASSUBFOLDERS then recurse delete the subfolders dir? */ - - /* FIXME: Handle errors */ - if (result == EVOLUTION_SHELL_COMPONENT_OK) { - ELocalStoragePrivate *priv; - - priv = E_LOCAL_STORAGE (callback_data->storage)->priv; - - result = remove_folder_directory (E_LOCAL_STORAGE (callback_data->storage), - callback_data->path); - - e_storage_removed_folder (E_STORAGE (callback_data->storage), - callback_data->path); - - evolution_storage_removed_folder (EVOLUTION_STORAGE (priv->bonobo_interface), - callback_data->path); - } - - bonobo_object_unref (BONOBO_OBJECT (shell_component_client)); - - g_free (callback_data->path); - g_free (callback_data->physical_path); - g_free (callback_data); -} - -static EStorageResult -remove_folder (ELocalStorage *local_storage, - const char *path, - const char *physical_uri) -{ - ELocalStoragePrivate *priv; - EStorage *storage; - AsyncRemoveFolderCallbackData *callback_data; - EvolutionShellComponentClient *component_client; - EFolder *folder; - char *physical_path, *physical_uri_mem = NULL; - GList *subfolder_paths; - GList *p; - - priv = local_storage->priv; - - storage = E_STORAGE (local_storage); - folder = e_storage_get_folder (storage, path); - - if (e_folder_get_is_stock (folder)) - return E_STORAGE_CANTCHANGESTOCKFOLDER; - - component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, - e_folder_get_type_string (folder)); - if (component_client == NULL) - return E_STORAGE_INVALIDTYPE; - - physical_path = e_path_to_physical (priv->base_path, path); - - if (!physical_uri) - physical_uri = physical_uri_mem = g_strconcat ("file://", physical_path, NULL); - - /* Recursively remove the subfolders */ - subfolder_paths = e_storage_get_subfolder_paths (storage, path); - - for (p = subfolder_paths; p; p = p->next) - remove_folder (local_storage, p->data, NULL); - - callback_data = g_new (AsyncRemoveFolderCallbackData, 1); - callback_data->storage = E_STORAGE (local_storage); - callback_data->path = g_strdup (path); - callback_data->physical_path = physical_path; - - bonobo_object_ref (BONOBO_OBJECT (component_client)); - - evolution_shell_component_client_async_remove_folder (component_client, - physical_uri, - e_folder_get_type_string (folder), - component_async_remove_folder_callback, - callback_data); - g_free (physical_uri_mem); - - return EVOLUTION_SHELL_COMPONENT_OK; -} - - -/* 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 const char * -impl_get_display_name (EStorage *storage) -{ - return U_("Local Folders"); -} - - -/* Creating folders. */ - -static void -impl_async_create_folder (EStorage *storage, - const char *path, - const char *type, - const char *description, - EStorageResultCallback callback, - void *data) -{ - ELocalStorage *local_storage; - - local_storage = E_LOCAL_STORAGE (storage); - - create_folder (local_storage, CORBA_OBJECT_NIL, path, type, description, callback, data); -} - - -/* Removing folders. */ - -static void -impl_async_remove_folder (EStorage *storage, - const char *path, - EStorageResultCallback callback, - void *data) -{ - ELocalStorage *local_storage; - EStorageResult result; - - local_storage = E_LOCAL_STORAGE (storage); - - result = remove_folder (local_storage, path, NULL); - - if (callback != NULL) - (* callback) (E_STORAGE (local_storage), result, data); -} - - - -/* Transferring folders. */ - -struct _XferItem { - char *source_path; - char *destination_path; -}; -typedef struct _XferItem XferItem; - -static XferItem * -xfer_item_new (char *source_path, - char *destination_path) -{ - XferItem *new; - - new = g_new (XferItem, 1); - new->source_path = source_path; - new->destination_path = destination_path; - - return new; -} - -static void -xfer_item_free (XferItem *item) -{ - g_free (item->source_path); - g_free (item->destination_path); - g_free (item); -} - -static void -append_xfer_item_list (EStorage *storage, - char *source_path, - char *destination_path, - GList **list) -{ - GList *subfolders; - GList *p; - - *list = g_list_prepend (*list, xfer_item_new (source_path, destination_path)); - - subfolders = e_storage_get_subfolder_paths (storage, source_path); - for (p = subfolders; p != NULL; p = p->next) { - char *source_subpath; - char *destination_subpath; - - source_subpath = g_strdup ((const char *) p->data); - destination_subpath = g_concat_dir_and_file (destination_path, - g_basename (source_subpath)); - - append_xfer_item_list (storage, source_subpath, destination_subpath, list); - } - - e_free_string_list (subfolders); -} - -struct _XferData { - /* The storage on which we are performing the xfer operation. */ - ELocalStorage *local_storage; - - /* List of source/destination path couples to copy, in the right - order. */ - GList *folder_items; - - /* Pointer into `folder_items'. The folder item pointed by this is the - one handled by the previous CORBA invocation. */ - GList *current_folder_item; - - /* Whether we want to remove the source too. */ - gboolean remove_source; - - /* The callback, with its data. */ - EStorageResultCallback callback; - void *callback_data; -}; -typedef struct _XferData XferData; - -static void -async_xfer_folder_step (ELocalStorage *local_storage, - const char *source_path, - const char *destination_path, - gboolean remove_source, - EvolutionShellComponentClientCallback component_client_callback, - void *component_client_callback_data) -{ - ELocalStoragePrivate *priv; - EFolder *source_folder; - EvolutionShellComponentClient *component_client; - char *physical_path; - char *physical_uri; - - priv = local_storage->priv; - - source_folder = e_storage_get_folder (E_STORAGE (local_storage), source_path); - g_assert (source_folder != NULL); - - create_folder_directory (local_storage, destination_path, - e_folder_get_type_string (source_folder), - e_folder_get_description (source_folder), - &physical_path); - - physical_uri = g_strconcat ("file://", physical_path, NULL); - g_free (physical_path); - - component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, - e_folder_get_type_string (source_folder)); - g_assert (component_client != NULL); - - evolution_shell_component_client_async_xfer_folder (component_client, - e_folder_get_physical_uri (source_folder), - physical_uri, - e_folder_get_type_string (source_folder), - remove_source, - component_client_callback, - component_client_callback_data); - - g_free (physical_uri); -} - -static void -async_xfer_folder_complete (XferData *xfer_data) -{ - ELocalStorage *local_storage; - GList *p; - - local_storage = xfer_data->local_storage; - - if (xfer_data->remove_source) { - EStorageResult result; - - /* Remove all the source physical directories, and also the - corresponding folders from the folder tree. */ - - for (p = g_list_last (xfer_data->folder_items); p != NULL; p = p->prev) { - XferItem *item; - - item = (XferItem *) p->data; - - result = remove_folder_directory (local_storage, item->source_path); - - /* FIXME handle failure differently? This should be n - unlikely situation. */ - if (result == E_STORAGE_OK) { - e_storage_removed_folder (E_STORAGE (local_storage), item->source_path); - - evolution_storage_removed_folder (EVOLUTION_STORAGE (local_storage->priv->bonobo_interface), - item->source_path); - } - } - } - - /* Free the data. */ - - for (p = xfer_data->folder_items; p != NULL; p = p->next) { - XferItem *item; - - item = (XferItem *) p->data; - xfer_item_free (item); - } - g_list_free (xfer_data->folder_items); - - g_free (xfer_data); -} - -static void -async_xfer_folder_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result, - void *callback_data) -{ - XferData *xfer_data; - XferItem *item; - EFolder *source_folder; - EFolder *destination_folder; - char *dest_physical_path; - char *new_physical_uri; - - /* FIXME handle errors. */ - - xfer_data = (XferData *) callback_data; - - item = (XferItem *) xfer_data->current_folder_item->data; - - source_folder = e_storage_get_folder (E_STORAGE (xfer_data->local_storage), item->source_path); - destination_folder = e_local_folder_new (e_folder_get_name (source_folder), - e_folder_get_type_string (source_folder), - e_folder_get_description (source_folder)); - - dest_physical_path = e_path_to_physical (xfer_data->local_storage->priv->base_path, item->destination_path); - new_physical_uri = g_strconcat ("file://", dest_physical_path, NULL); - g_free (dest_physical_path); - e_folder_set_physical_uri (destination_folder, new_physical_uri); - g_free (new_physical_uri); - - e_local_folder_save (E_LOCAL_FOLDER (destination_folder)); /* FIXME check for errors */ - new_folder (xfer_data->local_storage, item->destination_path, destination_folder); - - xfer_data->current_folder_item = xfer_data->current_folder_item->next; - if (xfer_data->current_folder_item == NULL) { - async_xfer_folder_complete (xfer_data); - return; - } - - item = (XferItem *) xfer_data->current_folder_item->data; - - async_xfer_folder_step (xfer_data->local_storage, - item->source_path, - item->destination_path, - xfer_data->remove_source, - async_xfer_folder_callback, - xfer_data); -} - -static void -impl_async_xfer_folder (EStorage *storage, - const char *source_path, - const char *destination_path, - gboolean remove_source, - EStorageResultCallback callback, - void *callback_data) -{ - ELocalStorage *local_storage; - ELocalStoragePrivate *priv; - XferData *xfer_data; - GList *folder_items; /* <XferItem> */ - XferItem *first_item; - - local_storage = E_LOCAL_STORAGE (storage); - priv = local_storage->priv; - - if (remove_source && e_folder_get_is_stock (e_storage_get_folder (storage, source_path))) - (* callback) (storage, E_STORAGE_CANTCHANGESTOCKFOLDER, callback_data); - - folder_items = NULL; - append_xfer_item_list (storage, g_strdup (source_path), g_strdup (destination_path), &folder_items); - folder_items = g_list_reverse (folder_items); /* lame */ - - xfer_data = g_new (XferData, 1); - xfer_data->local_storage = local_storage; - xfer_data->folder_items = folder_items; - xfer_data->current_folder_item = folder_items; - xfer_data->remove_source = remove_source; - xfer_data->callback = callback; - xfer_data->callback_data = callback_data; - - first_item = (XferItem *) xfer_data->folder_items->data; - - async_xfer_folder_step (E_LOCAL_STORAGE (storage), - first_item->source_path, - first_item->destination_path, - remove_source, - async_xfer_folder_callback, - xfer_data); -} - - -/* Callbacks for the `Evolution::Storage' interface we are exposing to the outside world. */ -static void -bonobo_interface_create_folder_cb (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *type, - const char *description, - const char *parent_path, - void *data) -{ - ELocalStorage *local_storage; - - local_storage = E_LOCAL_STORAGE (data); - - create_folder (local_storage, listener, path, type, description, NULL, NULL); -} - -static int -bonobo_interface_remove_folder_cb (EvolutionStorage *storage, - const char *path, - const char *physical_uri, - void *data) -{ - ELocalStorage *local_storage; - - local_storage = E_LOCAL_STORAGE (data); - - return remove_folder (local_storage, path, physical_uri); -} - -static void -bonobo_interface_update_folder_cb (EvolutionStorage *storage, - const char *path, - const char *display_name, - int unread_count, - 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_unread_count (folder, unread_count); - - return; -} - - -/* 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->get_display_name = impl_get_display_name; - storage_class->async_create_folder = impl_async_create_folder; - storage_class->async_remove_folder = impl_async_remove_folder; - storage_class->async_xfer_folder = impl_async_xfer_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), NULL, NULL); - - 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_storage_new (E_LOCAL_STORAGE_NAME, - NULL, NULL); - - gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "create_folder", - GTK_SIGNAL_FUNC (bonobo_interface_create_folder_cb), - local_storage); - gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "remove_folder", - GTK_SIGNAL_FUNC (bonobo_interface_remove_folder_cb), - local_storage); - 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 GNOME_Evolution_Storage -e_local_storage_get_corba_interface (ELocalStorage *local_storage) -{ - ELocalStoragePrivate *priv; - GNOME_Evolution_Storage 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 10ca804cb5..0000000000 --- a/shell/e-local-storage.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.h - * - * Copyright (C) 2000, 2001 Ximian, 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_ - -#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 GNOME_Evolution_Storage 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 9ca5bc35da..0000000000 --- a/shell/e-setup.c +++ /dev/null @@ -1,367 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-setup.c - * - * Copyright (C) 2000, 2001 Ximian, 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 <errno.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <dirent.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -#include <gtk/gtklabel.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-gui-utils.h> - -#include "e-local-folder.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; - - if (current->d_name[0] == '.' && - (current->d_name[1] == '\0' || - (current->d_name[1] == '.' && current->d_name[2] == '\0'))) { - current = readdir (def); - continue; - } - - /* Hack to not copy the old Executive-Summary dir */ - if (strcmp (current->d_name, "Executive-Summary") == 0) { - current = readdir (def); - continue; - } - - fullname = g_concat_dir_and_file (evolution_directory, - current->d_name); - fulldefaultname = g_concat_dir_and_file (current_directory, - current->d_name); - - 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) { - retval = TRUE; - goto out; - } - - 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); - - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE); - - result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - if (result != 0) { - retval = FALSE; - goto out; - } - - 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); - } - - if (retval == FALSE) - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Could not update files correctly")); - - out: - - for (l = newfiles; l; l = l->next) - g_free (l->data); - - g_list_free (newfiles); - g_free (defaultdir); - - return retval; -} - - -static gboolean -copy_default_stuff (const char *evolution_directory) -{ - gboolean retval; - char *command; - char *old_default_shortcuts_file; - - 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, - _("An error occurred in copying files into\n`%s'."), evolution_directory); - retval = FALSE; - } else { - retval = TRUE; - } - - /* Temporary block of code to keep it from using the older - shortcuts.xml that exists for current users in - $GNOME/share/evolution/default_user. Remove this by 1.0 */ - old_default_shortcuts_file = g_concat_dir_and_file (evolution_directory, - "shortcuts.xml"); - unlink (old_default_shortcuts_file); - g_free (old_default_shortcuts_file); - - g_free (command); - - return retval; -} - -static void -e_shell_rm_dir (const char *path) -{ - DIR *base; - struct stat statbuf; - struct dirent *contents; - - stat (path, &statbuf); - if (!S_ISDIR (statbuf.st_mode)) { - /* Not a directory */ - g_message ("Removing: %s", path); - unlink (path); - return; - } else { - g_message ("Opening: %s", path); - base = opendir (path); - - if (base == NULL) - return; - - contents = readdir (base); - while (contents != NULL) { - char *fullpath; - - if (strcmp (contents->d_name, ".") == 0|| - strcmp (contents->d_name, "..") ==0) { - contents = readdir (base); - continue; - } - - fullpath = g_concat_dir_and_file (path, contents->d_name); - e_shell_rm_dir (fullpath); - g_free (fullpath); - - contents = readdir (base); - } - - closedir (base); - rmdir (path); - } -} - - -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/local/Executive-Summary", evolution_directory); - if (stat (file, &statinfo) == 0) { - if (S_ISDIR (statinfo.st_mode)) { - GtkWidget *dialog; - - dialog = gnome_message_box_new (_("Evolution has detected an old\n" - "Executive-Summary directory.\n" - "This needs to be removed before\n" - "Evolution will run.\n" - "Do you want me to remove this directory?"), - GNOME_MESSAGE_BOX_INFO, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { - case 0: - e_shell_rm_dir (file); - break; - - default: - return FALSE; - } - } - } - - g_free (file); - - file = g_strdup_printf ("%s/searches.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); - - /* If the user has an old style trash folder, remove it so it gets - * replaced by the new vfolder-based trash folder. FIXME: This should - * go away at some point. */ - file = g_strdup_printf ("%s/local/Trash", evolution_directory); - if (stat (file, &statinfo) == 0 && S_ISDIR (statinfo.st_mode)) { - EFolder *local_folder; - - local_folder = e_local_folder_new_from_path (file); - if (local_folder != NULL - && strcmp (e_folder_get_type_string (local_folder), "mail") == 0) { - char *old = g_strdup_printf ("%s.old", file); - - rename (file, old); - g_free (old); - } - - gtk_object_unref (GTK_OBJECT (local_folder)); - } - 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 ba7bac5840..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 Ximian, 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 02744c0b9b..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 Ximian, 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-commands.c b/shell/e-shell-folder-commands.c deleted file mode 100644 index a9bc540ca3..0000000000 --- a/shell/e-shell-folder-commands.c +++ /dev/null @@ -1,599 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-commands.h - * - * Copyright (C) 2001 Ximian, 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-shell-folder-commands.h" - -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> - -#include <gtk/gtklabel.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkentry.h> - -#include "e-shell-constants.h" -#include "e-shell-folder-creation-dialog.h" -#include "e-shell-folder-selection-dialog.h" - - -/* Utility functions. */ - -static const char * -get_folder_name (EShell *shell, - const char *path) -{ - EStorageSet *storage_set; - EFolder *folder; - - storage_set = e_shell_get_storage_set (shell); - folder = e_storage_set_get_folder (storage_set, path); - - return e_folder_get_name (folder); -} - -static int -get_folder_unread (EShell *shell, - const char *path) -{ - EStorageSet *storage_set; - EFolder *folder; - - storage_set = e_shell_get_storage_set (shell); - folder = e_storage_set_get_folder (storage_set, path); - - return e_folder_get_unread_count (folder); -} - - -/* The data passed to the signals handled during the execution of the folder - commands. */ - -enum _FolderCommand { - FOLDER_COMMAND_COPY, - FOLDER_COMMAND_MOVE -}; -typedef enum _FolderCommand FolderCommand; - -struct _FolderCommandData { - EShell *shell; - EShellView *shell_view; - FolderCommand command; - char *source_path; - char *destination_path; -}; -typedef struct _FolderCommandData FolderCommandData; - -static FolderCommandData * -folder_command_data_new (EShell *shell, - EShellView *shell_view, - FolderCommand command, - const char *source_path, - const char *destination_path) -{ - FolderCommandData *new; - - new = g_new (FolderCommandData, 1); - new->shell = shell; - new->shell_view = shell_view; - new->command = command; - new->source_path = g_strdup (source_path); - new->destination_path = g_strdup (destination_path); - - return new; -} - -static void -folder_command_data_free (FolderCommandData *folder_command_data) -{ - g_free (folder_command_data->source_path); - g_free (folder_command_data->destination_path); - - g_free (folder_command_data); -} - - -/* Callback for the storage result. */ - -static void -xfer_result_callback (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - FolderCommandData *folder_command_data; - - folder_command_data = (FolderCommandData *) data; - - /* FIXME: do something. */ - - folder_command_data_free (folder_command_data); -} - - -/* The signals for the folder selection dialog. This used for the copy and - move commands. */ - -static void -folder_selection_dialog_folder_selected_callback (EShellFolderSelectionDialog *folder_selection_dialog, - const char *path, - void *data) -{ - FolderCommandData *folder_command_data; - EStorageSet *storage_set; - gboolean remove_source; - - folder_command_data = (FolderCommandData *) data; - - folder_command_data->destination_path = g_concat_dir_and_file (path, - g_basename (folder_command_data->source_path)); - - switch (folder_command_data->command) { - case FOLDER_COMMAND_COPY: - remove_source = FALSE; - break; - case FOLDER_COMMAND_MOVE: - remove_source = TRUE; - break; - default: - g_assert_not_reached (); - return; - } - - if (strcmp (folder_command_data->destination_path, - folder_command_data->source_path) == 0) { - const char *msg; - - if (remove_source) - msg = _("Cannot move a folder over itself."); - else - msg = _("Cannot copy a folder over itself."); - - e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, msg); - return; - } - - if (remove_source) { - int source_len; - - source_len = strlen (folder_command_data->source_path); - if (strncmp (folder_command_data->destination_path, - folder_command_data->source_path, - source_len) == 0) { - e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, - _("Cannot move a folder into one of its descendants.")); - return; - } - } - - storage_set = e_shell_get_storage_set (folder_command_data->shell); - - if (remove_source) - e_shell_view_remove_control_for_uri (folder_command_data->shell_view, - e_shell_view_get_current_uri (folder_command_data->shell_view)); - - e_storage_set_async_xfer_folder (storage_set, - folder_command_data->source_path, - folder_command_data->destination_path, - remove_source, - xfer_result_callback, - folder_command_data); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); - folder_command_data_free (folder_command_data); -} - -static void -folder_selection_dialog_cancelled_callback (EShellFolderSelectionDialog *folder_selection_dialog, - void *data) -{ - folder_command_data_free ((FolderCommandData *) data); -} - -static void -connect_folder_selection_dialog_signals (EShellFolderSelectionDialog *folder_selection_dialog, - FolderCommandData *folder_command_data) -{ - g_assert (folder_command_data != NULL); - - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected", - GTK_SIGNAL_FUNC (folder_selection_dialog_folder_selected_callback), - folder_command_data); - - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled", - GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_callback), - folder_command_data); -} - - -/* Create new folder. */ - -void -e_shell_command_create_new_folder (EShell *shell, - EShellView *shell_view) -{ - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && E_IS_SHELL_VIEW (shell_view)); - - /* FIXME: Should handle the result stuff. */ - e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), - e_shell_view_get_current_path (shell_view), - NULL /* result_callback */, - NULL /* result_callback_data */); -} - - -/* Open folder in other window. */ - -void -e_shell_command_open_folder_in_other_window (EShell *shell, - EShellView *shell_view) -{ - EShellView *view; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && E_IS_SHELL_VIEW (shell_view)); - - view = e_shell_create_view (shell, e_shell_view_get_current_uri (shell_view)); - - gtk_widget_show (GTK_WIDGET (view)); -} - - -/* Copy folder. */ - -void -e_shell_command_copy_folder (EShell *shell, - EShellView *shell_view) -{ - GtkWidget *folder_selection_dialog; - FolderCommandData *data; - const char *current_path; - const char *current_uri; - char *caption; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && E_IS_SHELL_VIEW (shell_view)); - - current_path = e_shell_view_get_current_path (shell_view); - - if (current_path == NULL) { - g_warning ("Called `e_shell_command_copy_folder()' without a valid displayed folder"); - return; - } - - caption = g_strdup_printf (_("Specify a folder to copy folder \"%s\" into:"), - get_folder_name (shell, current_path)); - - current_uri = e_shell_view_get_current_uri (shell_view); - folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, - _("Copy folder"), - caption, - current_uri, - NULL); - - g_free (caption); - - data = folder_command_data_new (shell, shell_view, FOLDER_COMMAND_COPY, current_path, NULL); - connect_folder_selection_dialog_signals (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), - data); - - gtk_widget_show (folder_selection_dialog); -} - - -/* Move folder. */ - -void -e_shell_command_move_folder (EShell *shell, - EShellView *shell_view) -{ - GtkWidget *folder_selection_dialog; - FolderCommandData *data; - const char *current_path; - const char *current_uri; - char *caption; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - current_path = e_shell_view_get_current_path (shell_view); - if (current_path == NULL) { - g_warning ("Called `e_shell_command_move_folder()' without a valid displayed folder"); - return; - } - - caption = g_strdup_printf (_("Specify a folder to move folder \"%s\" into:"), - get_folder_name (shell, current_path)); - - current_uri = e_shell_view_get_current_uri (shell_view); - folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, - _("Move folder"), - caption, - current_uri, - NULL); - - g_free (caption); - - data = folder_command_data_new (shell, shell_view, FOLDER_COMMAND_MOVE, current_path, NULL); - connect_folder_selection_dialog_signals (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), - data); - - gtk_widget_show (folder_selection_dialog); -} - -static void -delete_cb (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - if (result != E_STORAGE_OK) - e_notice (GTK_WINDOW (shell_view), GNOME_MESSAGE_BOX_ERROR, - _("Cannot delete folder:\n%s"), e_storage_result_to_string (result)); -} - -static int -delete_dialog (EShellView *shell_view, const char *utf8_folder) -{ - GnomeDialog *dialog; - char *title; - GtkWidget *question_label; - char *question; - char *folder_name; - - /* Popup a dialog asking if they are sure they want to delete - the folder */ - folder_name = e_utf8_to_gtk_string (GTK_WIDGET (shell_view), - (char *)utf8_folder); - title = g_strdup_printf (_("Delete folder '%s'"), folder_name); - - dialog = GNOME_DIALOG (gnome_dialog_new (title, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL)); - g_free (title); - gnome_dialog_set_parent (dialog, GTK_WINDOW (shell_view)); - - /* "Are you sure..." label */ - question = g_strdup_printf (_("Are you sure you want to remove the '%s' folder?"), - folder_name); - question_label = gtk_label_new (question); - gtk_widget_show (question_label); - - gtk_box_pack_start (GTK_BOX (dialog->vbox), question_label, FALSE, TRUE, 2); - g_free (folder_name); - g_free (question); - - gnome_dialog_set_default (dialog, 1); - - return gnome_dialog_run_and_close (dialog); -} - -void -e_shell_command_delete_folder (EShell *shell, - EShellView *shell_view) -{ - EStorageSet *storage_set; - char *path; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - storage_set = e_shell_get_storage_set (shell); - path = g_strdup (e_shell_view_get_current_path (shell_view)); - - if (delete_dialog (shell_view, get_folder_name (shell, path)) == 0) { - /* Remove and destroy the control */ - e_shell_view_remove_control_for_uri (shell_view, - e_shell_view_get_current_uri (shell_view)); - - /* Remove the folder */ - e_storage_set_async_remove_folder (storage_set, - path, - delete_cb, - shell_view); - - /* Select another folder to prevent bad things from happening */ - e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); - } - - g_free (path); -} - -#if 0 -static void -rename_clicked (GtkWidget *dialog, gint button_num, void *data) -{ - char **retval = data; - GtkWidget *entry; - - entry = gtk_object_get_data (GTK_OBJECT (dialog), "entry"); - *retval = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); -} -#endif - -#if 0 -static char * -rename_dialog (char *folder_name) -{ - GnomeDialog *dialog; - int result; - char *title; - GtkWidget *hbox; - char *label; - GtkWidget *prompt_label; - GtkWidget *entry; - char *question; - char *retval; - - /* Popup a dialog asking what the user would like to rename - the folder to */ - title = g_strdup_printf (_("Rename folder '%s'"), - folder_name); - - dialog = GNOME_DIALOG (gnome_dialog_new (title, - _("Rename"), - GNOME_STOCK_BUTTON_CANCEL, - NULL)); - g_free (title); - - hbox = gtk_hbox_new (FALSE, 2); - - /* Make, pack the label */ - label = g_strdup_printf (_("Folder name:")); - prompt_label = gtk_label_new (label); - gtk_box_pack_start (GTK_BOX (hbox), prompt_label, FALSE, TRUE, 2); - - /* Make, setup, pack the entry */ - entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), folder_name); - gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, TRUE, 2); - - gtk_widget_show (GTK_WIDGET (prompt_label)); - gtk_widget_show (GTK_WIDGET (entry)); - gtk_widget_show (GTK_WIDGET (hbox)); - - gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, FALSE, TRUE, 2); - - gtk_object_set_data (GTK_OBJECT (dialog), "entry", entry); - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - rename_clicked, &retval); - - gnome_dialog_set_default (dialog, 1); - - result = gnome_dialog_run_and_close (dialog); - - return retval; -} -#endif - - - -#if 0 -static void -rename_cb (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - /* FIXME: Do something? */ -} -#endif - -#if 0 -void -e_shell_command_rename_folder (EShell *shell, - EShellView *shell_view) -{ - EStorageSet *storage_set; - char *oldname; - char *newname; - - char *path; - char *newpath; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - storage_set = e_shell_get_storage_set (shell); - path = g_strdup (e_shell_view_get_current_path (shell_view)); - - oldname = get_folder_name (shell, path); - newname = rename_dialog (oldname); - - if (strcmp (oldname, newname)) { - /* FIXME: Doing strstr isn't robust enough, will fail - when path is /blah/blah, do looped strchr for '/' */ - char *tmp = strstr (path, oldname); - char *tmp2; - - tmp2 = g_strndup (path, strlen (path) - strlen (tmp)); - - newpath = g_strconcat (tmp2, newname, NULL); - - printf ("newpath: %s\n", newpath); - - g_free (tmp2); - g_free (tmp); - -/* FIXME: newpath needs to be correct - e_storage_set_async_xfer_folder (storage_set, - oldpath, - newpath, - TRUE, - rename_cb, - NULL); -*/ - } - - g_free (path); -} -#endif - - -void -e_shell_command_add_to_shortcut_bar (EShell *shell, - EShellView *shell_view) -{ - EShortcuts *shortcuts; - EStorageSet *storage_set; - EFolder *folder; - int group_num; - const char *uri; - int unread_count; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - shortcuts = e_shell_get_shortcuts (shell); - group_num = e_shell_view_get_current_shortcuts_group_num (shell_view); - uri = e_shell_view_get_current_uri (shell_view); - - unread_count = get_folder_unread (shell, e_shell_view_get_current_path (shell_view)); - - storage_set = e_shell_get_storage_set (shell); - folder = e_storage_set_get_folder (storage_set, e_shell_view_get_current_path (shell_view)); - - e_shortcuts_add_shortcut (shortcuts, group_num, -1, uri, NULL, unread_count, e_folder_get_type_string (folder)); -} diff --git a/shell/e-shell-folder-commands.h b/shell/e-shell-folder-commands.h deleted file mode 100644 index 2a3f61d863..0000000000 --- a/shell/e-shell-folder-commands.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-commands.h - * - * Copyright (C) 2001 Ximian, 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_COMMANDS_H -#define E_SHELL_FOLDER_COMMANDS_H - -#include "e-shell.h" -#include "e-shell-view.h" - -void e_shell_command_create_new_folder (EShell *shell, EShellView *shell_view); - -void e_shell_command_open_folder_in_other_window (EShell *shell, EShellView *shell_view); - -void e_shell_command_copy_folder (EShell *shell, EShellView *shell_view); -void e_shell_command_move_folder (EShell *shell, EShellView *shell_view); -void e_shell_command_delete_folder (EShell *shell, EShellView *shell_view); -void e_shell_command_rename_folder (EShell *shell, EShellView *shell_view); - -void e_shell_command_add_to_shortcut_bar (EShell *shell, EShellView *shell_view); - -#endif diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c deleted file mode 100644 index 59d6468338..0000000000 --- a/shell/e-shell-folder-creation-dialog.c +++ /dev/null @@ -1,524 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000, 2001 Ximian, 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 <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.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; - - char *folder_path; - - EShellFolderCreationDialogCallback result_callback; - void *result_callback_data; -}; -typedef struct _DialogData DialogData; - -static void -dialog_data_destroy (DialogData *dialog_data) -{ - e_free_string_list (dialog_data->folder_types); - g_free (dialog_data->folder_path); - - g_free (dialog_data); -} - - -/* Callback for the asynchronous folder creation function. */ - -static void -async_create_cb (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - if (result == E_STORAGE_OK) { - /* Success! Tell the callback of this, then return */ - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS, - dialog_data->folder_path, - dialog_data->result_callback_data); - gtk_widget_destroy (dialog_data->dialog); - return; - } else if (result == E_STORAGE_EXISTS) { - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (dialog_data->storage_set_view), - dialog_data->folder_path); - } - - /* Tell the callback something failed, then popup a dialog - explaining how it failed */ - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_FAIL, - dialog_data->folder_path, - dialog_data->result_callback_data); - - 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, char **reason) -{ - const char *name; - - name = gtk_entry_get_text (entry); - - if (name == NULL || *name == '\0') { - *reason = _("No folder name specified."); - return FALSE; - } - - /* GtkEntry is broken - if you hit KP_ENTER you get a \r inserted... */ - if (strchr (name, '\r')) { - *reason = _("Folder name cannot contain the Return character."); - return FALSE; - } - - if (strchr (name, G_DIR_SEPARATOR) != NULL) { - *reason = _("Folder cannot contain the directory separator."); - return FALSE; - } - - if (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) { - *reason = _("'.' and '..' are reserved folder names."); - 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 *reason; - char *path; - - dialog_data = (DialogData *) data; - - if (button_number != 0) { - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL, - NULL, - dialog_data->result_callback_data); - gtk_widget_destroy (GTK_WIDGET (dialog)); - return; - } - - if (!entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry), &reason)) { - e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR, - _("The specified folder name is not valid: %s"), reason); - return; - } - - parent_path = e_storage_set_view_get_current_folder - (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - if (parent_path == NULL) { - if (dialog_data->result_callback != NULL) - (* dialog_data->result_callback) (dialog_data->shell, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL, - NULL, - dialog_data->result_callback_data); - gtk_widget_destroy (GTK_WIDGET (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; - } - - g_free (dialog_data->folder_path); - dialog_data->folder_path = path; - - e_storage_set_async_create_folder (storage_set, - path, - folder_type, - "", /* description */ - async_create_cb, dialog_data); -} - -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) -{ - DialogData *dialog_data; - const char *parent_path; - - dialog_data = (DialogData *) data; - - parent_path = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (dialog_data->storage_set_view)); - - if (parent_path != NULL - && GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE); - else - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, FALSE); -} - -static void -storage_set_view_folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - if (GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE); -} - -static void -storage_set_view_storage_selected_cb (EStorageSetView *storage_set_view, - const char *name, - void *data) -{ - DialogData *dialog_data; - - dialog_data = (DialogData *) data; - - if (GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0) - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE); -} - - -/* 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)); -} - -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, NULL/*XXX*/); - - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); - - 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); - e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll_frame), GTK_SHADOW_IN); - 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; -} - -struct _TypeWithDisplayName { - const char *type; - const char *display_name; -}; -typedef struct _TypeWithDisplayName TypeWithDisplayName; - -static int -type_with_display_name_compare_func (const void *a, const void *b) -{ - const TypeWithDisplayName *val_a, *val_b; - - val_a = (const TypeWithDisplayName *) a; - val_b = (const TypeWithDisplayName *) b; - - return g_strcasecmp (val_a->display_name, val_b->display_name); -} - -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 *types_with_display_names; - 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? */ - - types_with_display_names = NULL; - for (p = folder_types; p != NULL; p = p->next) { - TypeWithDisplayName *new; - - new = g_new (TypeWithDisplayName, 1); - new->type = p->data; - new->display_name = e_folder_type_registry_get_display_name_for_type (folder_type_registry, new->type); - - types_with_display_names = g_list_prepend (types_with_display_names, new); - } - - types_with_display_names = g_list_sort (types_with_display_names, type_with_display_name_compare_func); - - /* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */ - - default_item = 0; - i = 0; - for (p = types_with_display_names; p != NULL; p = p->next) { - const TypeWithDisplayName *type; - GtkWidget *menu_item; - - type = (const TypeWithDisplayName *) p->data; - - if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type->type)) - continue; - - menu_item = gtk_menu_item_new_with_label (type->display_name); - gtk_widget_show (menu_item); - gtk_menu_append (GTK_MENU (menu), menu_item); - - gtk_object_set_data_full (GTK_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free); - - if (strcmp (type->type, "mail") == 0) - default_item = i; - - i ++; - } - - for (p = types_with_display_names; p != NULL; p = p->next) - g_free (p->data); - g_list_free (types_with_display_names); - - 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, - EShellFolderCreationDialogCallback result_callback, - void *result_callback_data) -{ - 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; - dialog_data->folder_path = NULL; - dialog_data->result_callback = result_callback; - dialog_data->result_callback_data = result_callback_data; - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), dialog_data); - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), dialog_data); - - gtk_signal_connect (GTK_OBJECT (dialog_data->folder_name_entry), "changed", - GTK_SIGNAL_FUNC (folder_name_entry_changed_cb), dialog_data); - - gtk_signal_connect (GTK_OBJECT (dialog_data->storage_set_view), "folder_selected", - storage_set_view_folder_selected_cb, dialog_data); - gtk_signal_connect (GTK_OBJECT (dialog_data->storage_set_view), "storage_selected", - storage_set_view_storage_selected_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 b9c1b6b979..0000000000 --- a/shell/e-shell-folder-creation-dialog.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 Ximian, 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" - -enum _EShellFolderCreationDialogResult { - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_FAIL, - E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL -}; -typedef enum _EShellFolderCreationDialogResult EShellFolderCreationDialogResult; - -typedef void (* EShellFolderCreationDialogCallback) (EShell *shell, - EShellFolderCreationDialogResult result, - const char *path, - void *data); - -void e_shell_show_folder_creation_dialog (EShell *shell, - GtkWindow *parent, - const char *default_parent_folder, - EShellFolderCreationDialogCallback result_callback, - void *result_callback_data); - -#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 e113b540dc..0000000000 --- a/shell/e-shell-folder-selection-dialog.c +++ /dev/null @@ -1,520 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-selection-dialog.c - * - * Copyright (C) 2000, 2001 Ximian, 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; - - gboolean allow_creation; -}; - -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\n" - "the requested operation.")); - - return FALSE; -} - - -/* Folder creation dialog callback. */ - -static void -folder_creation_dialog_result_cb (EShell *shell, - EShellFolderCreationDialogResult result, - const char *path, - void *data) -{ - EShellFolderSelectionDialog *dialog; - EShellFolderSelectionDialogPrivate *priv; - - dialog = E_SHELL_FOLDER_SELECTION_DIALOG (data); - priv = dialog->priv; - - if (priv == NULL) { - g_warning ("dialog->priv is NULL, and should not be"); - return; - } - - if (result == E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS) - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), - path); -} - - -/* 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, - ETreePath path, - int col, - GdkEvent *event, - EShellFolderSelectionDialog *folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - - g_return_if_fail (folder_selection_dialog != NULL); - - 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)); - } - - gnome_dialog_close (GNOME_DIALOG (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)); - gnome_dialog_close (GNOME_DIALOG (dialog)); - } - break; - case 1: /* Cancel */ - gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[CANCELLED]); - gnome_dialog_close (GNOME_DIALOG (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, - folder_creation_dialog_result_cb, - dialog); - - 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; - priv->allow_creation = TRUE; - - 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); -} - -static void -folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - void *data) -{ - GnomeDialog *dialog; - - dialog = GNOME_DIALOG (data); - - gnome_dialog_set_sensitive (dialog, 0, TRUE); -} - -/** - * 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 - * @caption: A brief text to be put on top of the storage view - * @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 *caption, - const char *default_uri, - const char *allowed_types[]) -{ - EShellFolderSelectionDialogPrivate *priv; - GtkWidget *scroll_frame; - GtkWidget *caption_label; - int i; - char *filename; - - 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; - - /* Basic dialog setup. */ - - gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (folder_selection_dialog), 350, 300); - 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); - gnome_dialog_set_sensitive (GNOME_DIALOG (folder_selection_dialog), 0, FALSE); - - /* Make sure we get destroyed if the shell gets destroyed. */ - - priv->shell = shell; - gtk_signal_connect_object_while_alive (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (folder_selection_dialog)); - - /* Set up the label. */ - - if (caption != NULL) { - caption_label = gtk_label_new (caption); - gtk_widget_show (caption_label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (folder_selection_dialog)->vbox), - caption_label, FALSE, TRUE, 2); - } - - /* Set up the storage set and its view. */ - - 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, NULL /* No BonoboUIContainer */); - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), FALSE); - - /* Load the expanded state for this StorageSetView */ - filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_0", - e_shell_get_local_directory (priv->shell)); - - e_tree_load_expanded_state (E_TREE (priv->storage_set_view), - filename); - - g_free (filename); - - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "double_click", - GTK_SIGNAL_FUNC (dbl_click_cb), - folder_selection_dialog); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "folder_selected", - GTK_SIGNAL_FUNC (folder_selected_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_shadow_type (E_SCROLL_FRAME (scroll_frame), GTK_SHADOW_IN); - 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 (priv->storage_set_view); - gtk_widget_show (scroll_frame); - - GTK_WIDGET_SET_FLAGS (priv->storage_set_view, GTK_CAN_FOCUS); - gtk_widget_grab_focus (priv->storage_set_view); -} - -/** - * e_shell_folder_selection_dialog_new: - * @shell: The this folder selection dialog is for - * @title: Title of the window - * @caption: A brief text to be put on top of the storage view - * @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-`evolution:' URIs are - * considered to be physical URIs). - * - * Return value: - **/ -GtkWidget * -e_shell_folder_selection_dialog_new (EShell *shell, - const char *title, - const char *caption, - 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, caption, default_uri, allowed_types); - - return GTK_WIDGET (folder_selection_dialog); -} - - -/** - * e_shell_folder_selection_dialog_set_allow_creation: - * @folder_selection_dialog: An EShellFolderSelectionDialog widget - * @allow_creation: Boolean specifying whether the "New..." button should be - * displayed - * - * Specify whether @folder_selection_dialog should have a "New..." button to - * create a new folder or not. - **/ -void -e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog, - gboolean allow_creation) -{ - GList *button_list_item; - GtkWidget *button; - - g_return_if_fail (folder_selection_dialog != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog)); - - folder_selection_dialog->priv->allow_creation = !! allow_creation; - - button_list_item = g_list_nth (GNOME_DIALOG (folder_selection_dialog)->buttons, 2); - g_assert (button_list_item != NULL); - - button = GTK_WIDGET (button_list_item->data); - - if (allow_creation) - gtk_widget_show (button); - else - gtk_widget_hide (button); -} - -/** - * e_shell_folder_selection_dialog_get_allow_creation: - * @folder_selection_dialog: An EShellFolderSelectionDialog widget - * - * Get whether the "New..." button is displayed. - * - * Return value: %TRUE if the "New..." button is displayed, %FALSE otherwise. - **/ -gboolean -e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog) -{ - g_return_val_if_fail (folder_selection_dialog != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), FALSE); - - return folder_selection_dialog->priv->allow_creation; -} - - -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 7cf2ec259e..0000000000 --- a/shell/e-shell-folder-selection-dialog.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-selection-dialog.h - * - * Copyright (C) 2000 Ximian, 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 *caption, - const char *default_uri, - const char *allowed_types[]); -GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell, - const char *title, - const char *caption, - const char *default_uri, - const char *allowed_types[]); - -void e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog, - gboolean allow_creation); -gboolean e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog); - -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 f3ff94a6fe..0000000000 --- a/shell/e-shell-folder-title-bar.c +++ /dev/null @@ -1,710 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-title-bar.c - * - * Copyright (C) 2000, 2001 Ximian, 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/gtklabel.h> -#include <gtk/gtkpixmap.h> -#include <gtk/gtkrc.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-font.h> - -#include "widgets/misc/e-clipped-label.h" -#include "e-shell-constants.h" -#include "e-shell-folder-title-bar.h" - - -#define PARENT_TYPE GTK_TYPE_HBOX -static GtkHBox *parent_class = NULL; - -struct _EShellFolderTitleBarPrivate { - GdkPixbuf *icon; - GtkWidget *icon_widget; - - /* 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; - - /* Holds extra information that is to be shown to the left of the icon */ - GtkWidget *folder_bar_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 pixmap. */ - -static GtkWidget * -create_arrow_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_arrow_pixmap (widget); - - gtk_widget_show (button_arrow); - gtk_box_pack_start (GTK_BOX (widget), button_arrow, FALSE, TRUE, 2); - - priv->button_arrow = button_arrow; -} - - -#if 0 /* This code is kinda broken in some subtle way - I haven't been able to figure out. */ - -static void -label_realize_callback (GtkWidget *widget, - void *data) -{ - GtkStyle *style; - EFont *e_font; - GdkFont *bolded_font; - - g_assert (widget->style->font != NULL); - - style = gtk_style_copy (widget->style); - gtk_style_unref (widget->style); - widget->style = style; - - e_font = e_font_from_gdk_font (style->font); - bolded_font = e_font_to_gdk_font (e_font, E_FONT_BOLD); - e_font_unref (e_font); - - if (bolded_font != NULL) { - gdk_font_unref (style->font); - style->font = bolded_font; - } - - gtk_style_attach (style, widget->window); - - if (E_IS_CLIPPED_LABEL (widget)) { - char *text; - - text = g_strdup (e_clipped_label_get_text (E_CLIPPED_LABEL (widget))); - e_clipped_label_set_text (E_CLIPPED_LABEL (widget), text); - g_free (text); - } -} - -static void -make_bold (GtkWidget *widget) -{ - gtk_signal_connect (GTK_OBJECT (widget), "realize", - GTK_SIGNAL_FUNC (label_realize_callback), NULL); -} - -#endif - -static void -set_title_bar_label_style (GtkWidget *widget) -{ - GtkRcStyle *rc_style; - - rc_style = gtk_rc_style_new(); - - rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG; - rc_style->fg[GTK_STATE_NORMAL].red = 0xffff; - rc_style->fg[GTK_STATE_NORMAL].green = 0xffff; - rc_style->fg[GTK_STATE_NORMAL].blue = 0xffff; - - gtk_widget_modify_style (widget, rc_style); - gtk_rc_style_unref (rc_style); -} - - -/* Utility functions. */ - -static int -get_max_clipped_label_width (EClippedLabel *clipped_label) -{ - GdkFont *font; - int width; - - font = GTK_WIDGET (clipped_label)->style->font; - - width = gdk_string_width (font, clipped_label->label); - width += 2 * GTK_MISC (clipped_label)->xpad; - - return width; -} - -static void -size_allocate_icon (EShellFolderTitleBar *title_bar, - GtkAllocation *allocation, - int *available_width_inout) -{ - EShellFolderTitleBarPrivate *priv; - GtkRequisition icon_requisition; - GtkAllocation icon_allocation; - int border_width; - - priv = title_bar->priv; - - if (priv->icon_widget == NULL) - return; - - border_width = GTK_CONTAINER (title_bar)->border_width; - - gtk_widget_get_child_requisition (priv->icon_widget, &icon_requisition); - - icon_allocation.x = allocation->x + allocation->width - border_width - icon_requisition.width; - icon_allocation.y = allocation->y + border_width; - icon_allocation.width = icon_requisition.width; - icon_allocation.height = allocation->height - 2 * border_width; - - gtk_widget_size_allocate (priv->icon_widget, &icon_allocation); - - *available_width_inout -= icon_allocation.width; -} - -static void -size_allocate_button (EShellFolderTitleBar *title_bar, - GtkAllocation *allocation, - int *available_width_inout) -{ - EShellFolderTitleBarPrivate *priv; - GtkAllocation child_allocation; - GtkRequisition child_requisition; - int border_width; - - priv = title_bar->priv; - - border_width = GTK_CONTAINER (title_bar)->border_width; - - gtk_widget_get_child_requisition (priv->button, &child_requisition); - child_allocation.x = allocation->x + border_width; - child_allocation.y = allocation->y + border_width; - child_allocation.height = allocation->height - 2 * border_width; - - child_allocation.width = child_requisition.width; - child_allocation.width += get_max_clipped_label_width (E_CLIPPED_LABEL (priv->button_label)); - - child_allocation.width = MIN (child_allocation.width, *available_width_inout); - - gtk_widget_size_allocate (priv->button, & child_allocation); - - *available_width_inout -= child_allocation.width; -} - -static void -size_allocate_label (EShellFolderTitleBar *title_bar, - GtkAllocation *allocation, - int *available_width_inout) -{ - EShellFolderTitleBarPrivate *priv; - GtkAllocation child_allocation; - int border_width; - - priv = title_bar->priv; - - border_width = GTK_CONTAINER (title_bar)->border_width; - - child_allocation.x = allocation->x + border_width; - child_allocation.y = allocation->y + border_width; - child_allocation.height = allocation->height - 2 * border_width; - - child_allocation.width = MIN (get_max_clipped_label_width (E_CLIPPED_LABEL (priv->label)), - *available_width_inout); - - gtk_widget_size_allocate (priv->label, & child_allocation); - - *available_width_inout -= child_allocation.width; -} - -static void -add_icon_widget (EShellFolderTitleBar *folder_title_bar) -{ - EShellFolderTitleBarPrivate *priv; - GdkPixmap *pixmap; - GdkBitmap *mask; - - priv = folder_title_bar->priv; - - g_assert (priv->icon != NULL); - - gdk_pixbuf_render_pixmap_and_mask (priv->icon, &pixmap, &mask, 128); - - if (priv->icon_widget != NULL) - gtk_widget_destroy (priv->icon_widget); - - priv->icon_widget = gtk_pixmap_new (pixmap, mask); - - gdk_pixmap_unref (pixmap); - gdk_pixmap_unref (mask); - - gtk_misc_set_alignment (GTK_MISC (priv->icon_widget), 1.0, .5); - gtk_misc_set_padding (GTK_MISC (priv->icon_widget), 0, 0); - - gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->icon_widget, FALSE, TRUE, 2); - gtk_widget_show (priv->icon_widget); -} - - -/* 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)); -} - - -/* 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 != NULL) - gdk_pixbuf_unref (priv->icon); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* GTkWidget methods. */ - -static void -realize (GtkWidget *widget) -{ - EShellFolderTitleBar *folder_title_bar; - EShellFolderTitleBarPrivate *priv; - - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); - - folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (widget); - priv = folder_title_bar->priv; - - if (priv->icon != NULL) - add_icon_widget (E_SHELL_FOLDER_TITLE_BAR (widget)); -} - -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; - - if (priv->icon_widget != NULL) { - gtk_widget_destroy (priv->icon_widget); - priv->icon_widget = NULL; - } -} - -static void -size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EShellFolderTitleBar *title_bar; - EShellFolderTitleBarPrivate *priv; - GtkAllocation label_allocation; - int border_width; - int available_width; - int width_before_icon; - - title_bar = E_SHELL_FOLDER_TITLE_BAR (widget); - priv = title_bar->priv; - - border_width = GTK_CONTAINER (widget)->border_width; - available_width = allocation->width - 2 * border_width; - - size_allocate_icon (title_bar, allocation, & available_width); - width_before_icon = available_width; - - if (priv->clickable) - size_allocate_button (title_bar, allocation, & available_width); - else - size_allocate_label (title_bar, allocation, & available_width); - - label_allocation.x = allocation->x + width_before_icon - available_width - border_width; - label_allocation.y = allocation->y + border_width; - label_allocation.width = available_width - 2 * border_width; - label_allocation.height = allocation->height - 2 * border_width; - - gtk_widget_size_allocate (priv->folder_bar_label, & label_allocation); - - widget->allocation = *allocation; -} - - -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; - widget_class->size_allocate = size_allocate; - - 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->label = NULL; - priv->folder_bar_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 = e_clipped_label_new (""); - gtk_misc_set_padding (GTK_MISC (priv->label), 5, 0); - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); - set_title_bar_label_style (priv->label); - /* make_bold (priv->label); */ - - priv->button_label = e_clipped_label_new (""); - gtk_misc_set_padding (GTK_MISC (priv->button_label), 2, 0); - gtk_misc_set_alignment (GTK_MISC (priv->button_label), 0.0, 0.5); - gtk_widget_show (priv->button_label); - set_title_bar_label_style (priv->button_label); - /* make_bold (priv->label); */ - - priv->folder_bar_label = e_clipped_label_new (""); - gtk_misc_set_alignment (GTK_MISC (priv->folder_bar_label), 1.0, 0.5); - gtk_widget_show (priv->folder_bar_label); - set_title_bar_label_style (priv->folder_bar_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); - - gtk_container_set_border_width (GTK_CONTAINER (folder_title_bar), 2); - gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->label, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->folder_bar_label, TRUE, TRUE, 0); - - /* Make the label have a border as large as the button's. - FIXME: This is really hackish. The hardcoded numbers should be OK - as the padding is hardcoded in GtkButton too (see CHILD_SPACING in - gtkbutton.c). */ - gtk_misc_set_padding (GTK_MISC (priv->label), - GTK_WIDGET (priv->button)->style->klass->xthickness + 3, - GTK_WIDGET (priv->button)->style->klass->ythickness + 1); - - gtk_signal_connect (GTK_OBJECT (priv->button), "toggled", - GTK_SIGNAL_FUNC (title_button_toggled_cb), folder_title_bar); - - 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; - - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - gtk_widget_push_visual (gdk_rgb_get_visual ()); - new = gtk_type_new (e_shell_folder_title_bar_get_type ()); - - e_shell_folder_title_bar_construct (new); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - 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) { - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->button_label), _("(Untitled)")); - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->label), _("(Untitled)")); - } else { - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->button_label), title); - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->label), title); - } - - /* FIXME: There seems to be a bug in EClippedLabel, this is just a workaround. */ - gtk_widget_queue_resize (GTK_WIDGET (folder_title_bar)); -} - -/** - * e_shell_folder_title_bar_set_folder_bar_label: - * @folder_title_bar: - * @text: Some text to show in the label. - * - * Sets the right-justified text label (to the left of the icon) for - * the title bar. - **/ -void -e_shell_folder_title_bar_set_folder_bar_label (EShellFolderTitleBar *folder_title_bar, - const char *text) -{ - 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 (text == NULL) - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->folder_bar_label), ""); - else - e_clipped_label_set_text (E_CLIPPED_LABEL (priv->folder_bar_label), text); - - /* FIXME: Might want to set the styles somewhere in here too, - black text on grey background isn't the best combination */ - - gtk_widget_queue_resize (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; - - 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 != NULL) - gdk_pixbuf_unref (priv->icon); - priv->icon = (GdkPixbuf *) icon; - - if (priv->icon != NULL) - add_icon_widget (folder_title_bar); -} - - -/** - * 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_hide (priv->label); - gtk_widget_show (priv->button); - } 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 3a15280d75..0000000000 --- a/shell/e-shell-folder-title-bar.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-folder-title-bar.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <gtk/gtkhbox.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 { - GtkHBox parent; - - EShellFolderTitleBarPrivate *priv; -}; - -struct _EShellFolderTitleBarClass { - GtkHBoxClass 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_folder_bar_label (EShellFolderTitleBar *folder_title_bar, - const char *folder_bar_label); -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-importer.c b/shell/e-shell-importer.c deleted file mode 100644 index 55145ff962..0000000000 --- a/shell/e-shell-importer.c +++ /dev/null @@ -1,738 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* importer.c - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-finish.h> -#include <libgnomeui/gnome-druid-page-standard.h> -#include <libgnomeui/gnome-druid-page-start.h> -#include <libgnomeui/gnome-file-entry.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-dialog.h> - -#include <liboaf/liboaf.h> - -#include "e-shell.h" -#include "e-shell-view.h" -#include "e-local-storage.h" /* for E_LOCAL_STORAGE_NAME */ -#include "e-shell-folder-selection-dialog.h" - -#include "importer/evolution-importer-client.h" - -#include <glade/glade.h> -#include <gtkhtml/gtkhtml.h> -#include <gal/widgets/e-gui-utils.h> -#include <e-util/e-html-utils.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> - -#include "e-shell-importer.h" -#include "importer/GNOME_Evolution_Importer.h" - -typedef struct _ImportDialogFilePage { - GtkWidget *vbox; - GtkWidget *filename; - GtkWidget *filetype; - GtkWidget *menu; - - gboolean need_filename; -} ImportDialogFilePage; - -typedef struct _ImportData { - EShell *shell; - EShellView *view; - - GladeXML *wizard; - GtkWidget *dialog; - GtkWidget *druid; - ImportDialogFilePage *filepage; - GtkWidget *filedialog; - GtkWidget *vbox; - - char *choosen_iid; -} ImportData; - -/* - #define IMPORTER_DEBUG -*/ -#ifdef IMPORTER_DEBUG -#define IN g_print ("=====> %s (%d)\n", __FUNCTION__, __LINE__) -#define OUT g_print ("<==== %s (%d)\n", __FUNCTION__, __LINE__) -#else -#define IN -#define OUT -#endif - -/* Some HTML helper functions copied from mail/mail-config-druid.c */ -static struct { - char *name; - char *text; -} info[] = { - { "file_html", - N_("Choose the file that you want to import into Evolution, " - "and select what type of file it is from the list.\n\n" - "You can select \"Automatic\" if you do not know, and " - "Evolution will attempt to work it out.") - } -}; -static int num_info = (sizeof (info) / sizeof (info[0])); - -static void -html_size_req (GtkWidget *widget, - GtkRequisition *requisition) -{ - requisition->height = GTK_LAYOUT (widget)->height; -} - -static GtkWidget * -create_html (const char *name) -{ - GtkWidget *scrolled, *html; - GtkHTMLStream *stream; - GtkStyle *style; - char *utf8; - int i; - - html = gtk_html_new (); - GTK_LAYOUT (html)->height = 0; - gtk_signal_connect (GTK_OBJECT (html), "size_request", - GTK_SIGNAL_FUNC (html_size_req), NULL); - gtk_html_set_editable (GTK_HTML (html), FALSE); - style = gtk_rc_get_style (html); - if (!style) - style = gtk_widget_get_style (html); - if (style) { - gtk_html_set_default_background_color (GTK_HTML (html), - &style->bg[0]); - } - gtk_widget_show (html); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolled); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), html); - - for (i = 0; i < num_info; i++) { - if (!strcmp (name, info[i].name)) - break; - } - g_return_val_if_fail (i != num_info, scrolled); - - stream = gtk_html_begin_content (GTK_HTML (html), - "text/html; charset=utf-8"); - gtk_html_write (GTK_HTML (html), stream, "<html><p>", 9); - utf8 = e_utf8_from_locale_string (_(info[i].text)); - gtk_html_write (GTK_HTML (html), stream, utf8, strlen (utf8)); - g_free (utf8); - gtk_html_write (GTK_HTML (html), stream, "</p></html>", 11); - gtk_html_end (GTK_HTML (html), stream, GTK_HTML_STREAM_OK); - - return scrolled; -} - -/* Importing functions */ - -/* Data to be passed around */ -typedef struct _ImporterComponentData { - EvolutionImporterClient *client; - EvolutionImporterListener *listener; - char *filename; - - GnomeDialog *dialog; - GtkWidget *contents; - - int item; - - gboolean stop; - gboolean destroyed; -} ImporterComponentData; - -static gboolean importer_timeout_fn (gpointer data); -static void -import_cb (EvolutionImporterListener *listener, - EvolutionImporterResult result, - gboolean more_items, - void *data) -{ - ImporterComponentData *icd = (ImporterComponentData *) data; - char *label; - - IN; - if (icd->stop != TRUE) { - if (result == EVOLUTION_IMPORTER_NOT_READY) { - /* Importer isn't ready yet. - Wait 5 seconds and try again. */ - - label = g_strdup_printf (_("Importing %s\nImporter not ready." - "\nWaiting 5 seconds to retry."), - icd->filename); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - gtk_timeout_add (5000, importer_timeout_fn, data); - OUT; - return; - } - - if (result == EVOLUTION_IMPORTER_BUSY) { - gtk_timeout_add (5000, importer_timeout_fn, data); - OUT; - return; - } - - if (more_items) { - label = g_strdup_printf (_("Importing %s\nImporting item %d."), - icd->filename, ++(icd->item)); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - g_idle_add_full (G_PRIORITY_LOW, importer_timeout_fn, - data, NULL); - OUT; - return; - } - } - - g_free (icd->filename); - if (!icd->destroyed) - gtk_object_destroy (GTK_OBJECT (icd->dialog)); - bonobo_object_unref (BONOBO_OBJECT (icd->listener)); - gtk_object_unref (GTK_OBJECT (icd->client)); - g_free (icd); - - OUT; -} - -static gboolean -importer_timeout_fn (gpointer data) -{ - ImporterComponentData *icd = (ImporterComponentData *) data; - char *label; - - IN; - label = g_strdup_printf (_("Importing %s\nImporting item %d."), - icd->filename, icd->item); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - evolution_importer_client_process_item (icd->client, icd->listener); - OUT; - return FALSE; -} - -static void -dialog_clicked_cb (GnomeDialog *dialog, - int button_number, - ImporterComponentData *icd) -{ - if (button_number != 0) - return; /* Interesting... */ - - icd->stop = TRUE; -} - -static void -dialog_destroy_cb (GtkObject *object, - ImporterComponentData *icd) -{ - icd->stop = TRUE; - icd->destroyed = TRUE; -} - -static char * -get_iid_for_filetype (const char *filename) -{ - OAF_ServerInfoList *info_list; - CORBA_Environment ev; - GList *can_handle = NULL, *l; - char *ret_iid; - int i, len = 0; - - CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); - - for (i = 0; i < info_list->_length; i++) { - CORBA_Environment ev2; - CORBA_Object importer; - const OAF_ServerInfo *info; - - info = info_list->_buffer + i; - - CORBA_exception_init (&ev2); - importer = oaf_activate_from_id ((char *) info->iid, 0, NULL, &ev2); - if (ev2._major != CORBA_NO_EXCEPTION) { - g_warning ("Error activating %s", info->iid); - CORBA_exception_free (&ev2); - continue; - } - - if (GNOME_Evolution_Importer_supportFormat (importer, - filename, &ev2)) { - can_handle = g_list_prepend (can_handle, - g_strdup (info->iid)); - len++; - } - - bonobo_object_release_unref (importer, &ev2); - CORBA_exception_free (&ev2); - } - CORBA_free (info_list); - - if (len == 1) { - ret_iid = can_handle->data; - g_list_free (can_handle); - return ret_iid; - } else if (len > 1) { - /* FIXME: Some way to choose between multiple iids */ - /* FIXME: Free stuff */ - g_warning ("Multiple iids can support %s", filename); - ret_iid = g_strdup (can_handle->data); - - for (l = can_handle; l; l = l->next) - g_free (l->data); - g_list_free (can_handle); - return ret_iid; - } else { - return NULL; - } -} - -static void -start_import (const char *folderpath, - const char *filename, - const char *iid) -{ - ImporterComponentData *icd; - char *label; - char *real_iid; - char *localpath; - struct stat buf; - - if (stat (filename, &buf) == -1) { - char *message; - - message = g_strdup_printf (_("File %s does not exist"), filename); - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, message); - g_free (message); - - return; - } - - /* Only allow importing to /local */ - localpath = "/" E_LOCAL_STORAGE_NAME "/"; - if (folderpath != NULL) { - if (strncmp (folderpath, localpath, strlen (localpath))) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("You may only import to local folders")); - return; - } - } - - if (iid == NULL || strcmp (iid, "Automatic") == 0) { - /* Work out the component to use */ - real_iid = get_iid_for_filetype (filename); - } else { - real_iid = g_strdup (iid); - } - - if (real_iid == NULL) { - char *message; - - message = g_strdup_printf (_("There is no importer that is able to handle\n%s"), filename); - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, message); - g_free (message); - - return; - } - - icd = g_new (ImporterComponentData, 1); - icd->stop = FALSE; - icd->destroyed = FALSE; - icd->dialog = GNOME_DIALOG (gnome_dialog_new (_("Importing"), - GNOME_STOCK_BUTTON_CANCEL, - NULL)); - gtk_signal_connect (GTK_OBJECT (icd->dialog), "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), icd); - gtk_signal_connect (GTK_OBJECT (icd->dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), icd); - - label = g_strdup_printf (_("Importing %s.\nStarting %s"), - filename, real_iid); - icd->contents = gtk_label_new (label); - g_free (label); - - gtk_box_pack_start (GTK_BOX (icd->dialog->vbox), icd->contents, - TRUE, TRUE, 0); - gtk_widget_show_all (GTK_WIDGET (icd->dialog)); - while (gtk_events_pending ()) - gtk_main_iteration (); - - icd->client = evolution_importer_client_new_from_id (real_iid); - if (icd->client == NULL) { - label = g_strdup_printf (_("Error starting %s"), real_iid); - g_free (real_iid); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - gtk_object_unref (GTK_OBJECT (icd->dialog)); - g_free (icd); - return; - } - g_free (real_iid); - - /* NULL for folderpath means use Inbox */ - if (*folderpath == '/') { - folderpath = strchr (folderpath + 1, '/'); - } - - if (evolution_importer_client_load_file (icd->client, filename, folderpath) == FALSE) { - label = g_strdup_printf (_("Error loading %s"), filename); - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, label); - - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - gtk_object_unref (GTK_OBJECT (icd->client)); - gtk_object_unref (GTK_OBJECT (icd->dialog)); - g_free (icd); - return; - } - - icd->filename = g_strdup (filename); - icd->item = 1; - - label = g_strdup_printf (_("Importing %s\nImporting item 1."), - filename); - gtk_label_set_text (GTK_LABEL (icd->contents), label); - g_free (label); - while (gtk_events_pending ()) - gtk_main_iteration (); - - icd->listener = evolution_importer_listener_new (import_cb, icd); - evolution_importer_client_process_item (icd->client, icd->listener); -} - -static void -filename_changed (GtkEntry *entry, - ImportData *data) -{ - ImportDialogFilePage *page; - char *filename; - - page = data->filepage; - - filename = gtk_entry_get_text (entry); - if (filename != NULL && *filename != '\0') - page->need_filename = FALSE; - else - page->need_filename = TRUE; - - gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid), - TRUE, !page->need_filename, TRUE); -} - -static const char * -get_name_from_component_info (const OAF_ServerInfo *info) -{ - OAF_Property *property; - const char *name; - - property = oaf_server_info_prop_find ((OAF_ServerInfo *) info, - "evolution:menu-name"); - if (property == NULL || property->v._d != OAF_P_STRING) - return NULL; - - name = property->v._u.value_string; - - return name; -} - -static void -item_selected (GtkWidget *item, - ImportData *data) -{ - char *iid; - - g_free (data->choosen_iid); - iid = gtk_object_get_data (GTK_OBJECT (item), "oafiid"); - if (iid == NULL) - data->choosen_iid = g_strdup ("Automatic"); - else - data->choosen_iid = g_strdup (iid); -} - -static GtkWidget * -create_plugin_menu (ImportData *data) -{ - OAF_ServerInfoList *info_list; - CORBA_Environment ev; - int i; - GtkWidget *menu; - GtkWidget *item; - - menu = gtk_menu_new (); - item = gtk_menu_item_new_with_label (_("Automatic")); - gtk_object_set_data_full (GTK_OBJECT (item), "oafiid", - g_strdup ("Automatic"), g_free); - gtk_menu_append (GTK_MENU (menu), item); - - CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - char *name = NULL; - - info = info_list->_buffer + i; - - name = g_strdup (get_name_from_component_info (info)); - if (name == NULL) { - name = g_strdup (info->iid); - } - - item = gtk_menu_item_new_with_label (name); - g_free (name); - - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (item_selected), data); - - gtk_object_set_data_full (GTK_OBJECT (item), "oafiid", - g_strdup (info->iid), g_free); - gtk_menu_append (GTK_MENU (menu), item); - } - CORBA_free (info_list); - - return menu; -} - -static ImportDialogFilePage * -importer_file_page_new (ImportData *data) -{ - ImportDialogFilePage *page; - GtkWidget *table, *label; - int row = 0; - - page = g_new0 (ImportDialogFilePage, 1); - - page->vbox = gtk_vbox_new (FALSE, 5); - page->need_filename = TRUE; - - table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 10); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - gtk_box_pack_start (GTK_BOX (page->vbox), table, TRUE, TRUE, 0); - - label = gtk_label_new (_("Filename:")); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - page->filename = gnome_file_entry_new (NULL, _("Select a file")); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (page->filename))), - "changed", GTK_SIGNAL_FUNC (filename_changed), - data); - - gtk_table_attach (GTK_TABLE (table), page->filename, 1, 2, - row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - - row++; - - label = gtk_label_new (_("File type:")); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - page->filetype = gtk_option_menu_new (); - page->menu = create_plugin_menu (data); - gtk_option_menu_set_menu (GTK_OPTION_MENU (page->filetype), page->menu); - - gtk_table_attach (GTK_TABLE (table), page->filetype, 1, 2, - row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - gtk_widget_show_all (table); - - return page; -} - -static void -import_druid_cancel (GnomeDruid *druid, - ImportData *data) -{ - gtk_widget_destroy (GTK_WIDGET (data->dialog)); -} - -static void -import_druid_destroy (GtkObject *object, - ImportData *data) -{ - gtk_object_unref (GTK_OBJECT (data->wizard)); - g_free (data->choosen_iid); - g_free (data); -} - -static void -folder_selected (EShellFolderSelectionDialog *dialog, - const char *path, - ImportData *data) -{ - char *filename, *iid; - - iid = g_strdup (data->choosen_iid); - filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (data->filepage->filename))))); - - gtk_widget_destroy (data->dialog); - start_import (path, filename, iid); - - g_free (iid); - g_free (filename); -} - -static void -folder_cancelled (EShellFolderSelectionDialog *dialog, - ImportData *data) -{ - gtk_widget_destroy (data->dialog); -} - -static void -import_druid_finish (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - GtkWidget *folder; - - folder = e_shell_folder_selection_dialog_new (data->shell, - _("Select folder"), - _("Select a destination folder for importing this data"), - e_shell_view_get_current_uri (data->view), - NULL); - - gtk_signal_connect (GTK_OBJECT (folder), "folder_selected", - GTK_SIGNAL_FUNC (folder_selected), data); - gtk_signal_connect (GTK_OBJECT (folder), "cancelled", - GTK_SIGNAL_FUNC (folder_cancelled), data); - - gtk_widget_hide (data->dialog); - gtk_widget_show (folder); -} - -static gboolean -prepare_file_page (GnomeDruidPage *page, - GnomeDruid *druid, - ImportData *data) -{ - gnome_druid_set_buttons_sensitive (druid, TRUE, - !data->filepage->need_filename, - TRUE); - return FALSE; -} - -/* Hack to change the Finish button */ -static void -druid_finish_button_change (GnomeDruid *druid) -{ - GtkWidget *button = druid->finish; - GtkWidget *hbox = GTK_BIN (button)->child, *hbox2; - GtkBoxChild *child; - GtkWidget *label; - - /* Get the second item from the children list */ - hbox2 = ((GtkBoxChild *)GTK_BOX (hbox)->children->data)->widget; - - g_return_if_fail (GTK_IS_BOX (hbox2)); - child = (GtkBoxChild *)g_list_nth_data (GTK_BOX (hbox2)->children, 0); - label = child->widget; - - /* Safety check :) */ - g_return_if_fail (GTK_IS_LABEL (label)); - - gtk_label_set_text (GTK_LABEL (label), _("Import")); -} - -void -show_import_wizard (BonoboUIComponent *component, - gpointer user_data, - const char *cname) -{ - ImportData *data = g_new0 (ImportData, 1); - GnomeDruidPageStart *start; - GnomeDruidPageFinish *finish; - GtkWidget *html; - - data->view = E_SHELL_VIEW (user_data); - data->shell = e_shell_view_get_shell (data->view); - - data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/import.glade", NULL); - data->dialog = glade_xml_get_widget (data->wizard, "importwizard"); - gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid", - "Evolution:shell"); - - data->druid = glade_xml_get_widget (data->wizard, "druid1"); - gtk_signal_connect (GTK_OBJECT (data->druid), "cancel", - GTK_SIGNAL_FUNC (import_druid_cancel), data); - - druid_finish_button_change (GNOME_DRUID (data->druid)); - start = GNOME_DRUID_PAGE_START (glade_xml_get_widget (data->wizard, "page1")); - data->filedialog = glade_xml_get_widget (data->wizard, "page2"); - gtk_signal_connect (GTK_OBJECT (data->filedialog), "prepare", - GTK_SIGNAL_FUNC (prepare_file_page), data); - - finish = GNOME_DRUID_PAGE_FINISH (glade_xml_get_widget (data->wizard, "page3")); - - data->filepage = importer_file_page_new (data); - data->vbox = data->filepage->vbox; - - html = create_html ("file_html"); - gtk_box_pack_start (GTK_BOX (data->vbox), html, FALSE, TRUE, 0); - gtk_box_reorder_child (GTK_BOX (data->vbox), html, 0); - - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (data->filedialog)->vbox), data->vbox, TRUE, TRUE, 0); - - /* Finish page */ - gtk_signal_connect (GTK_OBJECT (finish), "finish", - GTK_SIGNAL_FUNC (import_druid_finish), data); - gtk_signal_connect (GTK_OBJECT (data->dialog), "destroy", - GTK_SIGNAL_FUNC (import_druid_destroy), data); - - gtk_widget_show_all (data->dialog); -} diff --git a/shell/e-shell-importer.h b/shell/e-shell-importer.h deleted file mode 100644 index 37a5f6ce9e..0000000000 --- a/shell/e-shell-importer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* importer.c - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#include <bonobo/bonobo-ui-component.h> - -#ifndef __IMPORTER_H__ -#define __IMPORTER_H__ - -void show_import_wizard (BonoboUIComponent *component, - gpointer user_data, - const char *cname); - -#endif diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c deleted file mode 100644 index 00f6f24f89..0000000000 --- a/shell/e-shell-offline-handler.c +++ /dev/null @@ -1,827 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-offline-handler.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtktypeutils.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkclist.h> - -#include <gal/util/e-util.h> - -#include <libgnomeui/gnome-dialog.h> -#include <libgnome/gnome-i18n.h> - -#include <glade/glade-xml.h> - -#include <bonobo/bonobo-main.h> - -#include "e-shell-offline-handler.h" - - -#define GLADE_DIALOG_FILE_NAME EVOLUTION_GLADEDIR "/e-active-connection-dialog.glade" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - - -/* Private part. */ - -struct _OfflineProgressListenerServant { - POA_GNOME_Evolution_OfflineProgressListener servant; - EShellOfflineHandler *offline_handler; - char *component_id; -}; -typedef struct _OfflineProgressListenerServant OfflineProgressListenerServant; - -struct _ComponentInfo { - /* Component ID. */ - char *id; - - /* The `Evolution::Offline' interface for this component (cached just - to avoid going through the EComponentRegistry all the time). */ - GNOME_Evolution_Offline offline_interface; - - /* The interface and servant for the - `Evolution::OfflineProgressListener' we have to implement to get - notifications about progress of the off-line process. */ - GNOME_Evolution_OfflineProgressListener progress_listener_interface; - OfflineProgressListenerServant *progress_listener_servant; - - /* The current active connections for this component. This is updated - by the component itself through the `::ProgressListener' interface; - when the count reaches zero, the off-line process is considered to - be complete. */ - GNOME_Evolution_ConnectionList *active_connection_list; -}; -typedef struct _ComponentInfo ComponentInfo; - -struct _EShellOfflineHandlerPrivate { - EComponentRegistry *component_registry; - - EShellView *parent_shell_view; - - GladeXML *dialog_gui; - - int num_total_connections; - GHashTable *id_to_component_info; - - gboolean procedure_in_progress : 1; -}; - - -/* Signals. */ - -enum { - OFFLINE_PROCEDURE_STARTED, - OFFLINE_PROCEDURE_FINISHED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Forward declarations for the dialog handling. */ - -static void update_dialog_clist (EShellOfflineHandler *offline_handler); - - -/* Implementation for the OfflineProgressListener interface. */ - -static PortableServer_ServantBase__epv OfflineProgressListener_base_epv; -static POA_GNOME_Evolution_OfflineProgressListener__epv OfflineProgressListener_epv; -static POA_GNOME_Evolution_OfflineProgressListener__vepv OfflineProgressListener_vepv; - -static OfflineProgressListenerServant * -progress_listener_servant_new (EShellOfflineHandler *offline_handler, - const char *id) -{ - OfflineProgressListenerServant *servant; - - servant = g_new0 (OfflineProgressListenerServant, 1); - - servant->servant.vepv = &OfflineProgressListener_vepv; - servant->offline_handler = offline_handler; - servant->component_id = g_strdup (id); - - return servant; -} - -static void -progress_listener_servant_free (OfflineProgressListenerServant *servant) -{ - CORBA_Environment ev; - PortableServer_ObjectId *oid; - - CORBA_exception_init (&ev); - - oid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev); - CORBA_free (oid); - - POA_GNOME_Evolution_OfflineProgressListener__fini ((POA_GNOME_Evolution_OfflineProgressListener *) servant, &ev); - - CORBA_exception_free (&ev); - - g_free (servant->component_id); - g_free (servant); -} - -static GNOME_Evolution_ConnectionList * -duplicate_connection_list (const GNOME_Evolution_ConnectionList *source) -{ - GNOME_Evolution_ConnectionList *copy; - int i; - - copy = GNOME_Evolution_ConnectionList__alloc (); - - copy->_length = source->_length; - copy->_maximum = source->_length; - - copy->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (copy->_maximum); - - for (i = 0; i < source->_length; i++) { - copy->_buffer[i].hostName = CORBA_string_dup (source->_buffer[i].hostName); - copy->_buffer[i].type = CORBA_string_dup (source->_buffer[i].type); - } - - return copy; -} - -static void -impl_OfflineProgressListener_updateProgress (PortableServer_Servant servant, - const GNOME_Evolution_ConnectionList *current_active_connections, - CORBA_Environment *ev) -{ - EShellOfflineHandler *offline_handler; - EShellOfflineHandlerPrivate *priv; - ComponentInfo *component_info; - int connection_delta; - const char *component_id; - - component_id = ((OfflineProgressListenerServant *) servant)->component_id; - - offline_handler = ((OfflineProgressListenerServant *) servant)->offline_handler; - priv = offline_handler->priv; - - component_info = g_hash_table_lookup (priv->id_to_component_info, component_id); - g_assert (component_info != NULL); - - connection_delta = component_info->active_connection_list->_length - current_active_connections->_length; - if (connection_delta < 0) { - /* FIXME: Should raise an exception or something? */ - g_warning ("Weird, buggy component increased number of connection when going off-line -- %s", - component_id); - } - - g_assert (priv->num_total_connections >= connection_delta); - priv->num_total_connections -= connection_delta; - - CORBA_free (component_info->active_connection_list); - component_info->active_connection_list = duplicate_connection_list (current_active_connections); - - update_dialog_clist (offline_handler); - - if (priv->num_total_connections == 0) - gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], TRUE); -} - -static gboolean -create_progress_listener (EShellOfflineHandler *offline_handler, - const char *component_id, - GNOME_Evolution_OfflineProgressListener *objref_return, - OfflineProgressListenerServant **servant_return) -{ - OfflineProgressListenerServant *servant; - CORBA_Environment ev; - - *servant_return = NULL; - *objref_return = CORBA_OBJECT_NIL; - - OfflineProgressListener_base_epv._private = NULL; - OfflineProgressListener_base_epv.finalize = NULL; - OfflineProgressListener_base_epv.default_POA = NULL; - - OfflineProgressListener_epv.updateProgress = impl_OfflineProgressListener_updateProgress; - - OfflineProgressListener_vepv._base_epv = &OfflineProgressListener_base_epv; - OfflineProgressListener_vepv.GNOME_Evolution_OfflineProgressListener_epv = &OfflineProgressListener_epv; - - servant = progress_listener_servant_new (offline_handler, component_id); - - CORBA_exception_init (&ev); - - POA_GNOME_Evolution_OfflineProgressListener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot initialize GNOME::Evolution::Offline::ProgressListener"); - progress_listener_servant_free (servant); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot activate GNOME::Evolution::Offline::ProgressListener"); - progress_listener_servant_free (servant); - CORBA_exception_free (&ev); - return FALSE; - } - - *servant_return = servant; - *objref_return = PortableServer_POA_servant_to_reference (bonobo_poa (), servant, &ev); - - CORBA_exception_free (&ev); - - return TRUE; -} - - -/* ComponentInfo handling. */ - -static ComponentInfo * -component_info_new (const char *id, - const GNOME_Evolution_Offline offline_interface, - GNOME_Evolution_OfflineProgressListener progress_listener_interface, - OfflineProgressListenerServant *progress_listener_servant, - GNOME_Evolution_ConnectionList *active_connection_list) -{ - ComponentInfo *new; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - new = g_new (ComponentInfo, 1); - new->id = g_strdup (id); - new->offline_interface = CORBA_Object_duplicate (offline_interface, &ev); - new->progress_listener_interface = progress_listener_interface; - new->progress_listener_servant = progress_listener_servant; - new->active_connection_list = active_connection_list; - - CORBA_exception_free (&ev); - - return new; -} - -static void -component_info_free (ComponentInfo *component_info) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - g_free (component_info->id); - - progress_listener_servant_free (component_info->progress_listener_servant); - CORBA_Object_release (component_info->progress_listener_interface, &ev); - - CORBA_Object_release (component_info->offline_interface, &ev); - - CORBA_free (component_info->active_connection_list); - - g_free (component_info); - - CORBA_exception_free (&ev); -} - - -/* Utility functions. */ - -static void -hash_foreach_free_component_info (void *key, - void *value, - void *user_data) -{ - ComponentInfo *component_info; - - component_info = (ComponentInfo *) value; - component_info_free (component_info); -} - - -/* Cancelling the off-line procedure. */ - -static void -cancel_offline (EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - GList *component_ids; - GList *p; - - priv = offline_handler->priv; - - component_ids = e_component_registry_get_id_list (priv->component_registry); - - for (p = component_ids; p != NULL; p = p->next) { - EvolutionShellComponentClient *shell_component_client; - GNOME_Evolution_Offline offline_interface; - CORBA_Environment ev; - const char *id; - - id = (const char *) p->data; - shell_component_client = e_component_registry_get_component_by_id (priv->component_registry, id); - - offline_interface = evolution_shell_component_client_get_offline_interface (shell_component_client); - if (offline_interface == CORBA_OBJECT_NIL) - continue; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Offline_goOnline (offline_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Error putting component `%s' on-line.", id); - - CORBA_exception_free (&ev); - } - - e_free_string_list (component_ids); - - priv->num_total_connections = 0; - - gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], FALSE); -} - - -/* Preparing the off-line procedure. */ - -static gboolean -prepare_for_offline (EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - GList *component_ids; - GList *p; - gboolean error; - - priv = offline_handler->priv; - - component_ids = e_component_registry_get_id_list (priv->component_registry); - - error = FALSE; - for (p = component_ids; p != NULL; p = p->next) { - EvolutionShellComponentClient *shell_component_client; - GNOME_Evolution_Offline offline_interface; - GNOME_Evolution_OfflineProgressListener progress_listener_interface; - GNOME_Evolution_ConnectionList *active_connection_list; - OfflineProgressListenerServant *progress_listener_servant; - ComponentInfo *component_info; - CORBA_Environment ev; - const char *id; - - id = (const char *) p->data; - shell_component_client = e_component_registry_get_component_by_id (priv->component_registry, id); - offline_interface = evolution_shell_component_client_get_offline_interface (shell_component_client); - if (offline_interface == CORBA_OBJECT_NIL) - continue; - - if (! create_progress_listener (offline_handler, id, - &progress_listener_interface, - &progress_listener_servant)) { - g_warning ("Cannot create the Evolution::OfflineProgressListener interface for `%s'", id); - continue; - } - - CORBA_exception_init (&ev); - - GNOME_Evolution_Offline_prepareForOffline (offline_interface, &active_connection_list, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot prepare component component to go offline -- %s", id); - - POA_GNOME_Evolution_OfflineProgressListener__fini - ((POA_GNOME_Evolution_OfflineProgressListener *) progress_listener_servant, &ev); - progress_listener_servant_free (progress_listener_servant); - - CORBA_Object_release (progress_listener_interface, &ev); - - CORBA_exception_free (&ev); - - error = TRUE; - break; - } - - CORBA_exception_free (&ev); - - priv->num_total_connections += active_connection_list->_length; - - component_info = component_info_new (id, - offline_interface, - progress_listener_interface, - progress_listener_servant, - active_connection_list); - - g_assert (g_hash_table_lookup (priv->id_to_component_info, component_info->id) == NULL); - g_hash_table_insert (priv->id_to_component_info, component_info->id, component_info); - } - - /* If an error occurred while preparing, just put all the components - on-line again. */ - if (error) - cancel_offline (offline_handler); - - e_free_string_list (component_ids); - - return ! error; -} - - -/* Finalizing the off-line procedure. */ - -static void -finalize_offline_hash_foreach (void *key, - void *value, - void *user_data) -{ - EShellOfflineHandler *offline_handler; - EShellOfflineHandlerPrivate *priv; - ComponentInfo *component_info; - CORBA_Environment ev; - - offline_handler = E_SHELL_OFFLINE_HANDLER (user_data); - priv = offline_handler->priv; - - component_info = (ComponentInfo *) value; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Offline_goOffline (component_info->offline_interface, - component_info->progress_listener_interface, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - /* FIXME: Should detect an error and put all the components - on-line again. */ - g_warning ("Error putting component off-line -- %s", component_info->id); - } - - CORBA_exception_free (&ev); -} - -static void -finalize_offline (EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - - priv = offline_handler->priv; - - g_hash_table_foreach (priv->id_to_component_info, finalize_offline_hash_foreach, offline_handler); - - if (priv->num_total_connections == 0) { - /* Nothing else to do, we are all set. */ - gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], TRUE); - } -} - - -/* The confirmation dialog. */ - -static void -update_dialog_clist_hash_foreach (void *key, - void *data, - void *user_data) -{ - ComponentInfo *component_info; - const GNOME_Evolution_Connection *p; - GtkWidget *clist; - int i; - - clist = GTK_WIDGET (user_data); - - component_info = (ComponentInfo *) data; - for (i = 0, p = component_info->active_connection_list->_buffer; - i < component_info->active_connection_list->_length; - i++, p++) { - char *columns[3]; - - columns[0] = p->hostName; - columns[1] = p->type; - columns[2] = NULL; - - gtk_clist_prepend (GTK_CLIST (clist), columns); - } -} - -static void -update_dialog_clist (EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - GtkWidget *clist; - - priv = offline_handler->priv; - - clist = glade_xml_get_widget (priv->dialog_gui, "active_connection_clist"); - - gtk_clist_set_auto_sort (GTK_CLIST (clist), TRUE); - - gtk_clist_freeze (GTK_CLIST (clist)); - - /* Populate the GtkCList. */ - gtk_clist_clear (GTK_CLIST (clist)); - g_hash_table_foreach (priv->id_to_component_info, update_dialog_clist_hash_foreach, clist); - - gtk_clist_thaw (GTK_CLIST (clist)); -} - -static void -dialog_handle_ok (GnomeDialog *dialog, - EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - GtkWidget *instruction_label; - - priv = offline_handler->priv; - - gnome_dialog_set_sensitive (dialog, 0, FALSE); - - instruction_label = glade_xml_get_widget (priv->dialog_gui, "instruction_label"); - g_assert (instruction_label != NULL); - g_assert (GTK_IS_LABEL (instruction_label)); - - gtk_label_set_text (GTK_LABEL (instruction_label), _("Closing connections...")); - - finalize_offline (offline_handler); -} - -static void -dialog_handle_cancel (GnomeDialog *dialog, - EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - - priv = offline_handler->priv; - - gtk_widget_destroy (GTK_WIDGET (dialog)); - - gtk_object_unref (GTK_OBJECT (priv->dialog_gui)); - priv->dialog_gui = NULL; - - cancel_offline (offline_handler); -} - -static void -dialog_clicked_cb (GnomeDialog *dialog, - int button_number, - void *data) -{ - EShellOfflineHandler *offline_handler; - - offline_handler = E_SHELL_OFFLINE_HANDLER (data); - - switch (button_number) { - case 0: /* OK */ - dialog_handle_ok (dialog, offline_handler); - break; - - case 1: /* Cancel */ - dialog_handle_cancel (dialog, offline_handler); - break; - - default: - g_assert_not_reached (); - } -} - -static void -pop_up_confirmation_dialog (EShellOfflineHandler *offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - GtkWidget *dialog; - - priv = offline_handler->priv; - - if (priv->dialog_gui == NULL) { - priv->dialog_gui = glade_xml_new (GLADE_DIALOG_FILE_NAME, NULL); - if (priv->dialog_gui == NULL) { - g_warning ("Cannot load the active connection dialog (installation problem?) -- %s", - GLADE_DIALOG_FILE_NAME); - finalize_offline (offline_handler); - return; - } - } - - dialog = glade_xml_get_widget (priv->dialog_gui, "active_connection_dialog"); - - /* FIXME: do we really want this? */ - /* gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (priv->parent_shell_view)); */ - /* gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); */ - - gnome_dialog_set_default (GNOME_DIALOG (dialog), 1); - - update_dialog_clist (offline_handler); - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), offline_handler); - - gtk_widget_show (dialog); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EShellOfflineHandler *offline_handler; - EShellOfflineHandlerPrivate *priv; - - offline_handler = E_SHELL_OFFLINE_HANDLER (object); - priv = offline_handler->priv; - - if (priv->component_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->component_registry)); - - g_hash_table_foreach (priv->id_to_component_info, hash_foreach_free_component_info, NULL); - g_hash_table_destroy (priv->id_to_component_info); - - if (priv->dialog_gui != NULL) { - GtkWidget *dialog; - - dialog = glade_xml_get_widget (priv->dialog_gui, "active_connection_dialog"); - gtk_widget_destroy (dialog); - - gtk_object_unref (GTK_OBJECT (priv->dialog_gui)); - priv->dialog_gui = NULL; - } - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* GTK type handling. */ - -static void -class_init (EShellOfflineHandlerClass *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[OFFLINE_PROCEDURE_STARTED] - = gtk_signal_new ("offline_procedure_started", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellOfflineHandlerClass, offline_procedure_started), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[OFFLINE_PROCEDURE_FINISHED] - = gtk_signal_new ("offline_procedure_finished", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellOfflineHandlerClass, offline_procedure_finished), - gtk_marshal_NONE__BOOL, - GTK_TYPE_NONE, 1, - GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - - -static void -init (EShellOfflineHandler *shell_offline_handler) -{ - EShellOfflineHandlerPrivate *priv; - - priv = g_new (EShellOfflineHandlerPrivate, 1); - - priv->component_registry = NULL; - priv->parent_shell_view = NULL; - - priv->dialog_gui = NULL; - - priv->num_total_connections = 0; - priv->id_to_component_info = g_hash_table_new (g_str_hash, g_str_equal); - - priv->procedure_in_progress = FALSE; - - shell_offline_handler->priv = priv; -} - - -/** - * e_shell_offline_handler_construct: - * @offline_handler: A pointer to an EShellOfflineHandler to construct. - * @component_registry: The registry for the components that we want to put - * off-line. - * - * Construct the @offline_handler. - **/ -void -e_shell_offline_handler_construct (EShellOfflineHandler *offline_handler, - EComponentRegistry *component_registry) -{ - EShellOfflineHandlerPrivate *priv; - - g_return_if_fail (offline_handler != NULL); - g_return_if_fail (E_IS_SHELL_OFFLINE_HANDLER (offline_handler)); - g_return_if_fail (component_registry != NULL); - g_return_if_fail (E_IS_COMPONENT_REGISTRY (component_registry)); - - priv = offline_handler->priv; - - g_assert (priv->component_registry == NULL); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (offline_handler), GTK_FLOATING); - - gtk_object_ref (GTK_OBJECT (component_registry)); - priv->component_registry = component_registry; -} - -/** - * e_shell_offline_handler_new: - * @component_registry: The registry for the components that we want to put - * off-line. - * - * Create a new offline handler. - * - * Return value: A pointer to the newly created EShellOfflineHandler object. - **/ -EShellOfflineHandler * -e_shell_offline_handler_new (EComponentRegistry *component_registry) -{ - EShellOfflineHandler *offline_handler; - - g_return_val_if_fail (component_registry != NULL, NULL); - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), NULL); - - offline_handler = (EShellOfflineHandler *) gtk_type_new (e_shell_offline_handler_get_type ()); - e_shell_offline_handler_construct (offline_handler, component_registry); - - return offline_handler; -} - - -/** - * e_shell_offline_handler_put_components_offline: - * @offline_handler: A pointer to an EShellOfflineHandler object. - * - * Put the components offline. - **/ -void -e_shell_offline_handler_put_components_offline (EShellOfflineHandler *offline_handler, - EShellView *parent_shell_view) -{ - EShellOfflineHandlerPrivate *priv; - - g_return_if_fail (offline_handler != NULL); - g_return_if_fail (E_IS_SHELL_OFFLINE_HANDLER (offline_handler)); - g_return_if_fail (parent_shell_view == NULL || E_IS_SHELL_VIEW (parent_shell_view)); - - priv = offline_handler->priv; - - priv->procedure_in_progress = TRUE; - priv->parent_shell_view = parent_shell_view; - - /* Add an extra ref here as the signal handlers might want to unref - us. */ - - gtk_object_ref (GTK_OBJECT (offline_handler)); - - gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_STARTED]); - - if (! prepare_for_offline (offline_handler)) { - /* FIXME: Maybe do something smarter here. */ - g_warning ("Couldn't put components off-line"); - gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], FALSE); - gtk_object_unref (GTK_OBJECT (offline_handler)); - return; - } - - if (priv->num_total_connections > 0 && priv->parent_shell_view != NULL) - pop_up_confirmation_dialog (offline_handler); - else - finalize_offline (offline_handler); - - gtk_object_unref (GTK_OBJECT (offline_handler)); -} - - -E_MAKE_TYPE (e_shell_offline_handler, "EShellOfflineHandler", EShellOfflineHandler, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-offline-handler.h b/shell/e-shell-offline-handler.h deleted file mode 100644 index cbb726a057..0000000000 --- a/shell/e-shell-offline-handler.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-offline-handler.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_SHELL_OFFLINE_HANDLER_H_ -#define _E_SHELL_OFFLINE_HANDLER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#include "e-component-registry.h" -#include "e-shell-view.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHELL_OFFLINE_HANDLER (e_shell_offline_handler_get_type ()) -#define E_SHELL_OFFLINE_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_OFFLINE_HANDLER, EShellOfflineHandler)) -#define E_SHELL_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_OFFLINE_HANDLER, EShellOfflineHandlerClass)) -#define E_IS_SHELL_OFFLINE_HANDLER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_OFFLINE_HANDLER)) -#define E_IS_SHELL_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_OFFLINE_HANDLER)) - - -typedef struct _EShellOfflineHandler EShellOfflineHandler; -typedef struct _EShellOfflineHandlerPrivate EShellOfflineHandlerPrivate; -typedef struct _EShellOfflineHandlerClass EShellOfflineHandlerClass; - -struct _EShellOfflineHandler { - GtkObject parent; - - EShellOfflineHandlerPrivate *priv; -}; - -struct _EShellOfflineHandlerClass { - GtkObjectClass parent_class; - - /* This signal is emitted when the offline procedure starts, i.e. the - EShellOfflineHanlder starts contacting the components one-by-one - telling them to be prepared to go off-line. */ - void (* offline_procedure_started) (EShellOfflineHandler *offline_handler); - - /* This is emitted when the procedure is finished, and all the - components are all either off-line (@now_offline is %TRUE) or - on-line (@now_offline is %FALSE). */ - void (* offline_procedure_finished) (EShellOfflineHandler *offline_hanlder, - gboolean now_offline); -}; - - -GtkType e_shell_offline_handler_get_type (void); -void e_shell_offline_handler_construct (EShellOfflineHandler *offline_handler, - EComponentRegistry *component_registry); -EShellOfflineHandler *e_shell_offline_handler_new (EComponentRegistry *component_registry); - -void e_shell_offline_handler_put_components_offline (EShellOfflineHandler *offline_handler, - EShellView *parent_shell_view); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHELL_OFFLINE_HANDLER_H_ */ diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c deleted file mode 100644 index d875540502..0000000000 --- a/shell/e-shell-startup-wizard.c +++ /dev/null @@ -1,848 +0,0 @@ -/* - * e-shell-startup-wizard.c - * - * Copyright (C) 2001 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-shell-startup-wizard.h" - -#include <errno.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <gnome.h> -#include <glade/glade.h> -#include <liboaf/liboaf.h> - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-widget.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-moniker-util.h> -#include <bonobo-conf/bonobo-config-database.h> - -#include <gal/widgets/e-gui-utils.h> - -#include <widgets/e-timezone-dialog/e-timezone-dialog.h> - -#include "importer/GNOME_Evolution_Importer.h" - -#include "e-timezone-dialog/e-timezone-dialog.h" - -#include <evolution-wizard.h> -#include "Evolution.h" - -typedef struct _TimezoneDialogPage { - GtkWidget *page; - GtkWidget *vbox; - GtkObject *etd; -} TimezoneDialogPage; - -typedef struct _ImportDialogPage { - GtkWidget *page; - GtkWidget *vbox; - - GList *importers; - - int running; - gboolean prepared; -} ImportDialogPage; - -typedef struct _MailDialogPage { - GtkWidget *page; - GtkWidget *vbox; - GtkWidget *widget; - - Bonobo_Control control; -} MailDialogPage; - -typedef struct _SWData { - GladeXML *wizard; - GtkWidget *dialog; - GtkWidget *druid; - - GtkWidget *start, *finish; - - MailDialogPage *id_page; - MailDialogPage *source_page; - MailDialogPage *extra_page; - MailDialogPage *transport_page; - MailDialogPage *management_page; - - TimezoneDialogPage *timezone_page; - ImportDialogPage *import_page; - - gboolean cancel; - CORBA_Object mailer; - Bonobo_EventSource event_source; - BonoboListener *listener; - int id; - - Bonobo_ConfigDatabase db; -} SWData; - -typedef struct _IntelligentImporterData { - CORBA_Object object; - Bonobo_Control control; - GtkWidget *widget; - - char *name; - char *blurb; - char *iid; -} IntelligentImporterData; - -typedef struct _SelectedImporterData{ - CORBA_Object importer; - char *iid; -} SelectedImporterData; - -static GHashTable *page_hash; -static GList *page_list = NULL; - -static void -druid_event_notify_cb (BonoboListener *listener, - const char *name, - BonoboArg *arg, - CORBA_Environment *ev, - SWData *data) -{ - int buttons, pagenum; - GnomeDruidPage *page; - - if (strcmp (name, EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE) == 0) { - buttons = (int) *((CORBA_short *)arg->_value); - gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid), - (buttons & 4) >> 2, - (buttons & 2) >> 1, - (buttons & 1)); - } else if (strcmp (name, EVOLUTION_WIZARD_SET_SHOW_FINISH) == 0) { - gnome_druid_set_show_finish (GNOME_DRUID (data->druid), - (gboolean) *((CORBA_boolean *) arg->_value)); - } else if (strcmp (name, EVOLUTION_WIZARD_SET_PAGE) == 0) { - pagenum = (int) *((CORBA_short *) arg->_value); - - page = g_list_nth_data (page_list, pagenum); - gnome_druid_set_page (GNOME_DRUID (data->druid), page); - } -} - -static void -make_mail_dialog_pages (SWData *data) -{ - CORBA_Environment ev; - CORBA_Object object; - - CORBA_exception_init (&ev); - data->mailer = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); - if (BONOBO_EX (&ev)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Could not start the Evolution Mailer Wizard interface\n%s"), CORBA_exception_id (&ev)); - g_warning ("Could not start mailer (%s)", CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - if (data->mailer == CORBA_OBJECT_NIL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Evolution Mailer Wizard interface")); - return; - } - - CORBA_exception_init (&ev); - data->event_source = Bonobo_Unknown_queryInterface (data->mailer, "IDL:Bonobo/EventSource:1.0", &ev); - CORBA_exception_free (&ev); - data->listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (data->listener), "event-notify", - GTK_SIGNAL_FUNC (druid_event_notify_cb), data); - object = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener)); - CORBA_exception_init (&ev); - data->id = Bonobo_EventSource_addListener (data->event_source, object, &ev); - CORBA_exception_free (&ev); -} - -static int -page_to_num (GnomeDruidPage *page) -{ - return GPOINTER_TO_INT (g_hash_table_lookup (page_hash, page)); -} - -static gboolean -next_func (GnomeDruidPage *page, - GnomeDruid *druid, - SWData *data) -{ - CORBA_Environment ev; - int pagenum; - - CORBA_exception_init (&ev); - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_NEXT, &ev); - CORBA_exception_free (&ev); - return FALSE; -} - -static gboolean -prepare_func (GnomeDruidPage *page, - GnomeDruid *druid, - SWData *data) -{ - CORBA_Environment ev; - int pagenum; - - CORBA_exception_init (&ev); - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev); - CORBA_exception_free (&ev); - return FALSE; -} - -static gboolean -back_func (GnomeDruidPage *page, - GnomeDruid *druid, - SWData *data) -{ - CORBA_Environment ev; - int pagenum; - - CORBA_exception_init (&ev); - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (data->mailer, pagenum, GNOME_Evolution_Wizard_BACK, &ev); - CORBA_exception_free (&ev); - return FALSE; -} - -static void -free_importers (SWData *data) -{ - GList *l; - - for (l = data->import_page->importers; l; l = l->next) { - IntelligentImporterData *iid; - - iid = l->data; - if (iid->object != CORBA_OBJECT_NIL) { - bonobo_object_release_unref (iid->object, NULL); - } - } - - g_list_free (data->import_page->importers); -} - -static void -start_importers (GList *p) -{ - CORBA_Environment ev; - - for (; p; p = p->next) { - SelectedImporterData *sid = p->data; - - CORBA_exception_init (&ev); - GNOME_Evolution_IntelligentImporter_importData (sid->importer, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error importing %s\n%s", sid->iid, - CORBA_exception_id (&ev)); - } - CORBA_exception_free (&ev); - } -} - -static void -do_import (SWData *data) -{ - CORBA_Environment ev; - GList *l, *selected = NULL; - - for (l = data->import_page->importers; l; l = l->next) { - IntelligentImporterData *importer_data; - SelectedImporterData *sid; - char *iid; - - importer_data = l->data; - iid = g_strdup (importer_data->iid); - - sid = g_new (SelectedImporterData, 1); - sid->iid = iid; - - CORBA_exception_init (&ev); - sid->importer = bonobo_object_dup_ref (importer_data->object, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error duplication %s\n(%s)", iid, - CORBA_exception_id (&ev)); - g_free (iid); - CORBA_exception_free (&ev); - g_free (sid); - continue; - } - CORBA_exception_free (&ev); - - selected = g_list_prepend (selected, sid); - } - - free_importers (data); - - if (selected != NULL) { - start_importers (selected); - - for (l = selected; l; l = l->next) { - SelectedImporterData *sid = l->data; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (sid->importer, &ev); - CORBA_exception_free (&ev); - - g_free (sid->iid); - g_free (sid); - } - g_list_free (selected); - } -} - -static gboolean -finish_func (GnomeDruidPage *page, - GnomeDruid *druid, - SWData *data) -{ - CORBA_Environment ev; - char *displayname, *tz; - - /* Notify mailer */ - CORBA_exception_init (&ev); - GNOME_Evolution_Wizard_notifyAction (data->mailer, 0, GNOME_Evolution_Wizard_FINISH, &ev); - CORBA_exception_free (&ev); - - /* Set Timezone */ - CORBA_exception_init (&ev); - - e_timezone_dialog_get_timezone (E_TIMEZONE_DIALOG (data->timezone_page->etd), &displayname); - if (displayname == NULL) - tz = g_strdup (""); - else - tz = g_strdup (displayname); - - bonobo_config_set_string (data->db, "/Calendar/Display/Timezone", tz, &ev); - g_free (tz); - CORBA_exception_free (&ev); - - do_import (data); - - /* Free data */ - data->cancel = FALSE; - gtk_widget_destroy (data->dialog); - gtk_main_quit (); - - return TRUE; -} - -static void -connect_page (GtkWidget *page, - SWData *data) -{ - gtk_signal_connect (GTK_OBJECT (page), "next", - GTK_SIGNAL_FUNC (next_func), data); - gtk_signal_connect (GTK_OBJECT (page), "prepare", - GTK_SIGNAL_FUNC (prepare_func), data); - gtk_signal_connect (GTK_OBJECT (page), "back", - GTK_SIGNAL_FUNC (back_func), data); - gtk_signal_connect (GTK_OBJECT (page), "finish", - GTK_SIGNAL_FUNC (finish_func), data); -} - -static MailDialogPage * -make_identity_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "identity-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - connect_page (page->page, data); - g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (0)); - page_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 0, &ev); - CORBA_exception_free (&ev); - - page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0); - gtk_widget_show_all (page->widget); - - return page; -} - -static MailDialogPage * -make_receive_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "receive-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - connect_page (page->page, data); - g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (1)); - page_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 1, &ev); - CORBA_exception_free (&ev); - - page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0); - gtk_widget_show_all (page->widget); - - return page; -} - -static MailDialogPage * -make_extra_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "extra-page"); - page_list = g_list_append (page_list, page->page); - g_return_val_if_fail (page->page != NULL, NULL); - - connect_page (page->page, data); - g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (2)); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 2, &ev); - CORBA_exception_free (&ev); - - page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0); - gtk_widget_show_all (page->widget); - - return page; -} - -static MailDialogPage * -make_transport_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "send-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - connect_page (page->page, data); - g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (3)); - page_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 3, &ev); - CORBA_exception_free (&ev); - - page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0); - gtk_widget_show_all (page->widget); - - return page; -} - -static MailDialogPage * -make_management_page (SWData *data) -{ - MailDialogPage *page; - CORBA_Environment ev; - - g_return_val_if_fail (data != NULL, NULL); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, NULL); - - page = g_new0 (MailDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "management-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - connect_page (page->page, data); - g_hash_table_insert (page_hash, page->page, GINT_TO_POINTER (4)); - page_list = g_list_append (page_list, page->page); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - - CORBA_exception_init (&ev); - page->control = GNOME_Evolution_Wizard_getControl (data->mailer, 4, &ev); - CORBA_exception_free (&ev); - - page->widget = bonobo_widget_new_control_from_objref (page->control, CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (page->vbox), page->widget, TRUE, TRUE, 0); - gtk_widget_show_all (page->widget); - - return page; -} - -static TimezoneDialogPage * -make_timezone_page (SWData *data) -{ - TimezoneDialogPage *page; - - g_return_val_if_fail (data != NULL, NULL); - - page = g_new0 (TimezoneDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "timezone-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - page->vbox = GTK_WIDGET (GNOME_DRUID_PAGE_STANDARD (page->page)->vbox); - - page->etd = GTK_OBJECT (e_timezone_dialog_new ()); - e_timezone_dialog_reparent (E_TIMEZONE_DIALOG (page->etd), page->vbox); - - return page; -} - -static GList * -get_intelligent_importers (void) -{ - OAF_ServerInfoList *info_list; - GList *iids_ret = NULL; - CORBA_Environment ev; - int i; - - CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); - CORBA_exception_free (&ev); - - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - - info = info_list->_buffer + i; - iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid)); - } - - return iids_ret; -} - -static void -dialog_mapped (GtkWidget *w, - gpointer data) -{ - while (gtk_events_pending ()) { - gtk_main_iteration (); - } -} - -static gboolean -prepare_importer_page (GnomeDruidPage *page, - - GnomeDruid *druid, - SWData *data) -{ - GtkWidget *dialog; - ImportDialogPage *import; - GList *l, *importers; - GtkWidget *table; - int running = 0; - - if (data->import_page->prepared == TRUE) { - return TRUE; - } - - dialog = gnome_message_box_new (_("Please wait...\nScanning for existing setups"), GNOME_MESSAGE_BOX_INFO, NULL); - gtk_signal_connect (GTK_OBJECT (dialog), "map", - GTK_SIGNAL_FUNC (dialog_mapped), NULL); - gtk_window_set_title (GTK_WINDOW (dialog), _("Starting Intelligent Importers")); - gtk_widget_show_all (dialog); - while (gtk_events_pending ()) { - gtk_main_iteration (); - } - - import = data->import_page; - importers = get_intelligent_importers (); - if (importers == NULL) { - /* No importers, go directly to finish, do not pass go - Do not collect $200 */ - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)) -; - gtk_widget_destroy (dialog); - return TRUE; - } - - table = gtk_table_new (g_list_length (importers), 2, FALSE); - for (l = importers; l; l = l->next) { - GtkWidget *label; - IntelligentImporterData *id; - CORBA_Environment ev; - gboolean can_run; - char *str; - - id = g_new0 (IntelligentImporterData, 1); - id->iid = g_strdup (l->data); - - CORBA_exception_init (&ev); - id->object = oaf_activate_from_id ((char *) id->iid, 0, NULL, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Could not start %s:%s", id->iid, - CORBA_exception_id (&ev)); - - CORBA_exception_free (&ev); - /* Clean up the IID */ - g_free (id->iid); - g_free (id); - continue; - } - - if (id->object == CORBA_OBJECT_NIL) { - g_warning ("Could not activate component %s", id->iid); - CORBA_exception_free (&ev); - - g_free (id->iid); - g_free (id); - continue; - } - - can_run = GNOME_Evolution_IntelligentImporter_canImport (id->object, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Could not call canImport(%s): %s", id->iid, - CORBA_exception_id (&ev)); - bonobo_object_release_unref (id->object, &ev); - CORBA_exception_free (&ev); - - g_free (id->iid); - g_free (id); - continue; - } - - if (can_run == FALSE) { - bonobo_object_release_unref (id->object, &ev); - CORBA_exception_free (&ev); - g_free (id->iid); - g_free (id); - continue; - } - - running++; - id->name = GNOME_Evolution_IntelligentImporter__get_importername (id->object, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Could not get name(%s): %s", id->iid, - CORBA_exception_id (&ev)); - bonobo_object_release_unref (id->object, &ev); - CORBA_exception_free (&ev); - g_free (id->iid); - g_free (id); - continue; - } - - id->blurb = GNOME_Evolution_IntelligentImporter__get_message (id->object, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Could not get message(%s): %s", - id->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (id->object, &ev); - CORBA_exception_free (&ev); - g_free (id->iid); - CORBA_free (id->name); - g_free (id); - continue; - } - - id->control = Bonobo_Unknown_queryInterface (id->object, - "IDL:Bonobo/Control:1.0", &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s", - id->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (id->object, &ev); - CORBA_exception_free (&ev); - g_free (id->iid); - CORBA_free (id->name); - CORBA_free (id->blurb); - continue; - } - - if (id->control != CORBA_OBJECT_NIL) { - id->widget = bonobo_widget_new_control_from_objref (id->control, CORBA_OBJECT_NIL); - gtk_widget_show (id->widget); - } else { - id->widget = gtk_label_new (""); - gtk_widget_show (id->widget); - } - - CORBA_exception_free (&ev); - - import->importers = g_list_prepend (import->importers, id); - str = g_strdup_printf (_("From %s:"), id->name); - label = gtk_label_new (str); - g_free (str); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, running - 1, - running, 0, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), id->widget, 1, 2, - running - 1, running, 0, 0, 0, 0); - gtk_widget_show_all (table); - - gtk_box_pack_start (GTK_BOX (data->import_page->vbox), table, - FALSE, FALSE, 0); - } - - if (running == 0) { - gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->finish)); - gtk_widget_destroy (dialog); - return TRUE; - } - - import->running = running; - gtk_widget_destroy (dialog); - - return FALSE; -} - -static ImportDialogPage * -make_importer_page (SWData *data) -{ - ImportDialogPage *page; - GtkWidget *label, *sep; - - g_return_val_if_fail (data != NULL, NULL); - - page = g_new0 (ImportDialogPage, 1); - page->page = glade_xml_get_widget (data->wizard, "import-page"); - g_return_val_if_fail (page->page != NULL, NULL); - - gtk_signal_connect (GTK_OBJECT (page->page), "prepare", - GTK_SIGNAL_FUNC (prepare_importer_page), data); - page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; - gtk_container_set_border_width (GTK_CONTAINER (page->vbox), 4); - - label = gtk_label_new (_("Please select the information\nthat you would like to import")); - gtk_box_pack_start (GTK_BOX (page->vbox), label, FALSE, FALSE, 0); - - sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (page->vbox), sep, FALSE, FALSE, 0); - - page->prepared = FALSE; - return page; -} - -static void -startup_wizard_cancel (GnomeDruid *druid, - SWData *data) -{ - /* Free data */ - data->cancel = TRUE; - gtk_widget_destroy (data->dialog); - gtk_main_quit (); -} - -gboolean -e_shell_startup_wizard_create (void) -{ - SWData *data; - CORBA_Environment ev; - gboolean runbefore; - - data = g_new0 (SWData, 1); - - CORBA_exception_init (&ev); - data->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || data->db == CORBA_OBJECT_NIL) { - g_warning ("Error starting wombat: (%s)", CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - g_free (data); - - return FALSE; - } - - runbefore = bonobo_config_get_boolean (data->db, "/Shell/RunBefore", &ev); - CORBA_exception_free (&ev); - - if (runbefore == TRUE) { - bonobo_object_release_unref (data->db, NULL); - g_free (data); - return TRUE; - } - - data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/evolution-startup-wizard.glade", NULL); - g_return_val_if_fail (data->wizard != NULL, FALSE); - data->dialog = glade_xml_get_widget (data->wizard, "startup-wizard"); - g_return_val_if_fail (data->dialog != NULL, FALSE); - gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "startup-wizard", - "Evolution:shell"); - - page_hash = g_hash_table_new (NULL, NULL); - data->druid = glade_xml_get_widget (data->wizard, "startup-druid"); - g_return_val_if_fail (data->druid != NULL, FALSE); - gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid), - FALSE, TRUE, FALSE); - - gtk_signal_connect (GTK_OBJECT (data->druid), "cancel", - GTK_SIGNAL_FUNC (startup_wizard_cancel), data); - - data->start = glade_xml_get_widget (data->wizard, "start-page"); - data->finish = glade_xml_get_widget (data->wizard, "done-page"); - g_return_val_if_fail (data->start != NULL, FALSE); - g_return_val_if_fail (data->finish != NULL, FALSE); - gtk_signal_connect (GTK_OBJECT (data->finish), "finish", - GTK_SIGNAL_FUNC (finish_func), data); - - make_mail_dialog_pages (data); - g_return_val_if_fail (data->mailer != CORBA_OBJECT_NIL, TRUE); - - data->id_page = make_identity_page (data); - data->source_page = make_receive_page (data); - data->extra_page = make_extra_page (data); - data->transport_page = make_transport_page (data); - data->management_page = make_management_page (data); - - data->timezone_page = make_timezone_page (data); - data->import_page = make_importer_page (data); - - g_return_val_if_fail (data->id_page != NULL, TRUE); - g_return_val_if_fail (data->source_page != NULL, TRUE); - g_return_val_if_fail (data->extra_page != NULL, TRUE); - g_return_val_if_fail (data->transport_page != NULL, TRUE); - g_return_val_if_fail (data->management_page != NULL, TRUE); - g_return_val_if_fail (data->timezone_page != NULL, TRUE); - g_return_val_if_fail (data->import_page != NULL, TRUE); - - gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid), FALSE, TRUE, TRUE); - gtk_widget_show_all (data->dialog); - - gtk_main (); - - /* Sync database */ - bonobo_config_set_boolean (data->db, "/Shell/RunBefore", TRUE, &ev); - Bonobo_ConfigDatabase_sync (data->db, &ev); - bonobo_object_release_unref (data->db, NULL); - CORBA_exception_free (&ev); - - return !data->cancel; -} diff --git a/shell/e-shell-startup-wizard.h b/shell/e-shell-startup-wizard.h deleted file mode 100644 index 38f427cf2e..0000000000 --- a/shell/e-shell-startup-wizard.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * e-shell-startup-wizard.h - * - * Copyright (C) 2001 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifndef E_SHELL_STARTUP_WIZARD_H -#define E_SHELL_STARTUP_WIZARD_H - -#include <glib.h> - -gboolean e_shell_startup_wizard_create (void); - -#endif diff --git a/shell/e-shell-user-creatable-items-handler.c b/shell/e-shell-user-creatable-items-handler.c deleted file mode 100644 index def1552fcc..0000000000 --- a/shell/e-shell-user-creatable-items-handler.c +++ /dev/null @@ -1,459 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-user-creatable-items-handler.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-shell-user-creatable-items-handler.h" - -#include "e-util/e-corba-utils.h" - -#include <gal/util/e-util.h> - -#include <bonobo/bonobo-ui-util.h> - -#include <stdlib.h> -#include <ctype.h> - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - - -#define VERB_PREFIX "ShellUserCreatableItemVerb" -#define SHELL_VIEW_DATA_KEY "EShellUserCreatableItemsHandler:shell_view" - -struct _Component { - EvolutionShellComponentClient *component_client; - - GNOME_Evolution_UserCreatableItemTypeList *type_list; -}; -typedef struct _Component Component; - -struct _EShellUserCreatableItemsHandlerPrivate { - GSList *components; /* Component */ - - char *menu_xml; -}; - - -/* Component struct handling. */ - -static Component * -component_new_from_client (EvolutionShellComponentClient *client) -{ - CORBA_Environment ev; - Component *new; - GNOME_Evolution_ShellComponent objref; - - new = g_new (Component, 1); - - new->component_client = client; - gtk_object_ref (GTK_OBJECT (client)); - - CORBA_exception_init (&ev); - - objref = bonobo_object_corba_objref (BONOBO_OBJECT (client)); - new->type_list = GNOME_Evolution_ShellComponent__get_userCreatableItemTypes (objref, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - new->type_list = NULL; - - CORBA_exception_free (&ev); - - return new; -} - -static void -component_free (Component *component) -{ - gtk_object_unref (GTK_OBJECT (component->component_client)); - - if (component->type_list != NULL) - CORBA_free (component->type_list); - - g_free (component); -} - - -/* Helper functions. */ - -static char * -create_verb_from_component_number_and_type_id (int component_num, - const char *type_id) -{ - return g_strdup_printf (VERB_PREFIX ":%d:%s", component_num, type_id); -} - - -/* Setting up the XML for the menus. */ - -struct _MenuItem { - const char *label; - char shortcut; - char *verb; -}; -typedef struct _MenuItem MenuItem; - -static int -item_types_sort_func (const void *a, - const void *b) -{ - const MenuItem *item_a; - const MenuItem *item_b; - const char *p1, *p2; - - item_a = (const MenuItem *) a; - item_b = (const MenuItem *) b; - - p1 = item_a->label; - p2 = item_b->label; - - while (*p1 != '\0' && *p2 != '\0') { - if (*p1 == '_') { - p1 ++; - continue; - } - - if (*p2 == '_') { - p2 ++; - continue; - } - - if (toupper ((int) *p1) < toupper ((int) *p2)) - return -1; - else if (toupper ((int) *p1) > toupper ((int) *p2)) - return +1; - - p1 ++, p2 ++; - } - - if (*p1 == '\0') { - if (*p2 == '\0') - return 0; - else - return -1; - } else { - return +1; - } - -} - -static char * -create_xml_from_menu_items (GSList *items) -{ - GString *xml; - GSList *p; - char *str; - - xml = g_string_new (""); - - g_string_append (xml, "<Root> <menu> <submenu name=\"File\"> <submenu name=\"New\"> <placeholder name=\"NewItems\">"); - - g_string_append (xml, "<separator/> "); - - for (p = items; p != NULL; p = p->next) { - const MenuItem *item; - char *encoded_label; - - item = (const MenuItem *) p->data; - - encoded_label = bonobo_ui_util_encode_str (item->label); - - g_string_sprintfa (xml, "<menuitem name=\"New:%s\" verb=\"%s\" label=\"%s\"", - item->verb, item->verb, encoded_label); - - if (item->shortcut != '\0') - g_string_sprintfa (xml, " accel=\"*Control**Shift*%c\"", item->shortcut); - - g_string_append (xml, "/> "); - - g_free (encoded_label); - } - - g_string_append (xml, "</placeholder> </submenu> </submenu> </menu> </Root>"); - - str = xml->str; - g_string_free (xml, FALSE); - - return str; -} - -static void -setup_menu_xml (EShellUserCreatableItemsHandler *handler) -{ - EShellUserCreatableItemsHandlerPrivate *priv; - GSList *menu_items; - GSList *p; - int component_num; - - priv = handler->priv; - g_assert (priv->menu_xml == NULL); - - menu_items = NULL; - component_num = 0; - for (p = priv->components; p != NULL; p = p->next) { - const Component *component; - int i; - - component = (const Component *) p->data; - if (component->type_list != NULL) { - for (i = 0; i < component->type_list->_length; i ++) { - const GNOME_Evolution_UserCreatableItemType *type; - MenuItem *item; - - type = (const GNOME_Evolution_UserCreatableItemType *) component->type_list->_buffer + i; - - item = g_new (MenuItem, 1); - item->label = type->menuDescription; - item->shortcut = type->menuShortcut; - item->verb = create_verb_from_component_number_and_type_id (component_num, type->id); - - menu_items = g_slist_prepend (menu_items, item); - } - } - - component_num ++; - } - - if (menu_items == NULL) { - priv->menu_xml = g_strdup (""); - return; - } - - menu_items = g_slist_sort (menu_items, item_types_sort_func); - - priv->menu_xml = create_xml_from_menu_items (menu_items); - - for (p = menu_items; p != NULL; p = p->next) { - MenuItem *item; - - item = (MenuItem *) p->data; - g_free (item->verb); - g_free (item); - } - g_slist_free (menu_items); -} - - -/* Verb handling. */ - -static void -verb_fn (BonoboUIComponent *ui_component, - void *data, - const char *verb_name) -{ - EShellUserCreatableItemsHandler *handler; - EShellUserCreatableItemsHandlerPrivate *priv; - EShellView *shell_view; - const Component *component; - int component_number; - const char *p; - const char *id; - GSList *component_list_item; - int i; - - shell_view = gtk_object_get_data (GTK_OBJECT (ui_component), SHELL_VIEW_DATA_KEY); - g_assert (E_IS_SHELL_VIEW (shell_view)); - - handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (data); - priv = handler->priv; - - p = strchr (verb_name, ':'); - g_assert (p != NULL); - component_number = atoi (p + 1); - - p = strchr (p + 1, ':'); - g_assert (p != NULL); - id = p + 1; - - component_list_item = g_slist_nth (priv->components, component_number); - g_assert (component_list_item != NULL); - - component = (const Component *) component_list_item->data; - - if (component->type_list == NULL) - return; - - for (i = 0; i < component->type_list->_length; i ++) { - if (strcmp (component->type_list->_buffer[i].id, id) == 0) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellComponent_userCreateNewItem - (bonobo_object_corba_objref (BONOBO_OBJECT (component->component_client)), - id, - e_safe_corba_string (e_shell_view_get_current_physical_uri (shell_view)), - e_safe_corba_string (e_shell_view_get_current_folder_type (shell_view)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Error in userCreateNewItem -- %s", ev._repo_id); - - CORBA_exception_free (&ev); - return; - } - } -} - -static void -add_verbs_to_ui_component (EShellUserCreatableItemsHandler *handler, - BonoboUIComponent *ui_component) -{ - EShellUserCreatableItemsHandlerPrivate *priv; - int component_num; - GSList *p; - - priv = handler->priv; - - component_num = 0; - for (p = priv->components; p != NULL; p = p->next) { - const Component *component; - int i; - - component = (const Component *) p->data; - - if (component->type_list != NULL) { - for (i = 0; i < component->type_list->_length; i ++) { - char *verb_name; - - verb_name = create_verb_from_component_number_and_type_id - (component_num, component->type_list->_buffer[i].id); - - bonobo_ui_component_add_verb (ui_component, verb_name, verb_fn, handler); - - g_free (verb_name); - } - } - - component_num ++; - } -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EShellUserCreatableItemsHandler *handler; - EShellUserCreatableItemsHandlerPrivate *priv; - GSList *p; - - handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (object); - priv = handler->priv; - - for (p = priv->components; p != NULL; p = p->next) - component_free ((Component *) p->data); - - g_slist_free (priv->components); - - g_free (priv->menu_xml); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; -} - -static void -init (EShellUserCreatableItemsHandler *shell_user_creatable_items_handler) -{ - EShellUserCreatableItemsHandlerPrivate *priv; - - priv = g_new (EShellUserCreatableItemsHandlerPrivate, 1); - priv->components = NULL; - priv->menu_xml = NULL; - - shell_user_creatable_items_handler->priv = priv; -} - - -EShellUserCreatableItemsHandler * -e_shell_user_creatable_items_handler_new (void) -{ - EShellUserCreatableItemsHandler *new; - - new = gtk_type_new (e_shell_user_creatable_items_handler_get_type ()); - - return new; -} - -void -e_shell_user_creatable_items_handler_add_component (EShellUserCreatableItemsHandler *handler, - EvolutionShellComponentClient *shell_component_client) -{ - EShellUserCreatableItemsHandlerPrivate *priv; - - g_return_if_fail (handler != NULL); - g_return_if_fail (E_IS_SHELL_USER_CREATABLE_ITEMS_HANDLER (handler)); - g_return_if_fail (shell_component_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - - priv = handler->priv; - g_return_if_fail (priv->menu_xml == NULL); - - priv->components = g_slist_prepend (priv->components, component_new_from_client (shell_component_client)); -} - -void -e_shell_user_creatable_items_handler_setup_menus (EShellUserCreatableItemsHandler *handler, - EShellView *shell_view) -{ - EShellUserCreatableItemsHandlerPrivate *priv; - BonoboUIComponent *ui_component; - - g_return_if_fail (handler != NULL); - g_return_if_fail (E_IS_SHELL_USER_CREATABLE_ITEMS_HANDLER (handler)); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - priv = handler->priv; - - if (priv->menu_xml == NULL) - setup_menu_xml (handler); - - ui_component = e_shell_view_get_bonobo_ui_component (shell_view); - g_assert (ui_component); - - add_verbs_to_ui_component (handler, ui_component); - - gtk_object_set_data (GTK_OBJECT (ui_component), SHELL_VIEW_DATA_KEY, shell_view); /* Yuck. */ - - bonobo_ui_component_set (ui_component, "/", priv->menu_xml, NULL); -} - - -E_MAKE_TYPE (e_shell_user_creatable_items_handler, - "EShellUserCreatableItemsHandler", EShellUserCreatableItemsHandler, - class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-user-creatable-items-handler.h b/shell/e-shell-user-creatable-items-handler.h deleted file mode 100644 index 50cf2bd750..0000000000 --- a/shell/e-shell-user-creatable-items-handler.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-user-creatable-items-handler.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_SHELL_USER_CREATABLE_ITEMS_HANDLER_H_ -#define _E_SHELL_USER_CREATABLE_ITEMS_HANDLER_H_ - -#include "evolution-shell-component-client.h" - -#include <gtk/gtkobject.h> -#include <bonobo/bonobo-ui-component.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHELL_USER_CREATABLE_ITEMS_HANDLER (e_shell_user_creatable_items_handler_get_type ()) -#define E_SHELL_USER_CREATABLE_ITEMS_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_USER_CREATABLE_ITEMS_HANDLER, EShellUserCreatableItemsHandler)) -#define E_SHELL_USER_CREATABLE_ITEMS_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_USER_CREATABLE_ITEMS_HANDLER, EShellUserCreatableItemsHandlerClass)) -#define E_IS_SHELL_USER_CREATABLE_ITEMS_HANDLER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_USER_CREATABLE_ITEMS_HANDLER)) -#define E_IS_SHELL_USER_CREATABLE_ITEMS_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_USER_CREATABLE_ITEMS_HANDLER)) - - -typedef struct _EShellUserCreatableItemsHandler EShellUserCreatableItemsHandler; -typedef struct _EShellUserCreatableItemsHandlerPrivate EShellUserCreatableItemsHandlerPrivate; -typedef struct _EShellUserCreatableItemsHandlerClass EShellUserCreatableItemsHandlerClass; - -#include "e-shell-view.h" - -struct _EShellUserCreatableItemsHandler { - GtkObject parent; - - EShellUserCreatableItemsHandlerPrivate *priv; -}; - -struct _EShellUserCreatableItemsHandlerClass { - GtkObjectClass parent_class; -}; - - -GtkType e_shell_user_creatable_items_handler_get_type (void); -EShellUserCreatableItemsHandler *e_shell_user_creatable_items_handler_new (void); - -void e_shell_user_creatable_items_handler_add_component (EShellUserCreatableItemsHandler *handler, - EvolutionShellComponentClient *shell_component_client); - -void e_shell_user_creatable_items_handler_setup_menus (EShellUserCreatableItemsHandler *handler, - EShellView *shell_view); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHELL_USER_CREATABLE_ITEMS_HANDLER_H_ */ diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c deleted file mode 100644 index f5f63c5a91..0000000000 --- a/shell/e-shell-utils.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.c - * - * Copyright (C) 2000 Ximian, 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 <string.h> - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.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 = 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 3d86ac0081..0000000000 --- a/shell/e-shell-utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.h - * - * Copyright (C) 2000 Ximian, 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 - -#include <glib.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 5f3520993f..0000000000 --- a/shell/e-shell-view-menu.c +++ /dev/null @@ -1,782 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view-menu.c - * - * Copyright (C) 2000, 2001 Ximian, 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 - */ - -/* FIXME: This file is a bit of a mess. */ - -#include <config.h> - -#include <glib.h> - -#include <gtk/gtksignal.h> -#include <gtk/gtkmain.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-exec.h> -#include <libgnome/gnome-help.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-url.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-about.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> - -#include <liboaf/liboaf.h> -#include <bonobo/bonobo-moniker-util.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 "e-shell-importer.h" - -#include "e-shell-folder-commands.h" - -#include "evolution-shell-component-utils.h" - - -const char *authors[] = { - "Seth Alves", - "Anders Carlsson", - "Damon Chaplin", - "Clifford R. Conover", - "Anna Dirks", - "Miguel de Icaza", - "Radek Doulik", - "Arturo Espinoza", - "Larry Ewing", - "Nat Friedman", - "Bertrand Guiheneuf", - "Iain Holmes", - "Tuomas Kuosmanen", - "Christopher J. Lahey", - "Jason Leach", - "Matthew Loper", - "Federico Mena", - "Eskil Heyn Olsen", - "Jesse Pavel", - "Ettore Perazzoli", - "JP Rosevear", - "Jeffrey Stedfast", - "Jakub Steiner", - "Russell Steinthal", - "Peter Teichman", - "Chris Toshok", - "Jon Trowbridge", - "Peter Williams", - "Dan Winship", - "Michael Zucchi", - NULL -}; - - -/* EShellView callbacks. */ - -static void -shortcut_bar_visibility_changed_cb (EShellView *shell_view, - gboolean visible, - void *data) -{ - BonoboUIComponent *uic; - const char *path; - const char *txt; - - if (visible) - txt = "1"; - else - txt = "0"; - - 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_visibility_changed_cb (EShellView *shell_view, - gboolean visible, - void *data) -{ - BonoboUIComponent *uic; - const char *path; - const char *txt; - - if (visible) - txt = "1"; - else - txt = "0"; - - 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_close (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - gtk_object_destroy (GTK_OBJECT (shell_view)); -} - -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_destroy_all_views (shell); -} - -static void -command_submit_bug (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]) { - gnome_error_dialog (_("Bug buddy was not found in your $PATH.")); - return; - } - - pid = gnome_execute_async (NULL, 4, args); - g_free (args[0]); - - if (pid == -1) - 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 { - char *version; - - if (SUB_VERSION[0] == '\0') - version = g_strdup (VERSION); - else - version = g_strdup_printf ("%s [%s]", VERSION, SUB_VERSION); - - about_box = gnome_about_new(_("Ximian Evolution"), - version, - _("Copyright 1999, 2000, 2001 Ximian, Inc."), - authors, - _("Ximian 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); - - g_free (version); - } -} - -static void -command_help_faq (BonoboUIComponent *uih, - void *data, - const char *path) -{ - gnome_url_show ("http://www.ximian.com/apps/evolution-faq.html"); -} - -static void -command_toggle_folder_bar (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - EShellView *shell_view; - gboolean show; - - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - shell_view = E_SHELL_VIEW (user_data); - show = atoi (state); - - e_shell_view_show_folder_bar (shell_view, show); -} - -static void -command_toggle_shortcut_bar (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - EShellView *shell_view; - gboolean show; - - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - shell_view = E_SHELL_VIEW (user_data); - - show = atoi (state); - - e_shell_view_show_shortcut_bar (shell_view, show); -} - - -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 (current_uri && 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, - NULL /* result_callback */, - NULL /* result_callback_data */); -} - -static void -command_open_folder_in_new_window (BonoboUIComponent *uih, - gpointer data, - const char *path) -{ - EShellView *shell_view, *new_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); - - new_view = e_shell_create_view (shell, current_uri); - gtk_widget_show (GTK_WIDGET (new_view)); -} - - -/* Folder operations. */ - -static void -command_move_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - e_shell_command_move_folder (e_shell_view_get_shell (shell_view), shell_view); -} - -static void -command_copy_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - e_shell_command_copy_folder (e_shell_view_get_shell (shell_view), shell_view); -} - -static void -command_delete_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - e_shell_command_delete_folder (e_shell_view_get_shell (shell_view), shell_view); -} - -static void -command_rename_folder (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); -/* e_shell_command_rename_folder (e_shell_view_get_shell (shell_view), shell_view); */ -} - -static void -command_add_folder_to_shortcut_bar (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - e_shell_command_add_to_shortcut_bar (e_shell_view_get_shell (shell_view), shell_view); -} - - -/* Going to a folder. */ - -static void -goto_folder_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog, - void *data) -{ - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - -static void -goto_folder_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, - gpointer 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..."), - _("Select the folder that you want to open"), - 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), "cancelled", - GTK_SIGNAL_FUNC (goto_folder_dialog_cancelled_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected", - GTK_SIGNAL_FUNC (goto_folder_dialog_folder_selected_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; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - - e_shell_command_create_new_folder (shell, shell_view); -} - -static void -command_xml_dump (gpointer dummy, - EShellView *view) -{ - bonobo_window_dump (BONOBO_WINDOW (view), "On demand"); -} - - -static void -command_work_offline (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); - - g_warning ("Putting the shell offline"); - e_shell_go_offline (shell, shell_view); -} - -static void -command_work_online (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); - - g_warning ("Putting the shell online"); - e_shell_go_online (shell, shell_view); -} - - -/* Unimplemented commands. */ - -#define DEFINE_UNIMPLEMENTED(func) \ -static void \ -func (BonoboUIComponent *uic, void *data, const char *path) \ -{ \ - g_warning ("e-shell-view-menu.c: %s: not implemented.", #func); \ -} \ - -static void -command_new_mail_message (BonoboUIComponent *uih, - gpointer data, - const char *path) -{ - CORBA_Environment ev; - Bonobo_Unknown object; - - CORBA_exception_init (&ev); - object = bonobo_get_object ("OAFIID:GNOME_Evolution_Mail_Composer!visible=1", - "Bonobo/Unknown", &ev); - - CORBA_exception_free (&ev); -} - - -static void -new_shortcut_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog, - void *data) -{ - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - -static void -new_shortcut_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog, - const char *path, - void *data) -{ - EShellView *shell_view; - EShell *shell; - EShortcuts *shortcuts; - EFolder *folder; - int group_num; - char *evolution_uri; - - if (path == NULL) - return; - - shell_view = E_SHELL_VIEW (data); - shell = e_shell_view_get_shell (shell_view); - shortcuts = e_shell_get_shortcuts (shell); - - folder = e_storage_set_get_folder (e_shell_get_storage_set (shell), path); - if (folder == NULL) - return; - - group_num = e_shell_view_get_current_shortcuts_group_num (shell_view); - - evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - - /* FIXME: I shouldn't have to set the type here. Maybe. */ - e_shortcuts_add_shortcut (shortcuts, group_num, -1, evolution_uri, NULL, e_folder_get_unread_count (folder), e_folder_get_type_string (folder)); - - g_free (evolution_uri); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - -static void -command_new_shortcut (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EShellView *shell_view; - GtkWidget *folder_selection_dialog; - - shell_view = E_SHELL_VIEW (data); - - folder_selection_dialog = e_shell_folder_selection_dialog_new (e_shell_view_get_shell (shell_view), - _("Create a new shortcut"), - _("Select the folder you want the shortcut to point to:"), - e_shell_view_get_current_uri (shell_view), - NULL); - e_shell_folder_selection_dialog_set_allow_creation (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), - FALSE); - - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled", - GTK_SIGNAL_FUNC (new_shortcut_dialog_cancelled_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected", - GTK_SIGNAL_FUNC (new_shortcut_dialog_folder_selected_cb), shell_view); - - gtk_widget_show (folder_selection_dialog); -} - -DEFINE_UNIMPLEMENTED (command_new_contact) -DEFINE_UNIMPLEMENTED (command_new_task_request) - -BonoboUIVerb new_verbs [] = { - BONOBO_UI_VERB ("NewFolder", command_new_folder), - BONOBO_UI_VERB ("NewShortcut", command_new_shortcut), - BONOBO_UI_VERB ("NewMailMessage", command_new_mail_message), - - BONOBO_UI_VERB ("NewAppointment", command_new_shortcut), - BONOBO_UI_VERB ("NewContact", command_new_contact), - BONOBO_UI_VERB ("NewTask", command_new_task_request), - - BONOBO_UI_VERB_END -}; - -BonoboUIVerb file_verbs [] = { - BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) show_import_wizard), - BONOBO_UI_VERB ("FileGoToFolder", command_goto_folder), - BONOBO_UI_VERB ("FileCreateFolder", command_create_folder), - BONOBO_UI_VERB ("FileClose", command_close), - BONOBO_UI_VERB ("FileExit", command_quit), - - BONOBO_UI_VERB ("WorkOffline", command_work_offline), - BONOBO_UI_VERB ("WorkOnline", command_work_online), - - BONOBO_UI_VERB_END -}; - -BonoboUIVerb folder_verbs [] = { - BONOBO_UI_VERB ("OpenFolderInNewWindow", command_open_folder_in_new_window), - BONOBO_UI_VERB ("MoveFolder", command_move_folder), - BONOBO_UI_VERB ("CopyFolder", command_copy_folder), - - BONOBO_UI_VERB ("DeleteFolder", command_delete_folder), - BONOBO_UI_VERB ("RenameFolder", command_rename_folder), - - BONOBO_UI_VERB ("AddFolderToShortcutBar", command_add_folder_to_shortcut_bar), - - BONOBO_UI_VERB_END -}; - -BonoboUIVerb help_verbs [] = { - BONOBO_UI_VERB_DATA ("HelpFAQ", command_help_faq, NULL), - - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps [] = { - E_PIXMAP ("/menu/File/New/Folder", "folder.xpm"), - E_PIXMAP ("/menu/File/Folder/Folder", "folder.xpm"), - E_PIXMAP ("/menu/File/FileImporter", "import.xpm"), - E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"), - - E_PIXMAP_END -}; - -static EPixmap offline_pixmaps [] = { - E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"), - - E_PIXMAP_END -}; - -static EPixmap online_pixmaps [] = { - E_PIXMAP ("/menu/File/ToggleOffline", "work_online-16.png"), - - E_PIXMAP_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_submit_bug, 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); -} - - -/* The Work Online / Work Offline menu item. */ - -static void -update_offline_menu_item (EShellView *shell_view, - EShellLineStatus line_status) -{ - BonoboUIComponent *ui_component; - - ui_component = e_shell_view_get_bonobo_ui_component (shell_view); - - switch (line_status) { - case E_SHELL_LINE_STATUS_OFFLINE: - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "label", _("Work Online"), NULL); - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "verb", "WorkOnline", NULL); - bonobo_ui_component_set_prop (ui_component, - "/commands/ToggleOffline", - "sensitive", "1", NULL); - e_pixmaps_update (ui_component, online_pixmaps); - break; - - case E_SHELL_LINE_STATUS_ONLINE: - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "label", _("Work Offline"), NULL); - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "verb", "WorkOffline", NULL); - bonobo_ui_component_set_prop (ui_component, - "/commands/ToggleOffline", - "sensitive", "1", NULL); - e_pixmaps_update (ui_component, offline_pixmaps); - break; - - case E_SHELL_LINE_STATUS_GOING_OFFLINE: - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "label", _("Work Offline"), NULL); - bonobo_ui_component_set_prop (ui_component, - "/menu/File/ToggleOffline", - "verb", "WorkOffline", NULL); - bonobo_ui_component_set_prop (ui_component, - "/commands/ToggleOffline", - "sensitive", "0", NULL); - e_pixmaps_update (ui_component, offline_pixmaps); - break; - - default: - g_assert_not_reached (); - } -} - -static void -shell_line_status_changed_cb (EShell *shell, - EShellLineStatus new_status, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - update_offline_menu_item (shell_view, new_status); -} - - -#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; - EShell *shell; - - 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); - shell = e_shell_view_get_shell (shell_view); - - bonobo_ui_component_add_verb_list_with_data (uic, file_verbs, shell_view); - bonobo_ui_component_add_verb_list_with_data (uic, folder_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); - - e_pixmaps_update (uic, pixmaps); - - gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_visibility_changed", - GTK_SIGNAL_FUNC (shortcut_bar_visibility_changed_cb), - SHORTCUT_BAR_TOGGLE_PATH); - gtk_signal_connect (GTK_OBJECT (shell_view), "folder_bar_visibility_changed", - GTK_SIGNAL_FUNC (folder_bar_visibility_changed_cb), - FOLDER_BAR_TOGGLE_PATH); - - /* Initialize the toggles. Yeah, this is, well, yuck. */ - folder_bar_visibility_changed_cb (shell_view, e_shell_view_folder_bar_shown (shell_view), - FOLDER_BAR_TOGGLE_PATH); - shortcut_bar_visibility_changed_cb (shell_view, e_shell_view_shortcut_bar_shown (shell_view), - SHORTCUT_BAR_TOGGLE_PATH); - - /* Set up the work online / work offline menu item. */ - gtk_signal_connect_while_alive (GTK_OBJECT (shell), "line_status_changed", - GTK_SIGNAL_FUNC (shell_line_status_changed_cb), shell_view, - GTK_OBJECT (shell_view)); - update_offline_menu_item (shell_view, e_shell_get_line_status (shell)); -} diff --git a/shell/e-shell-view-menu.h b/shell/e-shell-view-menu.h deleted file mode 100644 index 9fb65c048c..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 Ximian, 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 db6237d2aa..0000000000 --- a/shell/e-shell-view.c +++ /dev/null @@ -1,2541 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000, 2001 Ximian, 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@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Matt Loper <matt@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <ctype.h> - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-window.h> -#include <libgnomeui/gnome-window-icon.h> -#include <libgnomeui/gnome-app.h> -#include <bonobo/bonobo-socket.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-widget.h> - -#include <gal/e-paned/e-hpaned.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 "widgets/misc/e-bonobo-widget.h" - -#include "evolution-shell-view.h" - -#include "e-gray-bar.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" - - -static BonoboWindowClass *parent_class = NULL; - -struct _View { - char *uri; - GtkWidget *control; - EFolder *folder; -}; -typedef struct _View View; - -struct _EShellViewPrivate { - /* The shell. */ - EShell *shell; - - /* EvolutionShellView Bonobo object for implementing the - Evolution::ShellView interface. */ - EvolutionShellView *corba_interface; - - /* The UI handler & container. */ - BonoboUIComponent *ui_component; - BonoboUIContainer *ui_container; - - /* 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; - - /* uri to go to at timeout */ - unsigned int set_folder_timeout; - char *set_folder_uri; - - /* Tooltips. */ - GtkTooltips *tooltips; - - /* The widgetry. */ - GtkWidget *appbar; - GtkWidget *hpaned; - GtkWidget *view_vbox; - GtkWidget *folder_title_bar; - GtkWidget *view_hpaned; - GtkWidget *contents; - GtkWidget *notebook; - GtkWidget *shortcut_frame; - GtkWidget *shortcut_bar; - GtkWidget *storage_set_title_bar; - GtkWidget *storage_set_view; - GtkWidget *storage_set_view_box; - - /* The status bar widgetry. */ - GtkWidget *status_bar; - GtkWidget *offline_toggle; - GtkWidget *offline_toggle_pixmap; - GtkWidget *menu_hint_label; - GtkWidget *task_bar; - - /* The pop-up window for the folder-tree (i.e. the one we create when - the user clicks on the folder title. */ - GtkWidget *folder_bar_popup; - - /* The views we have already open. */ - GHashTable *uri_to_view; - - /* 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; - - /* Whether the shortcut and folder bars are visible or not. */ - unsigned int shortcut_bar_shown : 1; - unsigned int folder_bar_shown : 1; - - /* List of sockets we created. */ - GList *sockets; -}; - -enum { - SHORTCUT_BAR_VISIBILITY_CHANGED, - FOLDER_BAR_VISIBILITY_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -#define DEFAULT_SHORTCUT_BAR_WIDTH 100 - -#define DEFAULT_TREE_WIDTH 130 -#define MIN_POPUP_TREE_WIDTH 130 - -#define DEFAULT_WIDTH 705 -#define DEFAULT_HEIGHT 550 - -#define SET_FOLDER_DELAY 250 - - -/* The icons for the offline/online status. */ - -static GdkPixmap *offline_pixmap = NULL; -static GdkBitmap *offline_mask = NULL; - -static GdkPixmap *online_pixmap = NULL; -static GdkBitmap *online_mask = NULL; - - -static void update_for_current_uri (EShellView *shell_view); -static void update_offline_toggle_status (EShellView *shell_view); -static const char *get_storage_set_path_from_uri (const char *uri); - - -/* Boo. */ -static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data); - - -/* View handling. */ - -static View * -view_new (const char *uri, - GtkWidget *control) -{ - View *new; - - new = g_new (View, 1); - new->uri = g_strdup (uri); - new->control = control; - - return new; -} - -static void -view_destroy (View *view) -{ - g_free (view->uri); - g_free (view); -} - - -/* 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; -} - -/* Initialize the icons. */ -static void -load_images (void) -{ - GdkPixbuf *pixbuf; - - pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGES "/offline.png"); - if (pixbuf == NULL) { - g_warning ("Cannot load `%s'", EVOLUTION_IMAGES "/offline.png"); - } else { - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &offline_pixmap, &offline_mask, 128); - gdk_pixbuf_unref (pixbuf); - } - - pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGES "/online.png"); - if (pixbuf == NULL) { - g_warning ("Cannot load `%s'", EVOLUTION_IMAGES "/online.png"); - } else { - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &online_pixmap, &online_mask, 128); - gdk_pixbuf_unref (pixbuf); - } -} - -/* 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; -} - -static void -cleanup_delayed_selection (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - if (priv->delayed_selection != NULL) { - 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); - } -} - - -/* Folder bar pop-up handling. */ - -static void -reparent (GtkWidget *widget, - GtkContainer *new_container) -{ - gtk_widget_ref (widget); - gtk_container_remove (GTK_CONTAINER (widget->parent), widget); - gtk_container_add (GTK_CONTAINER (new_container), widget); - gtk_widget_unref (widget); -} - -static void -reparent_storage_set_view_box_and_destroy_popup (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (priv->storage_set_view_box); - - g_assert (priv->folder_bar_popup != NULL); - - gtk_widget_ref (priv->storage_set_view_box); - gtk_container_remove (GTK_CONTAINER (priv->folder_bar_popup), priv->storage_set_view_box); - e_paned_pack1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box, FALSE, FALSE); - gtk_widget_unref (priv->storage_set_view_box); - - gtk_widget_destroy (priv->folder_bar_popup); - priv->folder_bar_popup = NULL; - - /* Re-enable DnD on the StorageSetView (it got disabled when displaying - the pop-up). */ - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), TRUE); -} - -static void -popdown_transient_folder_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - reparent_storage_set_view_box_and_destroy_popup (shell_view); - gtk_widget_hide (priv->storage_set_view_box); - - e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), FALSE); - - /* Re-enable DnD on the StorageSetView (it got disabled when displaying - the pop-up). */ - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), TRUE); -} - -static int -storage_set_view_box_button_release_event_cb (GtkWidget *widget, - GdkEventButton *button_event, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - if (button_event->window == E_PANED (priv->view_hpaned)->handle - || button_event->button != 1) - return FALSE; - - popdown_transient_folder_bar (shell_view); - - return TRUE; -} - -static int -storage_set_view_box_event_cb (GtkWidget *widget, - GdkEvent *event, - void *data) -{ - GtkWidget *event_widget; - GtkWidget *tooltip; - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - event_widget = gtk_get_event_widget (event); - - if (!event_widget) - return FALSE; - - tooltip = e_tree_get_tooltip (E_TREE(priv->storage_set_view)); - if (! (GTK_WIDGET_IS_SENSITIVE (event_widget) && - tooltip && - gtk_widget_is_ancestor (event_widget, tooltip))) - return FALSE; - - switch (event->type) { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - case GDK_KEY_PRESS: - case GDK_KEY_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_RELEASE: - case GDK_PROXIMITY_IN: - case GDK_PROXIMITY_OUT: - gtk_propagate_event (event_widget, event); - return TRUE; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - gtk_widget_event (event_widget, event); - return TRUE; - break; - default: - break; - } - return FALSE; -} - -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; - - g_assert (priv->folder_bar_popup != NULL); - - reparent_storage_set_view_box_and_destroy_popup (shell_view); - - e_shell_view_show_folder_bar (shell_view, TRUE); - e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), FALSE); -} - -static void -folder_bar_popup_map_callback (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 ("e-shell-view.c:folder_bar_popup_map_callback() -- pointer grab failed."); - return; - } - - gtk_grab_add (widget); - - gtk_signal_connect_while_alive (GTK_OBJECT (widget), "event", - GTK_SIGNAL_FUNC (storage_set_view_box_event_cb), shell_view, - GTK_OBJECT (priv->folder_bar_popup)); - gtk_signal_connect_while_alive (GTK_OBJECT (widget), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view, - GTK_OBJECT (priv->folder_bar_popup)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->storage_set_view), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view, - GTK_OBJECT (priv->folder_bar_popup)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->storage_set_title_bar), "button_clicked", - GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), shell_view, - GTK_OBJECT (priv->folder_bar_popup)); -} - -static void -pop_up_folder_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - int x, y; - int orig_x, orig_y; - - priv = shell_view->priv; - - g_assert (! priv->folder_bar_shown); - - e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar), - E_TITLE_BAR_BUTTON_MODE_PIN); - - priv->folder_bar_popup = gtk_window_new (GTK_WINDOW_POPUP); - - /* 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" signal; `storage_set_view_box_map_cb()' will do the grab. */ - gtk_signal_connect (GTK_OBJECT (priv->folder_bar_popup), "map", - GTK_SIGNAL_FUNC (folder_bar_popup_map_callback), shell_view); - - x = priv->folder_title_bar->allocation.x; - y = priv->folder_title_bar->allocation.y + priv->folder_title_bar->allocation.height; - - gdk_window_get_origin (priv->folder_title_bar->window, &orig_x, &orig_y); - x += orig_x; - y += orig_y + 2; - - priv->view_hpaned_position = MAX (priv->view_hpaned_position, MIN_POPUP_TREE_WIDTH); - - gtk_window_set_default_size (GTK_WINDOW (priv->folder_bar_popup), - priv->view_hpaned_position, - priv->view_hpaned->allocation.height); - - reparent (priv->storage_set_view_box, GTK_CONTAINER (priv->folder_bar_popup)); - - gtk_widget_show (priv->storage_set_view_box); - - gtk_widget_popup (priv->folder_bar_popup, x, y); - - /* Disable DnD or "interesting" things will happen. */ - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), FALSE); -} - - - -/* Switching views on a tree view click. */ - -static int -set_folder_timeout (gpointer data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - /* set to 0 so we don't remove it in _display_uri() */ - priv->set_folder_timeout = 0; - e_shell_view_display_uri (shell_view, priv->set_folder_uri); - - return FALSE; -} - -static void -switch_on_folder_tree_click (EShellView *shell_view, - const char *path) -{ - EShellViewPrivate *priv; - char *uri; - - priv = shell_view->priv; - - uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - if (priv->uri != NULL && !strcmp (uri, priv->uri)) { - g_free (uri); - return; - } - - if (priv->set_folder_timeout != 0) - gtk_timeout_remove (priv->set_folder_timeout); - - g_free (priv->set_folder_uri); - priv->set_folder_uri = NULL; - - cleanup_delayed_selection (shell_view); - - if (priv->folder_bar_popup != NULL) { - e_shell_view_display_uri (shell_view, uri); - popdown_transient_folder_bar (shell_view); - g_free (uri); - return; - } - - priv->set_folder_uri = uri; - - priv->set_folder_timeout = gtk_timeout_add (SET_FOLDER_DELAY, set_folder_timeout, shell_view); -} - - -/* 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 = g_strdup (priv->delayed_selection); - cleanup_delayed_selection (shell_view); - 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, - gboolean in_new_window, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - if (in_new_window) { - EShellView *new_view; - - new_view = e_shell_create_view (e_shell_view_get_shell (shell_view), uri); - gtk_widget_show (GTK_WIDGET (new_view)); - } else { - e_shell_view_display_uri (shell_view, uri); - } -} - -/* Callback when user chooses "Hide shortcut bar" via a right click */ -static void -hide_requested_cb (EShortcutsView *shortcut_view, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_show_shortcut_bar (shell_view, FALSE); -} - -/* 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; - EStorageSet *storage_set; - EFolder *folder; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - /* Adjust sensitivity for menu options depending on whether - the folder selected is a stock folder */ - storage_set = e_shell_get_storage_set (priv->shell); - folder = e_storage_set_get_folder (storage_set, path); - if (folder) { - BonoboUIComponent *uic; - char *txt; - - if (e_folder_get_is_stock (folder)) - txt = "0"; - else - txt = "1"; - - uic = e_shell_view_get_bonobo_ui_component (shell_view); - - bonobo_ui_component_set_prop (uic, "/commands/MoveFolder", - "sensitive", txt, NULL); - bonobo_ui_component_set_prop (uic, "/commands/CopyFolder", - "sensitive", txt, NULL); - bonobo_ui_component_set_prop (uic, "/commands/DeleteFolder", - "sensitive", txt, NULL); - bonobo_ui_component_set_prop (uic, "/commands/RenameFolder", - "sensitive", txt, NULL); - } - - switch_on_folder_tree_click (shell_view, path); -} - -/* Callback called when a storage in the tree view is clicked. */ -static void -storage_selected_cb (EStorageSetView *storage_set_view, - const char *name, - void *data) -{ - EShellView *shell_view; - char *path; - - shell_view = E_SHELL_VIEW (data); - - path = g_strconcat (G_DIR_SEPARATOR_S, name, NULL); - switch_on_folder_tree_click (shell_view, path); - - g_free (path); -} - -/* 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); - - if (shell_view->priv->folder_bar_popup == NULL) - e_shell_view_show_folder_bar (shell_view, FALSE); -} - -/* Callback called when the title bar button is clicked. */ -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 (shell_view->priv->folder_bar_popup == NULL) - pop_up_folder_bar (shell_view); -} - -/* Callback called when the offline toggle button is clicked. */ -static void -offline_toggle_clicked_cb (GtkButton *button, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - switch (e_shell_get_line_status (priv->shell)) { - case E_SHELL_LINE_STATUS_ONLINE: - e_shell_go_offline (priv->shell, shell_view); - break; - case E_SHELL_LINE_STATUS_OFFLINE: - e_shell_go_online (priv->shell, shell_view); - break; - default: - g_assert_not_reached (); - } -} - - -/* 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), - priv->ui_container); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_selected", - GTK_SIGNAL_FUNC (folder_selected_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (storage_set_view), "storage_selected", - GTK_SIGNAL_FUNC (storage_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 (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; - - /* Notice we don't show the vbox here yet. By default it's hidden. */ -} - -static void -setup_offline_toggle (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkWidget *toggle; - GtkWidget *pixmap; - - priv = shell_view->priv; - - toggle = gtk_button_new (); - GTK_WIDGET_UNSET_FLAGS (toggle, GTK_CAN_FOCUS); - gtk_button_set_relief (GTK_BUTTON (toggle), GTK_RELIEF_NONE); - - gtk_signal_connect (GTK_OBJECT (toggle), "clicked", - GTK_SIGNAL_FUNC (offline_toggle_clicked_cb), shell_view); - - pixmap = gtk_pixmap_new (offline_pixmap, offline_mask); - - gtk_container_add (GTK_CONTAINER (toggle), pixmap); - - gtk_widget_show (toggle); - gtk_widget_show (pixmap); - - priv->offline_toggle = toggle; - priv->offline_toggle_pixmap = pixmap; - - update_offline_toggle_status (shell_view); - - g_assert (priv->status_bar != NULL); - - gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->offline_toggle, FALSE, TRUE, 0); -} - -static void -setup_menu_hint_label (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - priv->menu_hint_label = gtk_label_new (""); - gtk_misc_set_alignment (GTK_MISC (priv->menu_hint_label), 0.0, 0.5); - - gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->menu_hint_label, TRUE, TRUE, 0); -} - -static void -setup_task_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - priv->task_bar = e_task_bar_new (); - - g_assert (priv->status_bar != NULL); - - gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->task_bar, TRUE, TRUE, 0); - gtk_widget_show (priv->task_bar); -} - -static void -create_status_bar (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - priv->status_bar = gtk_hbox_new (FALSE, 2); - gtk_widget_show (priv->status_bar); - - setup_offline_toggle (shell_view); - setup_menu_hint_label (shell_view); - setup_task_bar (shell_view); -} - - -/* Menu hints for the status bar. */ - -static void -ui_engine_add_hint_callback (BonoboUIEngine *engine, - const char *hint, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - gtk_label_set (GTK_LABEL (priv->menu_hint_label), hint); - gtk_widget_show (priv->menu_hint_label); - gtk_widget_hide (priv->task_bar); -} - -static void -ui_engine_remove_hint_callback (BonoboUIEngine *engine, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - gtk_widget_hide (priv->menu_hint_label); - gtk_widget_show (priv->task_bar); -} - -static void -setup_statusbar_hints (EShellView *shell_view) -{ - EShellViewPrivate *priv; - BonoboUIEngine *ui_engine; - - priv = shell_view->priv; - - g_assert (priv->status_bar != NULL); - - ui_engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view)); - - gtk_signal_connect (GTK_OBJECT (ui_engine), "add_hint", - GTK_SIGNAL_FUNC (ui_engine_add_hint_callback), shell_view); - gtk_signal_connect (GTK_OBJECT (ui_engine), "remove_hint", - GTK_SIGNAL_FUNC (ui_engine_remove_hint_callback), shell_view); -} - - -static void -setup_widgets (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkWidget *contents_vbox; - GtkWidget *gray_bar; - - priv = shell_view->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); - - gtk_signal_connect (GTK_OBJECT (priv->shortcut_bar), "hide_requested", - GTK_SIGNAL_FUNC (hide_requested_cb), shell_view); - - priv->shortcut_frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (priv->shortcut_frame), GTK_SHADOW_IN); - - /* 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); - - priv->folder_title_bar = e_shell_folder_title_bar_new (); - gtk_signal_connect (GTK_OBJECT (priv->folder_title_bar), "title_toggled", - GTK_SIGNAL_FUNC (title_bar_toggled_cb), shell_view); - - priv->view_hpaned = e_hpaned_new (); - e_paned_pack1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box, FALSE, FALSE); - e_paned_pack2 (E_PANED (priv->view_hpaned), priv->notebook, TRUE, FALSE); - - gray_bar = e_gray_bar_new (); - gtk_container_add (GTK_CONTAINER (gray_bar), priv->folder_title_bar); - gtk_box_pack_start (GTK_BOX (priv->view_vbox), gray_bar, FALSE, FALSE, 2); - - gtk_box_pack_start (GTK_BOX (priv->view_vbox), priv->view_hpaned, TRUE, TRUE, 0); - - priv->hpaned = e_hpaned_new (); - gtk_container_add (GTK_CONTAINER (priv->shortcut_frame), priv->shortcut_bar); - e_paned_pack1 (E_PANED (priv->hpaned), priv->shortcut_frame, FALSE, FALSE); - e_paned_pack2 (E_PANED (priv->hpaned), priv->view_vbox, TRUE, FALSE); - e_paned_set_position (E_PANED (priv->hpaned), DEFAULT_SHORTCUT_BAR_WIDTH); - - /* The status bar. */ - - create_status_bar (shell_view); - setup_statusbar_hints (shell_view); - - /* The contents. */ - - contents_vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (contents_vbox), priv->hpaned, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (contents_vbox), priv->status_bar, FALSE, TRUE, 0); - gtk_widget_show (contents_vbox); - - bonobo_window_set_contents (BONOBO_WINDOW (shell_view), contents_vbox); - - /* Show stuff. */ - - gtk_widget_show (priv->shortcut_frame); - gtk_widget_show (priv->shortcut_bar); - gtk_widget_show (priv->storage_set_view); - 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->folder_title_bar); - gtk_widget_show (priv->status_bar); - - gtk_widget_show (gray_bar); - - priv->shortcut_bar_shown = TRUE; - priv->folder_bar_shown = FALSE; - - /* 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_view (void *name, - void *value, - void *data) -{ - View *view; - - view = (View *) value; - - gtk_widget_destroy (view->control); - - view_destroy (view); - - 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; - - gtk_object_unref (GTK_OBJECT (priv->tooltips)); - - if (priv->corba_interface != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->corba_interface)); - - if (priv->folder_bar_popup != NULL) - gtk_widget_destroy (priv->folder_bar_popup); - - 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_view, hash_forall_destroy_view, NULL); - g_hash_table_destroy (priv->uri_to_view); - - bonobo_object_unref (BONOBO_OBJECT (priv->ui_component)); - - g_free (priv->uri); - - cleanup_delayed_selection (shell_view); - - if (priv->set_folder_timeout != 0) - gtk_timeout_remove (priv->set_folder_timeout); - - g_free (priv->set_folder_uri); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* 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_VISIBILITY_CHANGED] - = gtk_signal_new ("shortcut_bar_visibility_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, shortcut_bar_visibility_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - signals[FOLDER_BAR_VISIBILITY_CHANGED] - = gtk_signal_new ("folder_bar_visibility_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, folder_bar_visibility_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - load_images (); -} - -static void -init (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = g_new (EShellViewPrivate, 1); - - priv->shell = NULL; - priv->corba_interface = NULL; - priv->ui_component = NULL; - priv->uri = NULL; - priv->delayed_selection = NULL; - - priv->tooltips = gtk_tooltips_new (); - - 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->status_bar = NULL; - priv->offline_toggle = NULL; - priv->offline_toggle_pixmap = NULL; - priv->menu_hint_label = NULL; - priv->task_bar = NULL; - - priv->folder_bar_popup = NULL; - - priv->shortcut_bar_shown = FALSE; - priv->folder_bar_shown = FALSE; - - priv->hpaned_position = 0; - priv->view_hpaned_position = 0; - - priv->uri_to_view = g_hash_table_new (g_str_hash, g_str_equal); - - priv->sockets = NULL; - - priv->set_folder_timeout = 0; - priv->set_folder_uri = NULL; - - shell_view->priv = priv; -} - - -/* EvolutionShellView interface callbacks. */ - -static void -corba_interface_set_message_cb (EvolutionShellView *shell_view, - const char *message, - gboolean busy, - void *data) -{ - /* Don't do anything here anymore. The interface is going to be - deprecated soon. */ -} - -static void -corba_interface_unset_message_cb (EvolutionShellView *shell_view, - void *data) -{ - /* Don't do anything here anymore. The interface is going to be - deprecated soon. */ -} - -static void -corba_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 -corba_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); -} - -static void -corba_interface_set_folder_bar_label (EvolutionShellView *evolution_shell_view, - const char *text, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - g_return_if_fail (data != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (data)); - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - e_shell_folder_title_bar_set_folder_bar_label (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), - text); -} - -static void -unmerge_on_error (BonoboObject *object, - CORBA_Object cobject, - CORBA_Environment *ev) -{ - BonoboWindow *win; - - win = bonobo_ui_container_get_win (BONOBO_UI_CONTAINER (object)); - - if (win) - bonobo_window_deregister_component_by_ref (win, cobject); -} - -static void -updated_folder_cb (EStorageSet *storage_set, - const char *path, - void *data) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - const char *view_path; - - shell_view = E_SHELL_VIEW (data); - priv = shell_view->priv; - - view_path = get_storage_set_path_from_uri (priv->uri); - if (view_path && strcmp (path, view_path) != 0) - return; - - /* Update the folder title bar and the window title bar */ - update_for_current_uri (shell_view); -} - - -/* Shell callbacks. */ - -static void -shell_line_status_changed_cb (EShell *shell, - EShellLineStatus new_status, - void *data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - update_offline_toggle_status (shell_view); -} - -static int -delete_event_cb (GtkWidget *widget, - GdkEventAny *ev, - void *data) -{ - return FALSE; -} - - -EShellView * -e_shell_view_construct (EShellView *shell_view, - EShell *shell) -{ - EShellViewPrivate *priv; - EShellView *view; - - 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", "Ximian Evolution")); - - if (!view) { - gtk_object_unref (GTK_OBJECT (shell_view)); - return NULL; - } - - gtk_signal_connect (GTK_OBJECT (view), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), NULL); - priv->shell = shell; - - gtk_signal_connect_while_alive (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), - "updated_folder", updated_folder_cb, shell_view, - GTK_OBJECT (shell_view)); - - priv->ui_container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (priv->ui_container, BONOBO_WINDOW (shell_view)); - gtk_signal_connect (GTK_OBJECT (priv->ui_container), "system_exception", - GTK_SIGNAL_FUNC (unmerge_on_error), NULL); - - priv->ui_component = bonobo_ui_component_new ("evolution"); - bonobo_ui_component_set_container (priv->ui_component, - bonobo_object_corba_objref (BONOBO_OBJECT (priv->ui_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); - - bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view)), - "/evolution/UIConf/kvps"); - e_shell_view_menu_setup (shell_view); - - e_shell_view_show_folder_bar (shell_view, FALSE); - - bonobo_ui_component_thaw (priv->ui_component, NULL); - - gtk_signal_connect_while_alive (GTK_OBJECT (shell), "line_status_changed", - GTK_SIGNAL_FUNC (shell_line_status_changed_cb), view, - GTK_OBJECT (view)); - - e_shell_user_creatable_items_handler_setup_menus (e_shell_get_user_creatable_items_handler (priv->shell), - shell_view); - - return view; -} - -/* WARNING: Don't use `e_shell_view_new()' to create new views for the shell - unless you know what you are doing; this is just the standard GTK+ - constructor thing and it won't allow the shell to do the required - bookkeeping for the created views. Instead, the right way to create a new - view is calling `e_shell_create_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); -} - -const GNOME_Evolution_ShellView -e_shell_view_get_corba_interface (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - g_return_val_if_fail (shell_view != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), CORBA_OBJECT_NIL); - - priv = shell_view->priv; - - return bonobo_object_corba_objref (BONOBO_OBJECT (priv->corba_interface)); -} - - -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, - const char *type) -{ - EShellViewPrivate *priv; - const char *icon_name; - char *icon_path; - - priv = shell_view->priv; - - 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, - const char *title, - const char *type) -{ - EShellViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - GdkPixbuf *folder_icon; - - priv = shell_view->priv; - - if (type == NULL) { - title = 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, type, TRUE); - } - - if (folder_icon != NULL) - e_shell_folder_title_bar_set_icon (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), folder_icon); - - if (title != NULL) { - char *s; - - s = e_utf8_to_gtk_string (GTK_WIDGET (priv->folder_title_bar), title); - e_shell_folder_title_bar_set_title (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), s); - g_free (s); - } -} - -static void -update_for_current_uri (EShellView *shell_view) -{ - EShellViewPrivate *priv; - EFolder *folder; - const char *path; - const char *type; - const char *folder_name; - char *title; - char *utf8_window_title; - char *gtk_window_title; - int unread_count; - - priv = shell_view->priv; - - /* if we update when there is a timeout set, the selection - * will jump around against the user's wishes. so we just - * return. - */ - if (priv->set_folder_timeout != 0) - return; - - path = get_storage_set_path_from_uri (priv->uri); - - folder_name = NULL; - type = NULL; - unread_count = 0; - - 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 = e_folder_get_name (folder); - type = e_folder_get_type_string (folder); - unread_count = e_folder_get_unread_count (folder); - } else if (path != NULL) { - EStorage *storage; - - storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1); - unread_count = 0; - - if (storage != NULL) { - folder_name = e_storage_get_display_name (storage); - type = e_storage_get_toplevel_node_type (storage); - } - } - } - - if (unread_count > 0) - title = g_strdup_printf (_("%s (%d)"), folder_name, unread_count); - else if (folder_name == NULL) - title = g_strdup (_("(None)")); - else - title = g_strdup (folder_name); - - if (SUB_VERSION[0] == '\0') - utf8_window_title = g_strdup_printf (_("%s - Ximian Evolution %s"), title, VERSION); - else - utf8_window_title = g_strdup_printf (_("%s - Ximian Evolution %s [%s]"), title, VERSION, SUB_VERSION); - - gtk_window_title = e_utf8_to_gtk_string (GTK_WIDGET (shell_view), utf8_window_title); - gtk_window_set_title (GTK_WINDOW (shell_view), gtk_window_title); - - update_folder_title_bar (shell_view, title, type); - update_window_icon (shell_view, type); - - g_free (gtk_window_title); - g_free (utf8_window_title); - g_free (title); - - 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); -} - -static void -update_offline_toggle_status (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GdkPixmap *icon_pixmap; - GdkBitmap *icon_mask; - const char *tooltip; - gboolean sensitive; - - priv = shell_view->priv; - - switch (e_shell_get_line_status (priv->shell)) { - case E_SHELL_LINE_STATUS_ONLINE: - icon_pixmap = online_pixmap; - icon_mask = online_mask; - sensitive = TRUE; - tooltip = _("Ximian Evolution is currently online. " - "Click on this button to work offline."); - break; - case E_SHELL_LINE_STATUS_GOING_OFFLINE: - icon_pixmap = online_pixmap; - icon_mask = online_mask; - sensitive = FALSE; - tooltip = _("Ximian Evolution is in the process of going offline."); - break; - case E_SHELL_LINE_STATUS_OFFLINE: - icon_pixmap = offline_pixmap; - icon_mask = offline_mask; - sensitive = TRUE; - tooltip = _("Ximian Evolution is currently offline. " - "Click on this button to work online."); - break; - default: - g_assert_not_reached (); - return; - } - - gtk_pixmap_set (GTK_PIXMAP (priv->offline_toggle_pixmap), icon_pixmap, icon_mask); - gtk_widget_set_sensitive (priv->offline_toggle, sensitive); - gtk_tooltips_set_tip (priv->tooltips, priv->offline_toggle, tooltip, NULL); -} - -/* 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_corba_interface (EShellView *shell_view, - GtkWidget *control) -{ - EShellViewPrivate *priv; - BonoboControlFrame *control_frame; - EvolutionShellView *corba_interface; - - g_return_if_fail (control != NULL); - - priv = shell_view->priv; - - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control)); - corba_interface = evolution_shell_view_new (); - - gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_message", - GTK_SIGNAL_FUNC (corba_interface_set_message_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "unset_message", - GTK_SIGNAL_FUNC (corba_interface_unset_message_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "change_current_view", - GTK_SIGNAL_FUNC (corba_interface_change_current_view_cb), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_title", - GTK_SIGNAL_FUNC (corba_interface_set_title), - shell_view, GTK_OBJECT (shell_view)); - gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_folder_bar_label", - GTK_SIGNAL_FUNC (corba_interface_set_folder_bar_label), - shell_view, GTK_OBJECT (shell_view)); - - bonobo_object_add_interface (BONOBO_OBJECT (control_frame), - BONOBO_OBJECT (corba_interface)); - - bonobo_object_ref (BONOBO_OBJECT (corba_interface)); - priv->corba_interface = corba_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; - View *view; - const char *uri; - gboolean viewing_closed_uri; - char *copy_of_uri; - const char *current_uri; - const char *path; - const char *folder_type; - - 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"); - - if (!g_hash_table_lookup_extended (priv->uri_to_view, uri, - (gpointer *)©_of_uri, - (gpointer *)&view)) { - g_warning ("What?! Destroyed socket for non-existing URI? -- %s", uri); - return; - } - - priv->sockets = g_list_remove (priv->sockets, socket_widget); - - gtk_widget_destroy (view->control); - - view_destroy (view); - g_hash_table_remove (priv->uri_to_view, uri); - g_free (copy_of_uri); - - path = get_storage_set_path_from_uri (uri); - folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path); - - if (folder != NULL) { - folder_type = e_folder_get_type_string (folder); - } else { - EStorage *storage; - - storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1); - if (storage == NULL) - folder_type = NULL; - else - folder_type = e_storage_get_toplevel_node_type (storage); - } - - /* See if we were actively viewing the uri for the socket that's being closed */ - current_uri = e_shell_view_get_current_uri (shell_view); - if (current_uri == NULL) { - viewing_closed_uri = FALSE; - } else { - if (strcmp (uri, current_uri) == 0) - viewing_closed_uri = TRUE; - else - viewing_closed_uri = FALSE; - } - - if (viewing_closed_uri) - e_shell_view_display_uri (shell_view, NULL); - - e_shell_component_maybe_crashed (priv->shell, uri, folder_type, shell_view); - - /* We were actively viewing the component that just crashed, so flip to the default URI */ - if (viewing_closed_uri) - e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); -} - - -static const char * -get_type_for_storage (EShellView *shell_view, - const char *name, - const char **physical_uri_return) -{ - EShellViewPrivate *priv; - EStorageSet *storage_set; - EStorage *storage; - - priv = shell_view->priv; - - storage_set = e_shell_get_storage_set (priv->shell); - storage = e_storage_set_get_storage (storage_set, name); - if (!storage) - return NULL; - - *physical_uri_return = e_storage_get_toplevel_node_uri (storage); - - return e_storage_get_toplevel_node_type (storage); -} - -static const char * -get_type_for_folder (EShellView *shell_view, - const char *path, - const char **physical_uri_return) -{ - EShellViewPrivate *priv; - EStorageSet *storage_set; - EFolder *folder; - - priv = shell_view->priv; - - storage_set = e_shell_get_storage_set (priv->shell); - folder = e_storage_set_get_folder (storage_set, path); - if (!folder) - return NULL; - - if (physical_uri_return != NULL) - *physical_uri_return = e_folder_get_physical_uri (folder); - - return e_folder_get_type_string (folder); -} - -/* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */ -static View * -get_view_for_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - CORBA_Environment ev; - EvolutionShellComponentClient *handler_client; - EFolderTypeRegistry *folder_type_registry; - GNOME_Evolution_ShellComponent handler; - Bonobo_UIContainer container; - GtkWidget *control; - GtkWidget *socket; - Bonobo_Control corba_control; - const char *path; - const char *slash; - const char *physical_uri; - const char *folder_type; - int destroy_connection_id; - - priv = shell_view->priv; - - path = strchr (uri, ':'); - if (path == NULL) - return NULL; - - path++; - if (*path == '\0') - return NULL; - - /* FIXME: This code needs to be made more robust. */ - slash = strchr (path + 1, G_DIR_SEPARATOR); - if (slash == NULL || slash[1] == '\0') - folder_type = get_type_for_storage (shell_view, path + 1, &physical_uri); - else - folder_type = get_type_for_folder (shell_view, path, &physical_uri); - if (folder_type == NULL) - return NULL; - - folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view)); - - handler_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, folder_type); - if (handler_client == CORBA_OBJECT_NIL) - return NULL; - - handler = bonobo_object_corba_objref (BONOBO_OBJECT (handler_client)); - - CORBA_exception_init (&ev); - - corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - if (corba_control == CORBA_OBJECT_NIL) - return NULL; - - container = bonobo_ui_component_get_container (priv->ui_component); - control = e_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_corba_interface (shell_view, control); - - return view_new (uri, control); -} - -static gboolean -show_existing_view (EShellView *shell_view, - const char *uri, - View *view) -{ - EShellViewPrivate *priv; - int notebook_page; - - priv = shell_view->priv; - - notebook_page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), view->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 (view->control))) { - GtkWidget *parent; - - parent = view->control->parent; - - /* Out with the old. */ - gtk_container_remove (GTK_CONTAINER (parent), view->control); - view_destroy (view); - - /* In with the new. */ - view = get_view_for_uri (shell_view, uri); - if (view == NULL) - return FALSE; - - gtk_container_add (GTK_CONTAINER (parent), view->control); - - /* The old (destroyed) view is already in the hash table, - * and g_hash_table_insert will re-use its old (strdup'ed) - * key rather than the one we pass here. - */ - g_hash_table_insert (priv->uri_to_view, (char *)uri, view); - - /* Show. */ - gtk_widget_show (view->control); - } - - g_free (priv->uri); - priv->uri = g_strdup (uri); - - set_current_notebook_page (shell_view, notebook_page); - - return TRUE; -} - -static gboolean -create_new_view_for_uri (EShellView *shell_view, - const char *uri) -{ - View *view; - EShellViewPrivate *priv; - int page_num; - - priv = shell_view->priv; - - view = get_view_for_uri (shell_view, uri); - if (view == NULL) - return FALSE; - - g_free (priv->uri); - priv->uri = g_strdup (uri); - - gtk_widget_show (view->control); - - gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), view->control, NULL); - - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), view->control); - g_assert (page_num != -1); - set_current_notebook_page (shell_view, page_num); - - g_hash_table_insert (priv->uri_to_view, g_strdup (uri), view); - - return TRUE; -} - -gboolean -e_shell_view_display_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - View *view; - 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); - - 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; - } - - view = g_hash_table_lookup (priv->uri_to_view, uri); - if (view != NULL) { - show_existing_view (shell_view, uri, view); - } else if (! create_new_view_for_uri (shell_view, uri)) { - cleanup_delayed_selection (shell_view); - 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; - } - - retval = TRUE; - - end: - g_free (priv->set_folder_uri); - priv->set_folder_uri = NULL; - - if (priv->set_folder_timeout != 0) { - gtk_timeout_remove (priv->set_folder_timeout); - priv->set_folder_timeout = 0; - } - - update_for_current_uri (shell_view); - - bonobo_window_thaw (BONOBO_WINDOW (shell_view)); - - return retval; -} - -gboolean -e_shell_view_remove_control_for_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - View *view; - GtkWidget *socket; - GtkWidget *control; - int page_num; - int destroy_connection_id; - char *old_key; - - 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; - - /* Get the control, remove it from our hash of controls */ - if (!g_hash_table_lookup_extended (priv->uri_to_view, uri, - (gpointer *)&old_key, - (gpointer *)&view)) { - g_message ("Trying to remove view for non-existing URI -- %s", uri); - return FALSE; - } - - control = view->control; - view_destroy (view); - g_hash_table_remove (priv->uri_to_view, uri); - g_free (old_key); - - /* Get the socket, remove it from our list of sockets */ - socket = find_socket (GTK_CONTAINER (control)); - priv->sockets = g_list_remove (priv->sockets, socket); - - /* disconnect from the destroy signal */ - destroy_connection_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (socket), - "e_shell_view_destroy_connection_id")); - gtk_signal_disconnect (GTK_OBJECT (socket), destroy_connection_id); - - /* Remove the notebook page, destroying the control and socket */ - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), page_num); - - return TRUE; -} - - -void -e_shell_view_show_shortcut_bar (EShellView *shell_view, - gboolean show) -{ - EShellViewPrivate *priv; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - priv = shell_view->priv; - - if (!! show == priv->shortcut_bar_shown) - return; - - if (show) { - if (! GTK_WIDGET_VISIBLE (priv->shortcut_frame)) { - gtk_widget_show (priv->shortcut_frame); - e_paned_set_position (E_PANED (priv->hpaned), priv->hpaned_position); - } - } else { - e_paned_set_position (E_PANED (priv->hpaned), 0); - if (GTK_WIDGET_VISIBLE (priv->shortcut_frame)) { - gtk_widget_hide (priv->shortcut_frame); - /* 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_shown = !! show; - - gtk_signal_emit (GTK_OBJECT (shell_view), signals[SHORTCUT_BAR_VISIBILITY_CHANGED], - priv->shortcut_bar_shown); -} - -void -e_shell_view_show_folder_bar (EShellView *shell_view, - gboolean show) -{ - EShellViewPrivate *priv; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - priv = shell_view->priv; - - if (!! show == priv->folder_bar_shown) - return; - - if (show) { - 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->folder_title_bar), - FALSE); - } else { - e_paned_set_position (E_PANED (priv->view_hpaned), 0); - - 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->folder_title_bar), - TRUE); - } - - priv->folder_bar_shown = !! show; - - gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_VISIBILITY_CHANGED], - priv->folder_bar_shown); -} - -gboolean -e_shell_view_shortcut_bar_shown (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - - return shell_view->priv->shortcut_bar_shown; -} - -gboolean -e_shell_view_folder_bar_shown (EShellView *shell_view) -{ - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - - return shell_view->priv->folder_bar_shown; -} - - -ETaskBar * -e_shell_view_get_task_bar (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 E_TASK_BAR (shell_view->priv->task_bar); -} - -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; -} - -BonoboUIContainer * -e_shell_view_get_bonobo_ui_container (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_container; -} - -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; -} - -/** - * e_shell_view_get_current_uri: - * @shell_view: A pointer to an EShellView object - * - * Get the URI currently displayed by this shell view. - * - * Return value: - **/ -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_get_current_path: - * @shell_view: A pointer to an EShellView object - * - * Get the path of the current displayed folder. - * - * Return value: - **/ -const char * -e_shell_view_get_current_path (EShellView *shell_view) -{ - const char *current_uri; - const char *current_path; - - current_uri = e_shell_view_get_current_uri (shell_view); - if (current_uri == NULL) - return NULL; - - if (strncmp (current_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) - current_path = current_uri + E_SHELL_URI_PREFIX_LEN; - else - current_path = NULL; - - return current_path; -} - -const char * -e_shell_view_get_current_physical_uri (EShellView *shell_view) -{ - const char *current_path; - const char *physical_uri; - - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - current_path = e_shell_view_get_current_path (shell_view); - if (current_path == NULL) - return NULL; - - if (get_type_for_folder (shell_view, current_path, &physical_uri) == NULL) - return NULL; - else - return physical_uri; -} - -const char * -e_shell_view_get_current_folder_type (EShellView *shell_view) -{ - const char *current_path; - - g_return_val_if_fail (shell_view != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - current_path = e_shell_view_get_current_path (shell_view); - if (current_path == NULL) - return NULL; - - return get_type_for_folder (shell_view, current_path, NULL); -} - - -/** - * 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, - int view_num) -{ - Bonobo_ConfigDatabase db; - EShellViewPrivate *priv; - EShortcutBar *shortcut_bar; - const char *uri; - char *prefix, *key; - char *filename; - int num_groups; - int group; - struct stat temp; - - 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; - shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar); - - db = e_shell_get_config_db (priv->shell); - - g_return_val_if_fail (db != CORBA_OBJECT_NIL, FALSE); - - prefix = g_strdup_printf ("/Shell/Views/%d/", view_num); - - key = g_strconcat (prefix, "Width", NULL); - bonobo_config_set_long (db, key, GTK_WIDGET (shell_view)->allocation.width, NULL); - g_free (key); - - key = g_strconcat (prefix, "Height", NULL); - bonobo_config_set_long (db, key, GTK_WIDGET (shell_view)->allocation.height, NULL); - g_free (key); - - key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL); - bonobo_config_set_long (db, key, - e_shell_view_get_current_shortcuts_group_num (shell_view), - NULL); - g_free (key); - - key = g_strconcat (prefix, "FolderBarShown", NULL); - bonobo_config_set_long (db, key, e_shell_view_folder_bar_shown (shell_view), NULL); - g_free (key); - - key = g_strconcat (prefix, "ShortcutBarShown", NULL); - bonobo_config_set_long (db, key, e_shell_view_shortcut_bar_shown (shell_view), NULL); - g_free (key); - - key = g_strconcat (prefix, "HPanedPosition", NULL); - bonobo_config_set_long (db, key, - e_paned_get_position (E_PANED (priv->hpaned)), NULL); - g_free (key); - - key = g_strconcat (prefix, "ViewHPanedPosition", NULL); - bonobo_config_set_long (db, key, - e_paned_get_position (E_PANED (priv->view_hpaned)), NULL); - g_free (key); - - key = g_strconcat (prefix, "DisplayedURI", NULL); - uri = e_shell_view_get_current_uri (shell_view); - if (uri != NULL) - bonobo_config_set_string (db, key, uri, NULL); - else - bonobo_config_set_string (db, key, E_SHELL_VIEW_DEFAULT_URI, NULL); - g_free (key); - - num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model); - - for (group = 0; group < num_groups; group++) { - key = g_strdup_printf ("%sShortcutBarGroup%dIconMode", prefix, - group); - bonobo_config_set_long (db, key, - e_shortcut_bar_get_view_type (shortcut_bar, group), - NULL); - g_free (key); - } - - g_free (prefix); - - /* If ~/evolution/config/ doesn't exist yet, make it */ - filename = g_strdup_printf ("%s/config/", e_shell_get_local_directory (priv->shell)); - if (stat (filename, &temp) != 0) - mkdir (filename, S_IRWXU); - g_free (filename); - - /* Save the expanded state for this ShellView's StorageSetView */ - filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d", - e_shell_get_local_directory (priv->shell), - view_num); - e_tree_save_expanded_state (E_TREE (priv->storage_set_view), - filename); - g_free (filename); - - 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, - int view_num) -{ - Bonobo_ConfigDatabase db; - EShellViewPrivate *priv; - EShortcutBar *shortcut_bar; - int num_groups, group, val; - long width, height; - char *stringval, *prefix, *filename, *key; - - 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; - shortcut_bar = E_SHORTCUT_BAR (priv->shortcut_bar); - - db = e_shell_get_config_db (priv->shell); - - g_return_val_if_fail (db != CORBA_OBJECT_NIL, FALSE); - - prefix = g_strdup_printf ("/Shell/Views/%d/", view_num); - - key = g_strconcat (prefix, "Width", NULL); - width = bonobo_config_get_long (db, key, NULL); - g_free (key); - - key = g_strconcat (prefix, "Height", NULL); - height = bonobo_config_get_long (db, key, NULL); - g_free (key); - - gtk_window_set_default_size (GTK_WINDOW (shell_view), width, height); - - key = g_strconcat (prefix, "CurrentShortcutsGroupNum", NULL); - val = bonobo_config_get_long (db, key, NULL); - e_shell_view_set_current_shortcuts_group_num (shell_view, val); - g_free (key); - - key = g_strconcat (prefix, "FolderBarShown", NULL); - val = bonobo_config_get_long (db, key, NULL); - e_shell_view_show_folder_bar (shell_view, val); - g_free (key); - - key = g_strconcat (prefix, "ShortcutBarShown", NULL); - val = bonobo_config_get_long (db, key, NULL); - e_shell_view_show_shortcut_bar (shell_view, val); - g_free (key); - - key = g_strconcat (prefix, "HPanedPosition", NULL); - val = bonobo_config_get_long (db, key, NULL); - if (priv->shortcut_bar_shown) - e_paned_set_position (E_PANED (priv->hpaned), val); - priv->hpaned_position = val; - g_free (key); - - key = g_strconcat (prefix, "ViewHPanedPosition", NULL); - val = bonobo_config_get_long (db, key, NULL); - if (priv->folder_bar_shown) - e_paned_set_position (E_PANED (priv->view_hpaned), val); - priv->view_hpaned_position = val; - g_free (key); - - key = g_strconcat (prefix, "DisplayedURI", NULL); - stringval = bonobo_config_get_string (db, key, NULL); - if (! e_shell_view_display_uri (shell_view, stringval)) - e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); - g_free (stringval); - g_free (key); - - num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model); - - for (group = 0; group < num_groups; group++) { - int iconmode; - - key = g_strdup_printf ("%sShortcutBarGroup%dIconMode", prefix, - group); - iconmode = bonobo_config_get_long (db, key, NULL); - g_free (key); - - e_shortcut_bar_set_view_type (shortcut_bar, group, iconmode); - } - - g_free (prefix); - - /* Load the expanded state for the ShellView's StorageSetView */ - filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d", - e_shell_get_local_directory (priv->shell), - view_num); - e_tree_load_expanded_state (E_TREE (priv->storage_set_view), - filename); - g_free (filename); - - return TRUE; -} - - -/* FIXME: This function could become static */ -void -e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, int group_num) -{ - EShellViewPrivate *priv; - EShortcutsView *shortcuts_view; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - priv = shell_view->priv; - - shortcuts_view = E_SHORTCUTS_VIEW (priv->shortcut_bar); - - e_group_bar_set_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view)), group_num, FALSE); -} - -int -e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view) -{ - EShellViewPrivate *priv; - EShortcutsView *shortcuts_view; - int group; - - g_return_val_if_fail (shell_view != NULL, -1); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), -1); - - priv = shell_view->priv; - - shortcuts_view = E_SHORTCUTS_VIEW (priv->shortcut_bar); - - group = e_group_bar_get_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view))); - - return group; -} - - -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 8fbdd199df..0000000000 --- a/shell/e-shell-view.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include "e-task-bar.h" - -#include <bonobo/bonobo-win.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; - -#include "e-shell.h" - -#define E_SHELL_VIEW_DEFAULT_URI "evolution:/summary" - -struct _EShellView { - BonoboWindow parent; - - EShellViewPrivate *priv; -}; - -struct _EShellViewClass { - BonoboWindowClass parent_class; - - /* Signals. */ - void (* shortcut_bar_visibility_changed) (EShellView *shell_view, gboolean visible); - void (* folder_bar_visibility_changed) (EShellView *shell_view, gboolean visible); -}; - - -/* WARNING: Don't use `e_shell_view_new()' to create new views for the shell - unless you know what you are doing; this is just the standard GTK+ - constructor thing and it won't allow the shell to do the required - bookkeeping for the created views. Instead, the right way to create a new - view is calling `e_shell_new_view()'. */ - -GtkType e_shell_view_get_type (void); -EShellView *e_shell_view_construct (EShellView *shell_view, - EShell *shell); -EShellView *e_shell_view_new (EShell *shell); - -const GNOME_Evolution_ShellView e_shell_view_get_corba_interface (EShellView *view); - -gboolean e_shell_view_display_uri (EShellView *shell_view, - const char *uri); - -void e_shell_view_show_shortcut_bar (EShellView *shell_view, - gboolean show); -gboolean e_shell_view_shortcut_bar_shown (EShellView *shell_view); -void e_shell_view_show_folder_bar (EShellView *shell_view, - gboolean show); -gboolean e_shell_view_folder_bar_shown (EShellView *shell_view); - -ETaskBar *e_shell_view_get_task_bar (EShellView *shell_view); -EShell *e_shell_view_get_shell (EShellView *shell_view); -BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view); -BonoboUIContainer *e_shell_view_get_bonobo_ui_container (EShellView *shell_view); -GtkWidget *e_shell_view_get_appbar (EShellView *shell_view); -const char *e_shell_view_get_current_uri (EShellView *shell_view); -const char *e_shell_view_get_current_physical_uri (EShellView *shell_view); -const char *e_shell_view_get_current_folder_type (EShellView *shell_view); -const char *e_shell_view_get_current_path (EShellView *shell_view); - -gboolean e_shell_view_save_settings (EShellView *shell_view, - int view_num); -gboolean e_shell_view_load_settings (EShellView *shell_view, - int view_num); - -gboolean e_shell_view_remove_control_for_uri (EShellView *shell_view, const char *uri); - -int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view); -void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, - int group_num); - - -#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 461807a3d9..0000000000 --- a/shell/e-shell.c +++ /dev/null @@ -1,1715 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000, 2001 Ximian, 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/gtkmain.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> - -/* (For the displayName stuff.) */ -#include <gdk/gdkprivate.h> -#include <X11/Xlib.h> - -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-moniker-util.h> - -#include <gal/widgets/e-gui-utils.h> -#include <gal/util/e-util.h> - -#include "Evolution.h" - -#include "e-activity-handler.h" -#include "e-component-registry.h" -#include "e-corba-shortcuts.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-offline-handler.h" -#include "e-shell-startup-wizard.h" -#include "e-shell-view.h" -#include "e-shortcuts.h" -#include "e-storage-set.h" -#include "e-splash.h" -#include "e-summary-storage.h" -#include "e-uri-schema-registry.h" - -#include "evolution-storage-set-view-factory.h" - -#include "e-shell.h" - -#include "importer/intelligent.h" - - -#define PARENT_TYPE bonobo_x_object_get_type () -static BonoboXObjectClass *parent_class = NULL; - -struct _EShellPrivate { - /* IID for registering the object on OAF. */ - char *iid; - - char *local_directory; - - GList *views; - - EStorageSet *storage_set; - ELocalStorage *local_storage; - ESummaryStorage *summary_storage; - - EShortcuts *shortcuts; - EFolderTypeRegistry *folder_type_registry; - EUriSchemaRegistry *uri_schema_registry; - - EComponentRegistry *component_registry; - - EShellUserCreatableItemsHandler *user_creatable_items_handler; - - /* ::StorageRegistry interface handler. */ - ECorbaStorageRegistry *corba_storage_registry; /* <aggregate> */ - - /* ::Activity interface handler. */ - EActivityHandler *activity_handler; /* <aggregate> */ - - /* ::Shortcuts interface handler. */ - ECorbaShortcuts *corba_shortcuts; /* <aggregate> */ - - /* This object handles going off-line. If the pointer is not NULL, it - means we have a going-off-line process in progress. */ - EShellOfflineHandler *offline_handler; - - /* Names for the types of the folders that have maybe crashed. */ - GList *crash_type_names; /* char * */ - - /* Line status. */ - EShellLineStatus line_status; - - /* Configuration Database */ - Bonobo_ConfigDatabase db; - - /* Whether the shell is succesfully initialized. This is needed during - the start-up sequence, to avoid CORBA calls to do make wrong things - to happen while the shell is initializing. */ - unsigned int is_initialized : 1; -}; - - -/* Constants. */ - -/* FIXME: We need a component repository instead. */ - -#define SHORTCUTS_FILE_NAME "shortcuts.xml" -#define LOCAL_STORAGE_DIRECTORY "local" - - -enum { - NO_VIEWS_LEFT, - LINE_STATUS_CHANGED, - 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) -{ - GNOME_Evolution_FolderSelectionListener listener; - CORBA_Environment ev; - - listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener"); - - CORBA_exception_init (&ev); - - GNOME_Evolution_FolderSelectionListener_notifyCanceled (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; - GNOME_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); - - GNOME_Evolution_FolderSelectionListener_notifySelected (listener, uri, physical_uri, &ev); - g_free (uri); - - CORBA_exception_free (&ev); - - gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); -} - - -/* CORBA interface implementation. */ - -static gboolean -raise_exception_if_not_ready (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EShell *shell; - - shell = E_SHELL (bonobo_object_from_servant (servant)); - - if (! shell->priv->is_initialized) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_NotReady, NULL); - return TRUE; - } - - return FALSE; -} - -static CORBA_char * -impl_Shell__get_displayName (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - char *display_string; - CORBA_char *retval; - - if (raise_exception_if_not_ready (servant, ev)) - return NULL; - - display_string = DisplayString (gdk_display); - if (display_string == NULL) - return CORBA_string_dup (""); - - retval = CORBA_string_dup (display_string); - XFree (display_string); - - return retval; -} - -static GNOME_Evolution_ShellComponent -impl_Shell_getComponentByType (PortableServer_Servant servant, - const CORBA_char *type, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentClient *handler; - EFolderTypeRegistry *folder_type_registry; - GNOME_Evolution_ShellComponent corba_component; - EShell *shell; - - if (raise_exception_if_not_ready (servant, ev)) - return CORBA_OBJECT_NIL; - - 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_GNOME_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 GNOME_Evolution_ShellView -impl_Shell_createNewView (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EShell *shell; - EShellView *shell_view; - GNOME_Evolution_ShellView shell_view_interface; - - if (raise_exception_if_not_ready (servant, ev)) - return CORBA_OBJECT_NIL; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - - if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_UnsupportedSchema, - NULL); - return CORBA_OBJECT_NIL; - } - - shell_view = e_shell_create_view (shell, uri); - if (shell_view == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_NotFound, NULL); - return CORBA_OBJECT_NIL; - } - - gtk_widget_show (GTK_WIDGET (shell_view)); - - shell_view_interface = e_shell_view_get_corba_interface (shell_view); - if (shell_view_interface == CORBA_OBJECT_NIL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_InternalError, NULL); - return CORBA_OBJECT_NIL; - } - - Bonobo_Unknown_ref (shell_view_interface, ev); - return CORBA_Object_duplicate ((CORBA_Object) shell_view_interface, ev); -} - -static void -impl_Shell_handleURI (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - EvolutionShellComponentClient *schema_handler; - EShell *shell; - EShellPrivate *priv; - const char *colon_p; - char *schema; - - if (raise_exception_if_not_ready (servant, ev)) - return; - - shell = E_SHELL (bonobo_object_from_servant (servant)); - priv = shell->priv; - - if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { - GNOME_Evolution_Shell_createNewView (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), uri, ev); - return; - } - - /* Extract the schema. */ - - colon_p = strchr (uri, ':'); - if (colon_p == NULL || colon_p == uri) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_InvalidURI, NULL); - return; - } - - schema = g_strndup (uri, colon_p - uri); - schema_handler = e_uri_schema_registry_get_handler_for_schema (priv->uri_schema_registry, schema); - g_free (schema); - - if (schema_handler == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL); - return; - } - - if (! evolution_shell_component_client_handle_external_uri (schema_handler, uri)) { - /* FIXME: Just a wild guess here. */ - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Shell_NotFound, NULL); - return; - } -} - -static void -corba_listener_destroy_notify (void *data) -{ - CORBA_Environment ev; - GNOME_Evolution_FolderSelectionListener listener_interface; - - listener_interface = (GNOME_Evolution_FolderSelectionListener) data; - - CORBA_exception_init (&ev); - CORBA_Object_release (listener_interface, &ev); - CORBA_exception_free (&ev); -} - -static void -impl_Shell_selectUserFolder (PortableServer_Servant servant, - const GNOME_Evolution_FolderSelectionListener listener, - const CORBA_char *title, - const CORBA_char *default_folder, - const GNOME_Evolution_Shell_FolderTypeNameList *corba_allowed_type_names, - CORBA_Environment *ev) -{ - GtkWidget *folder_selection_dialog; - BonoboObject *bonobo_object; - GNOME_Evolution_FolderSelectionListener listener_duplicate; - EShell *shell; - const char **allowed_type_names; - int i; - - if (raise_exception_if_not_ready (servant, ev)) - return; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - - allowed_type_names = alloca (sizeof (allowed_type_names[0]) * (corba_allowed_type_names->_length + 1)); - for (i = 0; i < corba_allowed_type_names->_length; i++) - allowed_type_names[i] = corba_allowed_type_names->_buffer[i]; - allowed_type_names[corba_allowed_type_names->_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, - NULL, - default_folder, - allowed_type_names); - - 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 GNOME_Evolution_Storage -impl_Shell_getLocalStorage (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - GNOME_Evolution_Storage local_storage_interface; - EShell *shell; - EShellPrivate *priv; - - if (raise_exception_if_not_ready (servant, ev)) - return CORBA_OBJECT_NIL; - - 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); - - bonobo_object_dup_ref (local_storage_interface, ev); - - return local_storage_interface; -} - -static Bonobo_Control -impl_Shell_createStorageSetView (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EShell *shell; - BonoboControl *control; - - if (raise_exception_if_not_ready (servant, ev)) - return CORBA_OBJECT_NIL; - - 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)); -} - -static void -impl_Shell_setLineStatus (PortableServer_Servant servant, - CORBA_boolean online, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EShell *shell; - - if (raise_exception_if_not_ready (servant, ev)) - return; - - bonobo_object = bonobo_object_from_servant (servant); - shell = E_SHELL (bonobo_object); - - if (online) - e_shell_go_online (shell, NULL); - else - e_shell_go_offline (shell, NULL); -} - - -/* Set up the ::Activity interface. */ - -static void -setup_activity_interface (EShell *shell) -{ - EActivityHandler *activity_handler; - EShellPrivate *priv; - - priv = shell->priv; - - activity_handler = e_activity_handler_new (); - - bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (activity_handler)); - priv->activity_handler = activity_handler; -} - - -/* Set up the ::Shortcuts interface. */ - -static void -setup_shortcuts_interface (EShell *shell) -{ - ECorbaShortcuts *corba_shortcuts; - EShellPrivate *priv; - - priv = shell->priv; - - g_assert (priv->shortcuts != NULL); - - corba_shortcuts = e_corba_shortcuts_new (priv->shortcuts); - - bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (corba_shortcuts)); - priv->corba_shortcuts = corba_shortcuts; -} - - -/* 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)); - - 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); - - priv->summary_storage = E_SUMMARY_STORAGE (e_summary_storage_new ()); - e_storage_set_add_storage (priv->storage_set, E_STORAGE (priv->summary_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:GNOME/Evolution/ShellComponent:1.0')", NULL, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_error ("Eeek! Cannot perform OAF query for Evolution components."); - - if (info_list->_length == 0) - g_warning ("No Evolution components installed."); - - 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 { - e_shell_user_creatable_items_handler_add_component - (priv->user_creatable_items_handler, - e_component_registry_get_component_by_id (priv->component_registry, info->iid)); - } - - if (splash != NULL) - e_splash_set_icon_highlight (splash, i, TRUE); - - while (gtk_events_pending ()) - gtk_main_iteration (); - } - - CORBA_free (info_list); - - CORBA_exception_free (&ev); -} - -/* FIXME what if anything fails here? */ -static void -set_owner_on_components (EShell *shell) -{ - GNOME_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_delete_event_cb (GtkWidget *widget, - GdkEventAny *ev, - void *data) -{ - EShell *shell; - - g_assert (E_IS_SHELL_VIEW (widget)); - - shell = E_SHELL (data); - e_shell_save_settings (shell); - - /* Destroy it */ - return FALSE; -} - -static void -view_destroy_cb (GtkObject *object, - void *data) -{ - EShell *shell; - int num_views; - - g_assert (E_IS_SHELL_VIEW (object)); - - shell = E_SHELL (data); - - num_views = g_list_length (shell->priv->views); - - /* If this is our last view, save settings now because in the - callback for no_views_left shell->priv->views will be NULL - and settings won't be saved because of that */ - if (num_views - 1 == 0) - e_shell_save_settings (shell); - - shell->priv->views = g_list_remove (shell->priv->views, object); - - if (shell->priv->views == NULL) { - 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; - - if (shell->priv->db != CORBA_OBJECT_NIL) { - bonobo_object_release_unref (shell->priv->db, NULL); - shell->priv->db = CORBA_OBJECT_NIL; - } - - if (priv->iid != NULL) - oaf_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (shell))); - - 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->summary_storage != NULL) - gtk_object_unref (GTK_OBJECT (priv->summary_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->uri_schema_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->uri_schema_registry)); - - if (priv->component_registry != NULL) - gtk_object_unref (GTK_OBJECT (priv->component_registry)); - - if (priv->user_creatable_items_handler != NULL) - gtk_object_unref (GTK_OBJECT (priv->user_creatable_items_handler)); - - 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_delete_event_cb), - shell); - gtk_signal_disconnect_by_func (GTK_OBJECT (view), - GTK_SIGNAL_FUNC (view_destroy_cb), - shell); - - gtk_object_destroy (GTK_OBJECT (view)); - } - - g_list_free (priv->views); - - /* No unreffing for these as they are aggregate. */ - /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */ - /* bonobo_object_unref (BONOBO_OBJECT (priv->activity_handler)); */ - /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_shortcuts)); */ - - /* FIXME. Maybe we should do something special here. */ - if (priv->offline_handler != NULL) - gtk_object_unref (GTK_OBJECT (priv->offline_handler)); - - e_free_string_list (priv->crash_type_names); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -class_init (EShellClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Shell__epv *epv; - - 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); - - signals[LINE_STATUS_CHANGED] = - gtk_signal_new ("line_status_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellClass, line_status_changed), - gtk_marshal_NONE__ENUM, - GTK_TYPE_NONE, 1, - GTK_TYPE_ENUM); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - epv = & klass->epv; - epv->_get_displayName = impl_Shell__get_displayName; - epv->getComponentByType = impl_Shell_getComponentByType; - epv->createNewView = impl_Shell_createNewView; - epv->handleURI = impl_Shell_handleURI; - epv->selectUserFolder = impl_Shell_selectUserFolder; - epv->getLocalStorage = impl_Shell_getLocalStorage; - epv->createStorageSetView = impl_Shell_createStorageSetView; - epv->setLineStatus = impl_Shell_setLineStatus; -} - -static void -init (EShell *shell) -{ - EShellPrivate *priv; - - priv = g_new (EShellPrivate, 1); - - priv->views = NULL; - - priv->iid = NULL; - priv->local_directory = NULL; - priv->storage_set = NULL; - priv->local_storage = NULL; - priv->summary_storage = NULL; - priv->shortcuts = NULL; - priv->component_registry = NULL; - priv->user_creatable_items_handler = NULL; - priv->folder_type_registry = NULL; - priv->uri_schema_registry = NULL; - priv->corba_storage_registry = NULL; - priv->activity_handler = NULL; - priv->corba_shortcuts = NULL; - priv->offline_handler = NULL; - priv->crash_type_names = NULL; - priv->line_status = E_SHELL_LINE_STATUS_ONLINE; - priv->db = CORBA_OBJECT_NIL; - priv->is_initialized = FALSE; - - shell->priv = priv; -} - - -/** - * e_shell_construct: - * @shell: An EShell object to construct - * @iid: OAFIID for registering the shell into the name server - * @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. - * - * Return value: The result of the operation. - **/ -EShellConstructResult -e_shell_construct (EShell *shell, - const char *iid, - const char *local_directory, - gboolean show_splash) -{ - GtkWidget *splash; - EShellPrivate *priv; - CORBA_Object corba_object; - CORBA_Environment ev; - gchar *shortcut_path; - g_return_val_if_fail (shell != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG); - g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG); - g_return_val_if_fail (local_directory != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG); - g_return_val_if_fail (g_path_is_absolute (local_directory), E_SHELL_CONSTRUCT_RESULT_INVALIDARG); - - priv = shell->priv; - - priv->iid = g_strdup (iid); - priv->local_directory = g_strdup (local_directory); - priv->folder_type_registry = e_folder_type_registry_new (); - priv->uri_schema_registry = e_uri_schema_registry_new (); - priv->storage_set = e_storage_set_new (priv->folder_type_registry); - - /* CORBA storages must be set up before the components, because otherwise components - cannot register their own storages. */ - if (! setup_corba_storages (shell)) - return FALSE; - - CORBA_exception_init (&ev); - - priv->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || priv->db == CORBA_OBJECT_NIL) { - g_warning ("Cannot access Bonobo/ConfigDatabase on wombat: (%s)", ev._repo_id); - - /* Make sure the DB object is NIL so we don't mess up - (`bonobo_get_object()' might return an undefined value in - the case of an exception). */ - priv->db = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - return E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB; - } - - CORBA_exception_free (&ev); - - if (! show_splash) { - splash = NULL; - } else { - splash = e_splash_new (); - gtk_signal_connect (GTK_OBJECT (splash), "delete_event", - GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL); - gtk_widget_show (splash); - } - - /* Now we can register into OAF. Notice that we shouldn't be - registering into OAF until we are sure we can complete. */ - - /* FIXME: Multi-display stuff. */ - corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - if (oaf_active_server_register (iid, corba_object) != OAF_REG_SUCCESS) { - CORBA_exception_free (&ev); - return E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER; - } - - while (gtk_events_pending ()) - gtk_main_iteration (); - - priv->user_creatable_items_handler = e_shell_user_creatable_items_handler_new (); - - if (show_splash) - setup_components (shell, E_SPLASH (splash)); - else - setup_components (shell, NULL); - - /* Set up the shortcuts. */ - - 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); - g_assert (priv->shortcuts != NULL); - - if (e_shortcuts_get_num_groups (priv->shortcuts) == 0) - e_shortcuts_add_default_group (priv->shortcuts); - - g_free (shortcut_path); - - /* The local storage depends on the component registry. */ - setup_local_storage (shell); - - /* Set up the ::Activity interface. This must be done before we notify - the components, as they might want to use it. */ - setup_activity_interface (shell); - - /* Set up the shortcuts interface. This has to be done after the - shortcuts are actually initialized. */ - - setup_shortcuts_interface (shell); - - /* Now that we have a local storage and all the interfaces set up, we - can tell the components we are here. */ - set_owner_on_components (shell); - - if (show_splash) { - gtk_widget_destroy (splash); - } - - if (e_shell_startup_wizard_create () == FALSE) { - e_shell_unregister_all (shell); - bonobo_object_unref (BONOBO_OBJECT (shell)); - - exit (0); - } - 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); - g_assert (priv->shortcuts != NULL); - - if (e_shortcuts_get_num_groups (priv->shortcuts) == 0) - e_shortcuts_add_default_group (priv->shortcuts); - - g_free (shortcut_path); - - priv->is_initialized = TRUE; - - return E_SHELL_CONSTRUCT_RESULT_OK; -} - -/** - * e_shell_new: - * @local_directory: Local directory for storing local information and folders. - * @show_splash: Whether to display a splash screen. - * @construct_result_return: A pointer to an EShellConstructResult variable into - * which the result of the operation will be stored. - * - * Create a new EShell. - * - * Return value: - **/ -EShell * -e_shell_new (const char *local_directory, - gboolean show_splash, - EShellConstructResult *construct_result_return) -{ - EShell *new; - EShellPrivate *priv; - EShellConstructResult construct_result; - - g_return_val_if_fail (local_directory != NULL, NULL); - g_return_val_if_fail (*local_directory != '\0', NULL); - - new = gtk_type_new (e_shell_get_type ()); - - construct_result = e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash); - - if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) { - *construct_result_return = construct_result; - bonobo_object_unref (BONOBO_OBJECT (new)); - return NULL; - } - - priv = new->priv; - - if (priv->shortcuts == NULL || priv->storage_set == NULL) { - /* FIXME? */ - *construct_result_return = E_SHELL_CONSTRUCT_RESULT_GENERICERROR; - bonobo_object_unref (BONOBO_OBJECT (new)); - return NULL; - } - - *construct_result_return = E_SHELL_CONSTRUCT_RESULT_OK; - return new; -} - - -/** - * e_shell_create_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_create_view (EShell *shell, - const char *uri) -{ - EShellView *view; - EShellPrivate *priv; - ETaskBar *task_bar; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - priv = shell->priv; - - view = e_shell_view_new (shell); - - gtk_signal_connect (GTK_OBJECT (view), "delete_event", - GTK_SIGNAL_FUNC (view_delete_event_cb), shell); - gtk_signal_connect (GTK_OBJECT (view), "destroy", - GTK_SIGNAL_FUNC (view_destroy_cb), shell); - - if (uri != NULL) - if (!e_shell_view_display_uri (E_SHELL_VIEW (view), uri)) - /* FIXME: Consider popping a dialog box up - about how the provided URI does not - exist/could not be displayed */ - e_shell_view_display_uri (E_SHELL_VIEW (view), E_SHELL_VIEW_DEFAULT_URI); - - shell->priv->views = g_list_prepend (shell->priv->views, view); - - task_bar = e_shell_view_get_task_bar (view); - e_activity_handler_attach_task_bar (priv->activity_handler, task_bar); - - 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; -} - -/** - * e_shell_get_uri_schema_registry: - * @shell: An EShell object. - * - * Get the schema registry associated to @shell. - * - * Return value: A pointer to the EUriSchemaRegistry associated to @shell. - **/ -EUriSchemaRegistry * -e_shell_get_uri_schema_registry (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->uri_schema_registry; -} - -/** - * e_shell_get_local_storage: - * @shell: An EShell object. - * - * Get the local storage associated to @shell. - * - * Return value: A pointer to the ELocalStorage associated to @shell. - **/ -ELocalStorage * -e_shell_get_local_storage (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->local_storage; -} - - -static gboolean -save_settings_for_views (EShell *shell) -{ - CORBA_Environment ev; - EShellPrivate *priv; - GList *p; - gboolean retval; - 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); - - if (! e_shell_view_save_settings (view, i)) { - g_warning ("Cannot save settings for view -- %d", i); - retval = FALSE; - } - } - - bonobo_config_set_long (priv->db, "/Shell/Views/NumberOfViews", - g_list_length (priv->views), NULL); - - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_sync (priv->db, &ev); - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -save_settings_for_component (EShell *shell, - const char *id, - EvolutionShellComponentClient *client) -{ - Bonobo_Unknown unknown_interface; - GNOME_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:GNOME/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); - GNOME_Evolution_Session_saveConfiguration (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; - 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; - - num_views = bonobo_config_get_long_with_default (priv->db, "/Shell/Views/NumberOfViews", 0, NULL); - - if (num_views == 0) - return FALSE; - - retval = TRUE; - - for (i = 0; i < num_views; i++) { - EShellView *view; - - /* FIXME: restore the URI here. There should be an - e_shell_create_view_from_configuration() thingie. */ - view = e_shell_create_view (shell, NULL); - - if (! e_shell_view_load_settings (view, i)) - retval = FALSE; - - /* This needs to be done after loading the settings as the - default size is in the settings as well. */ - gtk_widget_show (GTK_WIDGET (view)); - } - - return retval; -} - -/** - * e_shell_destroy_all_views: - * @shell: - * - * Destroy all the views in @shell. - **/ -void -e_shell_destroy_all_views (EShell *shell) -{ - EShellPrivate *priv; - GList *p, *pnext; - - 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 = pnext) { - EShellView *shell_view; - - pnext = p->next; - - shell_view = E_SHELL_VIEW (p->data); - gtk_widget_destroy (GTK_WIDGET (shell_view)); - } -} - - -/** - * e_shell_component_maybe_crashed: - * @shell: A pointer to an EShell object - * @uri: URI that caused the crash - * @type_name: The type of the folder that caused the crash - * @shell_view: Pointer to the EShellView over which we want the modal dialog - * to appear. - * - * Report that a maybe crash happened when trying to display a folder of type - * @type_name. The shell will pop up a crash dialog whose parent will be the - * @shell_view. - **/ -void -e_shell_component_maybe_crashed (EShell *shell, - const char *uri, - const char *type_name, - EShellView *shell_view) -{ - EShellPrivate *priv; - GtkWindow *parent_window; - GList *p; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (type_name != NULL); - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - - priv = shell->priv; - - /* See if that type has caused a crash already. */ - - for (p = priv->crash_type_names; p != NULL; p = p->next) { - const char *crash_type_name; - - crash_type_name = (const char *) p->data; - if (strcmp (type_name, crash_type_name) == 0) { - /* This type caused a crash already. */ - return; - } - } - - /* New crash. */ - - priv->crash_type_names = g_list_prepend (priv->crash_type_names, g_strdup (type_name)); - - if (shell_view == NULL) - parent_window = NULL; - else - parent_window = GTK_WINDOW (shell_view); - - e_notice (parent_window, GNOME_MESSAGE_BOX_ERROR, - _("Ooops! The views for `%s' have died unexpectedly. :-(\n" - "This probably means that the %s component has crashed."), - uri, type_name); - - if (shell_view) - bonobo_window_deregister_dead_components (BONOBO_WINDOW (shell_view)); - - /* FIXME: we should probably re-start the component here */ -} - - -/* Offline/online handling. */ - -static void -offline_procedure_started_cb (EShellOfflineHandler *offline_handler, - void *data) -{ - EShell *shell; - EShellPrivate *priv; - - shell = E_SHELL (data); - priv = shell->priv; - - priv->line_status = E_SHELL_LINE_STATUS_GOING_OFFLINE; - gtk_signal_emit (GTK_OBJECT (shell), signals[LINE_STATUS_CHANGED], priv->line_status); -} - -static void -offline_procedure_finished_cb (EShellOfflineHandler *offline_handler, - gboolean now_offline, - void *data) -{ - EShell *shell; - EShellPrivate *priv; - - shell = E_SHELL (data); - priv = shell->priv; - - if (now_offline) - priv->line_status = E_SHELL_LINE_STATUS_OFFLINE; - else - priv->line_status = E_SHELL_LINE_STATUS_ONLINE; - - gtk_object_unref (GTK_OBJECT (priv->offline_handler)); - priv->offline_handler = NULL; - - gtk_signal_emit (GTK_OBJECT (shell), signals[LINE_STATUS_CHANGED], priv->line_status); -} - -/** - * e_shell_get_line_status: - * @shell: A pointer to an EShell object. - * - * Get the line status for @shell. - * - * Return value: The current line status for @shell. - **/ -EShellLineStatus -e_shell_get_line_status (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, E_SHELL_LINE_STATUS_OFFLINE); - g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_LINE_STATUS_OFFLINE); - - return shell->priv->line_status; -} - -/** - * e_shell_go_offline: - * @shell: - * @action_view: - * - * Make the shell go into off-line mode. - **/ -void -e_shell_go_offline (EShell *shell, - EShellView *action_view) -{ - EShellPrivate *priv; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (action_view != NULL); - g_return_if_fail (action_view == NULL || E_IS_SHELL_VIEW (action_view)); - - priv = shell->priv; - - if (priv->line_status != E_SHELL_LINE_STATUS_ONLINE) - return; - - g_assert (priv->offline_handler == NULL); - - priv->offline_handler = e_shell_offline_handler_new (priv->component_registry); - - gtk_signal_connect (GTK_OBJECT (priv->offline_handler), "offline_procedure_started", - GTK_SIGNAL_FUNC (offline_procedure_started_cb), shell); - gtk_signal_connect (GTK_OBJECT (priv->offline_handler), "offline_procedure_finished", - GTK_SIGNAL_FUNC (offline_procedure_finished_cb), shell); - - e_shell_offline_handler_put_components_offline (priv->offline_handler, action_view); -} - -/** - * e_shell_go_online: - * @shell: - * @action_view: - * - * Make the shell go into on-line mode. - **/ -void -e_shell_go_online (EShell *shell, - EShellView *action_view) -{ - EShellPrivate *priv; - GList *component_ids; - GList *p; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (action_view == NULL || E_IS_SHELL_VIEW (action_view)); - - priv = shell->priv; - - component_ids = e_component_registry_get_id_list (priv->component_registry); - - for (p = component_ids; p != NULL; p = p->next) { - CORBA_Environment ev; - EvolutionShellComponentClient *client; - GNOME_Evolution_Offline offline_interface; - const char *id; - - id = (const char *) p->data; - client = e_component_registry_get_component_by_id (priv->component_registry, id); - - CORBA_exception_init (&ev); - - offline_interface = evolution_shell_component_client_get_offline_interface (client); - - if (CORBA_Object_is_nil (offline_interface, &ev) || ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - continue; - } - - GNOME_Evolution_Offline_goOnline (offline_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Error putting component `%s' online.", id); - - CORBA_exception_free (&ev); - } - - e_free_string_list (component_ids); - - priv->line_status = E_SHELL_LINE_STATUS_ONLINE; - gtk_signal_emit (GTK_OBJECT (shell), signals[LINE_STATUS_CHANGED], priv->line_status); -} - - -Bonobo_ConfigDatabase -e_shell_get_config_db (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, CORBA_OBJECT_NIL); - - return shell->priv->db; -} - -EComponentRegistry * -e_shell_get_component_registry (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->component_registry; -} - -EShellUserCreatableItemsHandler * -e_shell_get_user_creatable_items_handler (EShell *shell) -{ - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - return shell->priv->user_creatable_items_handler; -} - - -void -e_shell_unregister_all (EShell *shell) -{ - EShellPrivate *priv; - - g_return_if_fail (E_IS_SHELL (shell)); - - /* FIXME: This really really sucks. */ - - priv = shell->priv; - - gtk_object_unref (GTK_OBJECT (priv->component_registry)); - priv->component_registry = NULL; -} - - -const char * -e_shell_construct_result_to_string (EShellConstructResult result) -{ - switch (result) { - case E_SHELL_CONSTRUCT_RESULT_OK: - return _("OK"); - case E_SHELL_CONSTRUCT_RESULT_INVALIDARG: - return _("Invalid arguments"); - case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER: - return _("Cannot register on OAF"); - case E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB: - return _("Configuration Database not found"); - case E_SHELL_CONSTRUCT_RESULT_GENERICERROR: - return _("Generic error"); - default: - return _("Unknown error"); - } -} - - -E_MAKE_X_TYPE (e_shell, "EShell", EShell, - class_init, init, PARENT_TYPE, - POA_GNOME_Evolution_Shell__init, - GTK_STRUCT_OFFSET (EShellClass, epv)); diff --git a/shell/e-shell.h b/shell/e-shell.h deleted file mode 100644 index 3e09b3f072..0000000000 --- a/shell/e-shell.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include <liboaf/liboaf.h> /* For the registration stuff. */ -#include <bonobo/bonobo-xobject.h> -#include <bonobo-conf/bonobo-config-database.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-component-registry.h" -#include "e-shortcuts.h" -#include "e-shell-view.h" -#include "e-uri-schema-registry.h" -#include "e-shell-user-creatable-items-handler.h" -#include "e-local-storage.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)) - - -enum _EShellLineStatus { - E_SHELL_LINE_STATUS_ONLINE, - E_SHELL_LINE_STATUS_GOING_OFFLINE, - E_SHELL_LINE_STATUS_OFFLINE -}; -typedef enum _EShellLineStatus EShellLineStatus; - -struct _EShell { - BonoboXObject parent; - - EShellPrivate *priv; -}; - -struct _EShellClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Shell__epv epv; - - void (* no_views_left) (EShell *shell); - void (* line_status_changed) (EShell *shell, EShellLineStatus status); -}; - - -/* ID for registering the shell in the OAF name service. */ -#define E_SHELL_OAFIID "OAFIID:GNOME_Evolution_Shell" - -enum _EShellConstructResult { - E_SHELL_CONSTRUCT_RESULT_OK, - E_SHELL_CONSTRUCT_RESULT_INVALIDARG, - E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER, - E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB, - E_SHELL_CONSTRUCT_RESULT_GENERICERROR -}; -typedef enum _EShellConstructResult EShellConstructResult; - - - -GtkType e_shell_get_type (void); -EShellConstructResult e_shell_construct (EShell *shell, - const char *iid, - const char *local_directory, - gboolean show_splash); -EShell *e_shell_new (const char *local_directory, - gboolean show_splash, - EShellConstructResult *construct_result_return); - -EShellView *e_shell_create_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); -ELocalStorage *e_shell_get_local_storage (EShell *shell); -EFolderTypeRegistry *e_shell_get_folder_type_registry (EShell *shell); -EUriSchemaRegistry *e_shell_get_uri_schema_registry (EShell *shell); - -gboolean e_shell_save_settings (EShell *shell); -gboolean e_shell_restore_from_settings (EShell *shell); - -void e_shell_destroy_all_views (EShell *shell); - -void e_shell_unregister_all (EShell *shell); - -void e_shell_component_maybe_crashed (EShell *shell, - const char *uri, - const char *type_name, - EShellView *shell_view); - -EShellLineStatus e_shell_get_line_status (EShell *shell); -void e_shell_go_offline (EShell *shell, - EShellView *action_view); -void e_shell_go_online (EShell *shell, - EShellView *action_view); - -Bonobo_ConfigDatabase e_shell_get_config_db (EShell *shell); -EComponentRegistry *e_shell_get_component_registry (EShell *shell); -EShellUserCreatableItemsHandler *e_shell_get_user_creatable_items_handler (EShell *shell); - - -const char *e_shell_construct_result_to_string (EShellConstructResult result); - -#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 e19315f920..0000000000 --- a/shell/e-shortcuts-view-model.c +++ /dev/null @@ -1,350 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view-model.c - * - * Copyright (C) 2000 Ximian, 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 "e-shortcuts-view-model.h" - -#include <glib.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-i18n.h> - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE e_shortcut_model_get_type () -static EShortcutModelClass *parent_class = NULL; - -struct _EShortcutsViewModelPrivate { - EShortcuts *shortcuts; -}; - - -/* Utility functions. */ - -static GdkPixbuf * -get_icon_for_item (EShortcutsViewModel *shortcuts_view_model, - const EShortcutItem *item, - gboolean want_mini) -{ - EShortcutsViewModelPrivate *priv; - - priv = shortcuts_view_model->priv; - - if (item->type != NULL) { - EStorageSet *storage_set; - EFolderTypeRegistry *folder_type_registry; - - storage_set = e_shortcuts_get_storage_set (priv->shortcuts); - folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); - - return e_folder_type_registry_get_icon_for_type (folder_type_registry, - item->type, - want_mini); - } - - return NULL; -} - - -/* View initialization. */ - -static char * -get_name_with_unread (const EShortcutItem *item) -{ - if (item->unread_count > 0) - return g_strdup_printf ("%s (%d)", item->name, item->unread_count); - else - return g_strdup (item->name); -} - -static void -load_group_into_model (EShortcutsViewModel *shortcuts_view_model, - int group_num) -{ - EShortcutsViewModelPrivate *priv; - const GSList *shortcut_list; - const GSList *p; - - priv = shortcuts_view_model->priv; - - shortcut_list = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, group_num); - if (shortcut_list == NULL) - return; - - for (p = shortcut_list; p != NULL; p = p->next) { - const EShortcutItem *item; - char *name_with_unread; - - item = (const EShortcutItem *) p->data; - name_with_unread = get_name_with_unread (item); - - e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), - group_num, -1, - item->uri, - name_with_unread, - get_icon_for_item (shortcuts_view_model, item, FALSE)); - - g_free (name_with_unread); - } -} - -static void -load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model) -{ - EShortcutsViewModelPrivate *priv; - const GSList *group_titles; - const GSList *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_num); - } -} - - -/* 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_rename_group_cb (EShortcuts *shortcuts, - int group_num, - const char *new_title, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - - /* FIXME: Ideally there should be an - e_shortcut_model_rename_group(), removing then re-add - actually causes a flip to the next group, which we work - around in e-shortcuts-view.c */ - e_shortcut_model_remove_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num); - e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, new_title); - load_group_into_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; - const EShortcutItem *shortcut_item; - char *name_with_unread; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - priv = shortcuts_view_model->priv; - - shortcut_item = e_shortcuts_get_shortcut (priv->shortcuts, group_num, item_num); - g_assert (shortcut_item != NULL); - - name_with_unread = get_name_with_unread (shortcut_item); - e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), - group_num, item_num, - shortcut_item->uri, - name_with_unread, - get_icon_for_item (shortcuts_view_model, shortcut_item, FALSE)); - - g_free (name_with_unread); -} - -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); -} - -static void -shortcuts_update_shortcut_cb (EShortcuts *shortcuts, - int group_num, - int item_num, - void *data) -{ - EShortcutsViewModel *shortcuts_view_model; - EShortcutsViewModelPrivate *priv; - const EShortcutItem *shortcut_item; - char *name_with_unread; - - shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); - priv = shortcuts_view_model->priv; - - shortcut_item = e_shortcuts_get_shortcut (priv->shortcuts, group_num, item_num); - g_assert (shortcut_item != NULL); - - name_with_unread = get_name_with_unread (shortcut_item); - e_shortcut_model_update_item (E_SHORTCUT_MODEL (shortcuts_view_model), - group_num, item_num, - shortcut_item->uri, - name_with_unread, - get_icon_for_item (shortcuts_view_model, shortcut_item, FALSE)); - - g_free (name_with_unread); -} - - -/* 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); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -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), - "rename_group", GTK_SIGNAL_FUNC (shortcuts_rename_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)); - gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), - "update_shortcut", GTK_SIGNAL_FUNC (shortcuts_update_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 a0e06ad020..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 Ximian, 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 <gal/shortcut-bar/e-shortcut-model.h> - -#include "e-shortcuts.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 24730a6268..0000000000 --- a/shell/e-shortcuts-view.c +++ /dev/null @@ -1,654 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.c - * - * Copyright (C) 2000, 2001 Ximian, 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/gtkcheckmenuitem.h> -#include <gtk/gtkentry.h> -#include <gtk/gtklabel.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-app-helper.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-popup-menu.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-uidefs.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> - -#include "e-util/e-request.h" - -#include "e-shell-constants.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, - HIDE_REQUESTED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static void -show_new_group_dialog (EShortcutsView *view) -{ - char *group_name; - - group_name = e_request_string (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), - _("Create new shortcut group"), - _("Group name:"), - NULL); - - if (group_name == NULL) - return; - - e_shortcuts_add_group (view->priv->shortcuts, -1, group_name); - - g_free (group_name); -} - - -/* 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 -hide_shortcut_bar_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - EShortcutsView *shortcut_view; - - menu_data = (RightClickMenuData *) data; - - shortcut_view = E_SHORTCUTS_VIEW (menu_data->shortcuts_view); - - gtk_signal_emit (GTK_OBJECT (shortcut_view), signals[HIDE_REQUESTED]); -} - -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, *title; - - menu_data = (RightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - priv = shortcuts_view->priv; - shortcuts = priv->shortcuts; - - title = e_utf8_to_locale_string (e_shortcuts_get_group_title ( - shortcuts, menu_data->group_num)); - question = g_strdup_printf (_("Do you really want to remove group\n" - "`%s' from the shortcut bar?"), title); - g_free (title); - - 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)))); - g_free (question); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (message_box)) != 0) - return; - - e_shortcuts_remove_group (shortcuts, menu_data->group_num); -} - -static void -rename_group_cb (GtkWidget *widget, - void *data) -{ - RightClickMenuData *menu_data; - EShortcuts *shortcuts; - EShortcutsView *shortcuts_view; - const char *old_name; - char *new_name; - int group; - - menu_data = (RightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - shortcuts = shortcuts_view->priv->shortcuts; - - old_name = e_shortcuts_get_group_title (shortcuts, menu_data->group_num); - - new_name = e_request_string (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shortcuts_view))), - _("Rename Shortcut Group"), - _("Rename selected shortcut group to:"), - old_name); - - if (new_name == NULL) - return; - - /* Remember the group and flip back to it */ - group = e_group_bar_get_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view))); - e_shortcuts_rename_group (shortcuts, menu_data->group_num, new_name); - g_free (new_name); - e_group_bar_set_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view)), group, FALSE); -} - -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 }, - { GNOME_APP_UI_ITEM, N_("Re_name this Group..."), - N_("Rename this shortcut group"), rename_group_cb, NULL, - NULL, 0, 0, 0, 0 }, - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, N_("_Hide the Shortcut Bar"), - N_("Hide the shortcut bar"), hide_shortcut_bar_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_unref (popup_menu); -} - - -/* Data to be passed around for the shortcut right-click menu items. */ - -struct _ShortcutRightClickMenuData { - EShortcutsView *shortcuts_view; - int group_num; - int item_num; -}; -typedef struct _ShortcutRightClickMenuData ShortcutRightClickMenuData; - - -/* "Open Shortcut" and "Open Shortcut in New Window" commands. */ - -static void -open_shortcut_helper (ShortcutRightClickMenuData *menu_data, - gboolean in_new_window) -{ - EShortcutsView *shortcuts_view; - EShortcuts *shortcuts; - const EShortcutItem *shortcut_item; - - shortcuts_view = menu_data->shortcuts_view; - shortcuts = shortcuts_view->priv->shortcuts; - - shortcut_item = e_shortcuts_get_shortcut (shortcuts, menu_data->group_num, menu_data->item_num); - if (shortcut_item == NULL) - return; - - gtk_signal_emit (GTK_OBJECT (shortcuts_view), signals[ACTIVATE_SHORTCUT], - shortcuts, shortcut_item->uri, in_new_window); -} - -static void -open_shortcut_cb (GtkWidget *widget, - void *data) -{ - open_shortcut_helper ((ShortcutRightClickMenuData *) data, FALSE); -} - -static void -open_shortcut_in_new_window_cb (GtkWidget *widget, - void *data) -{ - open_shortcut_helper ((ShortcutRightClickMenuData *) data, TRUE); -} - - -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); -} - - -/* "Rename Shortcut" command. */ - -static void -rename_shortcut_cb (GtkWidget *widget, - void *data) -{ - ShortcutRightClickMenuData *menu_data; - EShortcutsView *shortcuts_view; - EShortcuts *shortcuts; - const EShortcutItem *shortcut_item; - char *new_name; - - menu_data = (ShortcutRightClickMenuData *) data; - shortcuts_view = menu_data->shortcuts_view; - shortcuts = shortcuts_view->priv->shortcuts; - - shortcut_item = e_shortcuts_get_shortcut (shortcuts, menu_data->group_num, menu_data->item_num); - - new_name = e_request_string (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shortcuts_view))), - _("Rename shortcut"), - _("Rename selected shortcut to:"), - shortcut_item->name); - - if (new_name == NULL) - return; - - e_shortcuts_update_shortcut (shortcuts, menu_data->group_num, menu_data->item_num, - shortcut_item->uri, new_name, shortcut_item->unread_count, shortcut_item->type); - g_free (new_name); -} - -static GnomeUIInfo shortcut_right_click_menu_uiinfo[] = { - GNOMEUIINFO_ITEM_STOCK (N_("_Open"), N_("Open the folder linked to this shortcut"), - open_shortcut_cb, GNOME_STOCK_MENU_OPEN), - GNOMEUIINFO_ITEM_NONE (N_("Open in New _Window"), N_("Open the folder linked to this shortcut in a new window"), - open_shortcut_in_new_window_cb), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("_Rename"), N_("Rename this shortcut"), - rename_shortcut_cb), - GNOMEUIINFO_ITEM_STOCK (N_("Re_move"), N_("Remove this shortcut from the shortcut bar"), - remove_shortcut_cb, GNOME_STOCK_MENU_TRASH), - 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 EShortcutItem *shortcut_item; - - 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; - - shortcut_item = e_shortcuts_get_shortcut (shortcuts, group_num, item_num); - if (shortcut_item == NULL) - return; - - gtk_signal_emit (GTK_OBJECT (shortcuts_view), signals[ACTIVATE_SHORTCUT], - shortcuts, shortcut_item->uri, FALSE); -} - -static void -get_shortcut_info (EShortcutsView *shortcuts_view, - const char *item_url, - int *unread_count_return, - const char **type_return) -{ - EShortcutsViewPrivate *priv; - EStorageSet *storage_set; - EStorage *storage; - EFolder *folder; - const char *path; - - priv = shortcuts_view->priv; - - if (strncmp (item_url, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) { - *unread_count_return = 0; - *type_return = NULL; - return; - } - - path = strchr (item_url, G_DIR_SEPARATOR); - storage_set = e_shortcuts_get_storage_set (priv->shortcuts); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder != NULL) { - *unread_count_return = e_folder_get_unread_count (folder); - *type_return = e_folder_get_type_string (folder); - return; - } - - storage = e_storage_set_get_storage (storage_set, path + 1); - if (storage != NULL) { - *unread_count_return = 0; - *type_return = e_storage_get_toplevel_node_type (storage); - return; - } - - *unread_count_return = 0; - *type_return = NULL; -} - -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; - int unread_count; - const char *type; - char *tmp; - char *tp; - char *name_without_unread; - - shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar); - priv = shortcuts_view->priv; - - get_shortcut_info (shortcuts_view, item_url, &unread_count, &type); - - /* Looks funny, but keeps it from adding the unread count - repeatedly when dragging folders around */ - tmp = g_strdup_printf (" (%d)", unread_count); - if ((tp = strstr (item_name, tmp)) != NULL) - name_without_unread = g_strndup (item_name, strlen (item_name) - strlen (tp)); - else - name_without_unread = g_strdup (item_name); - - e_shortcuts_add_shortcut (priv->shortcuts, - group_num, position, - item_url, name_without_unread, unread_count, type); - - g_free (tmp); - g_free (name_without_unread); -} - -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), - e_marshal_NONE__POINTER_POINTER_INT, - GTK_TYPE_NONE, 3, - GTK_TYPE_POINTER, - GTK_TYPE_STRING, - GTK_TYPE_BOOL); - - signals[HIDE_REQUESTED] = - gtk_signal_new ("hide_requested", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsViewClass, - hide_requested), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - 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; - gtk_object_ref (GTK_OBJECT (priv->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 d98f0e68f6..0000000000 --- a/shell/e-shortcuts-view.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include <gtk/gtkwidget.h> - -#include <gal/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, - gboolean in_new_window); - - void (* hide_requested) (EShortcutsView *view); -}; - - -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 a343d5caca..0000000000 --- a/shell/e-shortcuts.c +++ /dev/null @@ -1,1171 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.c - * - * Copyright (C) 2000, 2001 Ximian, 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 like this: - - <?xml version="1.0"?> - <shortcuts> - <group title="Evolution shortcuts"> - <item name="Inbox" type="mail">evolution:/local/Inbox</item> - <item name="Trash" type="vtrash">evolution:/local/Trash</item> - <item name="Calendar" type="calendar">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 "e-shortcuts.h" - -#include <string.h> - -#include <glib.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> -#include <gal/widgets/e-unicode.h> -#include <gal/shortcut-bar/e-shortcut-bar.h> - -#include "e-shortcuts-view.h" - -#include "e-shell-constants.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _ShortcutGroup { - /* Title of the group. */ - char *title; - - /* A list of shortcuts. */ - GSList *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; - - /* Total number of groups. */ - int num_groups; - - /* A list of ShortcutGroups. */ - GSList *groups; - - /* A list of ShortcutViews. */ - GSList *views; -}; - -enum { - NEW_GROUP, - REMOVE_GROUP, - RENAME_GROUP, - NEW_SHORTCUT, - REMOVE_SHORTCUT, - UPDATE_SHORTCUT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -static void make_dirty (EShortcuts *shortcuts); - - -static EShortcutItem * -shortcut_item_new (const char *uri, - const char *name, - int unread_count, - const char *type) -{ - EShortcutItem *new; - - if (name == NULL) - name = g_basename (uri); - - new = g_new (EShortcutItem, 1); - new->uri = g_strdup (uri); - new->name = g_strdup (name); - new->type = g_strdup (type); - new->unread_count = unread_count; - - return new; -} - -static gboolean -shortcut_item_update (EShortcutItem *shortcut_item, - const char *uri, - const char *name, - int unread_count, - const char *type) -{ - gboolean changed = FALSE; - - if (name == NULL) - name = g_basename (uri); - - if (shortcut_item->uri == NULL || uri == NULL || - strcmp (shortcut_item->uri, uri) != 0) { - g_free (shortcut_item->uri); - shortcut_item->uri = g_strdup (uri); - changed = TRUE; - } - - if (shortcut_item->name == NULL || name == NULL || - strcmp (shortcut_item->name, name) != 0) { - g_free (shortcut_item->name); - shortcut_item->name = g_strdup (name); - changed = TRUE; - } - - if (shortcut_item->unread_count != unread_count) { - shortcut_item->unread_count = unread_count; - changed = FALSE; - } - - if (shortcut_item->type == NULL || type == NULL || - strcmp (shortcut_item->type, type) != 0) { - g_free (shortcut_item->type); - shortcut_item->type = g_strdup (type); - changed = TRUE; - } - - return changed; -} - -static void -shortcut_item_free (EShortcutItem *shortcut_item) -{ - g_free (shortcut_item->uri); - g_free (shortcut_item->name); - g_free (shortcut_item->type); - - g_free (shortcut_item); -} - -static ShortcutGroup * -shortcut_group_new (const char *title) -{ - ShortcutGroup *new; - - new = g_new (ShortcutGroup, 1); - new->title = g_strdup (title); - new->shortcuts = NULL; - - return new; -} - -static void -shortcut_group_free (ShortcutGroup *group) -{ - GSList *p; - - g_free (group->title); - - for (p = group->shortcuts; p != NULL; p = p->next) - shortcut_item_free ((EShortcutItem *) p->data); - g_slist_free (group->shortcuts); - - g_free (group); -} - - -/* Utility functions. */ - -static gboolean -update_shortcut_and_emit_signal (EShortcuts *shortcuts, - EShortcutItem *shortcut_item, - int group_num, - int num, - const char *uri, - const char *name, - int unread_count, - const char *type) -{ - /* Only thing that changed was the unread count */ - if (shortcut_item->unread_count != unread_count - && !shortcut_item_update (shortcut_item, uri, name, unread_count, type)) { - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num); - return FALSE; - } - - /* Unread count is the same, but other stuff changed */ - else if (shortcut_item_update (shortcut_item, uri, name, unread_count, type)) { - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num); - return TRUE; - } - - /* Nothing at all changed, return false only */ - else - return FALSE; -} - -static void -unload_shortcuts (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - GSList *orig_groups; - GSList *p; - - 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; - - shortcut_group_free (group); - - priv->groups = priv->groups->next; - } - - if (orig_groups != NULL) - g_slist_free (orig_groups); - - priv->groups = NULL; -} - -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; - xmlChar *shortcut_group_title; - - if (strcmp ((char *) p->name, "group") != 0) - continue; - - shortcut_group_title = xmlGetProp (p, "title"); - if (shortcut_group_title == NULL) - continue; - - shortcut_group = shortcut_group_new (shortcut_group_title); - xmlFree (shortcut_group_title); - - for (q = p->childs; q != NULL; q = q->next) { - EShortcutItem *shortcut_item; - xmlChar *uri; - xmlChar *name; - xmlChar *type; - - if (strcmp ((char *) q->name, "item") != 0) - continue; - - uri = xmlNodeListGetString (doc, q->childs, 1); - name = xmlGetProp (q, "name"); - type = xmlGetProp (q, "type"); - - if (uri != NULL && strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { - EFolder *folder; - - folder = e_storage_set_get_folder (priv->storage_set, uri + E_SHELL_URI_PREFIX_LEN); - if (folder != NULL) { - if (type != NULL) - xmlFree (type); - type = xmlMemStrdup (e_folder_get_type_string (folder)); - } else { - EStorage *storage; - const char *storage_type; - - storage = e_storage_set_get_storage (priv->storage_set, - uri + E_SHELL_URI_PREFIX_LEN + 1); - if (storage != NULL) { - if (type != NULL) - xmlFree (type); - storage_type = e_storage_get_toplevel_node_type (storage); - - if (storage_type == NULL) - type = NULL; - else - type = xmlMemStrdup (storage_type); - - if (name != NULL) - xmlFree (name); - - name = xmlMemStrdup (e_storage_get_display_name (storage)); - } - } - - shortcut_item = shortcut_item_new (uri, name, 0, type); - shortcut_group->shortcuts = g_slist_prepend (shortcut_group->shortcuts, - shortcut_item); - } - - if (uri != NULL) - xmlFree (uri); - if (name != NULL) - xmlFree (name); - if (type != NULL) - xmlFree (type); - } - - shortcut_group->shortcuts = g_slist_reverse (shortcut_group->shortcuts); - - priv->groups = g_slist_prepend (priv->groups, shortcut_group); - priv->num_groups ++; - } - - priv->groups = g_slist_reverse (priv->groups); - - xmlFreeDoc (doc); - - /* After loading, we always have to re-save ourselves as we have merged - the information we have with the information we got from the - StorageSet. */ - /* FIXME: Obviously, this sucks. */ - make_dirty (shortcuts); - - return TRUE; -} - -static gboolean -save_shortcuts (EShortcuts *shortcuts, - const char *file_name) -{ - EShortcutsPrivate *priv; - xmlDoc *doc; - xmlNode *root; - GSList *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) { - EShortcutItem *shortcut; - xmlNode *shortcut_node; - - shortcut = (EShortcutItem *) q->data; - shortcut_node = xmlNewTextChild (group_node, NULL, (xmlChar *) "item", - (xmlChar *) shortcut->uri); - - if (shortcut->name != NULL) - xmlSetProp (shortcut_node, (xmlChar *) "name", shortcut->name); - - if (shortcut->type != NULL) - xmlSetProp (shortcut_node, (xmlChar *) "type", shortcut->type); - - } - } - - 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) { - 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; - - priv->save_idle_id = gtk_idle_add (idle_cb, shortcuts); -} - -static void -make_dirty (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - - priv = shortcuts->priv; - - priv->dirty = TRUE; - schedule_idle (shortcuts); -} - -static void -update_shortcuts_by_path (EShortcuts *shortcuts, - const char *path) -{ - EShortcutsPrivate *priv; - EFolder *folder; - const GSList *p, *q; - char *evolution_uri; - int group_num, num; - gboolean changed = FALSE; - - priv = shortcuts->priv; - folder = e_storage_set_get_folder (priv->storage_set, path); - - evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); - - group_num = 0; - for (p = priv->groups; p != NULL; p = p->next, group_num++) { - ShortcutGroup *group; - - group = (ShortcutGroup *) p->data; - num = 0; - for (q = group->shortcuts; q != NULL; q = q->next, num++) { - EShortcutItem *shortcut_item; - - shortcut_item = (EShortcutItem *) q->data; - - if (strcmp (shortcut_item->uri, evolution_uri) == 0) { - changed = update_shortcut_and_emit_signal (shortcuts, - shortcut_item, - group_num, - num, - evolution_uri, - shortcut_item->name, - e_folder_get_unread_count (folder), - e_folder_get_type_string (folder)); - } - } - } - - g_free (evolution_uri); - - if (changed) - make_dirty (shortcuts); -} - - -static EShortcutItem * -get_item (EShortcuts *shortcuts, - int group_num, - int num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GSList *group_element; - GSList *shortcut_element; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - group_element = g_slist_nth (priv->groups, group_num); - if (group_element == NULL) - return NULL; - - group = (ShortcutGroup *) group_element->data; - - shortcut_element = g_slist_nth (group->shortcuts, num); - if (shortcut_element == NULL) - return NULL; - - return (EShortcutItem *) shortcut_element->data; -} - - -/* 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_slist_remove (priv->views, object); -} - - -/* Signal handlers for the EStorageSet. */ - -static void -storage_set_new_folder_callback (EStorageSet *storage_set, - const char *path, - void *data) -{ - EShortcuts *shortcuts; - - shortcuts = E_SHORTCUTS (data); - - update_shortcuts_by_path (shortcuts, path); -} - -static void -storage_set_updated_folder_callback (EStorageSet *storage_set, - const char *path, - void *data) -{ - EShortcuts *shortcuts; - - shortcuts = E_SHORTCUTS (data); - - update_shortcuts_by_path (shortcuts, path); -} - - -/* 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 */ - } - - (* 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[RENAME_GROUP] - = gtk_signal_new ("rename_group", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, rename_group), - gtk_marshal_NONE__INT_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_INT, - GTK_TYPE_STRING); - - 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); - - signals[UPDATE_SHORTCUT] - = gtk_signal_new ("update_shortcut", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsClass, update_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->num_groups = 0; - priv->groups = NULL; - priv->views = NULL; - 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_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_folder", - GTK_SIGNAL_FUNC (storage_set_new_folder_callback), - shortcuts, GTK_OBJECT (shortcuts)); - gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "updated_folder", - GTK_SIGNAL_FUNC (storage_set_updated_folder_callback), - shortcuts, GTK_OBJECT (shortcuts)); - - 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)) - new->priv->file_name = g_strdup (file_name); - - return new; -} - - -int -e_shortcuts_get_num_groups (EShortcuts *shortcuts) -{ - g_return_val_if_fail (shortcuts != NULL, 0); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), 0); - - return shortcuts->priv->num_groups; -} - -GSList * -e_shortcuts_get_group_titles (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GSList *list; - GSList *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_slist_prepend (list, g_strdup (group->title)); - } - - return g_slist_reverse (list); -} - -const GSList * -e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - int group_num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *shortcut_group; - GSList *shortcut_group_list_item; - - priv = shortcuts->priv; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - shortcut_group_list_item = g_slist_nth (priv->groups, group_num); - if (shortcut_group_list_item == NULL) - return NULL; - - shortcut_group = (ShortcutGroup *) shortcut_group_list_item->data; - - return shortcut_group->shortcuts; -} - - -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_slist_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 EShortcutItem * -e_shortcuts_get_shortcut (EShortcuts *shortcuts, - int group_num, - int num) -{ - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - return (const EShortcutItem *) get_item (shortcuts, group_num, num); -} - - -void -e_shortcuts_remove_shortcut (EShortcuts *shortcuts, - int group_num, - int num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GSList *p; - EShortcutItem *item; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_slist_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - group = (ShortcutGroup *) p->data; - - p = g_slist_nth (group->shortcuts, num); - g_return_if_fail (p != NULL); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_SHORTCUT], group_num, num); - - item = (EShortcutItem *) p->data; - shortcut_item_free (item); - - group->shortcuts = g_slist_remove_link (group->shortcuts, p); - - make_dirty (shortcuts); -} - -void -e_shortcuts_add_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri, - const char *name, - int unread_count, - const char *type) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - EShortcutItem *item; - GSList *p; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_slist_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - group = (ShortcutGroup *) p->data; - - if (num == -1) - num = g_slist_length (group->shortcuts); - - item = shortcut_item_new (uri, name, unread_count, type); - - group->shortcuts = g_slist_insert (group->shortcuts, item, num); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[NEW_SHORTCUT], group_num, num); - - make_dirty (shortcuts); -} - -void -e_shortcuts_update_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri, - const char *name, - int unread_count, - const char *type) -{ - EShortcutItem *shortcut_item; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - shortcut_item = get_item (shortcuts, group_num, num); - - update_shortcut_and_emit_signal (shortcuts, shortcut_item, group_num, num, uri, name, unread_count, type); - - make_dirty (shortcuts); -} - - -void -e_shortcuts_add_default_group (EShortcuts *shortcuts) -{ - char *utf; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - utf = e_utf8_from_locale_string (_("Shortcuts")); - e_shortcuts_add_group (shortcuts, -1, utf); - g_free (utf); - - /* FIXME: Inbox shortcut should point to something else for - people who won't care about using /Local Folders/Inbox */ - utf = e_utf8_from_locale_string (_("Summary")); - e_shortcuts_add_shortcut (shortcuts, 0, -1, "evolution:/summary", utf, 0, "summary"); - g_free (utf); - utf = e_utf8_from_locale_string (_("Inbox")); - e_shortcuts_add_shortcut (shortcuts, 0, -1, "evolution:/local/Inbox", utf, 0, "mail"); - g_free (utf); - utf = e_utf8_from_locale_string (_("Calendar")); - e_shortcuts_add_shortcut (shortcuts, 0, -1, "evolution:/local/Calendar", utf, 0, "calendar"); - g_free (utf); - utf = e_utf8_from_locale_string (_("Tasks")); - e_shortcuts_add_shortcut (shortcuts, 0, -1, "evolution:/local/Tasks", utf, 0, "tasks"); - g_free (utf); - utf = e_utf8_from_locale_string (_("Contacts")); - e_shortcuts_add_shortcut (shortcuts, 0, -1, "evolution:/local/Contacts", utf, 0, "contacts"); - g_free (utf); -} - -void -e_shortcuts_remove_group (EShortcuts *shortcuts, - int group_num) -{ - EShortcutsPrivate *priv; - GSList *p; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_slist_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_GROUP], group_num); - - shortcut_group_free ((ShortcutGroup *) p->data); - - priv->groups = g_slist_remove_link (priv->groups, p); - priv->num_groups --; - - make_dirty (shortcuts); -} - -void -e_shortcuts_rename_group (EShortcuts *shortcuts, - int group_num, - const char *new_title) -{ - EShortcutsPrivate *priv; - GSList *p; - ShortcutGroup *group; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts->priv; - - p = g_slist_nth (priv->groups, group_num); - g_return_if_fail (p != NULL); - - group = (ShortcutGroup *) p->data; - if (strcmp (group->title, new_title)) { - g_free (group->title); - group->title = g_strdup (new_title); - } else - return; - - gtk_signal_emit (GTK_OBJECT (shortcuts), signals[RENAME_GROUP], group_num, new_title); - - 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 = shortcut_group_new (group_name); - - if (group_num == -1) - group_num = g_slist_length (priv->groups); - - priv->groups = g_slist_insert (priv->groups, group, group_num); - priv->num_groups ++; - - 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; - GSList *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_slist_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 2173b4457a..0000000000 --- a/shell/e-shortcuts.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.h - * - * Copyright (C) 2000, 2001 Ximian, 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_ - -#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 _EShortcutItem { - /* URI of the shortcut. */ - char *uri; - - /* Name of the shortcut. */ - char *name; - - /* Folder type for the shortcut. If the shortcut doesn't point to a - folder, this is NULL. */ - char *type; - - /* Number of unread items in the folder. Zero if not a folder. */ - int unread_count; -}; -typedef struct _EShortcutItem EShortcutItem; - -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 (* rename_group) (EShortcuts *shortcuts, int group_num, const char *new_title); - - void (* new_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); - void (* remove_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); - void (* update_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); - -int e_shortcuts_get_num_groups (EShortcuts *shortcuts); - -GSList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); -const char *e_shortcuts_get_group_title (EShortcuts *shortcuts, - int group_num); -const GSList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - int group_num); - -const EShortcutItem *e_shortcuts_get_shortcut (EShortcuts *shortcuts, - int group_num, - int num); - -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); - -void e_shortcuts_add_default_group (EShortcuts *shortcuts); - -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, - const char *name, - int unread_count, - const char *type); -void e_shortcuts_update_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri, - const char *name, - int unread_count, - const char *type); - -void e_shortcuts_remove_group (EShortcuts *shortcuts, - int group_num); -void e_shortcuts_add_group (EShortcuts *shortcuts, - int group_num, - const char *group_title); -void e_shortcuts_rename_group (EShortcuts *shortcuts, - int group_name, - const char *new_title); - -#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 14ab3a7d37..0000000000 --- a/shell/e-splash.c +++ /dev/null @@ -1,423 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-splash.c - * - * Copyright (C) 2000, 2001 Ximian, 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-splash.h" -#include <gtk/gtkframe.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> -#include <libgnomeui/gnome-window-icon.h> -#include <gal/util/e-util.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 280 -#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); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -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; -} - -static gboolean -button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data) -{ - ESplash *splash; - - splash = E_SPLASH (data); - - gtk_widget_hide (GTK_WIDGET (splash)); - - return TRUE; -} - - -/** - * 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_signal_connect (GTK_OBJECT (splash), "button-press-event", - GTK_SIGNAL_FUNC (button_press_event), splash); - - gtk_object_set (GTK_OBJECT (splash), "type", GTK_WINDOW_TOPLEVEL, 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); - gnome_window_icon_set_from_file (GTK_WINDOW (splash), EVOLUTION_DATADIR "/pixmaps/evolution.png"); - gtk_window_set_title (GTK_WINDOW (splash), "Ximian Evolution"); - -} - -/** - * 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_data (priv->icons, num); - - 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 efda6c8ed3..0000000000 --- a/shell/e-splash.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-splash.h - * - * Copyright (C) 2000 Ximian, 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_ - -#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 9edc5ce07f..0000000000 --- a/shell/e-storage-set-view.c +++ /dev/null @@ -1,2055 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.c - * - * Copyright (C) 2000, 2001 Ximian, 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 "e-storage-set-view.h" - -#include <glib.h> -#include <gnome.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> -#include <gal/util/e-util.h> -#include <gal/e-table/e-tree-memory-callbacks.h> -#include <gal/e-table/e-cell-tree.h> -#include <gal/e-table/e-cell-text.h> -#include <gal/unicode/gunicode.h> - -#include <libgnome/gnome-util.h> - -#include "e-util/e-gtk-utils.h" - -#include "e-shell-constants.h" -#include "e-local-storage.h" -#include "e-summary-storage.h" - - -/*#define DEBUG_XML*/ - -#define ROOT_NODE_NAME "/RootNode" - - -/* This is used on the source side to define the two basic types that we always - export. */ -enum _DndTargetTypeIdx { - EVOLUTION_PATH_TARGET_TYPE_IDX = 0, - E_SHORTCUT_TARGET_TYPE_IDX = 1 -}; -typedef enum _DndTargetTypeIdx DndTargetTypeIdx; - -#define EVOLUTION_PATH_TARGET_TYPE "_EVOLUTION_PRIVATE_PATH" -#define E_SHORTCUT_TARGET_TYPE "E-SHORTCUT" - - -#define PARENT_TYPE E_TREE_TYPE -static ETreeClass *parent_class = NULL; - -struct _EStorageSetViewPrivate { - EStorageSet *storage_set; - - BonoboUIContainer *container; - - 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_activated" signal. */ - char *selected_row_path; - - unsigned int show_folders : 1; - unsigned int allow_dnd : 1; - - /* The `Evolution::ShellComponentDnd::SourceFolder' interface for the - folder we are dragging from, or CORBA_OBJECT_NIL if no dragging is - happening. */ - GNOME_Evolution_ShellComponentDnd_SourceFolder drag_corba_source_interface; - - /* Source context information. NULL if no dragging is in progress. */ - GNOME_Evolution_ShellComponentDnd_SourceFolder_Context *drag_corba_source_context; - - /* The data. */ - GNOME_Evolution_ShellComponentDnd_Data *drag_corba_data; -}; - - -enum { - FOLDER_SELECTED, - STORAGE_SELECTED, - DND_ACTION, - LAST_SIGNAL -}; - -static unsigned int 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" - - -/* Sorting callbacks. */ - -static int -storage_sort_callback (ETreeMemory *etmm, - ETreePath node1, - ETreePath node2, - void *closure) -{ - char *folder_path1; - char *folder_path2; - gboolean path1_local; - gboolean path2_local; - - folder_path1 = e_tree_memory_node_get_data(etmm, node1); - folder_path2 = e_tree_memory_node_get_data(etmm, node2); - - /* FIXME bad hack to put the "my evolution" and "local" storages on - top. */ - - if (strcmp (folder_path1, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) - return -1; - if (strcmp (folder_path2, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0) - return +1; - - path1_local = ! strcmp (folder_path1, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME); - path2_local = ! strcmp (folder_path2, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME); - - if (path1_local && path2_local) - return 0; - if (path1_local) - return -1; - if (path2_local) - return 1; - - return g_utf8_collate (e_tree_model_value_at (E_TREE_MODEL (etmm), node1, 0), - e_tree_model_value_at (E_TREE_MODEL (etmm), node2, 0)); -} - -static int -folder_sort_callback (ETreeMemory *etmm, ETreePath path1, ETreePath path2, gpointer closure) -{ - return g_utf8_collate (e_tree_model_value_at (E_TREE_MODEL (etmm), path1, 0), - e_tree_model_value_at (E_TREE_MODEL (etmm), path2, 0)); -} - - - -/* 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; - int icon_pixbuf_width, icon_pixbuf_height; - - 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; - - icon_pixbuf_width = gdk_pixbuf_get_width (icon_pixbuf); - icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf); - - if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) { - scaled_pixbuf = gdk_pixbuf_ref (icon_pixbuf); - } else { - 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; -} - -static EFolder * -get_folder_at_node (EStorageSetView *storage_set_view, - ETreePath path) -{ - EStorageSetViewPrivate *priv; - const char *folder_path; - - priv = storage_set_view->priv; - - if (path == NULL) - return NULL; - - folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); - g_assert (folder_path != NULL); - - return e_storage_set_get_folder (priv->storage_set, folder_path); -} - -static EvolutionShellComponentClient * -get_component_at_node (EStorageSetView *storage_set_view, - ETreePath path) -{ - EStorageSetViewPrivate *priv; - EvolutionShellComponentClient *component_client; - EFolderTypeRegistry *folder_type_registry; - EFolder *folder; - - priv = storage_set_view->priv; - - folder = get_folder_at_node (storage_set_view, path); - if (folder == NULL) - return NULL; - - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - g_assert (folder_type_registry != NULL); - - component_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, - e_folder_get_type_string (folder)); - - return component_client; -} - -static GNOME_Evolution_ShellComponentDnd_ActionSet -convert_gdk_drag_action_set_to_corba (GdkDragAction action) -{ - GNOME_Evolution_ShellComponentDnd_Action retval; - - retval = GNOME_Evolution_ShellComponentDnd_ACTION_DEFAULT; - - if (action & GDK_ACTION_COPY) - retval |= GNOME_Evolution_ShellComponentDnd_ACTION_COPY; - if (action & GDK_ACTION_MOVE) - retval |= GNOME_Evolution_ShellComponentDnd_ACTION_MOVE; - if (action & GDK_ACTION_LINK) - retval |= GNOME_Evolution_ShellComponentDnd_ACTION_LINK; - if (action & GDK_ACTION_ASK) - retval |= GNOME_Evolution_ShellComponentDnd_ACTION_ASK; - - return retval; -} - -static GNOME_Evolution_ShellComponentDnd_ActionSet -convert_gdk_drag_action_to_corba (GdkDragAction action) -{ - if (action == GDK_ACTION_COPY) - return GNOME_Evolution_ShellComponentDnd_ACTION_COPY; - else if (action == GDK_ACTION_MOVE) - return GNOME_Evolution_ShellComponentDnd_ACTION_MOVE; - else if (action == GDK_ACTION_LINK) - return GNOME_Evolution_ShellComponentDnd_ACTION_LINK; - else if (action == GDK_ACTION_ASK) - return GNOME_Evolution_ShellComponentDnd_ACTION_ASK; - else { - g_warning ("Unknown GdkDragAction %d", action); - return GNOME_Evolution_ShellComponentDnd_ACTION_DEFAULT; - } -} - -static GdkDragAction -convert_corba_drag_action_to_gdk (GNOME_Evolution_ShellComponentDnd_ActionSet action) -{ - if (action == GNOME_Evolution_ShellComponentDnd_ACTION_COPY) - return GDK_ACTION_COPY; - else if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE) - return GDK_ACTION_MOVE; - else if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK) - return GDK_ACTION_LINK; - else if (action == GNOME_Evolution_ShellComponentDnd_ACTION_ASK) - return GDK_ACTION_ASK; - else { - g_warning ("unknown GNOME_Evolution_ShellComponentDnd_ActionSet %d", action); - return GDK_ACTION_DEFAULT; - } -} - -/* This will look for the targets in @drag_context, choose one that matches - with the allowed types at @path, and return its name. The EVOLUTION_PATH - type always matches. */ -static const char * -find_matching_target_for_drag_context (EStorageSetView *storage_set_view, - ETreePath path, - GdkDragContext *drag_context) -{ - EStorageSetViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - EFolder *folder; - GList *accepted_types; - GList *p, *q; - - priv = storage_set_view->priv; - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - - folder = get_folder_at_node (storage_set_view, path); - if (folder == NULL) - return NULL; - - accepted_types = e_folder_type_registry_get_accepted_dnd_types_for_type (folder_type_registry, - e_folder_get_type_string (folder)); - - /* FIXME? We might make this more efficient. Currently it takes `n * - m' string compares, where `n' is the number of targets in the - @drag_context, and `m' is the number of supported types in - @folder. */ - - for (p = drag_context->targets; p != NULL; p = p->next) { - char *possible_type; - - possible_type = gdk_atom_name ((GdkAtom) p->data); - if (strcmp (possible_type, EVOLUTION_PATH_TARGET_TYPE) == 0) { - g_free (possible_type); - return EVOLUTION_PATH_TARGET_TYPE; - } - - for (q = accepted_types; q != NULL; q = q->next) { - const char *accepted_type; - - accepted_type = (const char *) q->data; - if (strcmp (possible_type, accepted_type) == 0) { - g_free (possible_type); - return accepted_type; - } - } - - g_free (possible_type); - } - - return NULL; -} - - -/* Custom marshalling function. */ - -typedef void (* GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING) (GtkObject *object, - GdkDragContext *action, - const char *, - const char *, - const char *); - -static void -marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING (GtkObject *object, - GtkSignalFunc func, - void *func_data, - GtkArg *args) -{ - GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING rfunc; - - rfunc = (GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING) func; - (* rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_STRING (args[1]), - GTK_VALUE_STRING (args[2]), - GTK_VALUE_STRING (args[3])); -} - - -/* DnD selection setup stuff. */ - -/* This will create an array of GtkTargetEntries from the specified list of DND - types. The type name will *not* be allocated in the list, as this is - supposed to be used only temporarily to set up the cell as a drag source. */ -static GtkTargetEntry * -create_target_entries_from_dnd_type_list (GList *dnd_types, - int *num_entries_return) -{ - GtkTargetEntry *entries; - GList *p; - int num_entries; - int i; - - if (dnd_types == NULL) - num_entries = 0; - else - num_entries = g_list_length (dnd_types); - - /* We always add two entries, one for an Evolution URI type, and one - for e-shortcuts. This will let us do drag & drop within Evolution - at least. */ - num_entries += 2; - - entries = g_new (GtkTargetEntry, num_entries); - - i = 0; - - /* The Evolution URI will always come first. */ - entries[i].target = EVOLUTION_PATH_TARGET_TYPE; - entries[i].flags = 0; - entries[i].info = i; - g_assert (i == EVOLUTION_PATH_TARGET_TYPE_IDX); - i ++; - - /* ...Then the shortcut type. */ - entries[i].target = E_SHORTCUT_TARGET_TYPE; - entries[i].flags = 0; - entries[i].info = i; - g_assert (i == E_SHORTCUT_TARGET_TYPE_IDX); - i ++; - - for (p = dnd_types; p != NULL; p = p->next, i++) { - const char *dnd_type; - - g_assert (i < num_entries); - - dnd_type = (const char *) p->data; - - entries[i].target = (char *) dnd_type; - entries[i].flags = 0; - entries[i].info = i; - } - - *num_entries_return = num_entries; - return entries; -} - -static void -free_target_entries (GtkTargetEntry *entries) -{ - g_assert (entries != NULL); - - /* The target names are not strdup()ed so a simple free will do. */ - g_free (entries); -} - -static GtkTargetList * -create_target_list_for_node (EStorageSetView *storage_set_view, - ETreePath node) -{ - EStorageSetViewPrivate *priv; - GtkTargetList *target_list; - EFolderTypeRegistry *folder_type_registry; - GList *exported_dnd_types; - GtkTargetEntry *target_entries; - EFolder *folder; - const char *folder_type; - int num_target_entries; - - priv = storage_set_view->priv; - - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - - folder = get_folder_at_node (storage_set_view, node); - folder_type = e_folder_get_type_string (folder); - - exported_dnd_types = e_folder_type_registry_get_exported_dnd_types_for_type (folder_type_registry, - folder_type); - - target_entries = create_target_entries_from_dnd_type_list (exported_dnd_types, - &num_target_entries); - g_assert (target_entries != NULL); - - target_list = gtk_target_list_new (target_entries, num_target_entries); - - free_target_entries (target_entries); - - return target_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_assert (storage_set_view != NULL); - g_assert (selection_data != 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 -set_evolution_path_selection (EStorageSetView *storage_set_view, - GtkSelectionData *selection_data) -{ - EStorageSetViewPrivate *priv; - - g_assert (storage_set_view != NULL); - g_assert (selection_data != NULL); - - priv = storage_set_view->priv; - - gtk_selection_data_set (selection_data, selection_data->target, - 8, (guchar *) priv->selected_row_path, strlen (priv->selected_row_path) + 1); -} - - -/* Callbacks for folder operations. */ - -static void -folder_xfer_callback (EStorageSet *storage_set, - EStorageResult result, - void *data) -{ - g_print ("Folder Xfer result -- %s\n", e_storage_result_to_string (result)); -} - - -/* Folder context menu. */ -/* FIXME: This should be moved somewhere else, so that also the shortcut 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 -remove_cb(EStorageSet *storage_set, EStorageResult result, void *data) -{ - g_print ("remove_cb: %d\n", result); -} - -static void -folder_context_menu_remove_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; - - e_storage_set_async_remove_folder (priv->storage_set, priv->selected_row_path, - remove_cb, storage_set_view); -} -#endif - -static void -popup_folder_menu (EStorageSetView *storage_set_view, - GdkEventButton *event) -{ - EvolutionShellComponentClient *handler; - EStorageSetViewPrivate *priv; - EFolderTypeRegistry *folder_type_registry; - EFolder *folder; - GtkWidget *menu; - - priv = storage_set_view->priv; - - 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)); - if (handler == NULL) - return; - - menu = gtk_menu_new (); - bonobo_window_add_popup (bonobo_ui_container_get_win (priv->container), - GTK_MENU (menu), "/popups/FolderPopup"); - - evolution_shell_component_client_populate_folder_context_menu (handler, - priv->container, - e_folder_get_physical_uri (folder), - e_folder_get_type_string (folder)); - - gtk_widget_show (GTK_WIDGET (menu)); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 3, event->time); -} - - -/* GtkObject methods. */ - -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_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node); - gtk_object_unref (GTK_OBJECT (priv->etree_model)); - - /* the data in the hash table was all freed by freeing the tree */ - 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)); - - if (priv->drag_corba_source_interface != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - g_assert (priv->drag_corba_source_context != NULL); - - GNOME_Evolution_ShellComponentDnd_SourceFolder_endDrag (priv->drag_corba_source_interface, - priv->drag_corba_source_context, - &ev); - - Bonobo_Unknown_unref (priv->drag_corba_source_interface, &ev); - CORBA_Object_release (priv->drag_corba_source_interface, &ev); - - CORBA_exception_free (&ev); - } - - if (priv->drag_corba_source_context != NULL) - CORBA_free (priv->drag_corba_source_context); - - if (priv->drag_corba_data != NULL) - CORBA_free (priv->drag_corba_data); - - g_free (priv->selected_row_path); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static gint -tree_start_drag (ETree *tree, int row, ETreePath path, int col, GdkEvent *event) -{ - GdkDragContext *context; - GtkTargetList *target_list; - GdkDragAction actions; - EStorageSetView *storage_set_view; - - storage_set_view = E_STORAGE_SET_VIEW (tree); - - if (! storage_set_view->priv->allow_dnd) - return FALSE; - - target_list = create_target_list_for_node (storage_set_view, path); - if (target_list == NULL) - return FALSE; - - actions = GDK_ACTION_MOVE | GDK_ACTION_COPY; - - context = e_tree_drag_begin (tree, row, col, - target_list, - actions, - 1, event); - - gtk_drag_set_icon_default (context); - - gtk_target_list_unref (target_list); - - return TRUE; -} - - -/* ETree methods. */ - -/* -- Source-side DnD. */ - -static void -tree_drag_begin (ETree *etree, - int row, ETreePath path, int col, - GdkDragContext *context) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - EFolder *folder; - EvolutionShellComponentClient *component_client; - GNOME_Evolution_ShellComponent corba_component; - GNOME_Evolution_ShellComponentDnd_ActionSet possible_actions; - GNOME_Evolution_ShellComponentDnd_Action suggested_action; - CORBA_Environment ev; - - storage_set_view = E_STORAGE_SET_VIEW (etree); - priv = storage_set_view->priv; - - g_free (priv->selected_row_path); - priv->selected_row_path = g_strdup (e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path)); - - g_assert (priv->drag_corba_source_interface == CORBA_OBJECT_NIL); - - folder = get_folder_at_node (storage_set_view, path); - component_client = get_component_at_node (storage_set_view, path); - - if (component_client == NULL) - return; - - /* Query the `ShellComponentDnd::SourceFolder' interface on the - component. */ - /* FIXME we could use the new - `evolution_shell_component_client_get_dnd_source_interface()' - call. */ - - CORBA_exception_init (&ev); - - corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (component_client)); - priv->drag_corba_source_interface = Bonobo_Unknown_queryInterface (corba_component, - "IDL:GNOME/Evolution/ShellComponentDnd/SourceFolder:1.0", - &ev); - if (ev._major != CORBA_NO_EXCEPTION - || priv->drag_corba_source_interface == CORBA_OBJECT_NIL) { - priv->drag_corba_source_interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - return; - } - - GNOME_Evolution_ShellComponentDnd_SourceFolder_beginDrag (priv->drag_corba_source_interface, - e_folder_get_physical_uri (folder), - e_folder_get_type_string (folder), - &possible_actions, - &suggested_action, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - Bonobo_Unknown_unref (priv->drag_corba_source_interface, &ev); - CORBA_Object_release (priv->drag_corba_source_interface, &ev); - - priv->drag_corba_source_interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - if (priv->drag_corba_source_context != NULL) - CORBA_free (priv->drag_corba_source_context); - - priv->drag_corba_source_context = GNOME_Evolution_ShellComponentDnd_SourceFolder_Context__alloc (); - priv->drag_corba_source_context->physicalUri = CORBA_string_dup (e_folder_get_physical_uri (folder)); - priv->drag_corba_source_context->folderType = CORBA_string_dup (e_folder_get_type_string (folder)); - priv->drag_corba_source_context->possibleActions = possible_actions; - priv->drag_corba_source_context->suggestedAction = suggested_action; -} - -static void -tree_drag_end (ETree *tree, - int row, - ETreePath path, - int col, - GdkDragContext *context) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - CORBA_Environment ev; - - storage_set_view = E_STORAGE_SET_VIEW (tree); - priv = storage_set_view->priv; - - if (priv->drag_corba_source_interface == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellComponentDnd_SourceFolder_endDrag (priv->drag_corba_source_interface, - priv->drag_corba_source_context, - &ev); - - CORBA_free (priv->drag_corba_source_context); - priv->drag_corba_source_context = NULL; - - Bonobo_Unknown_unref (priv->drag_corba_source_interface, &ev); - CORBA_Object_release (priv->drag_corba_source_interface, &ev); - - CORBA_exception_free (&ev); -} - -static void -tree_drag_data_get (ETree *etree, - int drag_row, - ETreePath drag_path, - int drag_col, - GdkDragContext *context, - GtkSelectionData *selection_data, - unsigned int info, - guint32 time) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - CORBA_Environment ev; - char *target_type; - - storage_set_view = E_STORAGE_SET_VIEW (etree); - priv = storage_set_view->priv; - - switch (info) { - case E_SHORTCUT_TARGET_TYPE_IDX: - set_e_shortcut_selection (storage_set_view, selection_data); - return; - case EVOLUTION_PATH_TARGET_TYPE_IDX: - set_evolution_path_selection (storage_set_view, selection_data); - return; - } - - g_assert (info > 0); - - if (priv->drag_corba_source_interface == CORBA_OBJECT_NIL) - return; - - target_type = gdk_atom_name ((GdkAtom) context->targets->data); - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellComponentDnd_SourceFolder_getData (priv->drag_corba_source_interface, - priv->drag_corba_source_context, - convert_gdk_drag_action_set_to_corba (context->action), - target_type, - & priv->drag_corba_data, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - gtk_selection_data_set (selection_data, selection_data->target, 8, "", -1); - else - gtk_selection_data_set (selection_data, - priv->drag_corba_data->target, - priv->drag_corba_data->format, - priv->drag_corba_data->bytes._buffer, - priv->drag_corba_data->bytes._length); - - g_free (target_type); - - CORBA_exception_free (&ev); -} - -static void -tree_drag_data_delete (ETree *tree, - int row, - ETreePath path, - int col, - GdkDragContext *context) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - CORBA_Environment ev; - - storage_set_view = E_STORAGE_SET_VIEW (tree); - priv = storage_set_view->priv; - - if (priv->drag_corba_source_interface == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellComponentDnd_SourceFolder_deleteData (priv->drag_corba_source_interface, - priv->drag_corba_source_context, - &ev); - - CORBA_exception_free (&ev); -} - -/* -- Destination-side DnD. */ - -static gboolean -handle_evolution_path_drag_motion (EStorageSetView *storage_set_view, - ETreePath path, - GdkDragContext *context, - unsigned int time) -{ - GdkModifierType modifiers; - GdkDragAction action; - - gdk_window_get_pointer (NULL, NULL, NULL, &modifiers); - - if ((modifiers & GDK_CONTROL_MASK) != 0) - action = GDK_ACTION_COPY; - else - action = GDK_ACTION_MOVE; - - gdk_drag_status (context, action, time); - - return TRUE; -} - -static gboolean -tree_drag_motion (ETree *tree, - int row, - ETreePath path, - int col, - GdkDragContext *context, - int x, - int y, - unsigned int time) -{ - EStorageSetView *storage_set_view; - EFolder *folder; - EStorageSetViewPrivate *priv; - EvolutionShellComponentClient *component_client; - GNOME_Evolution_ShellComponentDnd_DestinationFolder destination_folder_interface; - GNOME_Evolution_ShellComponentDnd_Action suggested_action; - GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context corba_context; - CORBA_boolean can_handle; - CORBA_Environment ev; - const char *dnd_type; - - storage_set_view = E_STORAGE_SET_VIEW (tree); - priv = storage_set_view->priv; - - if (! priv->allow_dnd) - return FALSE; - - path = e_tree_node_at_row (E_TREE (storage_set_view), row); - - component_client = get_component_at_node (storage_set_view, path); - if (component_client == NULL) - return FALSE; - - dnd_type = find_matching_target_for_drag_context (storage_set_view, path, context); - if (dnd_type == NULL) - return FALSE; - - if (strcmp (dnd_type, EVOLUTION_PATH_TARGET_TYPE) == 0) - return handle_evolution_path_drag_motion (storage_set_view, path, context, time); - - destination_folder_interface = evolution_shell_component_client_get_dnd_destination_interface (component_client); - if (destination_folder_interface == NULL) - return FALSE; - - CORBA_exception_init (&ev); - - corba_context.dndType = (char *) dnd_type; /* (Safe cast, as we don't actually free the corba_context.) */ - corba_context.possibleActions = convert_gdk_drag_action_set_to_corba (context->actions); - corba_context.suggestedAction = convert_gdk_drag_action_to_corba (context->suggested_action); - - folder = get_folder_at_node (storage_set_view, path); - - can_handle = GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleMotion (destination_folder_interface, - e_folder_get_physical_uri (folder), - &corba_context, - &suggested_action, - &ev); - if (ev._major != CORBA_NO_EXCEPTION || ! can_handle) { - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_tree_drag_highlight (tree, row, -1); - - gdk_drag_status (context, convert_corba_drag_action_to_gdk (suggested_action), time); - - return TRUE; -} - -static void -tree_drag_leave (ETree *etree, - int row, - ETreePath path, - int col, - GdkDragContext *context, - unsigned int time) -{ - e_tree_drag_unhighlight (etree); -} - -static gboolean -tree_drag_drop (ETree *etree, - int row, - ETreePath path, - int col, - GdkDragContext *context, - int x, - int y, - unsigned int time) -{ - e_tree_drag_unhighlight (etree); - if (context->targets != NULL) { - gtk_drag_get_data (GTK_WIDGET (etree), context, - GPOINTER_TO_INT (context->targets->data), - time); - return TRUE; - } - - return FALSE; -} - -static void -tree_drag_data_received (ETree *etree, - int row, - ETreePath path, - int col, - GdkDragContext *context, - int x, - int y, - GtkSelectionData *selection_data, - unsigned int info, - unsigned int time) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - gboolean handled = FALSE; - char *target_type; - - storage_set_view = E_STORAGE_SET_VIEW (etree); - priv = storage_set_view->priv; - - if (selection_data->data == NULL && selection_data->length == -1) - return; - - target_type = gdk_atom_name (selection_data->target); - - if (strcmp (target_type, EVOLUTION_PATH_TARGET_TYPE) == 0) { - const char *source_path; - const char *destination_folder_path; - char *destination_path; - - g_free (target_type); - source_path = (const char *) selection_data->data; - /* (Basic sanity checks.) */ - if (source_path == NULL || source_path[0] != G_DIR_SEPARATOR || source_path[1] == '\0') - return; - - destination_folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), path); - if (destination_folder_path == NULL) - return; - - destination_path = g_concat_dir_and_file (destination_folder_path, - g_basename (source_path)); - - - switch (context->action) { - case GDK_ACTION_MOVE: - e_storage_set_async_xfer_folder (priv->storage_set, source_path, destination_path, TRUE, - folder_xfer_callback, NULL); - handled = TRUE; - break; - case GDK_ACTION_COPY: - e_storage_set_async_xfer_folder (priv->storage_set, source_path, destination_path, FALSE, - folder_xfer_callback, NULL); - handled = TRUE; - break; - default: - handled = FALSE; - g_warning ("EStorageSetView: Unknown action %d", context->action); - } - - g_free (destination_path); - } else { - GNOME_Evolution_ShellComponentDnd_DestinationFolder destination_folder_interface; - GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context corba_context; - GNOME_Evolution_ShellComponentDnd_Data corba_data; - EvolutionShellComponentClient *component_client; - const char *target_path; - - target_path = e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path); - - component_client = get_component_at_node (storage_set_view, path); - if (component_client != NULL) { - destination_folder_interface = evolution_shell_component_client_get_dnd_destination_interface (component_client); - if (destination_folder_interface != NULL) { - EFolder *folder; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - - folder = get_folder_at_node (storage_set_view, path); - - corba_context.dndType = (char *) target_type; - corba_context.possibleActions = convert_gdk_drag_action_set_to_corba (context->actions); - corba_context.suggestedAction = convert_gdk_drag_action_to_corba (context->suggested_action); - - corba_data.format = selection_data->format; - corba_data.target = selection_data->target; - - corba_data.bytes._release = FALSE; - - if (selection_data->data == NULL) { - /* If data is NULL the length is -1 and this would mess things - up so we handle it separately. */ - corba_data.bytes._length = 0; - corba_data.bytes._buffer = NULL; - } else { - corba_data.bytes._length = selection_data->length; - corba_data.bytes._buffer = selection_data->data; - } - - /* pass off the data to the component's DestinationFolderInterface */ - handled = GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleDrop (destination_folder_interface, - e_folder_get_physical_uri (folder), - &corba_context, - convert_gdk_drag_action_to_corba (context->action), - &corba_data, - &ev); - - } - } - g_free (target_type); - } - - gtk_drag_finish (context, handled, FALSE, time); -} - -static gboolean -right_click (ETree *etree, - int row, - ETreePath path, - int col, - GdkEvent *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (etree); - priv = storage_set_view->priv; - - if (priv->container) - popup_folder_menu (storage_set_view, (GdkEventButton *) event); - - return TRUE; -} - -static void -cursor_activated (ETree *tree, - int row, - ETreePath path) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (tree); - - priv = storage_set_view->priv; - - g_free (priv->selected_row_path); - priv->selected_row_path = g_strdup (e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), path)); - - if (e_tree_model_node_depth (priv->etree_model, path) >= 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 + 1); - } -} - - -/* ETreeModel Methods */ - -static GdkPixbuf* -etree_icon_at (ETreeModel *etree, - ETreePath tree_path, - void *model_data) -{ - EFolderTypeRegistry *folder_type_registry; - EStorageSetView *storage_set_view; - EStorageSet *storage_set; - EFolder *folder; - char *path; - int depth; - - storage_set_view = E_STORAGE_SET_VIEW (model_data); - storage_set = storage_set_view->priv->storage_set; - - /* Tree depth will indicate storages or folders */ - depth = e_tree_model_node_depth (etree, tree_path); - - path = (char*) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path); - - /* Is this a storage? */ - - if (depth == 1) { - EStorage *storage; - const char *storage_type; - - storage = e_storage_set_get_storage (storage_set, path + 1); - - folder_type_registry = e_storage_set_get_folder_type_registry (storage_set); - storage_type = e_storage_get_toplevel_node_type (storage); - if (storage_type != NULL) - return e_folder_type_registry_get_icon_for_type (folder_type_registry, storage_type, TRUE); - else - return NULL; - } - - /* Folder. */ - - folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) - return NULL; - - return get_pixbuf_for_folder (storage_set_view, folder); -} - -/* This function returns the number of columns in our ETreeModel. */ -static int -etree_column_count (ETreeModel *etc, void *data) -{ - return 2; -} - -static gboolean -etree_has_save_id (ETreeModel *etm, void *data) -{ - return TRUE; -} - -static gchar * -etree_get_save_id (ETreeModel *etm, ETreePath node, void *model_data) -{ - return g_strdup(e_tree_memory_node_get_data (E_TREE_MEMORY(etm), node)); -} - -static gboolean -etree_has_get_node_by_id (ETreeModel *etm, void *data) -{ - return TRUE; -} - -static ETreePath -etree_get_node_by_id (ETreeModel *etm, const char *save_id, void *model_data) -{ - EStorageSetView *storage_set_view; - storage_set_view = E_STORAGE_SET_VIEW (model_data); - - return g_hash_table_lookup (storage_set_view->priv->path_to_etree_node, save_id); -} - -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_memory_node_get_data (E_TREE_MEMORY(etree), tree_path); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder != NULL) { - const char *folder_name = e_folder_get_name (folder); - int unread_count = e_folder_get_unread_count (folder); - - if (unread_count > 0) - gtk_object_set_data_full (GTK_OBJECT (folder), "name_with_unread", - g_strdup_printf ("%s (%d)", folder_name, unread_count), g_free); - - if (col == 0) - if (unread_count > 0) - return (void *) gtk_object_get_data (GTK_OBJECT (folder), - "name_with_unread"); - else - return (void *) folder_name; - else - return (void *) e_folder_get_highlighted (folder); - } - - storage = e_storage_set_get_storage (storage_set, path + 1); - if (storage != NULL) { - if (col == 0) - return (void *) e_storage_get_display_name (storage); - else - return (void *) TRUE; - } - - if (col == 0) - return _("Summary"); - else - return (void *) TRUE; -} - -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; -} - - -/* This function duplicates the value passed to it. */ -static void * -etree_duplicate_value (ETreeModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return (void *)g_strdup (value); - else - return (void *)value; -} - -/* This function frees the value passed to it. */ -static void -etree_free_value (ETreeModel *etc, int col, void *value, void *data) -{ - if (col == 0) - g_free (value); -} - -/* This function creates an empty value. */ -static void * -etree_initialize_value (ETreeModel *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 (ETreeModel *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 (ETreeModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup(value); - else - return g_strdup(value ? "Yes" : "No"); -} - -static void -etree_node_destroy_func (void *data, - void *user_data) -{ - EStorageSetView *storage_set_view; - char *path; - - path = (char *) data; - storage_set_view = E_STORAGE_SET_VIEW (user_data); - - if (strcmp (path, ROOT_NODE_NAME)) - remove_node_from_hash (storage_set_view, path); - g_free (path); -} - - -/* StorageSet signal handling. */ - -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_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path); - e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view); - - if (! add_node_to_hash (storage_set_view, path, node)) { - e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), node); - return; - } -} - -static void -removed_storage_cb (EStorageSet *storage_set, - EStorage *storage, - void *data) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETreeModel *etree; - ETreePath node; - char *path; - - 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 = lookup_node_in_hash (storage_set_view, path); - g_free (path); - - e_tree_memory_node_remove (E_TREE_MEMORY(etree), node); -} - -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_warning ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s", - parent_path); - g_free (parent_path); - return; - } - - g_free (parent_path); - - copy_of_path = g_strdup (path); - new_node = e_tree_memory_node_insert (E_TREE_MEMORY(etree), parent_node, -1, copy_of_path); - e_tree_memory_sort_node (E_TREE_MEMORY(etree), parent_node, folder_sort_callback, storage_set_view); - - if (! add_node_to_hash (storage_set_view, path, new_node)) { - e_tree_memory_node_remove (E_TREE_MEMORY(etree), new_node); - return; - } -} - -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_data_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; - - 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_memory_node_remove (E_TREE_MEMORY(etree), node); -} - - -static void -class_init (EStorageSetViewClass *klass) -{ - GtkObjectClass *object_class; - ETreeClass *etree_class; - - parent_class = gtk_type_class (e_tree_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - etree_class = E_TREE_CLASS (klass); - etree_class->right_click = right_click; - etree_class->cursor_activated = cursor_activated; - etree_class->start_drag = tree_start_drag; - etree_class->tree_drag_begin = tree_drag_begin; - etree_class->tree_drag_end = tree_drag_end; - etree_class->tree_drag_data_get = tree_drag_data_get; - etree_class->tree_drag_data_delete = tree_drag_data_delete; - etree_class->tree_drag_motion = tree_drag_motion; - etree_class->tree_drag_drop = tree_drag_drop; - etree_class->tree_drag_leave = tree_drag_leave; - etree_class->tree_drag_data_received = tree_drag_data_received; - - 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); - - signals[DND_ACTION] - = gtk_signal_new ("dnd_action", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageSetViewClass, dnd_action), - marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING, - GTK_TYPE_NONE, 4, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -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; - priv->allow_dnd = TRUE; - - priv->drag_corba_source_interface = CORBA_OBJECT_NIL; - - priv->drag_corba_source_context = NULL; - priv->drag_corba_data = NULL; - - 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_data_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_memory_node_insert (E_TREE_MEMORY(etree), parent, -1, (void *) full_path); - e_tree_memory_sort_node(E_TREE_MEMORY(etree), parent, folder_sort_callback, storage_set_view); - add_node_to_hash (storage_set_view, full_path, node); - - 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 (full_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_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path); - e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), - priv->root_node, - storage_sort_callback, storage_set_view); - - 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); -} - -void -e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set, - BonoboUIContainer *container) -{ - 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->container = container; - - priv->etree_model = e_tree_memory_callbacks_new (etree_icon_at, - - etree_column_count, - - etree_has_save_id, - etree_get_save_id, - etree_has_get_node_by_id, - etree_get_node_by_id, - - etree_value_at, - etree_set_value_at, - etree_is_editable, - - etree_duplicate_value, - etree_free_value, - etree_initialize_value, - etree_value_is_empty, - etree_value_to_string, - - storage_set_view); - - e_tree_memory_set_node_destroy_func (E_TREE_MEMORY (priv->etree_model), - etree_node_destroy_func, storage_set_view); - e_tree_memory_set_expanded_default (E_TREE_MEMORY (priv->etree_model), TRUE); - - priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, - g_strdup (ROOT_NODE_NAME)); - add_node_to_hash (storage_set_view, ROOT_NODE_NAME, priv->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_tree_construct_from_spec_file (E_TREE (storage_set_view), priv->etree_model, extras, - EVOLUTION_ETSPECDIR "/e-storage-set-view.etspec", NULL); - - e_tree_root_node_set_visible (E_TREE(storage_set_view), FALSE); - - gtk_object_unref (GTK_OBJECT (extras)); - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; - - e_tree_drag_dest_set (E_TREE (storage_set_view), 0, NULL, 0, GDK_ACTION_MOVE | GDK_ACTION_COPY); - - 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)); - - insert_storages (storage_set_view); -} - -GtkWidget * -e_storage_set_view_new (EStorageSet *storage_set, - BonoboUIContainer *container) -{ - 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, container); - - 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_tree_show_node (E_TREE (storage_set_view), node); - e_tree_set_cursor (E_TREE (storage_set_view), node); - - g_free (priv->selected_row_path); - priv->selected_row_path = g_strdup (path); - - 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; - - 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! */ - - etree_node = e_tree_get_cursor (E_TREE (storage_set_view)); - - if (etree_node == NULL) - return NULL; /* Mmh? */ - - path = (char*)e_tree_memory_node_get_data(E_TREE_MEMORY(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_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node); - - /* now re-add the root node */ - priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, - g_strdup (ROOT_NODE_NAME)); - add_node_to_hash (storage_set_view, ROOT_NODE_NAME, priv->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; -} - - -void -e_storage_set_view_set_allow_dnd (EStorageSetView *storage_set_view, - gboolean allow_dnd) -{ - g_return_if_fail (storage_set_view != NULL); - g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); - - storage_set_view->priv->allow_dnd = !! allow_dnd; -} - -gboolean -e_storage_set_view_get_allow_dnd (EStorageSetView *storage_set_view) -{ - g_return_val_if_fail (storage_set_view != NULL, FALSE); - g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), FALSE); - - return storage_set_view->priv->allow_dnd; -} - - -E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-set-view.etspec b/shell/e-storage-set-view.etspec deleted file mode 100644 index 5ee19975df..0000000000 --- a/shell/e-storage-set-view.etspec +++ /dev/null @@ -1,7 +0,0 @@ -<ETableSpecification no-headers="true" selection-mode="single" cursor-mode="line" draw-grid="false" horizontal-scrolling="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>
\ No newline at end of file diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h deleted file mode 100644 index 9e00c0e678..0000000000 --- a/shell/e-storage-set-view.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <gal/e-table/e-tree.h> -#include <bonobo/bonobo-ui-container.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 { - ETree parent; - - EStorageSetViewPrivate *priv; -}; - -struct _EStorageSetViewClass { - ETreeClass parent_class; - - /* Signals. */ - - void (* folder_selected) (EStorageSetView *storage_set_view, - const char *path); - void (* storage_selected) (EStorageSetView *storage_set_view, - const char *name); - - void (* dnd_action) (EStorageSetView *storage_set_view, - GdkDragContext *context, - const char *source_data, - const char *source_data_type, - const char *target_path); -}; - - -GtkType e_storage_set_view_get_type (void); - -GtkWidget *e_storage_set_view_new (EStorageSet *storage_set, - BonoboUIContainer *container); -void e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set, - BonoboUIContainer *container); - -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); - -void e_storage_set_view_set_allow_dnd (EStorageSetView *storage_set_view, - gboolean allow_dnd); -gboolean e_storage_set_view_get_allow_dnd (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 3b17448532..0000000000 --- a/shell/e-storage-set.c +++ /dev/null @@ -1,733 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.c - * - * Copyright (C) 2000 Ximian, 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 <string.h> - -#include <glib.h> -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.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; -} - - -/* "Callback converter", from `EStorageResultCallback' to - `EStorageSetResultCallback'. */ - -struct _StorageCallbackConverterData { - EStorageSet *storage_set; - EStorageSetResultCallback storage_set_result_callback; - void *data; -}; -typedef struct _StorageCallbackConverterData StorageCallbackConverterData; - -static StorageCallbackConverterData * -storage_callback_converter_data_new (EStorageSet *storage_set, - EStorageSetResultCallback callback, - void *data) -{ - StorageCallbackConverterData *new; - - new = g_new (StorageCallbackConverterData, 1); - new->storage_set = storage_set; - new->storage_set_result_callback = callback; - new->data = data; - - return new; -} - -static void -storage_callback_converter (EStorage *storage, - EStorageResult result, - void *data) -{ - StorageCallbackConverterData *converter_data; - - converter_data = (StorageCallbackConverterData *) data; - - (* converter_data->storage_set_result_callback) (converter_data->storage_set, - result, - converter_data->data); - - g_free (converter_data); -} - - -/* 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); - 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; -} - -static void -signal_new_folder_for_all_folders_under_paths (EStorageSet *storage_set, - EStorage *storage, - GList *path_list) -{ - GList *p; - - for (p = path_list; p != NULL; p = p->next) { - GList *sub_path_list; - const char *path; - char *path_with_storage; - - path = (const char *) p->data; - - path_with_storage = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), path, NULL); - gtk_signal_emit (GTK_OBJECT (storage_set), signals[NEW_FOLDER], path_with_storage); - g_free (path_with_storage); - - sub_path_list = e_storage_get_subfolder_paths (storage, path); - - signal_new_folder_for_all_folders_under_paths (storage_set, storage, sub_path_list); - - e_free_string_list (sub_path_list); - } -} - -static void -signal_new_folder_for_all_folders_in_storage (EStorageSet *storage_set, - EStorage *storage) -{ - GList *path_list; - - path_list = e_storage_get_subfolder_paths (storage, G_DIR_SEPARATOR_S); - - signal_new_folder_for_all_folders_under_paths (storage_set, storage, path_list); - - e_free_string_list (path_list); -} - - -/* 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) name_to_named_storage_foreach_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); - - signal_new_folder_for_all_folders_in_storage (storage_set, 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, BonoboUIContainer *container) -{ - 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, container); - - return storage_set_view; -} - - -void -e_storage_set_async_create_folder (EStorageSet *storage_set, - const char *path, - const char *type, - const char *description, - EStorageSetResultCallback callback, - void *data) -{ - EStorage *storage; - const char *subpath; - StorageCallbackConverterData *converter_data; - - 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 (description != NULL); - g_return_if_fail (callback != NULL); - - storage = get_storage_for_path (storage_set, path, &subpath); - - converter_data = storage_callback_converter_data_new (storage_set, callback, data); - - e_storage_async_create_folder (storage, subpath, type, description, - storage_callback_converter, converter_data); -} - -void -e_storage_set_async_remove_folder (EStorageSet *storage_set, - const char *path, - EStorageSetResultCallback callback, - void *data) -{ - EStorage *storage; - const char *subpath; - StorageCallbackConverterData *converter_data; - - 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); - - converter_data = storage_callback_converter_data_new (storage_set, callback, data); - - e_storage_async_remove_folder (storage, subpath, - storage_callback_converter, converter_data); -} - -void -e_storage_set_async_xfer_folder (EStorageSet *storage_set, - const char *source_path, - const char *destination_path, - gboolean remove_source, - EStorageSetResultCallback callback, - void *data) -{ - EStorage *source_storage; - EStorage *destination_storage; - const char *source_subpath; - const char *destination_subpath; - StorageCallbackConverterData *converter_data; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - g_return_if_fail (source_path != NULL); - g_return_if_fail (g_path_is_absolute (source_path)); - g_return_if_fail (destination_path != NULL); - g_return_if_fail (g_path_is_absolute (destination_path)); - g_return_if_fail (callback != NULL); - - source_storage = get_storage_for_path (storage_set, source_path, &source_subpath); - destination_storage = get_storage_for_path (storage_set, destination_path, &destination_subpath); - - if (source_storage != destination_storage) { - g_warning ("e_storage_set_async_xfer_folder(): " - "Attempt to xfer folders between different storages -- not supported yet."); - (* callback) (storage_set, E_STORAGE_UNSUPPORTEDOPERATION, data); - return; - } - - converter_data = storage_callback_converter_data_new (storage_set, callback, data); - - e_storage_async_xfer_folder (source_storage, - source_subpath, destination_subpath, remove_source, - storage_callback_converter, converter_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; -} - - -/** - * 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 d32c13ea15..0000000000 --- a/shell/e-storage-set.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include <gtk/gtkwidget.h> - -#include <bonobo/bonobo-ui-container.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; - -typedef void (* EStorageSetResultCallback) (EStorageSet *storage_set, EStorageResult result, void *data); - -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, - BonoboUIContainer *container); - -void e_storage_set_async_create_folder (EStorageSet *storage_set, - const char *path, - const char *type, - const char *description, - EStorageSetResultCallback callback, - void *data); -void e_storage_set_async_remove_folder (EStorageSet *storage_set, - const char *path, - EStorageSetResultCallback callback, - void *data); -void e_storage_set_async_xfer_folder (EStorageSet *storage_set, - const char *source_path, - const char *destination_path, - gboolean remove_source, - EStorageSetResultCallback 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 17c8d94f14..0000000000 --- a/shell/e-storage.c +++ /dev/null @@ -1,643 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.c - * - * Copyright (C) 2000, 2001 Ximian, 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: The EFolderTree is kept both in the EStorage and the - * EvolutionStorage. Bad design. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.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 { - /* The set of folders we have in this storage. */ - EFolderTree *folder_tree; - - /* URI for the toplevel node. */ - char *toplevel_node_uri; - - /* Toplevel node type. */ - char *toplevel_node_type; -}; - -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)); -} - - -/* Signal callbacks for the EFolders. */ - -static void -folder_changed_cb (EFolder *folder, - void *data) -{ - EStorage *storage; - EStoragePrivate *priv; - const char *path, *p; - gboolean highlight; - - g_assert (E_IS_STORAGE (data)); - - storage = E_STORAGE (data); - priv = storage->priv; - - path = e_folder_tree_get_path_for_data (priv->folder_tree, folder); - g_assert (path != NULL); - - gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path); - - highlight = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (folder), "last_highlight")); - if (highlight != e_folder_get_highlighted (folder)) { - highlight = !highlight; - gtk_object_set_data (GTK_OBJECT (folder), "last_highlight", - GINT_TO_POINTER (highlight)); - p = strrchr (path, '/'); - if (p && p != path) { - char *name; - - name = g_strndup (path, p - path); - folder = e_folder_tree_get_folder (priv->folder_tree, name); - g_free (name); - if (folder) - e_folder_set_child_highlight (folder, highlight); - } - } -} - - -/* 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); - - g_free (priv->toplevel_node_uri); - g_free (priv->toplevel_node_type); - - (* 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 const char * -impl_get_display_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); -} - -static void -impl_async_xfer_folder (EStorage *storage, - const char *source_path, - const char *destination_path, - gboolean remove_source, - 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->get_display_name = impl_get_display_name; - class->async_create_folder = impl_async_create_folder; - class->async_remove_folder = impl_async_remove_folder; - class->async_xfer_folder = impl_async_xfer_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); - priv->toplevel_node_uri = NULL; - priv->toplevel_node_type = NULL; - - storage->priv = priv; -} - - -/* Creation. */ - -void -e_storage_construct (EStorage *storage, - const char *toplevel_node_uri, - const char *toplevel_node_type) -{ - EStoragePrivate *priv; - - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - - priv = storage->priv; - - priv->toplevel_node_uri = g_strdup (toplevel_node_uri); - priv->toplevel_node_type = g_strdup (toplevel_node_type); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING); -} - -EStorage * -e_storage_new (const char *toplevel_node_uri, - const char *toplevel_node_type) -{ - EStorage *new; - - new = gtk_type_new (e_storage_get_type ()); - - e_storage_construct (new, toplevel_node_uri, toplevel_node_type); - - 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); -} - -const char * -e_storage_get_display_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_display_name) (storage); -} - -/** - * e_storage_get_toplevel_node_uri: - * @storage: A pointer to an EStorage object - * - * Get the physical URI for the toplevel node in the storage. - * - * Return value: a pointer to a string representing that URI. - **/ -const char * -e_storage_get_toplevel_node_uri (EStorage *storage) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - priv = storage->priv; - return priv->toplevel_node_uri; -} - -/** - * e_storage_get_toplevel_node_type: - * @storage: A pointer to an EStorage object. - * - * Get the folder type for the toplevel node. - * - * Return value: A string identifying the type of the toplevel node. - **/ -const char * -e_storage_get_toplevel_node_type (EStorage *storage) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - priv = storage->priv; - return priv->toplevel_node_type; -} - - -/* 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); -} - -void -e_storage_async_xfer_folder (EStorage *storage, - const char *source_path, - const char *destination_path, - const gboolean remove_source, - EStorageResultCallback callback, - void *data) -{ - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - g_return_if_fail (source_path != NULL); - g_return_if_fail (g_path_is_absolute (source_path)); - g_return_if_fail (destination_path != NULL); - g_return_if_fail (g_path_is_absolute (destination_path)); - - if (remove_source) { - int source_len; - - source_len = strlen (source_path); - if (strncmp (destination_path, source_path, source_len) == 0) { - (* callback) (storage, E_STORAGE_CANTMOVETODESCENDANT, data); - return; - } - } - - (* ES_CLASS (storage)->async_xfer_folder) (storage, source_path, destination_path, remove_source, 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"); - case E_STORAGE_CANTCHANGESTOCKFOLDER: - return _("The specified folder cannot be modified or removed"); - case E_STORAGE_CANTMOVETODESCENDANT: - return _("Cannot make a folder a child of one of its descendants"); - 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_connect_while_alive (GTK_OBJECT (e_folder), "changed", folder_changed_cb, - storage, GTK_OBJECT (storage)); - - gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], path); - - folder_changed_cb (e_folder, storage); - - 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 bc60e1ee5a..0000000000 --- a/shell/e-storage.h +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.h - * - * Copyright (C) 2000 Ximian, 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_ - -#include <gtk/gtkobject.h> - -#include "evolution-shell-component-client.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_NOTEMPTY, - E_STORAGE_NOTFOUND, - E_STORAGE_NOTIMPLEMENTED, - E_STORAGE_PERMISSIONDENIED, - E_STORAGE_UNSUPPORTEDOPERATION, - E_STORAGE_UNSUPPORTEDTYPE, - E_STORAGE_CANTCHANGESTOCKFOLDER, - E_STORAGE_CANTMOVETODESCENDANT, - E_STORAGE_INVALIDNAME -}; -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); - const char * (* get_display_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); - - void (* async_xfer_folder) (EStorage *storage, - const char *source_path, - const char *destination_path, - const gboolean remove_source, - EStorageResultCallback callback, - void *data); -}; - - -GtkType e_storage_get_type (void); -void e_storage_construct (EStorage *storage, - const char *toplevel_node_uri, - const char *toplevel_node_type); -EStorage *e_storage_new (const char *toplevel_node_uri, - const char *toplevel_node_type); - -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); -const char *e_storage_get_display_name (EStorage *storage); -const char *e_storage_get_toplevel_node_uri (EStorage *storage); -const char *e_storage_get_toplevel_node_type (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); -void e_storage_async_xfer_folder (EStorage *storage, - const char *source_path, - const char *destination_path, - const gboolean remove_source, - 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_removed_folder (EStorage *storage, const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_STORAGE_H_ */ diff --git a/shell/e-summary-storage.c b/shell/e-summary-storage.c deleted file mode 100644 index 6d127f8f91..0000000000 --- a/shell/e-summary-storage.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-storage.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-summary-storage.h" - -#include "e-folder.h" - -#include "e-util/e-unicode-i18n.h" - -#include <gal/util/e-util.h> - -#include <gtk/gtktypeutils.h> - -#include <libgnome/gnome-i18n.h> - - -#define PARENT_TYPE e_storage_get_type () -static EStorageClass *parent_class = NULL; - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EStorage methods. */ - -static GList * -impl_get_subfolder_paths (EStorage *storage, - const char *path) -{ - /* We never have any child folders. */ - return NULL; -} - -static EFolder * -impl_get_folder (EStorage *storage, - const char *path) -{ - return NULL; -} - -static const char * -impl_get_name (EStorage *storage) -{ - return E_SUMMARY_STORAGE_NAME; -} - -static const char * -impl_get_display_name (EStorage *storage) -{ - return U_("Summary"); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - EStorageClass *storage_class; - - object_class->destroy = impl_destroy; - - storage_class = E_STORAGE_CLASS (object_class); - storage_class->get_subfolder_paths = impl_get_subfolder_paths; - storage_class->get_folder = impl_get_folder; - storage_class->get_name = impl_get_name; - storage_class->get_display_name = impl_get_display_name; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -init (ESummaryStorage *summary_storage) -{ - /* No members. */ -} - - -/** - * e_summary_storage_new: - * - * Create a new summary storage. - * - * Return value: The newly created ESummaryStorage object. - **/ -EStorage * -e_summary_storage_new (void) -{ - EStorage *storage; - - storage = gtk_type_new (e_summary_storage_get_type ()); - - e_storage_construct (storage, "/", "summary"); - - return storage; -} - - -E_MAKE_TYPE (e_summary_storage, "ESummaryStorage", ESummaryStorage, class_init, init, PARENT_TYPE) diff --git a/shell/e-summary-storage.h b/shell/e-summary-storage.h deleted file mode 100644 index bdbd81bd5d..0000000000 --- a/shell/e-summary-storage.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-summary-storage.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_SUMMARY_STORAGE_H_ -#define _E_SUMMARY_STORAGE_H_ - -#include "e-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SUMMARY_STORAGE (e_summary_storage_get_type ()) -#define E_SUMMARY_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SUMMARY_STORAGE, ESummaryStorage)) -#define E_SUMMARY_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SUMMARY_STORAGE, ESummaryStorageClass)) -#define E_IS_SUMMARY_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SUMMARY_STORAGE)) -#define E_IS_SUMMARY_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SUMMARY_STORAGE)) - - -#define E_SUMMARY_STORAGE_NAME "summary" - - -typedef struct _ESummaryStorage ESummaryStorage; -typedef struct _ESummaryStoragePrivate ESummaryStoragePrivate; -typedef struct _ESummaryStorageClass ESummaryStorageClass; - -struct _ESummaryStorage { - EStorage parent; - - ESummaryStoragePrivate *priv; -}; - -struct _ESummaryStorageClass { - EStorageClass parent_class; -}; - - -GtkType e_summary_storage_get_type (void); -EStorage *e_summary_storage_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SUMMARY_STORAGE_H_ */ diff --git a/shell/e-task-bar.c b/shell/e-task-bar.c deleted file mode 100644 index 2c89b016f3..0000000000 --- a/shell/e-task-bar.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-bar.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-task-bar.h" - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE gtk_hbox_get_type () -static GtkHBoxClass *parent_class = NULL; - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ETaskBar *task_bar; - - task_bar = E_TASK_BAR (object); - - /* Nothing to do here. */ - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; -} - -static void -init (ETaskBar *task_bar) -{ - /* Nothing to do here. */ -} - - -void -e_task_bar_construct (ETaskBar *task_bar) -{ - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - - /* Nothing to do here. */ -} - -GtkWidget * -e_task_bar_new (void) -{ - ETaskBar *task_bar; - - task_bar = gtk_type_new (e_task_bar_get_type ()); - e_task_bar_construct (task_bar); - - return GTK_WIDGET (task_bar); -} - -void -e_task_bar_prepend_task (ETaskBar *task_bar, - ETaskWidget *task_widget) -{ - GtkBoxChild *child_info; - GtkBox *box; - - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - - /* Hah hah. GTK+ sucks. This is adapted from `gtkhbox.c'. */ - - child_info = g_new (GtkBoxChild, 1); - child_info->widget = GTK_WIDGET (task_widget); - child_info->padding = 0; - child_info->expand = TRUE; - child_info->fill = TRUE; - child_info->pack = GTK_PACK_START; - - box = GTK_BOX (task_bar); - - box->children = g_list_prepend (box->children, child_info); - - gtk_widget_set_parent (GTK_WIDGET (task_widget), GTK_WIDGET (task_bar)); - - if (GTK_WIDGET_REALIZED (task_bar)) - gtk_widget_realize (GTK_WIDGET (task_widget)); - - if (GTK_WIDGET_VISIBLE (task_bar) && GTK_WIDGET_VISIBLE (task_widget)) { - if (GTK_WIDGET_MAPPED (task_bar)) - gtk_widget_map (GTK_WIDGET (task_widget)); - gtk_widget_queue_resize (GTK_WIDGET (task_widget)); - } -} - -void -e_task_bar_remove_task (ETaskBar *task_bar, - int n) -{ - ETaskWidget *task_widget; - - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - g_return_if_fail (n >= 0); - - task_widget = e_task_bar_get_task_widget (task_bar, n); - gtk_widget_destroy (GTK_WIDGET (task_widget)); -} - -ETaskWidget * -e_task_bar_get_task_widget (ETaskBar *task_bar, - int n) -{ - GtkBoxChild *child_info; - - g_return_val_if_fail (task_bar != NULL, NULL); - g_return_val_if_fail (E_IS_TASK_BAR (task_bar), NULL); - - child_info = (GtkBoxChild *) g_list_nth (GTK_BOX (task_bar)->children, n)->data; - - return E_TASK_WIDGET (child_info->widget); -} - - -E_MAKE_TYPE (e_task_bar, "ETaskBar", ETaskBar, class_init, init, PARENT_TYPE) diff --git a/shell/e-task-bar.h b/shell/e-task-bar.h deleted file mode 100644 index 14e4c961d7..0000000000 --- a/shell/e-task-bar.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-bar.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_TASK_BAR_H_ -#define _E_TASK_BAR_H_ - -#include "e-task-widget.h" - -#include <gtk/gtkhbox.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_TASK_BAR (e_task_bar_get_type ()) -#define E_TASK_BAR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TASK_BAR, ETaskBar)) -#define E_TASK_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_BAR, ETaskBarClass)) -#define E_IS_TASK_BAR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TASK_BAR)) -#define E_IS_TASK_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_BAR)) - - -typedef struct _ETaskBar ETaskBar; -typedef struct _ETaskBarPrivate ETaskBarPrivate; -typedef struct _ETaskBarClass ETaskBarClass; - -struct _ETaskBar { - GtkHBox parent; -}; - -struct _ETaskBarClass { - GtkHBoxClass parent_class; -}; - - -GtkType e_task_bar_get_type (void); -void e_task_bar_construct (ETaskBar *task_bar); -GtkWidget *e_task_bar_new (void); - -void e_task_bar_prepend_task (ETaskBar *task_bar, - ETaskWidget *task_widget); -void e_task_bar_remove_task (ETaskBar *task_bar, - int n); - -ETaskWidget *e_task_bar_get_task_widget (ETaskBar *task_bar, - int n); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TASK_BAR_H_ */ diff --git a/shell/e-task-widget.c b/shell/e-task-widget.c deleted file mode 100644 index 22ffecad4d..0000000000 --- a/shell/e-task-widget.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-widget.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-task-widget.h" - -#include <gtk/gtkframe.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkpixmap.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> - -#include <gal/util/e-util.h> - - -#define SPACING 2 - -#define PARENT_TYPE (gtk_event_box_get_type ()) -static GtkEventBoxClass *parent_class = NULL; - -struct _ETaskWidgetPrivate { - GdkPixbuf *icon_pixbuf; - GtkWidget *label; - GtkWidget *pixmap; -}; - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ETaskWidget *task_widget; - ETaskWidgetPrivate *priv; - - task_widget = E_TASK_WIDGET (object); - priv = task_widget->priv; - - gdk_pixbuf_unref (priv->icon_pixbuf); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; -} - -static void -init (ETaskWidget *task_widget) -{ - ETaskWidgetPrivate *priv; - - priv = g_new (ETaskWidgetPrivate, 1); - - task_widget->priv = priv; -} - - -void -e_task_widget_construct (ETaskWidget *task_widget, - GdkPixbuf *icon_pixbuf, - const char *information) -{ - ETaskWidgetPrivate *priv; - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkWidget *box; - GtkWidget *frame; - - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - g_return_if_fail (icon_pixbuf != NULL); - g_return_if_fail (information != NULL); - - priv = task_widget->priv; - - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); - gtk_container_add (GTK_CONTAINER (task_widget), frame); - gtk_widget_show (frame); - - box = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (frame), box); - gtk_widget_show (box); - - gtk_widget_set_usize (box, 1, -1); - - priv->icon_pixbuf = gdk_pixbuf_ref (icon_pixbuf); - - gdk_pixbuf_render_pixmap_and_mask (icon_pixbuf, &pixmap, &mask, 128); - - priv->pixmap = gtk_pixmap_new (pixmap, mask); - gtk_widget_show (priv->pixmap); - gtk_box_pack_start (GTK_BOX (box), priv->pixmap, FALSE, TRUE, 0); - - priv->label = gtk_label_new (""); - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); - gtk_widget_show (priv->label); - gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0); - - gdk_pixmap_unref (pixmap); - gdk_bitmap_unref (mask); - - e_task_widget_update (task_widget, information, -1.0); -} - -GtkWidget * -e_task_widget_new (GdkPixbuf *icon_pixbuf, - const char *information) -{ - ETaskWidget *task_widget; - - g_return_val_if_fail (icon_pixbuf != NULL, NULL); - g_return_val_if_fail (information != NULL, NULL); - - task_widget = gtk_type_new (e_task_widget_get_type ()); - e_task_widget_construct (task_widget, icon_pixbuf, information); - - return GTK_WIDGET (task_widget); -} - - -void -e_task_widget_update (ETaskWidget *task_widget, - const char *information, - double completion) -{ - ETaskWidgetPrivate *priv; - char *text; - - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - g_return_if_fail (information != NULL); - - priv = task_widget->priv; - - if (completion < 0.0) { - text = g_strdup_printf (_("%s (...)"), information); - } else { - int percent_complete; - - percent_complete = (int) (completion * 100.0 + .5); - text = g_strdup_printf (_("%s (%d%% complete)"), information, percent_complete); - } - - gtk_label_set_text (GTK_LABEL (priv->label), text); - - g_free (text); -} - -void -e_task_wiget_alert (ETaskWidget *task_widget) -{ - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); -} - -void -e_task_wiget_unalert (ETaskWidget *task_widget) -{ - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); -} - - -E_MAKE_TYPE (e_task_widget, "ETaskWidget", ETaskWidget, class_init, init, PARENT_TYPE) diff --git a/shell/e-task-widget.h b/shell/e-task-widget.h deleted file mode 100644 index dacb09fbdd..0000000000 --- a/shell/e-task-widget.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-widget.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_TASK_WIDGET_H_ -#define _E_TASK_WIDGET_H_ - -#include <gtk/gtkeventbox.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_TASK_WIDGET (e_task_widget_get_type ()) -#define E_TASK_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TASK_WIDGET, ETaskWidget)) -#define E_TASK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_WIDGET, ETaskWidgetClass)) -#define E_IS_TASK_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TASK_WIDGET)) -#define E_IS_TASK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_WIDGET)) - - -typedef struct _ETaskWidget ETaskWidget; -typedef struct _ETaskWidgetPrivate ETaskWidgetPrivate; -typedef struct _ETaskWidgetClass ETaskWidgetClass; - -struct _ETaskWidget { - GtkEventBox parent; - - ETaskWidgetPrivate *priv; -}; - -struct _ETaskWidgetClass { - GtkEventBoxClass parent_class; -}; - - -GtkType e_task_widget_get_type (void); -void e_task_widget_construct (ETaskWidget *task_widget, - GdkPixbuf *icon_pixbuf, - const char *information); -GtkWidget *e_task_widget_new (GdkPixbuf *icon_pixbuf, - const char *information); - -void e_task_widget_update (ETaskWidget *task_widget, - const char *information, - double completion); - -void e_task_wiget_alert (ETaskWidget *task_widget); -void e_task_wiget_unalert (ETaskWidget *task_widget); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TASK_WIDGET_H_ */ diff --git a/shell/e-uri-schema-registry.c b/shell/e-uri-schema-registry.c deleted file mode 100644 index 1136cb92a6..0000000000 --- a/shell/e-uri-schema-registry.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-uri-schema-registry.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-uri-schema-registry.h" - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -struct _SchemaHandler { - char *schema; - EvolutionShellComponentClient *component; -}; -typedef struct _SchemaHandler SchemaHandler; - -struct _EUriSchemaRegistryPrivate { - GHashTable *schema_to_handler; -}; - - -/* SchemaHandler. */ - -static SchemaHandler * -schema_handler_new (const char *schema, - EvolutionShellComponentClient *component) -{ - SchemaHandler *handler; - - handler = g_new (SchemaHandler, 1); - handler->schema = g_strdup (schema); - handler->component = component; - - bonobo_object_ref (BONOBO_OBJECT (component)); - - return handler; -} - -static void -schema_handler_free (SchemaHandler *handler) -{ - g_free (handler->schema); - bonobo_object_unref (BONOBO_OBJECT (handler->component)); - - g_free (handler); -} - - -static void -schema_to_handler_destroy_foreach_callback (void *key, - void *value, - void *data) -{ - schema_handler_free ((SchemaHandler *) value); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EUriSchemaRegistry *registry; - EUriSchemaRegistryPrivate *priv; - - registry = E_URI_SCHEMA_REGISTRY (object); - priv = registry->priv; - - g_hash_table_foreach (priv->schema_to_handler, schema_to_handler_destroy_foreach_callback, NULL); - g_hash_table_destroy (priv->schema_to_handler); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = impl_destroy; -} - -static void -init (EUriSchemaRegistry *uri_schema_registry) -{ - EUriSchemaRegistryPrivate *priv; - - priv = g_new (EUriSchemaRegistryPrivate, 1); - priv->schema_to_handler = g_hash_table_new (g_str_hash, g_str_equal); - - uri_schema_registry->priv = priv; - - GTK_OBJECT_UNSET_FLAGS (uri_schema_registry, GTK_FLOATING); -} - - -EUriSchemaRegistry * -e_uri_schema_registry_new (void) -{ - EUriSchemaRegistry *registry; - - registry = gtk_type_new (e_uri_schema_registry_get_type ()); - - return registry; -} - - -gboolean -e_uri_schema_registry_set_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema, - EvolutionShellComponentClient *shell_component) -{ - EUriSchemaRegistryPrivate *priv; - SchemaHandler *existing_handler; - SchemaHandler *new_handler; - - g_return_val_if_fail (registry != NULL, FALSE); - g_return_val_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry), FALSE); - g_return_val_if_fail (schema != NULL, FALSE); - g_return_val_if_fail (shell_component == NULL || EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component), FALSE); - - priv = registry->priv; - - existing_handler = g_hash_table_lookup (priv->schema_to_handler, schema); - if (existing_handler != NULL) - return FALSE; - - new_handler = schema_handler_new (schema, shell_component); - g_hash_table_insert (priv->schema_to_handler, new_handler->schema, new_handler); - - return TRUE; -} - -EvolutionShellComponentClient * -e_uri_schema_registry_get_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema) -{ - EUriSchemaRegistryPrivate *priv; - const SchemaHandler *handler; - - g_return_val_if_fail (registry != NULL, NULL); - g_return_val_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry), NULL); - g_return_val_if_fail (schema != NULL, NULL); - - priv = registry->priv; - - handler = g_hash_table_lookup (priv->schema_to_handler, schema); - if (handler == NULL) - return NULL; - - return handler->component; -} - - -E_MAKE_TYPE (e_uri_schema_registry, "EUriSchemaRegistry", EUriSchemaRegistry, class_init, init, PARENT_TYPE) diff --git a/shell/e-uri-schema-registry.h b/shell/e-uri-schema-registry.h deleted file mode 100644 index 458810b739..0000000000 --- a/shell/e-uri-schema-registry.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-uri-schema-registry.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _E_URI_SCHEMA_REGISTRY_H_ -#define _E_URI_SCHEMA_REGISTRY_H_ - -#include "evolution-shell-component-client.h" - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_URI_SCHEMA_REGISTRY (e_uri_schema_registry_get_type ()) -#define E_URI_SCHEMA_REGISTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_URI_SCHEMA_REGISTRY, EUriSchemaRegistry)) -#define E_URI_SCHEMA_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_URI_SCHEMA_REGISTRY, EUriSchemaRegistryClass)) -#define E_IS_URI_SCHEMA_REGISTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_URI_SCHEMA_REGISTRY)) -#define E_IS_URI_SCHEMA_REGISTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_URI_SCHEMA_REGISTRY)) - - -typedef struct _EUriSchemaRegistry EUriSchemaRegistry; -typedef struct _EUriSchemaRegistryPrivate EUriSchemaRegistryPrivate; -typedef struct _EUriSchemaRegistryClass EUriSchemaRegistryClass; - -struct _EUriSchemaRegistry { - GtkObject parent; - - EUriSchemaRegistryPrivate *priv; -}; - -struct _EUriSchemaRegistryClass { - GtkObjectClass parent_class; -}; - - -GtkType e_uri_schema_registry_get_type (void); -EUriSchemaRegistry *e_uri_schema_registry_new (void); - -gboolean e_uri_schema_registry_set_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema, - EvolutionShellComponentClient *shell_component); -EvolutionShellComponentClient *e_uri_schema_registry_get_handler_for_schema (EUriSchemaRegistry *registry, - const char *schema); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_URI_SCHEMA_REGISTRY_H_ */ diff --git a/shell/evolution-activity-client.c b/shell/evolution-activity-client.c deleted file mode 100644 index 8e2a06c87e..0000000000 --- a/shell/evolution-activity-client.c +++ /dev/null @@ -1,495 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-activity-client.c - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -/* Another evil GTK+ object wrapper for a CORBA API. In this case, the wrapper - is needed to avoid sending too frequent CORBA requests across the wire, thus - slowing the client down. The wrapper makes sure that there is a minimum - amount of time between each CORBA method invocation. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-activity-client.h" - -#include <gtk/gtksignal.h> -#include <gtk/gtkmain.h> - -#include <bonobo/bonobo-listener.h> - -#include <gal/util/e-util.h> - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -/* The minimum time between updates, in msecs. */ -#define UPDATE_DELAY 1000 - -enum { - SHOW_DETAILS, - CANCEL, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -struct _EvolutionActivityClientPrivate { - /* The ::Activity interface that we QI from the shell. */ - GNOME_Evolution_Activity activity_interface; - - /* BonoboListener used to get notification about actions that the user - requested on the activity. */ - BonoboListener *listener; - - /* Id of this activity. */ - GNOME_Evolution_Activity_ActivityId activity_id; - - /* Id for the GTK+ timeout used to do updates. */ - int next_update_timeout_id; - - /* Wether we have to actually push an update at this timeout. */ - int have_pending_update; - - /* Data for the next update. */ - char *new_information; - double new_progress; -}; - - -/* Utility functions. */ - -/* Create an icon from @pixbuf in @icon_return. */ -static void -create_icon_from_pixbuf (GdkPixbuf *pixbuf, - GNOME_Evolution_Icon *icon_return) -{ - const char *sp; - CORBA_octet *dp; - int width, height, total_width, rowstride; - int i, j; - gboolean has_alpha; - - width = gdk_pixbuf_get_width (pixbuf); - height = gdk_pixbuf_get_height (pixbuf); - rowstride = gdk_pixbuf_get_rowstride (pixbuf); - has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); - - if (has_alpha) - total_width = 4 * width; - else - total_width = 3 * width; - - icon_return->width = width; - icon_return->height = height; - icon_return->hasAlpha = has_alpha; - - icon_return->rgbaData._length = icon_return->height * total_width; - icon_return->rgbaData._maximum = icon_return->rgbaData._length; - icon_return->rgbaData._buffer = CORBA_sequence_CORBA_octet_allocbuf (icon_return->rgbaData._maximum); - - sp = gdk_pixbuf_get_pixels (pixbuf); - dp = icon_return->rgbaData._buffer; - for (i = 0; i < height; i ++) { - for (j = 0; j < total_width; j++) - *(dp ++) = sp[j]; - sp += rowstride; - } - - CORBA_sequence_set_release (& icon_return->rgbaData, TRUE); -} - -/* Generate an AnimatedIcon from a NULL-terminated @pixbuf_array. */ -static GNOME_Evolution_AnimatedIcon * -create_corba_animated_icon_from_pixbuf_array (GdkPixbuf **pixbuf_array) -{ - GNOME_Evolution_AnimatedIcon *animated_icon; - GdkPixbuf **p; - int num_frames; - int i; - - num_frames = 0; - for (p = pixbuf_array; *p != NULL; p++) - num_frames++; - - if (num_frames == 0) - return NULL; - - animated_icon = GNOME_Evolution_AnimatedIcon__alloc (); - - animated_icon->_length = num_frames; - animated_icon->_maximum = num_frames; - animated_icon->_buffer = CORBA_sequence_GNOME_Evolution_Icon_allocbuf (animated_icon->_maximum); - - for (i = 0; i < num_frames; i++) - create_icon_from_pixbuf (pixbuf_array[i], & animated_icon->_buffer[i]); - - CORBA_sequence_set_release (animated_icon, TRUE); - - return animated_icon; -} - -static gboolean -corba_update_progress (EvolutionActivityClient *activity_client, - const char *information, - double progress) -{ - EvolutionActivityClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - priv = activity_client->priv; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Activity_operationProgressing (priv->activity_interface, - priv->activity_id, - information, - progress, - &ev); - - if (ev._major == CORBA_NO_EXCEPTION) { - retval = TRUE; - } else { - g_warning ("EvolutionActivityClient: Error updating progress -- %s", - ev._repo_id); - retval = FALSE; - } - - CORBA_exception_free (&ev); - - return retval; -} - -static gboolean -update_timeout_callback (void *data) -{ - EvolutionActivityClient *activity_client; - EvolutionActivityClientPrivate *priv; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (data); - priv = activity_client->priv; - - if (priv->have_pending_update) { - priv->have_pending_update = FALSE; - corba_update_progress (activity_client, priv->new_information, priv->new_progress); - return TRUE; - } else { - priv->next_update_timeout_id = 0; - return FALSE; - } -} - - -/* BonoboListener callback. */ - -static void -listener_callback (BonoboListener *listener, - char *event_name, - CORBA_any *any, - CORBA_Environment *ev, - void *data) -{ - EvolutionActivityClient *activity_client; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (data); - - if (strcmp (event_name, "ShowDetails") == 0) - gtk_signal_emit (GTK_OBJECT (activity_client), signals[SHOW_DETAILS]); - else if (strcmp (event_name, "Cancel") == 0) - gtk_signal_emit (GTK_OBJECT (activity_client), signals[CANCEL]); - else - g_warning ("EvolutionActivityClient: Unknown event from listener -- %s", event_name); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionActivityClient *activity_client; - EvolutionActivityClientPrivate *priv; - CORBA_Environment ev; - - activity_client = EVOLUTION_ACTIVITY_CLIENT (object); - priv = activity_client->priv; - - if (priv->next_update_timeout_id != 0) - g_source_remove (priv->next_update_timeout_id); - - CORBA_exception_init (&ev); - - if (! CORBA_Object_is_nil (priv->activity_interface, &ev)) { - GNOME_Evolution_Activity_operationFinished (priv->activity_interface, - priv->activity_id, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EvolutionActivityClient: Error reporting completion of operation -- %s", - ev._repo_id); - - CORBA_Object_release (priv->activity_interface, &ev); - } - - CORBA_exception_free (&ev); - - if (priv->listener != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - - g_free (priv->new_information); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EvolutionActivityClientClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - signals[SHOW_DETAILS] - = gtk_signal_new ("show_details", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionActivityClientClass, show_details), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[CANCEL] - = gtk_signal_new ("cancel", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionActivityClientClass, cancel), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - - -static void -init (EvolutionActivityClient *activity_client) -{ - EvolutionActivityClientPrivate *priv; - - priv = g_new (EvolutionActivityClientPrivate, 1); - priv->activity_interface = CORBA_OBJECT_NIL; - priv->listener = bonobo_listener_new (listener_callback, activity_client); - priv->activity_id = (GNOME_Evolution_Activity_ActivityId) 0; - priv->next_update_timeout_id = 0; - priv->have_pending_update = FALSE; - priv->new_information = NULL; - priv->new_progress = 0.0; - - activity_client->priv = priv; -} - - -gboolean -evolution_activity_client_construct (EvolutionActivityClient *activity_client, - EvolutionShellClient *shell_client, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return) -{ - EvolutionActivityClientPrivate *priv; - GNOME_Evolution_Activity activity_interface; - CORBA_Environment ev; - CORBA_boolean suggest_display; - GNOME_Evolution_AnimatedIcon *corba_animated_icon; - - g_return_val_if_fail (activity_client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), FALSE); - g_return_val_if_fail (shell_client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client), FALSE); - g_return_val_if_fail (animated_icon != NULL, FALSE); - g_return_val_if_fail (*animated_icon != NULL, FALSE); - g_return_val_if_fail (information != NULL, FALSE); - g_return_val_if_fail (suggest_display_return != NULL, FALSE); - - priv = activity_client->priv; - g_return_val_if_fail (priv->activity_interface == CORBA_OBJECT_NIL, FALSE); - - GTK_OBJECT_UNSET_FLAGS (activity_client, GTK_FLOATING); - - CORBA_exception_init (&ev); - - activity_interface = evolution_shell_client_get_activity_interface (shell_client); - priv->activity_interface = CORBA_Object_duplicate (activity_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - priv->activity_interface = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return FALSE; - } - - corba_animated_icon = create_corba_animated_icon_from_pixbuf_array (animated_icon); - - GNOME_Evolution_Activity_operationStarted (activity_interface, - component_id, - corba_animated_icon, - information, - cancellable, - bonobo_object_corba_objref (BONOBO_OBJECT (priv->listener)), - &priv->activity_id, - &suggest_display, - &ev); - - CORBA_free (corba_animated_icon); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return FALSE; - } - - *suggest_display_return = (gboolean) suggest_display; - - CORBA_exception_free (&ev); - return TRUE; -} - -EvolutionActivityClient * -evolution_activity_client_new (EvolutionShellClient *shell_client, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return) -{ - EvolutionActivityClient *activity_client; - - g_return_val_if_fail (shell_client != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client), NULL); - g_return_val_if_fail (animated_icon != NULL, NULL); - g_return_val_if_fail (*animated_icon != NULL, NULL); - g_return_val_if_fail (information != NULL, NULL); - g_return_val_if_fail (suggest_display_return != NULL, NULL); - - activity_client = gtk_type_new (evolution_activity_client_get_type ()); - - if (! evolution_activity_client_construct (activity_client, - shell_client, - component_id, - animated_icon, - information, - cancellable, - suggest_display_return)) { - gtk_object_unref (GTK_OBJECT (activity_client)); - return NULL; - } - - return activity_client; -} - - -gboolean -evolution_activity_client_update (EvolutionActivityClient *activity_client, - const char *information, - double progress) -{ - EvolutionActivityClientPrivate *priv; - gboolean retval; - - g_return_val_if_fail (activity_client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), FALSE); - g_return_val_if_fail (information != NULL, FALSE); - g_return_val_if_fail (progress == -1.0 || (progress >= 0.0 && progress <= 1.0), FALSE); - - priv = activity_client->priv; - - if (priv->next_update_timeout_id == 0) { - /* There is no pending timeout, so the last CORBA update - happened more than UPDATE_DELAY msecs ago. So we set up a - timeout so we can check against it at the next update - request. - - Notice that GLib timeouts or other operations on this object - can be invoked within a remote CORBA invocation, so we need - to set `next_update_timeout_id' and `have_pending_update' - before doing the CORBA call, or nasty race conditions might - happen. */ - - priv->have_pending_update = FALSE; - - priv->next_update_timeout_id = g_timeout_add (UPDATE_DELAY, - update_timeout_callback, - activity_client); - - retval = corba_update_progress (activity_client, information, progress); - } else { - /* There is a pending timeout, so the last CORBA update - happened less than UPDATE_DELAY msecs ago. So just queue an - update instead. */ - - g_free (priv->new_information); - priv->new_information = g_strdup (information); - priv->new_progress = progress; - - priv->have_pending_update = TRUE; - - retval = TRUE; - } - - return retval; -} - -GNOME_Evolution_Activity_DialogAction -evolution_activity_client_request_dialog (EvolutionActivityClient *activity_client, - GNOME_Evolution_Activity_DialogType dialog_type) -{ - EvolutionActivityClientPrivate *priv; - GNOME_Evolution_Activity_DialogAction retval; - CORBA_Environment ev; - - g_return_val_if_fail (activity_client != NULL, GNOME_Evolution_Activity_DIALOG_ACTION_ERROR); - g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), GNOME_Evolution_Activity_DIALOG_ACTION_ERROR); - - priv = activity_client->priv; - - CORBA_exception_init (&ev); - - retval = GNOME_Evolution_Activity_requestDialog (priv->activity_interface, - priv->activity_id, - dialog_type, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EvolutionActivityClient: Error requesting a dialog -- %s", ev._repo_id); - retval = GNOME_Evolution_Activity_DIALOG_ACTION_ERROR; - } - - CORBA_exception_free (&ev); - - return retval; -} - - -E_MAKE_TYPE (evolution_activity_client, "EvolutionActivityClient", EvolutionActivityClient, - class_init, init, PARENT_TYPE) diff --git a/shell/evolution-activity-client.h b/shell/evolution-activity-client.h deleted file mode 100644 index e21fbec52d..0000000000 --- a/shell/evolution-activity-client.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-activity-client.h - * - * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com> - */ - -#ifndef _EVOLUTION_ACTIVITY_CLIENT_H_ -#define _EVOLUTION_ACTIVITY_CLIENT_H_ - -#include "evolution-shell-client.h" - -#include "Evolution.h" - -#include <gtk/gtkobject.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_ACTIVITY_CLIENT (evolution_activity_client_get_type ()) -#define EVOLUTION_ACTIVITY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT, EvolutionActivityClient)) -#define EVOLUTION_ACTIVITY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_ACTIVITY_CLIENT, EvolutionActivityClientClass)) -#define EVOLUTION_IS_ACTIVITY_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT)) -#define EVOLUTION_IS_ACTIVITY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_ACTIVITY_CLIENT)) - - -typedef struct _EvolutionActivityClient EvolutionActivityClient; -typedef struct _EvolutionActivityClientPrivate EvolutionActivityClientPrivate; -typedef struct _EvolutionActivityClientClass EvolutionActivityClientClass; - -struct _EvolutionActivityClient { - GtkObject parent; - - EvolutionActivityClientPrivate *priv; -}; - -struct _EvolutionActivityClientClass { - GtkObjectClass parent_class; - - /* Signals. */ - void (* show_details) (EvolutionActivityClient *activity_client); - void (* cancel) (EvolutionActivityClient *activity_client); -}; - - -GtkType evolution_activity_client_get_type (void); -gboolean evolution_activity_client_construct (EvolutionActivityClient *activity_client, - EvolutionShellClient *shell_client, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return); -EvolutionActivityClient *evolution_activity_client_new (EvolutionShellClient *shell_client, - const char *component_id, - GdkPixbuf **animated_icon, - const char *information, - gboolean cancellable, - gboolean *suggest_display_return); - -gboolean evolution_activity_client_update (EvolutionActivityClient *activity_client, - const char *information, - double progress); - -GNOME_Evolution_Activity_DialogAction -evolution_activity_client_request_dialog (EvolutionActivityClient *activity_client, - GNOME_Evolution_Activity_DialogType dialog_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _EVOLUTION_ACTIVITY_CLIENT_H_ */ diff --git a/shell/evolution-session.c b/shell/evolution-session.c deleted file mode 100644 index 818fb393e5..0000000000 --- a/shell/evolution-session.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-session.c - * - * Copyright (C) 2000 Ximian, 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 <gal/util/e-util.h> - -#include "Evolution.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_GNOME_Evolution_Session_saveConfiguration (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_GNOME_Evolution_Session_loadConfiguration (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_GNOME_Evolution_Session__vepv GNOME_Evolution_Session_vepv; - -static void -corba_class_init (void) -{ - POA_GNOME_Evolution_Session__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_Session__epv, 1); - epv->saveConfiguration = impl_GNOME_Evolution_Session_saveConfiguration; - epv->loadConfiguration = impl_GNOME_Evolution_Session_loadConfiguration; - - vepv = &GNOME_Evolution_Session_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_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 GNOME_Evolution_Session -create_corba_session (BonoboObject *object) -{ - POA_GNOME_Evolution_Session *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_Session *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &GNOME_Evolution_Session_vepv; - - CORBA_exception_init (&ev); - - POA_GNOME_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 (GNOME_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; - GNOME_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 2b30993936..0000000000 --- a/shell/evolution-session.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-session.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <bonobo/bonobo-object.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 6b3f48e1f3..0000000000 --- a/shell/evolution-shell-client.c +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-client.c - * - * Copyright (C) 2000 Ximian, 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/gtkmain.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object.h> - -#include <gal/util/e-util.h> - -#include "evolution-shell-client.h" - - -struct _EvolutionShellClientPrivate { - GNOME_Evolution_Activity activity_interface; - GNOME_Evolution_Shortcuts shortcuts_interface; -}; - -#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_GNOME_Evolution_FolderSelectionListener__epv FolderSelectionListener_epv; -static POA_GNOME_Evolution_FolderSelectionListener__vepv FolderSelectionListener_vepv; -static gboolean FolderSelectionListener_vtables_initialized = FALSE; - -struct _FolderSelectionListenerServant { - POA_GNOME_Evolution_FolderSelectionListener servant; - char **uri_return; - char **physical_uri_return; -}; -typedef struct _FolderSelectionListenerServant FolderSelectionListenerServant; - - -/* Helper functions. */ - -static CORBA_Object -query_shell_interface (EvolutionShellClient *shell_client, - const char *interface_name) -{ - CORBA_Environment ev; - CORBA_Object interface_object; - EvolutionShellClientPrivate *priv; - - priv = shell_client->priv; - - CORBA_exception_init (&ev); - - interface_object = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)), - interface_name, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EvolutionShellClient: Error querying interface %s on %p -- %s", - interface_name, shell_client, ev._repo_id); - interface_object = CORBA_OBJECT_NIL; - } else if (CORBA_Object_is_nil (interface_object, &ev)) { - g_warning ("No interface %s for ShellClient %p", interface_name, shell_client); - } - - CORBA_exception_free (&ev); - - return interface_object; -} - - -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.notifySelected = impl_FolderSelectionListener_selected; - FolderSelectionListener_epv.notifyCanceled = impl_FolderSelectionListener_cancel; - - FolderSelectionListener_vepv._base_epv = &FolderSelectionListener_base_epv; - FolderSelectionListener_vepv.GNOME_Evolution_FolderSelectionListener_epv = &FolderSelectionListener_epv; - - FolderSelectionListener_vtables_initialized = TRUE; -} - -static GNOME_Evolution_FolderSelectionListener -create_folder_selection_listener_interface (char **result, - char **uri_return, - char **physical_uri_return) -{ - GNOME_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_GNOME_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) -{ - GNOME_Evolution_FolderSelectionListener listener_interface; - GNOME_Evolution_Shell corba_shell; - CORBA_Environment ev; - GNOME_Evolution_Shell_FolderTypeNameList corba_type_name_list; - int num_possible_types; - char *result; - - result = NULL; - - if (uri_return != NULL) - *uri_return = NULL; - if (physical_uri_return != NULL) - *physical_uri_return = 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_name_list._length = num_possible_types; - corba_type_name_list._maximum = num_possible_types; - corba_type_name_list._buffer = (CORBA_char **) possible_types; - - GNOME_Evolution_Shell_selectUserFolder (corba_shell, listener_interface, - title, default_folder, &corba_type_name_list, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - 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; - CORBA_Environment ev; - - shell_client = EVOLUTION_SHELL_CLIENT (object); - priv = shell_client->priv; - - CORBA_exception_init (&ev); - - if (priv->activity_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->activity_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EvolutionShellClient::destroy: " - "Error unreffing the ::Activity interface -- %s\n", - ev._repo_id); - CORBA_Object_release (priv->activity_interface, &ev); - } - - if (priv->shortcuts_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->shortcuts_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("EvolutionShellClient::destroy: " - "Error unreffing the ::Shortcuts interface -- %s\n", - ev._repo_id); - CORBA_Object_release (priv->shortcuts_interface, &ev); - } - - CORBA_exception_free (&ev); - - g_free (priv); - - (* 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->activity_interface = CORBA_OBJECT_NIL; - priv->shortcuts_interface = CORBA_OBJECT_NIL; - - 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, - GNOME_Evolution_Shell corba_shell) -{ - EvolutionShellClientPrivate *priv; - - 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); - - priv = shell_client->priv; - g_return_if_fail (priv->activity_interface == CORBA_OBJECT_NIL); - - priv->activity_interface = query_shell_interface (shell_client, "IDL:GNOME/Evolution/Activity:1.0"); - priv->shortcuts_interface = query_shell_interface (shell_client, "IDL:GNOME/Evolution/Shortcuts:1.0"); -} - -/** - * 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 (GNOME_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_activity_interface: - * @shell_client: An EvolutionShellClient object - * - * Get the GNOME::Evolution::Activity for the shell associated to - * @shell_client. - * - * Return value: A CORBA Object represeting the GNOME::Evolution::Activity - * interface. - **/ -GNOME_Evolution_Activity -evolution_shell_client_get_activity_interface (EvolutionShellClient *shell_client) -{ - 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); - - return shell_client->priv->activity_interface; -} - -/** - * evolution_shell_client_get_activity_interface: - * @shell_client: An EvolutionShellClient object - * - * Get the GNOME::Evolution::Shortcuts for the shell associated to - * @shell_client. - * - * Return value: A CORBA Object represeting the GNOME::Evolution::Shortcuts - * interface. - **/ -GNOME_Evolution_Shortcuts -evolution_shell_client_get_shortcuts_interface (EvolutionShellClient *shell_client) -{ - 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); - - return shell_client->priv->shortcuts_interface; -} - - -/** - * 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. - **/ -GNOME_Evolution_Storage -evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client) -{ - GNOME_Evolution_Shell corba_shell; - GNOME_Evolution_Storage 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) { - g_warning ("evolution_shell_client_get_local_storage() invoked on an " - "EvolutionShellClient that doesn't have a CORBA objref???"); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - corba_local_storage = GNOME_Evolution_Shell_getLocalStorage (corba_shell, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("evolution_shell_client_get_local_storage() failing -- %s ???", ev._repo_id); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - return corba_local_storage; -} - -void -evolution_shell_client_set_line_status (EvolutionShellClient *shell_client, - gboolean line_status) -{ - GNOME_Evolution_Shell corba_shell; - CORBA_Environment ev; - - g_return_if_fail (shell_client != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client)); - - CORBA_exception_init (&ev); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - if (corba_shell == CORBA_OBJECT_NIL) - return; - - GNOME_Evolution_Shell_setLineStatus (corba_shell, line_status, &ev); - - CORBA_exception_free (&ev); -} - - -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 f4fd194f58..0000000000 --- a/shell/evolution-shell-client.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-client.h - * - * Copyright (C) 2000 Ximian, 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__ - -#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, - GNOME_Evolution_Shell corba_shell); -EvolutionShellClient *evolution_shell_client_new (GNOME_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); - -GNOME_Evolution_Activity evolution_shell_client_get_activity_interface (EvolutionShellClient *shell_client); -GNOME_Evolution_Shortcuts evolution_shell_client_get_shortcuts_interface (EvolutionShellClient *shell_client); - -GNOME_Evolution_Storage evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client); - -void evolution_shell_client_set_line_status (EvolutionShellClient *shell_client, - gboolean online); - -#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 bba3cb462e..0000000000 --- a/shell/evolution-shell-component-client.c +++ /dev/null @@ -1,820 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-client.c - * - * Copyright (C) 2000, 2001 Ximian, 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/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <liboaf/liboaf.h> - -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-widget.h> - -#include <gal/util/e-util.h> - -#include "evolution-shell-component-client.h" - - -char *evolution_debug_log; - -#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionShellComponentClientPrivate { - EvolutionShellComponentClientCallback callback; - void *callback_data; - - GNOME_Evolution_ShellComponentListener listener_interface; - PortableServer_Servant listener_servant; - - GNOME_Evolution_ShellComponentDnd_SourceFolder dnd_source_folder_interface; - GNOME_Evolution_ShellComponentDnd_DestinationFolder dnd_destination_folder_interface; - GNOME_Evolution_Offline offline_interface; -}; - - -#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_GNOME_Evolution_ShellComponent_AlreadyOwned) == 0) - return EVOLUTION_SHELL_COMPONENT_ALREADYOWNED; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_NotOwned) == 0) - return EVOLUTION_SHELL_COMPONENT_NOTOWNED; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_NotFound) == 0) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_UnsupportedType) == 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_InternalError) == 0) - return EVOLUTION_SHELL_COMPONENT_INTERNALERROR; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_Busy) == 0) - return EVOLUTION_SHELL_COMPONENT_BUSY; - if (strcmp (ev->_repo_id, ex_GNOME_Evolution_ShellComponent_UnsupportedSchema) == 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDSCHEMA; - - return EVOLUTION_SHELL_COMPONENT_UNKNOWNERROR; - } else { - /* FIXME maybe we need something more specific here. */ - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; - } -} - -static EvolutionShellComponentResult -shell_component_result_from_corba_exception (const CORBA_Environment *ev) -{ - if (ev->_major == CORBA_NO_EXCEPTION) - return EVOLUTION_SHELL_COMPONENT_OK; - if (ev->_major == CORBA_SYSTEM_EXCEPTION) - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; /* FIXME? */ -} - - -/* CORBA listener interface implementation. */ - -static PortableServer_ServantBase__epv ShellComponentListener_base_epv; -static POA_GNOME_Evolution_ShellComponentListener__epv ShellComponentListener_epv; -static POA_GNOME_Evolution_ShellComponentListener__vepv ShellComponentListener_vepv; -static gboolean ShellComponentListener_vepv_initialized = FALSE; - -static void ShellComponentListener_vepv_initialize (void); -static void dispatch_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result); - -struct _ShellComponentListenerServant { - POA_GNOME_Evolution_ShellComponentListener servant; - EvolutionShellComponentClient *component_client; -}; -typedef struct _ShellComponentListenerServant ShellComponentListenerServant; - -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 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 (GNOME_Evolution_ShellComponentListener_Result async_corba_result) -{ - switch (async_corba_result) { - case GNOME_Evolution_ShellComponentListener_OK: - return EVOLUTION_SHELL_COMPONENT_OK; - case GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION: - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDOPERATION; - case GNOME_Evolution_ShellComponentListener_EXISTS: - return EVOLUTION_SHELL_COMPONENT_EXISTS; - case GNOME_Evolution_ShellComponentListener_INVALID_URI: - return EVOLUTION_SHELL_COMPONENT_INVALIDURI; - case GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED: - return EVOLUTION_SHELL_COMPONENT_PERMISSIONDENIED; - case GNOME_Evolution_ShellComponentListener_HAS_SUBFOLDERS: - return EVOLUTION_SHELL_COMPONENT_HASSUBFOLDERS; - case GNOME_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 GNOME_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.notifyResult = impl_ShellComponentListener_report_result; - - ShellComponentListener_vepv._base_epv = & ShellComponentListener_base_epv; - ShellComponentListener_vepv.GNOME_Evolution_ShellComponentListener_epv = & ShellComponentListener_epv; - - ShellComponentListener_vepv_initialized = TRUE; -} - -static void -create_listener_interface (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - PortableServer_Servant listener_servant; - GNOME_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_GNOME_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; -} - -static void -destroy_listener_interface (EvolutionShellComponentClient *client) -{ - EvolutionShellComponentClientPrivate *priv; - CORBA_Environment ev; - PortableServer_ObjectId *oid; - - priv = client->priv; - 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_GNOME_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev); - CORBA_free (oid); - - CORBA_Object_release (priv->listener_interface, &ev); - free_ShellComponentListener_servant (priv->listener_servant); - - CORBA_exception_free (&ev); -} - -static void -dispatch_callback (EvolutionShellComponentClient *shell_component_client, - EvolutionShellComponentResult result) -{ - EvolutionShellComponentClientPrivate *priv; - EvolutionShellComponentClientCallback callback; - void *callback_data; - - 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. */ - - destroy_listener_interface (shell_component_client); - - 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); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EvolutionShellComponentClient *shell_component_client; - EvolutionShellComponentClientPrivate *priv; - CORBA_Environment ev; - - 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); - - CORBA_exception_init (&ev); - - if (priv->dnd_source_folder_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->dnd_source_folder_interface, &ev); - CORBA_Object_release (priv->dnd_source_folder_interface, &ev); - } - - if (priv->dnd_destination_folder_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->dnd_destination_folder_interface, &ev); - CORBA_Object_release (priv->dnd_destination_folder_interface, &ev); - } - - if (priv->offline_interface != CORBA_OBJECT_NIL) { - Bonobo_Unknown_unref (priv->offline_interface, &ev); - CORBA_Object_release (priv->offline_interface, &ev); - } - - if (priv->listener_interface != CORBA_OBJECT_NIL) - destroy_listener_interface (shell_component_client); - - CORBA_exception_free (&ev); - - 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; - - priv->dnd_source_folder_interface = CORBA_OBJECT_NIL; - priv->dnd_destination_folder_interface = CORBA_OBJECT_NIL; - priv->offline_interface = CORBA_OBJECT_NIL; - - 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) -{ - 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.", 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; - } - - return evolution_shell_component_client_new_for_objref (corba_object); -} - -EvolutionShellComponentClient * -evolution_shell_component_client_new_for_objref (const GNOME_Evolution_ShellComponent objref) -{ - EvolutionShellComponentClient *new; - - g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL); - - new = gtk_type_new (evolution_shell_component_client_get_type ()); - evolution_shell_component_client_construct (new, objref); - - return new; -} - - -/* Querying DnD interfaces. */ - -GNOME_Evolution_ShellComponentDnd_SourceFolder -evolution_shell_component_client_get_dnd_source_interface (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - GNOME_Evolution_ShellComponentDnd_SourceFolder interface; - CORBA_Environment ev; - - g_return_val_if_fail (shell_component_client != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client), CORBA_OBJECT_NIL); - - priv = shell_component_client->priv; - - if (priv->dnd_source_folder_interface != CORBA_OBJECT_NIL) - return priv->dnd_source_folder_interface; - - CORBA_exception_init (&ev); - - interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - "IDL:GNOME/Evolution/ShellComponentDnd/SourceFolder:1.0", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - - priv->dnd_source_folder_interface = interface; - return interface; -} - -GNOME_Evolution_ShellComponentDnd_DestinationFolder -evolution_shell_component_client_get_dnd_destination_interface (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - GNOME_Evolution_ShellComponentDnd_DestinationFolder interface; - CORBA_Environment ev; - - g_return_val_if_fail (shell_component_client != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client), CORBA_OBJECT_NIL); - - priv = shell_component_client->priv; - - if (priv->dnd_destination_folder_interface != CORBA_OBJECT_NIL) - return priv->dnd_destination_folder_interface; - - CORBA_exception_init (&ev); - - interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - "IDL:GNOME/Evolution/ShellComponentDnd/DestinationFolder:1.0", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - - priv->dnd_destination_folder_interface = interface; - return interface; -} - - -/* Querying the offline interface. */ - -GNOME_Evolution_Offline -evolution_shell_component_client_get_offline_interface (EvolutionShellComponentClient *shell_component_client) -{ - EvolutionShellComponentClientPrivate *priv; - GNOME_Evolution_Offline interface; - CORBA_Environment ev; - - priv = shell_component_client->priv; - - if (priv->offline_interface != CORBA_OBJECT_NIL) - return priv->offline_interface; - - CORBA_exception_init (&ev); - - interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - "IDL:GNOME/Evolution/Offline:1.0", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - interface = CORBA_OBJECT_NIL; - - CORBA_exception_free (&ev); - - priv->offline_interface = interface; - return interface; -} - - -/* Synchronous operations. */ - -EvolutionShellComponentResult -evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client, - GNOME_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); - - GNOME_Evolution_ShellComponent_setOwner (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - shell, evolution_homedir, &ev); - - result = corba_exception_to_result (&ev); - - if (result == EVOLUTION_SHELL_COMPONENT_OK && evolution_debug_log) - GNOME_Evolution_ShellComponent_debug (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), evolution_debug_log, &ev); - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionShellComponentResult -evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client, - GNOME_Evolution_Shell shell) -{ - EvolutionShellComponentResult result; - GNOME_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)); - - GNOME_Evolution_ShellComponent_unsetOwner (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; - GNOME_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 = GNOME_Evolution_ShellComponent_createView (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; -} - -EvolutionShellComponentResult -evolution_shell_component_client_handle_external_uri (EvolutionShellComponentClient *shell_component_client, - const char *uri) -{ - GNOME_Evolution_ShellComponent corba_component; - CORBA_Environment ev; - EvolutionShellComponentResult result; - - RETURN_ERROR_IF_FAIL (shell_component_client != NULL); - RETURN_ERROR_IF_FAIL (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); - RETURN_ERROR_IF_FAIL (uri != NULL); - - CORBA_exception_init (&ev); - - corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); - GNOME_Evolution_ShellComponent_handleExternalURI (corba_component, uri, &ev); - - result = corba_exception_to_result (&ev); - - 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; - GNOME_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; - - GNOME_Evolution_ShellComponent_createFolderAsync (corba_shell_component, - priv->listener_interface, - physical_uri, type, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) { - (* callback) (shell_component_client, - shell_component_result_from_corba_exception (&ev), - data); - priv->callback = NULL; - priv->callback_data = NULL; - } - - CORBA_exception_free (&ev); -} - -void -evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client, - const char *physical_uri, - const char *type, - EvolutionShellComponentClientCallback callback, - void *data) -{ - EvolutionShellComponentClientPrivate *priv; - GNOME_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 (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; - - GNOME_Evolution_ShellComponent_removeFolderAsync (corba_shell_component, - priv->listener_interface, - physical_uri, - type, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) { - (* callback) (shell_component_client, - shell_component_result_from_corba_exception (&ev), - data); - priv->callback = NULL; - priv->callback_data = NULL; - } - - CORBA_exception_free (&ev); -} - -void -evolution_shell_component_client_async_xfer_folder (EvolutionShellComponentClient *shell_component_client, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - EvolutionShellComponentClientCallback callback, - void *data) -{ - EvolutionShellComponentClientPrivate *priv; - GNOME_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 (source_physical_uri != NULL); - g_return_if_fail (destination_physical_uri != NULL); - g_return_if_fail (data != 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; - - GNOME_Evolution_ShellComponent_xferFolderAsync (corba_shell_component, - priv->listener_interface, - source_physical_uri, - destination_physical_uri, - type, - remove_source, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) { - (* callback) (shell_component_client, - shell_component_result_from_corba_exception (&ev), - data); - priv->callback = NULL; - priv->callback_data = NULL; - } - - CORBA_exception_free (&ev); -} - -void -evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, - BonoboUIContainer *container, - const char *physical_uri, - const char *type) -{ - Bonobo_UIContainer corba_container; - EvolutionShellComponentClientPrivate *priv; - GNOME_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_container = bonobo_object_corba_objref (BONOBO_OBJECT (container)); - - GNOME_Evolution_ShellComponent_populateFolderContextMenu (corba_shell_component, - corba_container, - 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 eca4440f96..0000000000 --- a/shell/evolution-shell-component-client.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-client.h - * - * Copyright (C) 2000 Ximian, 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 <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-component.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); -EvolutionShellComponentClient *evolution_shell_component_client_new_for_objref (const GNOME_Evolution_ShellComponent objref); - -/* Querying DnD interfaces. */ - -GNOME_Evolution_ShellComponentDnd_SourceFolder -evolution_shell_component_client_get_dnd_source_interface (EvolutionShellComponentClient *shell_component_client); -GNOME_Evolution_ShellComponentDnd_DestinationFolder -evolution_shell_component_client_get_dnd_destination_interface (EvolutionShellComponentClient *shell_component_client); - -/* Querying the offline interface. */ -GNOME_Evolution_Offline -evolution_shell_component_client_get_offline_interface (EvolutionShellComponentClient *shell_component_client); - -/* Synchronous operations. */ - -EvolutionShellComponentResult evolution_shell_component_client_set_owner (EvolutionShellComponentClient *shell_component_client, - GNOME_Evolution_Shell shell, - const char *evolution_homedir); -EvolutionShellComponentResult evolution_shell_component_client_unset_owner (EvolutionShellComponentClient *shell_component_client, - GNOME_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); - -EvolutionShellComponentResult evolution_shell_component_client_handle_external_uri (EvolutionShellComponentClient *shell_component_client, - const char *uri); - -/* 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, - const char *type, - EvolutionShellComponentClientCallback callback, - void *data); -void evolution_shell_component_client_async_xfer_folder (EvolutionShellComponentClient *shell_component_client, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - EvolutionShellComponentClientCallback callback, - void *data); - -void evolution_shell_component_client_populate_folder_context_menu (EvolutionShellComponentClient *shell_component_client, - BonoboUIContainer *container, - const char *physical_uri, - const char *type); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* EVOLUTION_SHELL_COMPONENT_CLIENT_H */ diff --git a/shell/evolution-shell-component-dnd.c b/shell/evolution-shell-component-dnd.c deleted file mode 100644 index c434ff4611..0000000000 --- a/shell/evolution-shell-component-dnd.c +++ /dev/null @@ -1,445 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-dnd.c - * - * Copyright (C) 2000, 2001 Ximian, 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: Chris Toshok - */ - -#include <gal/util/e-util.h> - -#include "Evolution.h" -#include "evolution-shell-component-dnd.h" - - -#define PARENT_TYPE (bonobo_object_get_type ()) - -static BonoboObjectClass *parent_class; - -/* Source Folder stuff */ - -struct _DndSourceFolderPrivate { - DndSourceFolderBeginDragFn begin_drag; - DndSourceFolderGetDataFn get_data; - DndSourceFolderDeleteDataFn delete_data; - DndSourceFolderEndDragFn end_drag; - gpointer user_data; -}; - -/* GtkObject methods */ -static void -dnd_source_destroy (GtkObject *object) -{ - EvolutionShellComponentDndSourceFolder *folder; - DndSourceFolderPrivate *priv; - - folder = EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (object); - priv = folder->priv; - - g_return_if_fail (priv != NULL); - - g_free (priv); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_beginDrag (PortableServer_Servant servant, const CORBA_char * physical_uri, - const CORBA_char * folder_type, GNOME_Evolution_ShellComponentDnd_ActionSet * possible_actions, - GNOME_Evolution_ShellComponentDnd_Action * suggested_action, CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndSourceFolder *folder; - DndSourceFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (bonobo_object); - priv = folder->priv; - - priv->begin_drag (folder, physical_uri, folder_type, possible_actions, suggested_action, priv->user_data); -} - -static void -impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_getData (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context * source_context, - const GNOME_Evolution_ShellComponentDnd_Action action, const CORBA_char * dnd_type, - GNOME_Evolution_ShellComponentDnd_Data ** data, CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndSourceFolder *folder; - DndSourceFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (bonobo_object); - priv = folder->priv; - - priv->get_data (folder, source_context, action, dnd_type, data, ev, priv->user_data); -} - -static void -impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_deleteData (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context * source_context, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndSourceFolder *folder; - DndSourceFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (bonobo_object); - priv = folder->priv; - - priv->delete_data (folder, source_context, priv->user_data); -} - -static void -impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_endDrag (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context * source_context, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndSourceFolder *folder; - DndSourceFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (bonobo_object); - priv = folder->priv; - - priv->end_drag (folder, source_context, priv->user_data); -} - -static POA_GNOME_Evolution_ShellComponentDnd_SourceFolder__vepv SourceFolder_vepv; - -static POA_GNOME_Evolution_ShellComponentDnd_SourceFolder * -create_dnd_source_servant (void) -{ - POA_GNOME_Evolution_ShellComponentDnd_SourceFolder *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_ShellComponentDnd_SourceFolder *)g_new0 (BonoboObjectServant, 1); - servant->vepv = &SourceFolder_vepv; - - CORBA_exception_init (&ev); - POA_GNOME_Evolution_ShellComponentDnd_SourceFolder__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 -source_corba_class_init (void) -{ - POA_GNOME_Evolution_ShellComponentDnd_SourceFolder__vepv *vepv; - POA_GNOME_Evolution_ShellComponentDnd_SourceFolder__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_GNOME_Evolution_ShellComponentDnd_SourceFolder__epv, 1); - epv->beginDrag = impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_beginDrag; - epv->getData = impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_getData; - epv->deleteData = impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_deleteData; - epv->endDrag = impl_GNOME_Evolution_ShellComponentDnd_SourceFolder_endDrag; - - vepv = &SourceFolder_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_ShellComponentDnd_SourceFolder_epv = epv; -} - -static void -evolution_shell_component_dnd_source_folder_class_init (EvolutionShellComponentDndSourceFolderClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = dnd_source_destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - - source_corba_class_init (); -} - -static void -evolution_shell_component_dnd_source_folder_init (EvolutionShellComponentDndSourceFolder *folder) -{ - DndSourceFolderPrivate *priv; - - priv = g_new (DndSourceFolderPrivate, 1); - - folder->priv = priv; -} - - -E_MAKE_TYPE (evolution_shell_component_dnd_source_folder, "EvolutionShellComponentDndSourceFolder", - EvolutionShellComponentDndSourceFolder, evolution_shell_component_dnd_source_folder_class_init, - evolution_shell_component_dnd_source_folder_init, PARENT_TYPE); - -static void -evolution_shell_component_dnd_source_folder_construct (EvolutionShellComponentDndSourceFolder *dnd_source, - DndSourceFolderBeginDragFn begin_drag, - DndSourceFolderGetDataFn get_data, - DndSourceFolderDeleteDataFn delete_data, - DndSourceFolderEndDragFn end_drag, - gpointer user_data, - GNOME_Evolution_ShellComponentDnd_SourceFolder corba_object) -{ - DndSourceFolderPrivate *priv; - - g_return_if_fail (dnd_source != NULL); - g_return_if_fail (IS_EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER (dnd_source)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - - priv = dnd_source->priv; - - priv->begin_drag = begin_drag; - priv->get_data = get_data; - priv->delete_data = delete_data; - priv->end_drag = end_drag; - priv->user_data = user_data; - - bonobo_object_construct (BONOBO_OBJECT (dnd_source), corba_object); -} - -EvolutionShellComponentDndSourceFolder* -evolution_shell_component_dnd_source_folder_new (DndSourceFolderBeginDragFn begin_drag, - DndSourceFolderGetDataFn get_data, - DndSourceFolderDeleteDataFn delete_data, - DndSourceFolderEndDragFn end_drag, - gpointer user_data) -{ - EvolutionShellComponentDndSourceFolder *dnd_source; - POA_GNOME_Evolution_ShellComponentDnd_SourceFolder *servant; - GNOME_Evolution_ShellComponentDnd_SourceFolder corba_object; - - g_return_val_if_fail (begin_drag != NULL, NULL); - g_return_val_if_fail (get_data != NULL, NULL); - g_return_val_if_fail (delete_data != NULL, NULL); - g_return_val_if_fail (end_drag != NULL, NULL); - - servant = create_dnd_source_servant(); - if (servant == NULL) - return NULL; - - dnd_source = gtk_type_new (evolution_shell_component_dnd_source_folder_get_type ()); - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (dnd_source), - servant); - - evolution_shell_component_dnd_source_folder_construct (dnd_source, - begin_drag, get_data, - delete_data, end_drag, - user_data, - corba_object); - return dnd_source; -} - - - -/* Destination Folder stuff */ - -struct _DndDestinationFolderPrivate { - DndDestinationFolderHandleMotionFn handle_motion; - DndDestinationFolderHandleDropFn handle_drop; - gpointer user_data; -}; - -/* GtkObject methods */ -static void -dnd_destination_destroy (GtkObject *object) -{ - EvolutionShellComponentDndDestinationFolder *folder; - DndDestinationFolderPrivate *priv; - - folder = EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER (object); - priv = folder->priv; - - g_return_if_fail (priv != NULL); - - g_free (priv); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -/* CORBA interface */ -static CORBA_boolean -impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleMotion (PortableServer_Servant servant, - const CORBA_char* physical_uri, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - GNOME_Evolution_ShellComponentDnd_Action * suggested_action, CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndDestinationFolder *folder; - DndDestinationFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER (bonobo_object); - priv = folder->priv; - - return priv->handle_motion (folder, physical_uri, destination_context, suggested_action, priv->user_data); -} - -static CORBA_boolean -impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleDrop (PortableServer_Servant servant, - const CORBA_char* physical_uri, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - const GNOME_Evolution_ShellComponentDnd_Action action, - const GNOME_Evolution_ShellComponentDnd_Data * data, CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponentDndDestinationFolder *folder; - DndDestinationFolderPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - folder = EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER (bonobo_object); - priv = folder->priv; - - return priv->handle_drop (folder, physical_uri, destination_context, action, data, priv->user_data); -} - -static POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder__vepv DestinationFolder_vepv; - -static POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder * -create_dnd_destination_servant (void) -{ - POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder *)g_new0 (BonoboObjectServant, 1); - servant->vepv = &DestinationFolder_vepv; - - CORBA_exception_init (&ev); - POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder__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 -destination_corba_class_init (void) -{ - POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder__vepv *vepv; - POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder__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_GNOME_Evolution_ShellComponentDnd_DestinationFolder__epv, 1); - epv->handleMotion = impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleMotion; - epv->handleDrop = impl_GNOME_Evolution_ShellComponentDnd_DestinationFolder_handleDrop; - - vepv = &DestinationFolder_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_ShellComponentDnd_DestinationFolder_epv = epv; -} - -static void -evolution_shell_component_dnd_destination_folder_class_init (EvolutionShellComponentDndDestinationFolderClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = dnd_destination_destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - - destination_corba_class_init (); -} - -static void -evolution_shell_component_dnd_destination_folder_init (EvolutionShellComponentDndDestinationFolder *folder) -{ - DndDestinationFolderPrivate *priv; - - priv = g_new (DndDestinationFolderPrivate, 1); - - folder->priv = priv; -} - - -E_MAKE_TYPE (evolution_shell_component_dnd_destination_folder, "EvolutionShellComponentDndDestinationFolder", - EvolutionShellComponentDndDestinationFolder, evolution_shell_component_dnd_destination_folder_class_init, - evolution_shell_component_dnd_destination_folder_init, PARENT_TYPE); - -static void -evolution_shell_component_dnd_destination_folder_construct (EvolutionShellComponentDndDestinationFolder *dnd_destination, - DndDestinationFolderHandleMotionFn handle_motion, - DndDestinationFolderHandleDropFn handle_drop, - gpointer user_data, - GNOME_Evolution_ShellComponentDnd_DestinationFolder corba_object) -{ - DndDestinationFolderPrivate *priv; - - g_return_if_fail (dnd_destination != NULL); - g_return_if_fail (IS_EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER (dnd_destination)); - g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - - priv = dnd_destination->priv; - - priv->handle_motion = handle_motion; - priv->handle_drop = handle_drop; - priv->user_data = user_data; - - bonobo_object_construct (BONOBO_OBJECT (dnd_destination), corba_object); -} - -EvolutionShellComponentDndDestinationFolder* -evolution_shell_component_dnd_destination_folder_new (DndDestinationFolderHandleMotionFn handle_motion, - DndDestinationFolderHandleDropFn handle_drop, - gpointer user_data) -{ - EvolutionShellComponentDndDestinationFolder *dnd_destination; - POA_GNOME_Evolution_ShellComponentDnd_DestinationFolder *servant; - GNOME_Evolution_ShellComponentDnd_DestinationFolder corba_object; - - g_return_val_if_fail (handle_motion != NULL, NULL); - g_return_val_if_fail (handle_drop != NULL, NULL); - - servant = create_dnd_destination_servant(); - if (servant == NULL) - return NULL; - - dnd_destination = gtk_type_new (evolution_shell_component_dnd_destination_folder_get_type ()); - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (dnd_destination), - servant); - - evolution_shell_component_dnd_destination_folder_construct (dnd_destination, - handle_motion, handle_drop, - user_data, - corba_object); - return dnd_destination; -} - diff --git a/shell/evolution-shell-component-dnd.h b/shell/evolution-shell-component-dnd.h deleted file mode 100644 index 1292f153f4..0000000000 --- a/shell/evolution-shell-component-dnd.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-dnd.h - * - * Copyright (C) 2000, 2001 Ximian, 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: Chris Toshok - */ - -#ifndef EVOLUTION_SHELL_COMPONENT_DND_H -#define EVOLUTION_SHELL_COMPONENT_DND_H - -#include <bonobo/bonobo-object.h> -#include "Evolution.h" - -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -/* Source Folder stuff */ -#define EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_TYPE (evolution_shell_component_dnd_source_folder_get_type ()) -#define EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_TYPE, EvolutionShellComponentDndSourceFolder)) -#define EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_TYPE, EvolutionShellComponentDndSourceFolderClass)) -#define IS_EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_TYPE)) -#define IS_EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_SHELL_COMPONENT_DND_SOURCE_FOLDER_TYPE)) - -typedef struct _DndSourceFolderPrivate DndSourceFolderPrivate; -typedef struct _EvolutionShellComponentDndSourceFolder EvolutionShellComponentDndSourceFolder; -typedef struct _EvolutionShellComponentDndSourceFolderClass EvolutionShellComponentDndSourceFolderClass; - -typedef void (*DndSourceFolderBeginDragFn)(EvolutionShellComponentDndSourceFolder *folder, - const char *physical_uri, - const char *folder_type, - GNOME_Evolution_ShellComponentDnd_ActionSet *possible_actions_return, - GNOME_Evolution_ShellComponentDnd_Action *suggested_action_return, - gpointer closure); -typedef void (*DndSourceFolderGetDataFn)(EvolutionShellComponentDndSourceFolder *folder, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context * source_context, - const GNOME_Evolution_ShellComponentDnd_Action action, - const char * dnd_type, - GNOME_Evolution_ShellComponentDnd_Data ** data_return, - CORBA_Environment *ev, - gpointer closure); -typedef void (*DndSourceFolderDeleteDataFn)(EvolutionShellComponentDndSourceFolder *folder, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context *source_context, - gpointer closure); -typedef void (*DndSourceFolderEndDragFn)(EvolutionShellComponentDndSourceFolder *folder, - const GNOME_Evolution_ShellComponentDnd_SourceFolder_Context *source_context, - gpointer closure); - -struct _EvolutionShellComponentDndSourceFolder { - BonoboObject object; - DndSourceFolderPrivate *priv; -}; - -struct _EvolutionShellComponentDndSourceFolderClass { - BonoboObjectClass parent_class; -}; - -GtkType evolution_shell_component_dnd_source_folder_get_type (void); - -EvolutionShellComponentDndSourceFolder* -evolution_shell_component_dnd_source_folder_new (DndSourceFolderBeginDragFn begin_drag, - DndSourceFolderGetDataFn get_data, - DndSourceFolderDeleteDataFn delete_data, - DndSourceFolderEndDragFn end_drag, - gpointer user_data); - - - -/* Destination Folder stuff */ -#define EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_TYPE (evolution_shell_component_dnd_destination_folder_get_type ()) -#define EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_TYPE, EvolutionShellComponentDndDestinationFolder)) -#define EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_TYPE, EvolutionShellComponentDndDestinationFolderClass)) -#define IS_EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_TYPE)) -#define IS_EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_SHELL_COMPONENT_DND_DESTINATION_FOLDER_TYPE)) - -typedef struct _DndDestinationFolderPrivate DndDestinationFolderPrivate; -typedef struct _EvolutionShellComponentDndDestinationFolder EvolutionShellComponentDndDestinationFolder; -typedef struct _EvolutionShellComponentDndDestinationFolderClass EvolutionShellComponentDndDestinationFolderClass; - -typedef CORBA_boolean (*DndDestinationFolderHandleMotionFn)(EvolutionShellComponentDndDestinationFolder *folder, - const char *physical_uri, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - GNOME_Evolution_ShellComponentDnd_Action * suggested_action_return, - gpointer closure); -typedef CORBA_boolean (*DndDestinationFolderHandleDropFn)(EvolutionShellComponentDndDestinationFolder *folder, - const char *physical_uri, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - const GNOME_Evolution_ShellComponentDnd_Action action, - const GNOME_Evolution_ShellComponentDnd_Data * data, - gpointer closure); - -struct _EvolutionShellComponentDndDestinationFolder { - BonoboObject object; - DndDestinationFolderPrivate *priv; -}; - -struct _EvolutionShellComponentDndDestinationFolderClass { - BonoboObjectClass parent_class; -}; - -GtkType evolution_shell_component_dnd_destination_folder_get_type (void); - -EvolutionShellComponentDndDestinationFolder* -evolution_shell_component_dnd_destination_folder_new (DndDestinationFolderHandleMotionFn handle_motion, - DndDestinationFolderHandleDropFn handle_drop, - gpointer user_data); - -#ifdef cplusplus -} -#endif /* cplusplus */ - -#endif /* EVOLUTION_SHELL_COMPONENT_DND_H */ diff --git a/shell/evolution-shell-component-utils.c b/shell/evolution-shell-component-utils.c deleted file mode 100644 index e056fc54b3..0000000000 --- a/shell/evolution-shell-component-utils.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-utils.c - * - * Copyright (C) 2000, 2001 Ximian, 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. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-shell-component-utils.h" - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> -#include <bonobo/bonobo-ui-util.h> - -static void free_pixmaps (void); -static GSList *inited_arrays = NULL; - -void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache) -{ - static int done_init = 0; - int i; - - if (!done_init) { - g_atexit (free_pixmaps); - done_init = 1; - } - - if (g_slist_find (inited_arrays, pixcache) == NULL) - inited_arrays = g_slist_prepend (inited_arrays, pixcache); - - for (i = 0; pixcache [i].path; i++) { - if (!pixcache [i].pixbuf) { - char *path; - GdkPixbuf *pixbuf; - - path = g_concat_dir_and_file (EVOLUTION_IMAGES, - pixcache [i].fname); - - pixbuf = gdk_pixbuf_new_from_file (path); - if (pixbuf == NULL) { - g_warning ("Cannot load image -- %s", path); - } else { - pixcache [i].pixbuf = bonobo_ui_util_pixbuf_to_xml (pixbuf); - gdk_pixbuf_unref (pixbuf); - bonobo_ui_component_set_prop (uic, - pixcache [i].path, "pixname", - pixcache [i].pixbuf, NULL); - } - - g_free (path); - } else { - bonobo_ui_component_set_prop (uic, pixcache [i].path, - "pixname", - pixcache [i].pixbuf, - NULL); - } - } -} - -static void -free_pixmaps (void) -{ - int i; - GSList *li; - - for (li = inited_arrays; li != NULL; li = li->next) { - EPixmap *pixcache = li->data; - for (i = 0; pixcache [i].path; i++) - g_free (pixcache [i].pixbuf); - } - - g_slist_free (inited_arrays); -} - diff --git a/shell/evolution-shell-component-utils.h b/shell/evolution-shell-component-utils.h deleted file mode 100644 index 4cf021ca64..0000000000 --- a/shell/evolution-shell-component-utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component-utils.h - * - * Copyright (C) 2000, 2001 Ximian, 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. - */ - -#ifndef __EVOLUTION_SHELL_COMPONENT_UTILS_H__ -#define __EVOLUTION_SHELL_COMPONENT_UTILS_H__ - -#include <bonobo/bonobo-ui-component.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -typedef struct _EPixmap { - const char *path; - const char *fname; - char *pixbuf; -} EPixmap; - -#define E_PIXMAP(path,fname) { (path), (fname), NULL } -#define E_PIXMAP_END { NULL, NULL, NULL } - -/* Takes an array of pixmaps, terminated by E_PIXMAP_END, and loads into uic */ -void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_SHELL_COMPONENT_UTILS_H__ */ diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c deleted file mode 100644 index 341091dd29..0000000000 --- a/shell/evolution-shell-component.c +++ /dev/null @@ -1,831 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.c - * - * Copyright (C) 2000, 2001 Ximian, 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 "evolution-shell-component.h" - -#include <fcntl.h> - -#include <glib.h> -#include <gtk/gtksignal.h> -#include <bonobo/bonobo-object.h> -#include <libgnome/gnome-i18n.h> - -#include <gal/util/e-util.h> - -#include "Evolution.h" - - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE - -static GtkObjectClass *parent_class = NULL; - -struct _UserCreatableItemType { - char *id; - char *description; - char *menu_description; - char menu_shortcut; -}; -typedef struct _UserCreatableItemType UserCreatableItemType; - -struct _EvolutionShellComponentPrivate { - GList *folder_types; /* EvolutionShellComponentFolderType */ - GList *external_uri_schemas; /* char * */ - - EvolutionShellComponentCreateViewFn create_view_fn; - EvolutionShellComponentCreateFolderFn create_folder_fn; - EvolutionShellComponentRemoveFolderFn remove_folder_fn; - EvolutionShellComponentXferFolderFn xfer_folder_fn; - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn; - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn; - - EvolutionShellClient *owner_client; - - GSList *user_creatable_item_types; /* UserCreatableItemType */ - - void *closure; -}; - -enum { - OWNER_SET, - OWNER_UNSET, - DEBUG, - HANDLE_EXTERNAL_URI, - USER_CREATE_NEW_ITEM, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* UserCreatableItemType handling. */ - -static UserCreatableItemType * -user_creatable_item_type_new (const char *id, - const char *description, - const char *menu_description, - char menu_shortcut) -{ - UserCreatableItemType *type; - - type = g_new (UserCreatableItemType, 1); - type->id = g_strdup (id); - type->description = g_strdup (description); - type->menu_description = g_strdup (menu_description); - type->menu_shortcut = menu_shortcut; - - return type; -} - -static void -user_creatable_item_type_free (UserCreatableItemType *type) -{ - g_free (type->id); - g_free (type->description); - g_free (type->menu_description); - - g_free (type); -} - - -/* Helper functions. */ - -/* Notice that, if passed a NULL pointer, this string will construct a - zero-element NULL-terminated string array instead of returning NULL itself - (i.e. it will return a pointer to a single g_malloc()ed NULL pointer). */ -static char ** -duplicate_null_terminated_string_array (char *array[]) -{ - char **new; - int count; - int i; - - if (array == NULL) { - count = 0; - } else { - for (count = 0; array[count] != NULL; count++) - ; - } - - new = g_new (char *, count + 1); - - for (i = 0; i < count; i++) - new[i] = g_strdup (array[i]); - new[count] = NULL; - - return new; -} - -/* The following will create a CORBA sequence of strings from the specified - * NULL-terminated array, without duplicating the strings. */ -static void -fill_corba_sequence_from_null_terminated_string_array (CORBA_sequence_CORBA_string *corba_sequence, - char **array) -{ - int count; - int i; - - g_assert (corba_sequence != NULL); - g_assert (array != NULL); - - CORBA_sequence_set_release (corba_sequence, TRUE); - - count = 0; - while (array[count] != NULL) - count++; - - corba_sequence->_maximum = count; - corba_sequence->_length = count; - corba_sequence->_buffer = CORBA_sequence_CORBA_string_allocbuf (count); - - for (i = 0; i < count; i++) - corba_sequence->_buffer[i] = CORBA_string_dup (array[i]); -} - - -/* CORBA interface implementation. */ - -static GNOME_Evolution_FolderTypeList * -impl__get_supportedTypes (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_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 = GNOME_Evolution_FolderTypeList__alloc (); - CORBA_sequence_set_release (folder_type_list, TRUE); - folder_type_list->_length = g_list_length (priv->folder_types); - folder_type_list->_maximum = folder_type_list->_length; - folder_type_list->_buffer = CORBA_sequence_GNOME_Evolution_FolderType_allocbuf (folder_type_list->_maximum); - - for (p = priv->folder_types, i = 0; p != NULL; p = p->next, i++) { - GNOME_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->iconName = CORBA_string_dup (folder_type->icon_name); - corba_folder_type->displayName = CORBA_string_dup (folder_type->display_name); - corba_folder_type->description = CORBA_string_dup (folder_type->description); - corba_folder_type->userCreatable = folder_type->user_creatable; - - fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->acceptedDndTypes, - folder_type->accepted_dnd_types); - fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->exportedDndTypes, - folder_type->exported_dnd_types); - } - - CORBA_sequence_set_release (folder_type_list, TRUE); - - return folder_type_list; -} - -static GNOME_Evolution_URISchemaList * -impl__get_externalUriSchemas (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_URISchemaList *uri_schema_list; - GList *p; - int i; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - uri_schema_list = GNOME_Evolution_URISchemaList__alloc (); - - /* FIXME: We could probably keep this to FALSE and avoid - CORBA_string_duplicating. */ - CORBA_sequence_set_release (uri_schema_list, TRUE); - - if (priv->external_uri_schemas == NULL) { - uri_schema_list->_length = 0; - uri_schema_list->_maximum = 0; - uri_schema_list->_buffer = NULL; - return uri_schema_list; - } - - uri_schema_list->_length = g_list_length (priv->external_uri_schemas); - uri_schema_list->_maximum = uri_schema_list->_length; - uri_schema_list->_buffer = CORBA_sequence_GNOME_Evolution_URISchema_allocbuf (uri_schema_list->_maximum); - - for (p = priv->external_uri_schemas, i = 0; p != NULL; p = p->next, i++) { - const char *schema; - - schema = (const char *) p->data; - uri_schema_list->_buffer[i] = CORBA_string_dup (schema); - } - - return uri_schema_list; -} - -static GNOME_Evolution_UserCreatableItemTypeList * -impl__get_userCreatableItemTypes (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_Evolution_UserCreatableItemTypeList *list; - GSList *p; - int i; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - list = GNOME_Evolution_UserCreatableItemTypeList__alloc (); - list->_maximum = g_slist_length (priv->user_creatable_item_types); - list->_length = list->_maximum; - list->_buffer = CORBA_sequence_GNOME_Evolution_UserCreatableItemType_allocbuf (list->_maximum); - - for (p = priv->user_creatable_item_types, i = 0; p != NULL; p = p->next, i ++) { - GNOME_Evolution_UserCreatableItemType *corba_type; - const UserCreatableItemType *type; - - corba_type = list->_buffer + i; - type = (const UserCreatableItemType *) p->data; - - corba_type->id = CORBA_string_dup (type->id); - corba_type->description = CORBA_string_dup (type->description); - corba_type->menuDescription = CORBA_string_dup (type->menu_description); - corba_type->menuShortcut = type->menu_shortcut; - } - - CORBA_sequence_set_release (list, TRUE); - - return list; -} - -static void -impl_setOwner (PortableServer_Servant servant, - const GNOME_Evolution_Shell shell, - const CORBA_char *evolution_homedir, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - GNOME_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_GNOME_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_unsetOwner (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_GNOME_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 void -impl_debug (PortableServer_Servant servant, - const CORBA_char *log_path, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionShellComponent *shell_component; - int fd; - - bonobo_object = bonobo_object_from_servant (servant); - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); - - fd = open (log_path, O_WRONLY | O_APPEND); - if (!fd) - return; - - dup2 (fd, STDOUT_FILENO); - dup2 (fd, STDERR_FILENO); - close (fd); - - gtk_signal_emit (GTK_OBJECT (shell_component), signals[DEBUG]); -} - -static Bonobo_Control -impl_createView (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_GNOME_Evolution_ShellComponent_UnsupportedType, - NULL); - break; - case EVOLUTION_SHELL_COMPONENT_INTERNALERROR: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_InternalError, - NULL); - break; - default: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_ShellComponent_NotFound, - NULL); - } - - return CORBA_OBJECT_NIL; - } - - return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev); -} - -static void -impl_handleExternalURI (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - - gtk_signal_emit (GTK_OBJECT (shell_component), signals[HANDLE_EXTERNAL_URI], uri); -} - -static void -impl_createFolderAsync (PortableServer_Servant servant, - const GNOME_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) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->create_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); -} - -static void -impl_removeFolderAsync (PortableServer_Servant servant, - const GNOME_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->remove_folder_fn == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->remove_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); -} - -static void -impl_xferFolderAsync (PortableServer_Servant servant, - const GNOME_Evolution_ShellComponentListener listener, - const CORBA_char *source_physical_uri, - const CORBA_char *destination_physical_uri, - const CORBA_char *type, - const CORBA_boolean remove_source, - 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->xfer_folder_fn == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - ev); - return; - } - - (* priv->xfer_folder_fn) (shell_component, - source_physical_uri, - destination_physical_uri, - type, - remove_source, - listener, - priv->closure); -} - -static void -impl_populateFolderContextMenu (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)); -} - -static void -impl_userCreateNewItem (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *parent_physical_uri, - const CORBA_char *parent_type, - CORBA_Environment *ev) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - - shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object_from_servant (servant)); - priv = shell_component->priv; - - /* FIXME: Check that the type is good. */ - - gtk_signal_emit (GTK_OBJECT (shell_component), signals[USER_CREATE_NEW_ITEM], id, parent_physical_uri, parent_type); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentPrivate *priv; - CORBA_Environment ev; - GSList *sp; - 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_strfreev (folder_type->exported_dnd_types); - g_strfreev (folder_type->accepted_dnd_types); - - g_free (folder_type); - } - g_list_free (priv->folder_types); - - e_free_string_list (priv->external_uri_schemas); - - for (sp = priv->user_creatable_item_types; sp != NULL; sp = sp->next) - user_creatable_item_type_free ((UserCreatableItemType *) sp->data); - g_slist_free (priv->user_creatable_item_types); - - g_free (priv); - - parent_class->destroy (object); -} - - -/* Initialization. */ - -static void -class_init (EvolutionShellComponentClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_ShellComponent__epv *epv = &klass->epv; - - 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); - - signals[DEBUG] - = gtk_signal_new ("debug", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, debug), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[HANDLE_EXTERNAL_URI] - = gtk_signal_new ("handle_external_uri", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, handle_external_uri), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - signals[USER_CREATE_NEW_ITEM] - = gtk_signal_new ("user_create_new_item", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, user_create_new_item), - gtk_marshal_NONE__POINTER_POINTER_POINTER, - GTK_TYPE_NONE, 3, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - parent_class = gtk_type_class (PARENT_TYPE); - - epv->_get_supportedTypes = impl__get_supportedTypes; - epv->_get_externalUriSchemas = impl__get_externalUriSchemas; - epv->_get_userCreatableItemTypes = impl__get_userCreatableItemTypes; - epv->setOwner = impl_setOwner; - epv->unsetOwner = impl_unsetOwner; - epv->debug = impl_debug; - epv->createView = impl_createView; - epv->handleExternalURI = impl_handleExternalURI; - epv->createFolderAsync = impl_createFolderAsync; - epv->removeFolderAsync = impl_removeFolderAsync; - epv->xferFolderAsync = impl_xferFolderAsync; - epv->populateFolderContextMenu = impl_populateFolderContextMenu; - epv->userCreateNewItem = impl_userCreateNewItem; -} - -static void -init (EvolutionShellComponent *shell_component) -{ - EvolutionShellComponentPrivate *priv; - - priv = g_new (EvolutionShellComponentPrivate, 1); - - priv->folder_types = NULL; - priv->external_uri_schemas = NULL; - - priv->create_view_fn = NULL; - priv->create_folder_fn = NULL; - priv->remove_folder_fn = NULL; - priv->xfer_folder_fn = NULL; - priv->populate_folder_context_menu_fn = NULL; - - priv->owner_client = NULL; - priv->user_creatable_item_types = NULL; - priv->closure = NULL; - - shell_component->priv = priv; -} - - -void -evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - void *closure) -{ - EvolutionShellComponentPrivate *priv; - int i; - - g_return_if_fail (shell_component != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component)); - g_return_if_fail (folder_types != NULL); - - 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->xfer_folder_fn = xfer_folder_fn; - priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn; - priv->get_dnd_selection_fn = get_dnd_selection_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); - - /* Notice that these get translated here. */ - new->display_name = g_strdup (_(folder_types[i].display_name)); - new->description = g_strdup (_(folder_types[i].description)); - - new->user_creatable = folder_types[i].user_creatable; - new->accepted_dnd_types = duplicate_null_terminated_string_array (folder_types[i].accepted_dnd_types); - new->exported_dnd_types = duplicate_null_terminated_string_array (folder_types[i].exported_dnd_types); - - 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); - - if (external_uri_schemas != NULL) { - for (i = 0; external_uri_schemas[i] != NULL; i++) - priv->external_uri_schemas = g_list_prepend (priv->external_uri_schemas, - g_strdup (external_uri_schemas[i])); - } -} - -EvolutionShellComponent * -evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - void *closure) -{ - EvolutionShellComponent *new; - - g_return_val_if_fail (folder_types != NULL, NULL); - - new = gtk_type_new (evolution_shell_component_get_type ()); - - evolution_shell_component_construct (new, - folder_types, - external_uri_schemas, - create_view_fn, - create_folder_fn, - remove_folder_fn, - xfer_folder_fn, - populate_folder_context_menu_fn, - get_dnd_selection_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; -} - - -void -evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - char menu_shortcut) -{ - EvolutionShellComponentPrivate *priv; - UserCreatableItemType *type; - - g_return_if_fail (shell_component != NULL); - g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component)); - g_return_if_fail (id != NULL); - g_return_if_fail (description != NULL); - g_return_if_fail (menu_description != NULL); - - priv = shell_component->priv; - - type = user_creatable_item_type_new (id, description, menu_description, menu_shortcut); - - priv->user_creatable_item_types = g_slist_prepend (priv->user_creatable_item_types, type); -} - - -E_MAKE_X_TYPE (evolution_shell_component, "EvolutionShellComponent", EvolutionShellComponent, - class_init, init, PARENT_TYPE, - POA_GNOME_Evolution_ShellComponent__init, - GTK_STRUCT_OFFSET (EvolutionShellComponentClass, epv)) diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h deleted file mode 100644 index 6fe70ac8fe..0000000000 --- a/shell/evolution-shell-component.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-component.h - * - * Copyright (C) 2000, 2001 Ximian, 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 - -#include <bonobo/bonobo-xobject.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)) - -#define EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER "/popups/FolderPopup/ComponentPlaceholder" - - -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_UNSUPPORTEDSCHEMA, - 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 GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentXferFolderFn) (EvolutionShellComponent *shell_component, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - const GNOME_Evolution_ShellComponentListener listener, - void *closure); -typedef void (* EvolutionShellComponentPopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component, - BonoboUIComponent *uic, - const char *physical_uri, - const char *type, - void *closure); -typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellComponent *shell_component, - const char *physical_uri, - int type, - int *format_return, - const char **selection_return, - int *selection_length_return, - void *closure); - -struct _EvolutionShellComponentFolderType { - char *name; - char *icon_name; - char *display_name; - char *description; - - gboolean user_creatable; - - /* The following are NULL-terminated arrays. */ - char **accepted_dnd_types; - char **exported_dnd_types; -}; -typedef struct _EvolutionShellComponentFolderType EvolutionShellComponentFolderType; - -struct _EvolutionShellComponent { - BonoboXObject parent; - - EvolutionShellComponentPrivate *priv; -}; - -struct _EvolutionShellComponentClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_ShellComponent__epv epv; - - /* Signals. */ - - void (* owner_set) (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir); - void (* owner_unset) (EvolutionShellComponent *shell_component); - void (* debug) (EvolutionShellComponent *shell_component); - - void (* handle_external_uri) (EvolutionShellComponent *shell_component, - const char *uri); - - void (* user_create_new_item) (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type); -}; - - -GtkType evolution_shell_component_get_type (void); -void evolution_shell_component_construct (EvolutionShellComponent *shell_component, - const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - void *closure); -EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[], - const char *external_uri_schemas[], - EvolutionShellComponentCreateViewFn create_view_fn, - EvolutionShellComponentCreateFolderFn create_folder_fn, - EvolutionShellComponentRemoveFolderFn remove_folder_fn, - EvolutionShellComponentXferFolderFn xfer_folder_fn, - EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn, - EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn, - void *closure); -EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); - -void evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - char menu_shortcut); - -#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 75639f33d2..0000000000 --- a/shell/evolution-shell-view.c +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-view.c - * - * Copyright (C) 2000 Ximian, 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 <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, - SET_FOLDER_BAR_LABEL, - LAST_SIGNAL -}; -static int signals[LAST_SIGNAL] = { 0 }; - - -/* CORBA interface implementation. */ - -static POA_GNOME_Evolution_ShellView__vepv ShellView_vepv; - -static POA_GNOME_Evolution_ShellView * -create_servant (void) -{ - POA_GNOME_Evolution_ShellView *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_ShellView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &ShellView_vepv; - CORBA_exception_init (&ev); - - POA_GNOME_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, - const 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, - const 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); -} - -static void -impl_ShellView_set_folder_bar_label (PortableServer_Servant servant, - const CORBA_char *text, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[SET_FOLDER_BAR_LABEL], - text); -} - - -/* 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_GNOME_Evolution_ShellView__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_ShellView__epv, 1); - epv->setMessage = impl_ShellView_set_message; - epv->unsetMessage = impl_ShellView_unset_message; - epv->changeCurrentView = impl_ShellView_change_current_view; - epv->setTitle = impl_ShellView_set_title; - epv->setFolderBarLabel = impl_ShellView_set_folder_bar_label; - - vepv = &ShellView_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_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); - - signals[SET_FOLDER_BAR_LABEL] - = gtk_signal_new ("set_folder_bar_label", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionShellViewClass, set_folder_bar_label), - 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, - GNOME_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_GNOME_Evolution_ShellView *servant; - GNOME_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 1fd72c0fe9..0000000000 --- a/shell/evolution-shell-view.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-shell-view.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <glib.h> -#include <bonobo/bonobo-object.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); - void (* set_folder_bar_label) (EvolutionShellView *shell_view, const char *text); -}; - - -GtkType evolution_shell_view_get_type (void); -void evolution_shell_view_construct (EvolutionShellView *shell_view, - GNOME_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 e5ac390f4a..0000000000 --- a/shell/evolution-storage-listener.c +++ /dev/null @@ -1,355 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-listener.c - * - * Copyright (C) 2000 Ximian, 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 <bonobo/bonobo-main.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 { - GNOME_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_GNOME_Evolution_StorageListener__vepv my_GNOME_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_GNOME_Evolution_StorageListener_notifyDestroyed (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_GNOME_Evolution_StorageListener_notifyFolderCreated (PortableServer_Servant servant, - const CORBA_char *path, - const GNOME_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_GNOME_Evolution_StorageListener_notifyFolderUpdated (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_long unread_count, - 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); -} - -static void -impl_GNOME_Evolution_StorageListener_notifyFolderRemoved (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_GNOME_Evolution_StorageListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EvolutionStorageListenerServant, 1); - corba_servant = (POA_GNOME_Evolution_StorageListener *) servant; - - corba_servant->vepv = &my_GNOME_Evolution_StorageListener_vepv; - POA_GNOME_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 GNOME_Evolution_StorageListener -activate_servant (EvolutionStorageListener *listener, - POA_GNOME_Evolution_StorageListener *servant) -{ - GNOME_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_GNOME_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_GNOME_Evolution_StorageListener__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_StorageListener__epv, 1); - epv->notifyDestroyed = impl_GNOME_Evolution_StorageListener_notifyDestroyed; - epv->notifyFolderCreated = impl_GNOME_Evolution_StorageListener_notifyFolderCreated; - epv->notifyFolderUpdated = impl_GNOME_Evolution_StorageListener_notifyFolderUpdated; - epv->notifyFolderRemoved = impl_GNOME_Evolution_StorageListener_notifyFolderRemoved; - - vepv = & my_GNOME_Evolution_StorageListener_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_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), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - 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, - GNOME_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; - GNOME_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_GNOME_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. - **/ -GNOME_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 5d813af408..0000000000 --- a/shell/evolution-storage-listener.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-listener.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <gtk/gtkobject.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 GNOME_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_GNOME_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, - GNOME_Evolution_StorageListener corba_objref); -EvolutionStorageListener *evolution_storage_listener_new (void); - -GNOME_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 9f2f30dee1..0000000000 --- a/shell/evolution-storage-set-view-factory.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-factory.c - * - * Copyright (C) 2000 Ximian, 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, NULL /*XXX*/); - gtk_widget_show (storage_set_view); - - e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); - - 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 f5a9ee63c3..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 Ximian, 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 3edfa14e24..0000000000 --- a/shell/evolution-storage-set-view-listener.c +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage-set-view-listener.c - * - * Copyright (C) 2000 Ximian, 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 <bonobo/bonobo-main.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 { - GNOME_Evolution_StorageSetViewListener corba_listener; - EvolutionStorageSetViewListenerServant *servant; -}; - -enum { - FOLDER_SELECTED, - STORAGE_SELECTED, - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Evolution::StorageSetViewListener implementation. */ - -static POA_GNOME_Evolution_StorageSetViewListener__vepv my_GNOME_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_GNOME_Evolution_StorageSetViewListener_notifyFolderSelected (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_GNOME_Evolution_StorageSetViewListener_notifyStorageSelected (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_GNOME_Evolution_StorageSetViewListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EvolutionStorageSetViewListenerServant, 1); - corba_servant = (POA_GNOME_Evolution_StorageSetViewListener *) servant; - - corba_servant->vepv = &my_GNOME_Evolution_StorageSetViewListener_vepv; - POA_GNOME_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 GNOME_Evolution_StorageSetViewListener -activate_servant (EvolutionStorageSetViewListener *listener, - POA_GNOME_Evolution_StorageSetViewListener *servant) -{ - GNOME_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_GNOME_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_GNOME_Evolution_StorageSetViewListener__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_StorageSetViewListener__epv, 1); - epv->notifyFolderSelected = impl_GNOME_Evolution_StorageSetViewListener_notifyFolderSelected; - epv->notifyStorageSelected = impl_GNOME_Evolution_StorageSetViewListener_notifyStorageSelected; - - vepv = & my_GNOME_Evolution_StorageSetViewListener_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_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, - GNOME_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; - GNOME_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_GNOME_Evolution_StorageSetViewListener *) priv->servant); - - evolution_storage_set_view_listener_construct (new, corba_listener); - - return new; -} - -GNOME_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 ad91f7b76d..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 Ximian, 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_GNOME_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, - GNOME_Evolution_StorageSetViewListener corba_objref); -EvolutionStorageSetViewListener *evolution_storage_set_view_listener_new (void); - -GNOME_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 6aaac40c56..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 Ximian, 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 "evolution-storage-set-view.h" -#include <gal/util/e-util.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; - GNOME_Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (GNOME_Evolution_StorageSetViewListener) p->data; - GNOME_Evolution_StorageSetViewListener_notifyFolderSelected (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 *name, - 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; - GNOME_Evolution_StorageSetViewListener listener; - - CORBA_exception_init (&ev); - - listener = (GNOME_Evolution_StorageSetViewListener) p->data; - GNOME_Evolution_StorageSetViewListener_notifyStorageSelected (listener, name, &ev); - - /* FIXME: What if we fail? */ - - CORBA_exception_free (&ev); - } -} - - -/* Listener handling. */ - -static GList * -find_listener_in_list (GNOME_Evolution_StorageSetViewListener listener, - GList *list) -{ - CORBA_Environment ev; - GList *p; - - CORBA_exception_init (&ev); - - for (p = list; p != NULL; p = p->next) { - GNOME_Evolution_StorageSetViewListener listener_item; - - listener_item = (GNOME_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, - GNOME_Evolution_StorageSetViewListener listener) -{ - EvolutionStorageSetViewPrivate *priv; - CORBA_Environment ev; - const char *current_uri; - GNOME_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) - GNOME_Evolution_StorageSetViewListener_notifyFolderSelected (listener, current_uri, &ev); - - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -remove_listener (EvolutionStorageSetView *storage_set_view, - GNOME_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_GNOME_Evolution_StorageSetView__vepv StorageSetView_vepv; - -static POA_GNOME_Evolution_StorageSetView * -create_servant (void) -{ - POA_GNOME_Evolution_StorageSetView *servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = (POA_GNOME_Evolution_StorageSetView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &StorageSetView_vepv; - - POA_GNOME_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 GNOME_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_GNOME_Evolution_StorageSetView_AlreadyListening, NULL); -} - -static void -impl_StorageSetView_remove_listener (PortableServer_Servant servant, - const GNOME_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_GNOME_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) { - GNOME_Evolution_StorageSetViewListener listener; - - listener = (GNOME_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_GNOME_Evolution_StorageSetView__vepv *vepv; - POA_GNOME_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_GNOME_Evolution_StorageSetView__epv, 1); - epv->addListener = impl_StorageSetView_add_listener; - epv->removeListener = impl_StorageSetView_remove_listener; - epv->_set_showFolders = impl_StorageSetView__set_show_folders; - epv->_get_showFolders = impl_StorageSetView__get_show_folders; - - vepv = &StorageSetView_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_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, - GNOME_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_GNOME_Evolution_StorageSetView *servant; - GNOME_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 220e0012e2..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 Ximian, 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, - GNOME_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 b4af27ec5b..0000000000 --- a/shell/evolution-storage.c +++ /dev/null @@ -1,1023 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage.c - * - * Copyright (C) 2000, 2001 Ximian, 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/gtksignal.h> -#include <bonobo/bonobo-object.h> - -#include <gal/util/e-util.h> - -#include "Evolution.h" - -#include "e-folder-tree.h" - -#include "evolution-storage.h" - - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionStoragePrivate { - /* Name of the storage. */ - char *name; - - /* What we will display as the name of the storage. */ - char *display_name; - - /* URI for the toplevel node of the storage. */ - char *toplevel_node_uri; - - /* Type for the toplevel node of the storage. */ - char *toplevel_node_type; - - /* The set of folders we have in this storage. */ - EFolderTree *folder_tree; - - /* Mappings from URIs to folder tree paths. */ - GHashTable *uri_to_path; - - /* The listener registered on this storage. */ - GList *corba_storage_listeners; -}; - - -enum { - CREATE_FOLDER, - REMOVE_FOLDER, - UPDATE_FOLDER, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Utility functions. */ - -static const CORBA_char * -safe_corba_string (const char *s) -{ - if (s == NULL) - return (CORBA_char *) ""; - - return s; -} - -static void -list_through_listener_foreach (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - const GNOME_Evolution_Folder *corba_folder; - GNOME_Evolution_StorageListener corba_listener; - CORBA_Environment ev; - - corba_folder = (GNOME_Evolution_Folder *) data; - corba_listener = (GNOME_Evolution_StorageListener) closure; - - /* The root folder has no data. */ - if (corba_folder == NULL) - return; - - CORBA_exception_init (&ev); - GNOME_Evolution_StorageListener_notifyFolderCreated (corba_listener, path, corba_folder, &ev); - CORBA_exception_free (&ev); -} - -static void -list_through_listener (EvolutionStorage *storage, - GNOME_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 GNOME_Evolution_StorageListener listener, - GList *list) -{ - CORBA_Environment ev; - GList *p; - - CORBA_exception_init (&ev); - - for (p = list; p != NULL; p = p->next) { - GNOME_Evolution_StorageListener listener_item; - - listener_item = (GNOME_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 GNOME_Evolution_StorageListener listener) -{ - EvolutionStoragePrivate *priv; - GNOME_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 GNOME_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) -{ - GNOME_Evolution_Folder *corba_folder; - - corba_folder = (GNOME_Evolution_Folder *) data; - CORBA_free (data); -} - - -/* CORBA interface implementation. */ - -static POA_GNOME_Evolution_Storage__vepv Storage_vepv; - -static POA_GNOME_Evolution_Storage * -create_servant (void) -{ - POA_GNOME_Evolution_Storage *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_Storage *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &Storage_vepv; - - CORBA_exception_init (&ev); - - POA_GNOME_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_async_create_folder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *type, - const CORBA_char *description, - const CORBA_char *parent_physical_uri, - const Bonobo_Listener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - CORBA_Object obj_dup; - EvolutionStorage *storage; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - - obj_dup = CORBA_Object_duplicate (listener, ev); - gtk_signal_emit (GTK_OBJECT (storage), signals[CREATE_FOLDER], - obj_dup, path, type, description, parent_physical_uri); -} - - -static void -impl_Storage_async_remove_folder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *physical_uri, - const Bonobo_Listener listener, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStorage *storage; - - CORBA_Object obj_dup; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - - obj_dup = CORBA_Object_duplicate (listener, ev); - gtk_signal_emit (GTK_OBJECT (storage), signals[REMOVE_FOLDER], - obj_dup, path, physical_uri); -} - -static void -impl_Storage_async_xfer_folder (PortableServer_Servant servant, - const CORBA_char *source_path, - const CORBA_char *destination_path, - const CORBA_boolean remove_source, - const Bonobo_Listener listener, - CORBA_Environment *ev) -{ - g_print ("FIXME: impl_Storage_async_xfer_folder -- implement me!\n"); -} - -static void -impl_Storage_updateFolder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_long unread_count, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionStoragePrivate *priv; - EvolutionStorage *storage; - GList *p; - - bonobo_object = bonobo_object_from_servant (servant); - storage = EVOLUTION_STORAGE (bonobo_object); - - gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATE_FOLDER], - path, display_name, unread_count); - - priv = storage->priv; - - if (priv->corba_storage_listeners == NULL) - return; - - CORBA_exception_init (ev); - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - GNOME_Evolution_StorageListener listener; - - listener = p->data; - GNOME_Evolution_StorageListener_notifyFolderUpdated (listener, - path, - display_name, - unread_count, - ev); - - if (ev->_major != CORBA_NO_EXCEPTION) - continue; - - /* FIXME: Handle errors */ - - break; - } - - CORBA_exception_free (ev); -} - -static void -impl_Storage_add_listener (PortableServer_Servant servant, - const GNOME_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_GNOME_Evolution_Storage_AlreadyListening, NULL); -} - -static void -impl_Storage_remove_listener (PortableServer_Servant servant, - const GNOME_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_GNOME_Evolution_Storage_NotFound, NULL); -} - - -/* GtkObject methods. */ - -static void -free_mapping (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - g_free (value); -} - -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); - g_free (priv->toplevel_node_uri); - g_free (priv->toplevel_node_type); - if (priv->folder_tree != NULL) - e_folder_tree_destroy (priv->folder_tree); - if (priv->uri_to_path != NULL) { - g_hash_table_foreach (priv->uri_to_path, free_mapping, NULL); - g_hash_table_destroy (priv->uri_to_path); - } - - CORBA_exception_init (&ev); - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - GNOME_Evolution_StorageListener listener; - - listener = p->data; - - GNOME_Evolution_StorageListener_notifyDestroyed (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_GNOME_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->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_Storage_epv = evolution_storage_get_epv (); -} - -/* The worst signal marshaller in Scotland */ -typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER) (GtkObject *, - gpointer, gpointer, gpointer, gpointer, gpointer, - gpointer user_data); - -static void -e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER rfunc; - - rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER) func; - (*rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - GTK_VALUE_POINTER (args[2]), - GTK_VALUE_POINTER (args[3]), - GTK_VALUE_POINTER (args[4]), - func_data); -} - -typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER) (GtkObject *, - gpointer, gpointer, gpointer, - gpointer user_data); - -static void -e_marshal_NONE__POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkSignal_NONE__POINTER_POINTER_POINTER rfunc; - - rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER) func; - (*rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - GTK_VALUE_POINTER (args[2]), - func_data); -} - -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 ()); - - signals[CREATE_FOLDER] = gtk_signal_new ("create_folder", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageClass, - create_folder), - e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER, - GTK_TYPE_INT, 4, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - signals[REMOVE_FOLDER] = gtk_signal_new ("remove_folder", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageClass, - remove_folder), - e_marshal_NONE__POINTER_POINTER_POINTER, - GTK_TYPE_INT, 2, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - signals[UPDATE_FOLDER] = gtk_signal_new ("update_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionStorageClass, - update_folder), - e_marshal_NONE__POINTER_POINTER_INT, - GTK_TYPE_NONE, 3, - GTK_TYPE_STRING, - GTK_TYPE_STRING, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - corba_class_init (); -} - -static void -init (EvolutionStorage *storage) -{ - EvolutionStoragePrivate *priv; - - priv = g_new (EvolutionStoragePrivate, 1); - priv->name = NULL; - priv->toplevel_node_uri = NULL; - priv->toplevel_node_type = NULL; - priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage); - priv->uri_to_path = g_hash_table_new (g_str_hash, g_str_equal); - priv->corba_storage_listeners = NULL; - - storage->priv = priv; -} - - -POA_GNOME_Evolution_Storage__epv * -evolution_storage_get_epv (void) -{ - POA_GNOME_Evolution_Storage__epv *epv; - - epv = g_new0 (POA_GNOME_Evolution_Storage__epv, 1); - epv->_get_name = impl_Storage__get_name; - epv->asyncCreateFolder = impl_Storage_async_create_folder; - epv->asyncRemoveFolder = impl_Storage_async_remove_folder; - epv->asyncXferFolder = impl_Storage_async_xfer_folder; - epv->updateFolder = impl_Storage_updateFolder; - epv->addListener = impl_Storage_add_listener; - epv->removeListener = impl_Storage_remove_listener; - - return epv; -} - -void -evolution_storage_construct (EvolutionStorage *storage, - GNOME_Evolution_Storage corba_object, - const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type) -{ - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - - 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'); - - CORBA_exception_init (&ev); - - bonobo_object_construct (BONOBO_OBJECT (storage), corba_object); - - priv = storage->priv; - priv->name = g_strdup (name); - priv->toplevel_node_uri = g_strdup (toplevel_node_uri); - priv->toplevel_node_type = g_strdup (toplevel_node_type); - - CORBA_exception_free (&ev); -} - -EvolutionStorage * -evolution_storage_new (const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type) -{ - EvolutionStorage *new; - POA_GNOME_Evolution_Storage *servant; - GNOME_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, toplevel_node_uri, toplevel_node_type); - - return new; -} - -void -evolution_storage_rename (EvolutionStorage *evolution_storage, - const char *new_name) -{ - /* FIXME: Implement me */ -} - -EvolutionStorageResult -evolution_storage_register (EvolutionStorage *evolution_storage, - GNOME_Evolution_StorageRegistry corba_storage_registry) -{ - EvolutionStorageResult result; - GNOME_Evolution_StorageListener corba_storage_listener; - GNOME_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 = GNOME_Evolution_StorageRegistry_addStorage (corba_storage_registry, - corba_storage, - priv->name, - safe_corba_string (priv->toplevel_node_uri), - safe_corba_string (priv->toplevel_node_type), - &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_GNOME_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, - GNOME_Evolution_Shell corba_shell) -{ - GNOME_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:GNOME/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_deregister_on_shell (EvolutionStorage *evolution_storage, - GNOME_Evolution_Shell corba_shell) -{ - GNOME_Evolution_StorageRegistry corba_storage_registry; - EvolutionStorageResult result; - 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_shell != CORBA_OBJECT_NIL, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - priv = evolution_storage->priv; - - CORBA_exception_init (&ev); - - corba_storage_registry = Bonobo_Unknown_queryInterface (corba_shell, - "IDL:GNOME/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; - } - - GNOME_Evolution_StorageRegistry_removeStorageByName (corba_storage_registry, - priv->name, - &ev); - - if (ev._major == CORBA_NO_EXCEPTION) - result = EVOLUTION_STORAGE_OK; - else { - if (ev._major != CORBA_USER_EXCEPTION) - result = EVOLUTION_STORAGE_ERROR_CORBA; - else if (strcmp (CORBA_exception_id (&ev), ex_GNOME_Evolution_StorageRegistry_NotFound) == 0) - result = EVOLUTION_STORAGE_ERROR_EXISTS; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - } - - /* Now unref the EvolutionStorage */ - bonobo_object_unref (BONOBO_OBJECT (evolution_storage)); - - 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, - int unread_count) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - GNOME_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 = GNOME_Evolution_Folder__alloc (); - corba_folder->displayName = CORBA_string_dup (display_name); - corba_folder->description = CORBA_string_dup (description); - corba_folder->type = CORBA_string_dup (type); - corba_folder->physicalUri = CORBA_string_dup (physical_uri); - corba_folder->unreadCount = unread_count; - - if (! e_folder_tree_add (priv->folder_tree, path, corba_folder)) { - CORBA_free (corba_folder); - return EVOLUTION_STORAGE_ERROR_EXISTS; - } - g_hash_table_insert (priv->uri_to_path, g_strdup (physical_uri), g_strdup (path)); - - result = EVOLUTION_STORAGE_OK; - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - GNOME_Evolution_StorageListener listener; - - listener = p->data; - GNOME_Evolution_StorageListener_notifyFolderCreated (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_GNOME_Evolution_StorageListener_Exists) == 0) - result = EVOLUTION_STORAGE_ERROR_EXISTS; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - - break; - } - - CORBA_exception_free (&ev); - - return result; -} - -EvolutionStorageResult -evolution_storage_update_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - int unread_count) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GList *p; - GNOME_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; - - gtk_signal_emit (GTK_OBJECT (evolution_storage), signals[UPDATE_FOLDER], - path, display_name, unread_count); - - 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) { - GNOME_Evolution_StorageListener listener; - - listener = p->data; - GNOME_Evolution_StorageListener_notifyFolderUpdated (listener, path, display_name, unread_count, &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_GNOME_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->displayName); - corba_folder->displayName = CORBA_string_dup (display_name); - corba_folder->unreadCount = unread_count; - } else - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - } - - return result; -} - -EvolutionStorageResult -evolution_storage_update_folder_by_uri (EvolutionStorage *evolution_storage, - const char *physical_uri, - const char *display_name, - int unread_count) -{ - EvolutionStoragePrivate *priv; - char *path; - - 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 (physical_uri != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); - - priv = evolution_storage->priv; - - path = g_hash_table_lookup (priv->uri_to_path, physical_uri); - return evolution_storage_update_folder (evolution_storage, path, display_name, unread_count); -} - -EvolutionStorageResult -evolution_storage_removed_folder (EvolutionStorage *evolution_storage, - const char *path) -{ - EvolutionStorageResult result; - EvolutionStoragePrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Folder *corba_folder; - gpointer key, value; - 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_folder = e_folder_tree_get_folder (priv->folder_tree, path); - if (corba_folder == NULL) - return EVOLUTION_STORAGE_ERROR_NOTFOUND; - if (g_hash_table_lookup_extended (priv->uri_to_path, corba_folder->physicalUri, &key, &value)) { - g_hash_table_remove (priv->uri_to_path, key); - g_free (key); - g_free (value); - } - e_folder_tree_remove (priv->folder_tree, path); - - CORBA_exception_init (&ev); - - result = EVOLUTION_STORAGE_OK; - - for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { - GNOME_Evolution_StorageListener listener; - - listener = p->data; - GNOME_Evolution_StorageListener_notifyFolderRemoved (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_GNOME_Evolution_StorageListener_NotFound) == 0) - result = EVOLUTION_STORAGE_ERROR_NOTFOUND; - else - result = EVOLUTION_STORAGE_ERROR_GENERIC; - - break; - } - - CORBA_exception_free (&ev); - - return result; -} - -gboolean -evolution_storage_folder_exists (EvolutionStorage *evolution_storage, - const char *path) -{ - EvolutionStoragePrivate *priv; - - 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; - - return e_folder_tree_get_folder (priv->folder_tree, path) != NULL; -} - - -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 f9c90b212c..0000000000 --- a/shell/evolution-storage.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-storage.h - * - * Copyright (C) 2000 Ximian, 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__ - -#include <glib.h> -#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, - - /* Generic errors */ - EVOLUTION_STORAGE_ERROR_GENERIC, - EVOLUTION_STORAGE_ERROR_CORBA, - EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER, - - /* Registration errors */ - EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED, - EVOLUTION_STORAGE_ERROR_NOTREGISTERED, - EVOLUTION_STORAGE_ERROR_NOREGISTRY, - EVOLUTION_STORAGE_ERROR_EXISTS, - EVOLUTION_STORAGE_ERROR_NOTFOUND, - - /* Folder creation/deletion errors */ - EVOLUTION_STORAGE_ERROR_UNSUPPORTED_OPERATION, - EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE, - EVOLUTION_STORAGE_ERROR_INVALID_URI, - EVOLUTION_STORAGE_ERROR_ALREADY_EXISTS, - EVOLUTION_STORAGE_ERROR_DOES_NOT_EXIST, - EVOLUTION_STORAGE_ERROR_PERMISSION_DENIED, - EVOLUTION_STORAGE_ERROR_NO_SPACE, - EVOLUTION_STORAGE_ERROR_NOT_EMPTY -}; -typedef enum _EvolutionStorageResult EvolutionStorageResult; - -struct _EvolutionStorage { - BonoboObject parent; - - EvolutionStoragePrivate *priv; -}; - -struct _EvolutionStorageClass { - BonoboObjectClass parent_class; - - /* signals */ - void (*create_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *type, - const char *description, - const char *parent_physical_uri); - - void (*remove_folder) (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *physical_uri); - - void (*update_folder) (EvolutionStorage *storage, - const char *path, - const char *display_name, - int unread_count); -}; - - -POA_GNOME_Evolution_Storage__epv *evolution_storage_get_epv (void); - -GtkType evolution_storage_get_type (void); -void evolution_storage_construct (EvolutionStorage *storage, - GNOME_Evolution_Storage corba_object, - const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type); -EvolutionStorage *evolution_storage_new (const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type); - -void evolution_storage_rename (EvolutionStorage *storage, - const char *new_name); - -EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage, - GNOME_Evolution_StorageRegistry corba_registry); -EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, - GNOME_Evolution_Shell corba_shell); -EvolutionStorageResult evolution_storage_deregister_on_shell (EvolutionStorage *storage, - GNOME_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, - int unread_count); -EvolutionStorageResult evolution_storage_update_folder (EvolutionStorage *evolution_storage, - const char *path, - const char *display_name, - int unread_count); -EvolutionStorageResult evolution_storage_update_folder_by_uri (EvolutionStorage *evolution_storage, - const char *physical_uri, - const char *display_name, - int unread_count); -EvolutionStorageResult evolution_storage_removed_folder (EvolutionStorage *evolution_storage, - const char *path); -gboolean evolution_storage_folder_exists (EvolutionStorage *evolution_storage, - const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVOLUTION_STORAGE_H__ */ diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c deleted file mode 100644 index 2cad304136..0000000000 --- a/shell/evolution-test-component.c +++ /dev/null @@ -1,330 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-test-component.c - * - * Copyright (C) 2001 Ximian, 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 - */ - -/* Simple test component for the Evolution shell. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-shell-component.h" -#include "evolution-activity-client.h" - -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-main.h> - -#include <gdk-pixbuf/gdk-pixbuf.h> - - -#define COMPONENT_ID "OAFIID:GNOME_Evolution_TestComponent_ShellComponent" - -static const EvolutionShellComponentFolderType folder_types[] = { - { "test", "/usr/share/pixmaps/gnome-money.png", N_("Test"), N_("Test type"), FALSE, NULL, NULL }, - { NULL } -}; - - -static EvolutionShellClient *parent_shell = NULL; -static EvolutionActivityClient *activity_client; - -static int timeout_id = 0; -static int progress = -1; - - -/* Test the ::Shortcut interface. */ - -static void -spit_out_shortcuts (EvolutionShellClient *shell_client) -{ - GNOME_Evolution_Shortcuts shortcuts_interface; - GNOME_Evolution_Shortcuts_GroupList *groups; - CORBA_Environment ev; - int i, j; - - CORBA_exception_init (&ev); - - shortcuts_interface = evolution_shell_client_get_shortcuts_interface (shell_client); - if (CORBA_Object_is_nil (shortcuts_interface, &ev)) { - g_warning ("No ::Shortcut interface on the shell"); - CORBA_exception_free (&ev); - return; - } - - groups = GNOME_Evolution_Shortcuts__get_groups (shortcuts_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Exception getting the groups: %s", ev._repo_id); - CORBA_exception_free (&ev); - return; - } - - for (i = 0; i < groups->_length; i ++) { - GNOME_Evolution_Shortcuts_Group *group; - GNOME_Evolution_Shortcuts_ShortcutList *shortcuts; - - group = groups->_buffer + i; - shortcuts = &group->shortcuts; - - g_print ("\tGROUP: %s\n", group->name); - - for (j = 0; j < shortcuts->_length; j ++) { - GNOME_Evolution_Shortcuts_Shortcut *shortcut; - - shortcut = shortcuts->_buffer + j; - - g_print ("\t\tName: %s\n", shortcut->name); - g_print ("\t\t\tType: %s\n", shortcut->type); - g_print ("\t\t\tURI: %s\n", shortcut->uri); - } - } - - g_print ("** Done\n\n"); - - CORBA_exception_free (&ev); -} - - -/* Callbacks. */ - -static void -activity_client_cancel_callback (EvolutionActivityClient *client, - void *data) -{ - g_print ("User requested that the operation be cancelled.\n"); -} - -static void -activity_client_show_details_callback (EvolutionActivityClient *client, - void *data) -{ - g_print ("User wants to see details.\n"); -} - - -/* Timeout #3: We are done. */ -static int -timeout_callback_3 (void *data) -{ - gtk_object_unref (GTK_OBJECT (activity_client)); - - g_print ("--> Done.\n"); - - return FALSE; -} - -/* Timeout #2: Update the progress until it reaches 100%. */ -static int -timeout_callback_2 (void *data) -{ - if (progress < 0) - progress = 0; - - g_print ("--> Updating %d\n", progress); - - if (! evolution_activity_client_update (activity_client, "Operation Foo in progress", - (float) progress / 100.0)) { - g_warning ("Error when updating operation"); - return FALSE; - } - - progress ++; - if (progress > 100) { - gtk_timeout_add (200, timeout_callback_3, NULL); - return FALSE; - } - - return TRUE; -} - -/* Timeout #1: Set busy. */ -static int -timeout_callback_1 (void *data) -{ - gboolean suggest_display; - GdkPixbuf *animated_icon[2]; - - animated_icon[0] = gdk_pixbuf_new_from_file (gnome_pixmap_file ("gnome-money.png")); - animated_icon[1] = NULL; - - g_assert (animated_icon[0] != NULL); - - activity_client = evolution_activity_client_new (parent_shell, COMPONENT_ID, - animated_icon, - "Operation Foo started!", - TRUE, - &suggest_display); - if (activity_client == CORBA_OBJECT_NIL) { - g_warning ("Cannot create EvolutionActivityClient object"); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (activity_client), "cancel", - GTK_SIGNAL_FUNC (activity_client_cancel_callback), NULL); - gtk_signal_connect (GTK_OBJECT (activity_client), "show_details", - GTK_SIGNAL_FUNC (activity_client_show_details_callback), NULL); - - g_print ("Component becoming busy -- %s\n", COMPONENT_ID); - if (suggest_display) - g_print (" --> Could display dialog box.\n"); - - gtk_timeout_add (100, timeout_callback_2, NULL); - - return FALSE; -} - - -static EvolutionShellComponentResult -create_view_fn (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *folder_type, - BonoboControl **control_return, - void *closure) -{ - GtkWidget *vbox; - GtkWidget *label_1, *label_2; - GtkWidget *event_box_1, *event_box_2; - - label_1 = gtk_label_new ("This is just a test component, displaying the following URI:"); - label_2 = gtk_label_new (physical_uri); - - event_box_1 = gtk_event_box_new (); - event_box_2 = gtk_event_box_new (); - - vbox = gtk_vbox_new (FALSE, 5); - - gtk_box_pack_start (GTK_BOX (vbox), event_box_1, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), label_1, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), label_2, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), event_box_2, TRUE, TRUE, 0); - - gtk_widget_show (label_1); - gtk_widget_show (label_2); - gtk_widget_show (event_box_1); - gtk_widget_show (event_box_2); - - gtk_widget_show (vbox); - - *control_return = bonobo_control_new (vbox); - - g_assert (timeout_id == 0); - timeout_id = gtk_timeout_add (2000, timeout_callback_1, NULL); - - return EVOLUTION_SHELL_COMPONENT_OK; -} - - -/* Callbacks. */ - -static void -owner_set_callback (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir) -{ - g_assert (parent_shell == NULL); - - g_print ("We have an owner -- home directory is `%s'\n", evolution_homedir); - - parent_shell = shell_client; - - if (evolution_shell_client_get_activity_interface (parent_shell) == CORBA_OBJECT_NIL) - g_warning ("Shell doesn't have a ::Activity interface -- weird!"); - - spit_out_shortcuts (shell_client); -} - -static int -owner_unset_idle_callback (void *data) -{ - gtk_main_quit (); - return FALSE; -} - -static void -owner_unset_callback (EvolutionShellComponent *shell_component, - void *data) -{ - g_idle_add_full (G_PRIORITY_LOW, owner_unset_idle_callback, NULL, NULL); -} - -static void -user_create_new_item_callback (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type) -{ - g_print ("\n*** Should create -- %s\n", id); - g_print ("\n\tType %s, URI %s\n", parent_folder_type, parent_folder_physical_uri); -} - - -static void -register_component (void) -{ - EvolutionShellComponent *shell_component; - int result; - - shell_component = evolution_shell_component_new (folder_types, - NULL, - create_view_fn, - NULL, NULL, NULL, NULL, NULL, NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_callback), NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_callback), NULL); - - evolution_shell_component_add_user_creatable_item (shell_component, "Stuff", "New Stuff", "New _Stuff", '\0'); - evolution_shell_component_add_user_creatable_item (shell_component, "MoreStuff", "New More Stuff", "New _More Stuff", 'n'); - - gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", - GTK_SIGNAL_FUNC (user_create_new_item_callback), NULL); - - result = oaf_active_server_register (COMPONENT_ID, - bonobo_object_corba_objref (BONOBO_OBJECT (shell_component))); - - if (result == OAF_REG_ERROR) - g_error ("Cannot register active server into OAF"); -} - - -int -main (int argc, char **argv) -{ - CORBA_ORB orb; - - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - gnome_init_with_popt_table ("evolution-test-component", VERSION, - argc, argv, oaf_popt_options, 0, NULL); - - orb = oaf_init (argc, argv); - - if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error ("Cannot initialize the test component."); - - register_component (); - - bonobo_main (); - - return 0; -} diff --git a/shell/evolution-wizard.c b/shell/evolution-wizard.c deleted file mode 100644 index 20f576e8e7..0000000000 --- a/shell/evolution-wizard.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * evolution-wizard.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmarshal.h> -#include <gtk/gtktypeutils.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-event-source.h> - -#include "evolution-wizard.h" -#include "Evolution.h" - -struct _EvolutionWizardPrivate { - EvolutionWizardGetControlFn get_fn; - BonoboEventSource *event_source; - - void *closure; - int page_count; -}; - -enum { - NEXT, - PREPARE, - BACK, - FINISH, - CANCEL, - HELP, - LAST_SIGNAL -}; - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE - -static GtkObjectClass *parent_class; -static guint32 signals[LAST_SIGNAL] = { 0 }; - -static CORBA_long -impl_GNOME_Evolution_Wizard__get_pageCount (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionWizard *wizard; - EvolutionWizardPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - wizard = EVOLUTION_WIZARD (bonobo_object); - priv = wizard->priv; - - return priv->page_count; -} - -static Bonobo_Control -impl_GNOME_Evolution_Wizard_getControl (PortableServer_Servant servant, - CORBA_long pagenumber, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionWizard *wizard; - EvolutionWizardPrivate *priv; - BonoboControl *control; - - bonobo_object = bonobo_object_from_servant (servant); - wizard = EVOLUTION_WIZARD (bonobo_object); - priv = wizard->priv; - - if (pagenumber < 0 || pagenumber >= priv->page_count) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Wizard_NoPage, NULL); - return CORBA_OBJECT_NIL; - } - - control = priv->get_fn (wizard, pagenumber, priv->closure); - if (control == NULL) - return CORBA_OBJECT_NIL; - - return (Bonobo_Control) CORBA_Object_duplicate (BONOBO_OBJREF (control), ev); -} - -static void -impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant, - CORBA_long pagenumber, - GNOME_Evolution_Wizard_Action action, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - EvolutionWizard *wizard; - EvolutionWizardPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - wizard = EVOLUTION_WIZARD (bonobo_object); - priv = wizard->priv; - - if (pagenumber < 0 || pagenumber >= priv->page_count) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Wizard_NoPage, NULL); - return; - } - - switch (action) { - case GNOME_Evolution_Wizard_NEXT: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[NEXT], - pagenumber); - break; - - case GNOME_Evolution_Wizard_PREPARE: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[PREPARE], - pagenumber); - break; - - case GNOME_Evolution_Wizard_BACK: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[BACK], - pagenumber); - break; - - case GNOME_Evolution_Wizard_FINISH: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[FINISH], - pagenumber); - break; - - case GNOME_Evolution_Wizard_CANCEL: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[CANCEL], - pagenumber); - break; - - case GNOME_Evolution_Wizard_HELP: - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[HELP], - pagenumber); - break; - - default: - break; - } -} - - -static void -evolution_wizard_destroy (GtkObject *object) -{ - EvolutionWizard *wizard; - - wizard = EVOLUTION_WIZARD (object); - if (wizard->priv == NULL) { - return; - } - - g_free (wizard->priv); - wizard->priv = NULL; - - parent_class->destroy (object); -} - -static void -evolution_wizard_class_init (EvolutionWizardClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Wizard__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = evolution_wizard_destroy; - - signals[NEXT] = gtk_signal_new ("next", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, next), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - signals[PREPARE] = gtk_signal_new ("prepare", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, prepare), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - signals[BACK] = gtk_signal_new ("back", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, back), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - signals[FINISH] = gtk_signal_new ("finish", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, finish), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - signals[CANCEL] = gtk_signal_new ("cancel", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, cancel), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - signals[HELP] = gtk_signal_new ("help", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EvolutionWizardClass, help), - gtk_marshal_NONE__INT, GTK_TYPE_NONE, - 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - parent_class = gtk_type_class (PARENT_TYPE); - - epv->_get_pageCount = impl_GNOME_Evolution_Wizard__get_pageCount; - epv->getControl = impl_GNOME_Evolution_Wizard_getControl; - epv->notifyAction = impl_GNOME_Evolution_Wizard_notifyAction; -} - -static void -evolution_wizard_init (EvolutionWizard *wizard) -{ - wizard->priv = g_new0 (EvolutionWizardPrivate, 1); -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionWizard, GNOME_Evolution_Wizard, - PARENT_TYPE, evolution_wizard); - -EvolutionWizard * -evolution_wizard_construct (EvolutionWizard *wizard, - BonoboEventSource *event_source, - EvolutionWizardGetControlFn get_fn, - int num_pages, - void *closure) -{ - EvolutionWizardPrivate *priv; - - g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL); - g_return_val_if_fail (IS_EVOLUTION_WIZARD (wizard), NULL); - - priv = wizard->priv; - priv->get_fn = get_fn; - priv->page_count = num_pages; - priv->closure = closure; - - priv->event_source = event_source; - bonobo_object_add_interface (BONOBO_OBJECT (wizard), - BONOBO_OBJECT (event_source)); - - return wizard; -} - -EvolutionWizard * -evolution_wizard_new_full (EvolutionWizardGetControlFn get_fn, - int num_pages, - BonoboEventSource *event_source, - void *closure) -{ - EvolutionWizard *wizard; - - g_return_val_if_fail (num_pages > 0, NULL); - g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL); - - wizard = gtk_type_new (evolution_wizard_get_type ()); - - return evolution_wizard_construct (wizard, event_source, get_fn, num_pages, closure); -} - -EvolutionWizard * -evolution_wizard_new (EvolutionWizardGetControlFn get_fn, - int num_pages, - void *closure) -{ - BonoboEventSource *event_source; - - g_return_val_if_fail (num_pages > 0, NULL); - - event_source = bonobo_event_source_new (); - - return evolution_wizard_new_full (get_fn, num_pages, event_source, closure); -} - -void -evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard, - gboolean back_sensitive, - gboolean next_sensitive, - gboolean cancel_sensitive, - CORBA_Environment *opt_ev) -{ - EvolutionWizardPrivate *priv; - CORBA_Environment ev; - CORBA_any any; - CORBA_short s; - - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); - - priv = wizard->priv; - - if (opt_ev == NULL) { - CORBA_exception_init (&ev); - } else { - ev = *opt_ev; - } - - s = back_sensitive << 2 | next_sensitive << 1 | cancel_sensitive; - any._type = (CORBA_TypeCode) TC_short; - any._value = &s; - - bonobo_event_source_notify_listeners (priv->event_source, - EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE, - &any, &ev); - if (opt_ev == NULL && BONOBO_EX (&ev)) { - g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev)); - } - - if (opt_ev == NULL) { - CORBA_exception_free (&ev); - } -} - -void -evolution_wizard_set_show_finish (EvolutionWizard *wizard, - gboolean show_finish, - CORBA_Environment *opt_ev) -{ - EvolutionWizardPrivate *priv; - CORBA_Environment ev; - CORBA_any any; - CORBA_boolean b; - - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); - - priv = wizard->priv; - if (opt_ev == NULL) { - CORBA_exception_init (&ev); - } else { - ev = *opt_ev; - } - - b = show_finish; - any._type = (CORBA_TypeCode) TC_boolean; - any._value = &b; - - bonobo_event_source_notify_listeners (priv->event_source, - EVOLUTION_WIZARD_SET_SHOW_FINISH, - &any, &ev); - if (opt_ev == NULL && BONOBO_EX (&ev)) { - g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev)); - } - - if (opt_ev == NULL) { - CORBA_exception_free (&ev); - } -} - -void -evolution_wizard_set_page (EvolutionWizard *wizard, - int page_number, - CORBA_Environment *opt_ev) -{ - EvolutionWizardPrivate *priv; - CORBA_Environment ev; - CORBA_any any; - CORBA_short s; - - g_return_if_fail (IS_EVOLUTION_WIZARD (wizard)); - - priv = wizard->priv; - - g_return_if_fail (page_number >= 0 && page_number < priv->page_count); - - if (opt_ev == NULL) { - CORBA_exception_init (&ev); - } else { - ev = *opt_ev; - } - - s = page_number; - any._type = (CORBA_TypeCode) TC_short; - any._value = &s; - - bonobo_event_source_notify_listeners (priv->event_source, - EVOLUTION_WIZARD_SET_PAGE, - &any, &ev); - - if (opt_ev == NULL && BONOBO_EX (&ev)) { - g_warning ("ERROR(%s): %s", __FUNCTION__, CORBA_exception_id (&ev)); - } - - if (opt_ev == NULL) { - CORBA_exception_free (&ev); - } -} - -BonoboEventSource * -evolution_wizard_get_event_source (EvolutionWizard *wizard) -{ - g_return_val_if_fail (IS_EVOLUTION_WIZARD (wizard), NULL); - - return wizard->priv->event_source; -} diff --git a/shell/evolution-wizard.h b/shell/evolution-wizard.h deleted file mode 100644 index 617d7bb3a5..0000000000 --- a/shell/evolution-wizard.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * evolution-wizard.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Iain Holmes <iain@ximian.com> - */ - -#ifndef __EVOLUTION_WIZARD_H__ -#define __EVOLUTION_WIZARD_H__ - -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-event-source.h> - -#include <Evolution.h> - -BEGIN_GNOME_DECLS - -typedef struct _EvolutionWizard EvolutionWizard; -typedef struct _EvolutionWizardPrivate EvolutionWizardPrivate; - -#define EVOLUTION_WIZARD_SET_PAGE "GNOME::Evolution::Wizard_setPage" -#define EVOLUTION_WIZARD_SET_SHOW_FINISH "GNOME::Evolution::Wizard_setShowFinish" -#define EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE "GNOME::Evolution::Wizard_setButtonsSensitive" - -#define EVOLUTION_WIZARD_TYPE (evolution_wizard_get_type ()) -#define EVOLUTION_WIZARD(o) (GTK_CHECK_CAST ((o), EVOLUTION_WIZARD_TYPE, EvolutionWizard)) -#define EVOLUTION_WIZARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EVOLUTION_WIZARD_TYPE, EvolutionWizardClass)) -#define IS_EVOLUTION_WIZARD(o) (GTK_CHECK_TYPE ((o), EVOLUTION_WIZARD_TYPE)) -#define IS_EVOLUTION_WIZARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EVOLUTION_WIZARD_TYPE)) - -typedef BonoboControl *(* EvolutionWizardGetControlFn) (EvolutionWizard *wizard, - int page_number, - void *closure); - -struct _EvolutionWizard { - BonoboXObject object; - - EvolutionWizardPrivate *priv; -}; - -typedef struct { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Wizard__epv epv; - - void (* next) (EvolutionWizard *wizard, int page_number); - void (* prepare) (EvolutionWizard *wizard, int page_number); - void (* back) (EvolutionWizard *wizard, int page_number); - void (* finish) (EvolutionWizard *wizard, int page_number); - void (* cancel) (EvolutionWizard *wizard, int page_number); - void (* help) (EvolutionWizard *wizard, int page_number); -} EvolutionWizardClass; - -GtkType evolution_wizard_get_type (void); - -EvolutionWizard *evolution_wizard_construct (EvolutionWizard *wizard, - BonoboEventSource *event_source, - EvolutionWizardGetControlFn get_fn, - int num_pages, - void *closure); -EvolutionWizard *evolution_wizard_new_full (EvolutionWizardGetControlFn get_fn, - int num_pages, - BonoboEventSource *event_source, - void *closure); -EvolutionWizard *evolution_wizard_new (EvolutionWizardGetControlFn get_fn, - int num_pages, - void *closure); - -void evolution_wizard_set_buttons_sensitive (EvolutionWizard *wizard, - gboolean back_sensitive, - gboolean next_sensitive, - gboolean cancel_sensitive, - CORBA_Environment *opt_ev); -void evolution_wizard_set_show_finish (EvolutionWizard *wizard, - gboolean show_finish, - CORBA_Environment *opt_ev); -void evolution_wizard_set_page (EvolutionWizard *wizard, - int page_number, - CORBA_Environment *opt_ev); - -BonoboEventSource * evolution_wizard_get_event_source (EvolutionWizard *wizard); - -END_GNOME_DECLS - -#endif /* __EVOLUTION_WIZARD_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 4ef31d8057..0000000000 --- a/shell/glade/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - e-active-connection-dialog.glade \ - e-shell-folder-creation-dialog.glade \ - evolution-startup-wizard.glade - -EXTRA_DIST = $(glade_DATA) diff --git a/shell/glade/e-active-connection-dialog.glade b/shell/glade/e-active-connection-dialog.glade deleted file mode 100644 index 2370b66821..0000000000 --- a/shell/glade/e-active-connection-dialog.glade +++ /dev/null @@ -1,179 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>e-active-connection-dialog</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>active_connection_dialog</name> - <title>Active connections</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</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>0</spacing> - <child> - <padding>0</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>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>The following connections are currently active:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>10</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>active_connection_clist</name> - <height>250</height> - <can_focus>True</can_focus> - <columns>2</columns> - <column_widths>154,80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label2</name> - <label>Host</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkEventBox</class> - <child_name>CList:title</child_name> - <name>eventbox1</name> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label3</name> - <label>Type</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>instruction_label</name> - <label>Click OK to close these connections and go offline</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>10</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> 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/glade/evolution-startup-wizard.glade b/shell/glade/evolution-startup-wizard.glade deleted file mode 100644 index ab4d4f5ec1..0000000000 --- a/shell/glade/evolution-startup-wizard.glade +++ /dev/null @@ -1,250 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Evolution-startup-wizard</name> - <program_name>evolution-startup-wizard</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>../../art/</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>startup-wizard</name> - <visible>False</visible> - <title>Setup Assistant</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GnomeDruid</class> - <name>startup-druid</name> - - <widget> - <class>GnomeDruidPageStart</class> - <name>start-page</name> - <title>First Run Setup Assistant</title> - <text>Welcome to the Evolution first run setup assistant - -This assistant will help you get started</text> - <title_color>255,255,255</title_color> - <text_color>0,0,0</text_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <logo_image>evolution.png</logo_image> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>identity-page</name> - <title>Identity</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>mail-config-druid-identity.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox2</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>receive-page</name> - <title>Receiving Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>mail-config-druid-receive.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox3</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>extra-page</name> - <title>Receiving Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>mail-config-druid-receive.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox8</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>send-page</name> - <title>Sending Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>mail-config-druid-send.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox5</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>management-page</name> - <title>Account Management</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>mail-config-druid-account-name.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox9</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>timezone-page</name> - <title>Timezone </title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>timezone.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox6</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>import-page</name> - <title>Importing Data</title> - <title_color>255,255,255</title_color> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>import.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox7</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageFinish</class> - <name>done-page</name> - <title>Done</title> - <text>Your configuration is complete.</text> - <background_color>0,0,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <text_color>0,0,0</text_color> - <title_color>255,255,255</title_color> - <logo_image>evolution.png</logo_image> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/shell/importer/.cvsignore b/shell/importer/.cvsignore deleted file mode 100644 index a1e30a4161..0000000000 --- a/shell/importer/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile.in -Makefile -GNOME_Evolution_Importer-stubs.c -GNOME_Evolution_Importer-skels.c -GNOME_Evolution_Importer-common.c -GNOME_Evolution_Importer.h -*.lo -*.la diff --git a/shell/importer/GNOME_Evolution_Importer.idl b/shell/importer/GNOME_Evolution_Importer.idl deleted file mode 100644 index 18ea7a65bb..0000000000 --- a/shell/importer/GNOME_Evolution_Importer.idl +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interfaces for the importer framework. - * - * Authors: - * Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - interface ImporterListener : Bonobo::Unknown { - enum ImporterResult { - OK, - UNSUPPORTED_OPERATION, - NOT_READY, - BUSY, - UNKNOWN_DATA, - BAD_DATA, - BAD_FILE - }; - - /** - * notifyResult: - * @result: The result of the import. - * @more_items: Are there any more items to be processed? - * - * Notifies the listener of the result and whether there are - * any more items to be imported. - */ - oneway void notifyResult (in ImporterResult result, - in boolean more_items); - }; - - interface Importer : Bonobo::Unknown { - - /** - * processItem: - * @listener: The ImporterListener that will be notified of the - * progress. - * - * Processes the next item. - * - */ - oneway void processItem (in ImporterListener listener); - - /** - * getError: - * - * Retrieve a detailed explaination of the error. - * - * Returns: A string. - */ - string getError (); - - /** - * supportFormat: - * @filename: The filename of the file. - * - * Checks if the importer created by this factory can - * import the file specified. - * - * Returns: A boolean, TRUE if it can import the file, - * FALSE otherwise. - */ - boolean supportFormat (in string filename); - - /** - * loadFile: - * @filename: The filename of the file. - * @folderpath: The full pathname to the folder. - * - * Loads the file and prepares an Importer object that can - * process files of this type. - * - * Returns: An Importer object. - */ - boolean loadFile (in string filename, - in string folderpath); - }; - - interface IntelligentImporter : Bonobo::Unknown { - - readonly attribute string importername; - readonly attribute string message; - - boolean canImport (); - - void importData (); - }; -}; -}; diff --git a/shell/importer/Makefile.am b/shell/importer/Makefile.am deleted file mode 100644 index 496a53da3f..0000000000 --- a/shell/importer/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(includedir) \ - $(EXTRA_GNOME_CFLAGS) \ - -DG_LOG_DOMAIN=\"Evolution-Importer\" \ - -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" - -lib_LTLIBRARIES = libevolution-importer.la - -IDLS = \ - GNOME_Evolution_Importer.idl - -IDL_GENERATED = \ - GNOME_Evolution_Importer.h \ - GNOME_Evolution_Importer-common.c \ - GNOME_Evolution_Importer-skels.c \ - GNOME_Evolution_Importer-stubs.c - -GNOME_Evolution_Importer-impl.o: GNOME_Evolution_Importer.h - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(srcdir)/GNOME_Evolution_Importer.idl - -idldir = $(datadir)/idl -idl_DATA = $(IDLS) - -libevolution_importerincludedir = $(includedir)/evolution/importer -libevolution_importer_la_SOURCES = \ - $(IDL_GENERATED) \ - evolution-intelligent-importer.c \ - evolution-importer-client.c \ - evolution-importer-listener.c \ - evolution-importer.c \ - intelligent.c \ - intelligent.h - -libevolution_importerinclude_HEADERS = \ - GNOME_Evolution_Importer.h \ - evolution-intelligent-importer.h \ - evolution-importer-client.h \ - evolution-importer-listener.h \ - evolution-importer.h - -libevolution_importer_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(BONOBO_CONF_LIBS) \ - $(EXTRA_GNOME_LIBS) \ - $(GTKHTML_LIBS) - -gladedir = $(datadir)/evolution/glade -glade_DATA = import.glade - -EXTRA_DIST = $(glade_DATA) $(IDLS) - -BUILT_SOURCES=$(IDL_GENERATED) -CLEANFILES = $(BUILT_SOURCES) -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c deleted file mode 100644 index 337cf36507..0000000000 --- a/shell/importer/evolution-importer-client.c +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.c - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - * Based on evolution-shell-component-client.c by Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-importer-client.h" - -#include <glib.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-main.h> -#include <gal/util/e-util.h> - -#include <liboaf/liboaf.h> - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - - -static void -destroy (GtkObject *object) -{ - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -class_init (EvolutionImporterClientClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = destroy; -} - -static void -init (EvolutionImporterClient *client) -{ -} - -/** - * evolution_importer_client_new: - * @objref: The CORBA_Object to make a client for. - * - * Makes a client for @objref. @objref should be an Evolution_Importer. - * - * Returns: A newly created EvolutionImporterClient. - */ -EvolutionImporterClient * -evolution_importer_client_new (const CORBA_Object objref) -{ - EvolutionImporterClient *client; - - g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL); - - client = gtk_type_new (evolution_importer_client_get_type ()); - client->objref = objref; - - return client; -} - -/** - * evolution_importer_client_new_from_id: - * @id: The oafiid of the component to make a client for. - * - * Makes a client for the object returned by activating @id. - * - * Returns: A newly created EvolutionImporterClient. - */ -EvolutionImporterClient * -evolution_importer_client_new_from_id (const char *id) -{ - CORBA_Environment ev; - CORBA_Object objref; - - g_return_val_if_fail (id != NULL, NULL); - - CORBA_exception_init (&ev); - objref = oaf_activate_from_id ((char *) id, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - g_warning ("Could not start %s.", id); - return NULL; - } - - CORBA_exception_free (&ev); - if (objref == CORBA_OBJECT_NIL) { - g_warning ("Could not activate component %s", id); - return NULL; - } - - return evolution_importer_client_new (objref); -} - -/* API */ -/** - * evolution_importer_client_support_format: - * @client: The EvolutionImporterClient. - * @filename: Name of the file to check. - * - * Checks whether @client is able to import @filename. - * - * Returns: TRUE if @client can import @filename, FALSE otherwise. - */ -gboolean -evolution_importer_client_support_format (EvolutionImporterClient *client, - const char *filename) -{ - GNOME_Evolution_Importer corba_importer; - gboolean result; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - CORBA_exception_init (&ev); - corba_importer = client->objref; - result = GNOME_Evolution_Importer_supportFormat (corba_importer, - filename, &ev); - CORBA_exception_free (&ev); - - return result; -} - -/** - * evolution_importer_client_load_file: - * @client: The EvolutionImporterClient. - * @filename: The file to load. - * @folderpath: The full path to the folder, or NULL for Inbox. - * - * Loads and initialises the importer. - * - * Returns: TRUE on sucess, FALSE on failure. - */ -gboolean -evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *folderpath) -{ - GNOME_Evolution_Importer corba_importer; - gboolean result; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - CORBA_exception_init (&ev); - corba_importer = client->objref; - result = GNOME_Evolution_Importer_loadFile (corba_importer, - filename, - folderpath ? folderpath : "", - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Oh there *WAS* an exception.\nIt was %s", - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - return FALSE; - } - CORBA_exception_free (&ev); - - return result; -} - -/** - * evolution_importer_client_process_item: - * @client: The EvolutionImporterClient. - * @listener: The EvolutionImporterListener. - * - * Starts importing the next item in the file. @listener will be notified - * when the item has finished. - */ -void -evolution_importer_client_process_item (EvolutionImporterClient *client, - EvolutionImporterListener *listener) -{ - GNOME_Evolution_Importer corba_importer; - GNOME_Evolution_ImporterListener corba_listener; - CORBA_Environment ev; - - g_return_if_fail (client != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client)); - g_return_if_fail (listener != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener)); - - CORBA_exception_init (&ev); - - corba_importer = client->objref; - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - GNOME_Evolution_Importer_processItem (corba_importer, - corba_listener, &ev); - CORBA_exception_free (&ev); -} - -/** - * evolution_importer_client_get_error: - * @client: The EvolutionImporterClient. - * - * Gets the error as a string. - * - * Returns: The error as a string. If there is no error NULL is returned. - * Importers need not support this method and if so, NULL is also returned. - */ -const char * -evolution_importer_client_get_error (EvolutionImporterClient *client) -{ - GNOME_Evolution_Importer corba_importer; - CORBA_char *str; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), NULL); - - corba_importer = client->objref; - - CORBA_exception_init (&ev); - str = GNOME_Evolution_Importer_getError (corba_importer, &ev); - - return str; -} - -E_MAKE_TYPE (evolution_importer_client, "EvolutionImporterClient", - EvolutionImporterClient, class_init, init, PARENT_TYPE) diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h deleted file mode 100644 index 20142c018d..0000000000 --- a/shell/importer/evolution-importer-client.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.h - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifndef EVOLUTION_IMPORTER_CLIENT_H -#define EVOLUTION_IMPORTER_CLIENT_H - -#include <glib.h> -#include <bonobo/bonobo-object-client.h> -#include <importer/evolution-importer.h> -#include <importer/evolution-importer-listener.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif - -#define EVOLUTION_TYPE_IMPORTER_CLIENT (evolution_importer_client_get_type ()) -#define EVOLUTION_IMPORTER_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClient)) -#define EVOLUTION_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClientClass)) -#define EVOLUTION_IS_IMPORTER_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT)) -#define EVOLUTION_IS_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_TYPE ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT)) - - -typedef struct _EvolutionImporterClient EvolutionImporterClient; -typedef struct _EvolutionImporterClientClass EvolutionImporterClientClass; - -struct _EvolutionImporterClient { - GtkObject parent_type; - - GNOME_Evolution_Importer objref; -}; - -struct _EvolutionImporterClientClass { - GtkObjectClass parent_class; -}; - -GtkType evolution_importer_client_get_type (void); - -EvolutionImporterClient *evolution_importer_client_new (const CORBA_Object objref); -EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id); - -gboolean evolution_importer_client_support_format (EvolutionImporterClient *client, - const char *filename); -gboolean evolution_importer_client_load_file (EvolutionImporterClient *client, - const char *filename, - const char *folderpath); -void evolution_importer_client_process_item (EvolutionImporterClient *client, - EvolutionImporterListener *listener); -const char *evolution_importer_client_get_error (EvolutionImporterClient *client); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-importer-listener.c b/shell/importer/evolution-importer-listener.c deleted file mode 100644 index 8a547e6f3e..0000000000 --- a/shell/importer/evolution-importer-listener.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-client.c - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-importer-listener.h" - -#include <bonobo/bonobo-object.h> -#include <gal/util/e-util.h> - -#include "GNOME_Evolution_Importer.h" -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE - -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionImporterListenerPrivate { - EvolutionImporterListenerCallback callback; - - void *closure; -}; - -#if 0 -static POA_GNOME_Evolution_ImporterListener__vepv Listener_vepv; - -static POA_GNOME_Evolution_ImporterListener * -create_servant (void) -{ - POA_GNOME_Evolution_ImporterListener *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_ImporterListener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &Listener_vepv; - - CORBA_exception_init (&ev); - POA_GNOME_Evolution_ImporterListener__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; -} -#endif - -static EvolutionImporterResult -corba_result_to_evolution (GNOME_Evolution_ImporterListener_ImporterResult corba_result) -{ - switch (corba_result) { - case GNOME_Evolution_ImporterListener_OK: - return EVOLUTION_IMPORTER_OK; - case GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION: - return EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION; - case GNOME_Evolution_ImporterListener_UNKNOWN_DATA: - return EVOLUTION_IMPORTER_UNKNOWN_DATA; - case GNOME_Evolution_ImporterListener_BAD_DATA: - return EVOLUTION_IMPORTER_BAD_DATA; - case GNOME_Evolution_ImporterListener_BAD_FILE: - return EVOLUTION_IMPORTER_BAD_FILE; - case GNOME_Evolution_ImporterListener_NOT_READY: - return EVOLUTION_IMPORTER_NOT_READY; - case GNOME_Evolution_ImporterListener_BUSY: - return EVOLUTION_IMPORTER_BUSY; - default: - return EVOLUTION_IMPORTER_UNKNOWN_ERROR; - } -} - -static inline EvolutionImporterListener * -evolution_importer_listener_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_IMPORTER_LISTENER (bonobo_object_from_servant (servant)); -} - -static void -impl_GNOME_Evolution_ImporterListener_notifyResult (PortableServer_Servant servant, - GNOME_Evolution_ImporterListener_ImporterResult result, - CORBA_boolean more_items, - CORBA_Environment *ev) -{ - EvolutionImporterListener *listener; - EvolutionImporterListenerPrivate *priv; - EvolutionImporterResult out_result; - - listener = evolution_importer_listener_from_servant (servant); - priv = listener->priv; - - g_print ("Notified\n"); - out_result = corba_result_to_evolution (result); - if (priv->callback) { - (priv->callback) (listener, out_result, more_items, - priv->closure); - } - - return; -} - - -/* GtkObject methods */ -static void -destroy (GtkObject *object) -{ - EvolutionImporterListener *listener; - EvolutionImporterListenerPrivate *priv; - - listener = EVOLUTION_IMPORTER_LISTENER (object); - priv = listener->priv; - - if (priv == NULL) - return; - - g_free (priv); - listener->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -#if 0 -static void -corba_class_init (void) -{ - POA_GNOME_Evolution_ImporterListener__vepv *vepv; - POA_GNOME_Evolution_ImporterListener__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_GNOME_Evolution_ImporterListener__epv, 1); - epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult; - - vepv = &Listener_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_ImporterListener_epv = epv; -} -#endif - -static void -evolution_importer_listener_class_init (EvolutionImporterListenerClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_ImporterListener__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult; -} - -static void -evolution_importer_listener_init (EvolutionImporterListener *listener) -{ - EvolutionImporterListenerPrivate *priv; - - priv = g_new0 (EvolutionImporterListenerPrivate, 1); - listener->priv = priv; -} - -static void -evolution_importer_listener_construct (EvolutionImporterListener *listener, - EvolutionImporterListenerCallback callback, - void *closure) -{ - EvolutionImporterListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener)); - g_return_if_fail (callback != NULL); - - priv = listener->priv; - priv->callback = callback; - priv->closure = closure; -} - -/** - * evolution_importer_listener_new - * @callback: The #EvolutionImporterListenerCallback callback. - * @closure: The data that will be passed to that callback. - * - * Creates a new #EvolutionImporterListener object which calls @callback when - * something happens. - * Returns: A newly allocated #EvolutionImporterListener. - */ -EvolutionImporterListener * -evolution_importer_listener_new (EvolutionImporterListenerCallback callback, - void *closure) -{ - EvolutionImporterListener *listener; - - listener = gtk_type_new (evolution_importer_listener_get_type ()); - - evolution_importer_listener_construct (listener, callback, closure); - return listener; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionImporterListener, - GNOME_Evolution_ImporterListener, - PARENT_TYPE, evolution_importer_listener); diff --git a/shell/importer/evolution-importer-listener.h b/shell/importer/evolution-importer-listener.h deleted file mode 100644 index 6289e54d99..0000000000 --- a/shell/importer/evolution-importer-listener.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer-listener.h - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifndef EVOLUTION_IMPORTER_LISTENER_H -#define EVOLUTION_IMPORTER_LISTENER_H - -#include <glib.h> -#include <bonobo/bonobo-xobject.h> -#include <importer/GNOME_Evolution_Importer.h> -#include "evolution-importer.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_IMPORTER_LISTENER (evolution_importer_listener_get_type ()) -#define EVOLUTION_IMPORTER_LISTENER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListener)) -#define EVOLUTION_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListenerClass)) -#define EVOLUTION_IS_IMPORTER_LISTENER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) -#define EVOLUTION_IS_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) - -typedef struct _EvolutionImporterListener EvolutionImporterListener; -typedef struct _EvolutionImporterListenerPrivate EvolutionImporterListenerPrivate; -typedef struct _EvolutionImporterListenerClass EvolutionImporterListenerClass; - -typedef void (* EvolutionImporterListenerCallback) (EvolutionImporterListener *listener, - EvolutionImporterResult result, - gboolean more_items, - void *closure); -struct _EvolutionImporterListener { - BonoboXObject parent; - - EvolutionImporterListenerPrivate *priv; -}; - -struct _EvolutionImporterListenerClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_ImporterListener__epv epv; -}; - -GtkType evolution_importer_listener_get_type (void); - -EvolutionImporterListener *evolution_importer_listener_new (EvolutionImporterListenerCallback callback, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c deleted file mode 100644 index f41ace28aa..0000000000 --- a/shell/importer/evolution-importer.c +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer.c - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-importer.h" - -#include <bonobo/bonobo-object.h> -#include <gal/util/e-util.h> - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionImporterPrivate { - EvolutionImporterLoadFileFn load_file_fn; - EvolutionImporterSupportFormatFn support_format_fn; - EvolutionImporterProcessItemFn process_item_fn; - EvolutionImporterGetErrorFn get_error_fn; - - void *closure; -}; - - -static inline EvolutionImporter * -evolution_importer_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_IMPORTER (bonobo_object_from_servant (servant)); -} - -static CORBA_boolean -impl_GNOME_Evolution_Importer_supportFormat (PortableServer_Servant servant, - const CORBA_char *filename, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->support_format_fn != NULL) - return (priv->support_format_fn) (importer, filename, - priv->closure); - else - return FALSE; -} - -static CORBA_boolean -impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant, - const CORBA_char *filename, - const CORBA_char *folderpath, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->load_file_fn != NULL) - return (priv->load_file_fn) (importer, filename, - folderpath, priv->closure); - else - return FALSE; -} - -static void -impl_GNOME_Evolution_Importer_processItem (PortableServer_Servant servant, - GNOME_Evolution_ImporterListener listener, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->process_item_fn != NULL) - (priv->process_item_fn) (importer, listener, priv->closure, ev); - else - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION, FALSE, ev); -} - -static CORBA_char * -impl_GNOME_Evolution_Importer_getError (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - CORBA_char *out_str; - - importer = evolution_importer_from_servant (servant); - priv = importer->priv; - - if (priv->get_error_fn != NULL) { - out_str = (priv->get_error_fn) (importer, priv->closure); - return CORBA_string_dup (out_str ? out_str : ""); - } else - return CORBA_string_dup (""); -} - - -static void -destroy (GtkObject *object) -{ - EvolutionImporter *importer; - EvolutionImporterPrivate *priv; - - importer = EVOLUTION_IMPORTER (object); - priv = importer->priv; - - if (priv == NULL) - return; - - g_free (priv); - importer->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -evolution_importer_class_init (EvolutionImporterClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Importer__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->supportFormat = impl_GNOME_Evolution_Importer_supportFormat; - epv->loadFile = impl_GNOME_Evolution_Importer_loadFile; - epv->processItem = impl_GNOME_Evolution_Importer_processItem; - epv->getError = impl_GNOME_Evolution_Importer_getError; -} - -static void -evolution_importer_init (EvolutionImporter *importer) -{ - EvolutionImporterPrivate *priv; - - priv = g_new0 (EvolutionImporterPrivate, 1); - - importer->priv = priv; -} - - - -static void -evolution_importer_construct (EvolutionImporter *importer, - EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure) -{ - EvolutionImporterPrivate *priv; - - g_return_if_fail (importer != NULL); - g_return_if_fail (EVOLUTION_IS_IMPORTER (importer)); - g_return_if_fail (support_format_fn != NULL); - g_return_if_fail (load_file_fn != NULL); - g_return_if_fail (process_item_fn != NULL); - - priv = importer->priv; - priv->support_format_fn = support_format_fn; - priv->load_file_fn = load_file_fn; - priv->process_item_fn = process_item_fn; - priv->get_error_fn = get_error_fn; - - priv->closure = closure; -} - -/** - * evolution_importer_new: - * @support_format_fn: The function to be called by the supportFormat method. - * @load_file_fn: The function to be called by the loadFile method. - * @process_item_fn: The function to be called by the processItem method. - * @get_error_fn: The function to be called by the getError method. - * @closure: The data to be passed to all of the above functions. - * - * Creates a new EvolutionImporter object. Of the parameters only - * @get_error_function and @closure may be #NULL. - * - * Returns: A newly created EvolutionImporter object. - */ -EvolutionImporter * -evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure) -{ - EvolutionImporter *importer; - - importer = gtk_type_new (evolution_importer_get_type ()); - evolution_importer_construct (importer, support_format_fn, load_file_fn, - process_item_fn, get_error_fn, closure); - return importer; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionImporter, - GNOME_Evolution_Importer, - PARENT_TYPE, - evolution_importer); diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h deleted file mode 100644 index abdcfc6bb6..0000000000 --- a/shell/importer/evolution-importer.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-importer.h - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifndef EVOLUTION_IMPORTER_H -#define EVOLUTION_IMPORTER_H - -#include <glib.h> -#include <bonobo/bonobo-xobject.h> -#include <importer/GNOME_Evolution_Importer.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EVOLUTION_TYPE_IMPORTER (evolution_importer_get_type ()) -#define EVOLUTION_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER, EvolutionImporter)) -#define EVOLUTION_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER, EvolutionImporterClass)) -#define EVOLUTION_IS_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) -#define EVOLUTION_IS_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) - -typedef struct _EvolutionImporter EvolutionImporter; -typedef struct _EvolutionImporterPrivate EvolutionImporterPrivate; -typedef struct _EvolutionImporterClass EvolutionImporterClass; - -typedef gboolean (* EvolutionImporterSupportFormatFn) (EvolutionImporter *importer, - const char *filename, - void *closure); -typedef gboolean (* EvolutionImporterLoadFileFn) (EvolutionImporter *importer, - const char *filename, - const char *folderpath, - void *closure); -typedef void (* EvolutionImporterProcessItemFn) (EvolutionImporter *importer, - CORBA_Object listener, - void *closure, - CORBA_Environment *ev); -typedef char *(* EvolutionImporterGetErrorFn) (EvolutionImporter *importer, - void *closure); - -typedef enum { - EVOLUTION_IMPORTER_OK, - EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION, - EVOLUTION_IMPORTER_INTERRUPTED, - EVOLUTION_IMPORTER_BUSY, - EVOLUTION_IMPORTER_NOT_READY, - EVOLUTION_IMPORTER_UNKNOWN_DATA, - EVOLUTION_IMPORTER_BAD_DATA, - EVOLUTION_IMPORTER_BAD_FILE, - EVOLUTION_IMPORTER_UNKNOWN_ERROR -} EvolutionImporterResult; - -struct _EvolutionImporter { - BonoboXObject parent; - - EvolutionImporterPrivate *priv; -}; - -struct _EvolutionImporterClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Importer__epv epv; -}; - -GtkType evolution_importer_get_type (void); - -EvolutionImporter *evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, - EvolutionImporterLoadFileFn load_file_fn, - EvolutionImporterProcessItemFn process_item_fn, - EvolutionImporterGetErrorFn get_error_fn, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/evolution-intelligent-importer.c b/shell/importer/evolution-intelligent-importer.c deleted file mode 100644 index e15f37cc24..0000000000 --- a/shell/importer/evolution-intelligent-importer.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-intelligent-importer.c - * - * Copyright (C) 2000, 2001 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-intelligent-importer.h" - -#include <bonobo/bonobo-object.h> - -#include "GNOME_Evolution_Importer.h" - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -struct _EvolutionIntelligentImporterPrivate { - EvolutionIntelligentImporterCanImportFn can_import_fn; - EvolutionIntelligentImporterImportDataFn import_data_fn; - - char *importername; - char *message; - void *closure; -}; - - -static inline EvolutionIntelligentImporter * -evolution_intelligent_importer_from_servant (PortableServer_Servant servant) -{ - return EVOLUTION_INTELLIGENT_IMPORTER (bonobo_object_from_servant (servant)); -} - -static CORBA_char * -impl_GNOME_Evolution_IntelligentImporter__get_importername (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - - ii = evolution_intelligent_importer_from_servant (servant); - - return CORBA_string_dup (ii->priv->importername ? - ii->priv->importername : ""); -} - -static CORBA_char * -impl_GNOME_Evolution_IntelligentImporter__get_message (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - - ii = evolution_intelligent_importer_from_servant (servant); - - return CORBA_string_dup (ii->priv->message ? - ii->priv->message : ""); -} - -static CORBA_boolean -impl_GNOME_Evolution_IntelligentImporter_canImport (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - EvolutionIntelligentImporterPrivate *priv; - - ii = evolution_intelligent_importer_from_servant (servant); - priv = ii->priv; - - if (priv->can_import_fn != NULL) - return (priv->can_import_fn) (ii, priv->closure); - else - return FALSE; -} - -static void -impl_GNOME_Evolution_IntelligentImporter_importData (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EvolutionIntelligentImporter *ii; - EvolutionIntelligentImporterPrivate *priv; - - ii = evolution_intelligent_importer_from_servant (servant); - priv = ii->priv; - - if (priv->import_data_fn) - (priv->import_data_fn) (ii, priv->closure); -} - - -static void -destroy (GtkObject *object) -{ - EvolutionIntelligentImporter *ii; - - ii = EVOLUTION_INTELLIGENT_IMPORTER (object); - - if (ii->priv == NULL) - return; - - g_free (ii->priv->importername); - g_free (ii->priv); - ii->priv = NULL; - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -evolution_intelligent_importer_class_init (EvolutionIntelligentImporterClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_IntelligentImporter__epv *epv = &klass->epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->_get_importername = impl_GNOME_Evolution_IntelligentImporter__get_importername; - epv->_get_message = impl_GNOME_Evolution_IntelligentImporter__get_message; - epv->canImport = impl_GNOME_Evolution_IntelligentImporter_canImport; - epv->importData = impl_GNOME_Evolution_IntelligentImporter_importData; -} - -static void -evolution_intelligent_importer_init (EvolutionIntelligentImporter *ii) -{ - ii->priv = g_new0 (EvolutionIntelligentImporterPrivate, 1); -} - - -static void -evolution_intelligent_importer_construct (EvolutionIntelligentImporter *ii, - EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure) -{ - g_return_if_fail (ii != NULL); - ii->priv->importername = g_strdup (importername); - ii->priv->message = g_strdup (message); - - ii->priv->can_import_fn = can_import_fn; - ii->priv->import_data_fn = import_data_fn; - ii->priv->closure = closure; -} - -/** - * evolution_intelligent_importer_new: - * can_import_fn: The function that will be called to see if this importer can do - * anything. - * import_data_fn: The function that will be called when the importer should - * import the data. - * importername: The name of this importer. - * message: The message that will be displayed when the importer can import. - * closure: The data to be passed to @can_import_fn and @import_data_fn. - * - * Creates a new IntelligentImporter. - * - * Returns: A newly allocated EvolutionIntelligentImporter. - */ -EvolutionIntelligentImporter * -evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure) -{ - EvolutionIntelligentImporter *ii; - - ii = gtk_type_new (evolution_intelligent_importer_get_type ()); - evolution_intelligent_importer_construct (ii, can_import_fn, - import_data_fn, importername, - message, closure); - return ii; -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionIntelligentImporter, - GNOME_Evolution_IntelligentImporter, - PARENT_TYPE, - evolution_intelligent_importer); diff --git a/shell/importer/evolution-intelligent-importer.h b/shell/importer/evolution-intelligent-importer.h deleted file mode 100644 index 4d2a4e849d..0000000000 --- a/shell/importer/evolution-intelligent-importer.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-intelligent-importer.h - * - * Copyright (C) 2000 Ximian, 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: Iain Holmes <iain@ximian.com> - */ - -#ifndef EVOLUTION_INTELLIGENT_IMPORTER_H -#define EVOLUTION_INTELLIGENT_IMPORTER_H - -#include <glib.h> -#include <bonobo/bonobo-xobject.h> -#include <importer/GNOME_Evolution_Importer.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define EVOLUTION_TYPE_INTELLIGENT_IMPORTER (evolution_intelligent_importer_get_type ()) -#define EVOLUTION_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporter)) -#define EVOLUTION_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporterClass)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) - -typedef struct _EvolutionIntelligentImporter EvolutionIntelligentImporter; -typedef struct _EvolutionIntelligentImporterPrivate EvolutionIntelligentImporterPrivate; -typedef struct _EvolutionIntelligentImporterClass EvolutionIntelligentImporterClass; - -typedef gboolean (* EvolutionIntelligentImporterCanImportFn) (EvolutionIntelligentImporter *ii, - void *closure); -typedef void (* EvolutionIntelligentImporterImportDataFn) (EvolutionIntelligentImporter *ii, - void *closure); - -struct _EvolutionIntelligentImporter { - BonoboXObject parent; - - EvolutionIntelligentImporterPrivate *priv; -}; - -struct _EvolutionIntelligentImporterClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_IntelligentImporter__epv epv; -}; - -GtkType evolution_intelligent_importer_get_type (void); - -EvolutionIntelligentImporter *evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn, - EvolutionIntelligentImporterImportDataFn import_data_fn, - const char *importername, - const char *message, - void *closure); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/shell/importer/import.glade b/shell/importer/import.glade deleted file mode 100644 index c3d858fbbf..0000000000 --- a/shell/importer/import.glade +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>import</name> - <program_name>import</program_name> - <directory></directory> - <source_directory>.</source_directory> - <pixmaps_directory>../../art</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> -</project> - -<widget> - <class>GtkWindow</class> - <name>importwizard</name> - <visible>False</visible> - <title>Evolution Importer Assistant</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GnomeDruid</class> - <name>druid1</name> - - <widget> - <class>GnomeDruidPageStart</class> - <name>page1</name> - <title>Evolution Import Assistant</title> - <text>Welcome to the Evolution Import Assistant. -With this assistant you will be guided through the process of -importing external files into Evolution.</text> - <title_color>255,255,255</title_color> - <text_color>0,0,0</text_color> - <background_color>1,1,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <logo_image>import.png</logo_image> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>page2</name> - <title>Select a File (step 1 of 2)</title> - <title_color>255,255,255</title_color> - <background_color>1,1,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <logo_image>import.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageFinish</class> - <name>page3</name> - <title>Import File (Step 2 of 2)</title> - <text>Click "Import" to begin importing the file into Evolution. </text> - <background_color>1,1,1</background_color> - <logo_background_color>1,1,1</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <text_color>0,0,0</text_color> - <title_color>255,255,255</title_color> - <logo_image>import.png</logo_image> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/shell/importer/intelligent.c b/shell/importer/intelligent.c deleted file mode 100644 index 28fcd9a00f..0000000000 --- a/shell/importer/intelligent.c +++ /dev/null @@ -1,487 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* intelligent.c - * - * Authors: - * Iain Holmes <iain@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "intelligent.h" - -#include <glib.h> - -#include <gtk/gtkdrawingarea.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkobject.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkframe.h> -#include <gtk/gtkclist.h> -#include <gtk/gtknotebook.h> -#include <gtk/gtkscrolledwindow.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-config.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> - -#include <liboaf/liboaf.h> - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-widget.h> - -#include "intelligent.h" -#include "GNOME_Evolution_Importer.h" - -/* Prototypes */ - -void intelligent_importer_init (void); - -/* End prototypes */ - -typedef struct { - CORBA_Object object; - Bonobo_Control control; - GtkWidget *widget; - - char *name; - char *blurb; - char *iid; -} IntelligentImporterData; - -typedef struct { - GtkWidget *dialog; - GtkWidget *placeholder; - GtkWidget *clist; - BonoboWidget *current; - - GList *importers; - - int running; -} IntelligentImporterDialog; - -typedef struct { - CORBA_Object importer; - char *iid; -} SelectedImporterData; - -static void -free_importer_dialog (IntelligentImporterDialog *d) -{ - GList *l; - - for (l = d->importers; l; l = l->next) { - CORBA_Environment ev; - IntelligentImporterData *data; - - data = l->data; - - CORBA_exception_init (&ev); - if (data->object != CORBA_OBJECT_NIL) - bonobo_object_release_unref (data->object, &ev); - - g_free (data->iid); - g_free (data->name); - g_free (data->blurb); - g_free (data); - } - - g_list_free (d->importers); - gtk_widget_destroy (d->dialog); - g_free (d); -} - -static void -start_importers (GList *selected) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - for (; selected; selected = selected->next) { - SelectedImporterData *selection = selected->data; - - GNOME_Evolution_IntelligentImporter_importData (selection->importer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Error importing %s\n%s", selection->iid, - CORBA_exception_id (&ev)); - } - } - CORBA_exception_free (&ev); -} - -static GList * -get_intelligent_importers (void) -{ - OAF_ServerInfoList *info_list; - GList *iids_ret = NULL; - CORBA_Environment ev; - int i; - - CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); - CORBA_exception_free (&ev); - - for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; - - info = info_list->_buffer + i; - iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid)); - } - - return iids_ret; -} - -static void -select_row_cb (GtkCList *clist, - int row, - int column, - GdkEvent *ev, - IntelligentImporterDialog *d) -{ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), row); -} - -static void -unselect_row_cb (GtkCList *clist, - int row, - int column, - GdkEvent *ev, - IntelligentImporterDialog *d) -{ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), d->running); -} - -static IntelligentImporterDialog * -create_gui (GList *importers) -{ - GtkWidget *dialog, *clist, *sw, *label; - GtkWidget *hbox, *vbox, *dummy; - IntelligentImporterDialog *d; - GList *l; - int running = 0; - - d = g_new (IntelligentImporterDialog, 1); - d->dialog = dialog = gnome_dialog_new (_("Importers"), - NULL); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Import"), - GNOME_STOCK_PIXMAP_CONVERT); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Don't import"), - GNOME_STOCK_BUTTON_NO); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), _("Don't ask me again"), - GNOME_STOCK_BUTTON_CANCEL); - - gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); - d->importers = NULL; - d->current = NULL; - - d->clist = clist = gtk_clist_new (1); - gtk_clist_set_selection_mode (GTK_CLIST (d->clist), GTK_SELECTION_MULTIPLE); - - label = gtk_label_new (_("Evolution can import data from the following files:")); - gtk_misc_set_alignment(GTK_MISC(label), 0, .5); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, - TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, - TRUE, TRUE, 0); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (sw, 300, 150); - gtk_container_add (GTK_CONTAINER (sw), clist); - gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - d->placeholder = gtk_notebook_new (); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (d->placeholder), FALSE); - gtk_box_pack_start (GTK_BOX (vbox), d->placeholder, TRUE, TRUE, 0); - - for (l = importers; l; l = l->next) { - IntelligentImporterData *data; - CORBA_Environment ev; - gboolean dontaskagain, can_run; - char *text[1], *prefix; - - /* Check if we want to show this one again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - dontaskagain = gnome_config_get_bool (l->data); - gnome_config_pop_prefix (); - - if (dontaskagain) - continue; - - data = g_new0 (IntelligentImporterData, 1); - data->iid = g_strdup (l->data); - - CORBA_exception_init (&ev); - data->object = oaf_activate_from_id ((char *) data->iid, 0, - NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not start %s: %s", data->iid, - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - - /* Clean up the IntelligentImporterData */ - g_free (data->iid); - g_free (data); - continue; - } - - CORBA_exception_free (&ev); - if (data->object == CORBA_OBJECT_NIL) { - g_warning ("Could not activate_component %s", data->iid); - g_free (data->iid); - g_free (data); - continue; - } - - CORBA_exception_init (&ev); - can_run = GNOME_Evolution_IntelligentImporter_canImport (data->object, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get canImport(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - CORBA_exception_free (&ev); - - if (can_run == FALSE) { - CORBA_exception_init (&ev); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - - running++; - - data->name = g_strdup (GNOME_Evolution_IntelligentImporter__get_importername (data->object, &ev)); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get name(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data); - continue; - } - - data->blurb = g_strdup (GNOME_Evolution_IntelligentImporter__get_message (data->object, &ev)); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not get message(%s): %s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data->name); - g_free (data); - continue; - } - - data->control = Bonobo_Unknown_queryInterface (data->object, - "IDL:Bonobo/Control:1.0", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s", - data->iid, CORBA_exception_id (&ev)); - bonobo_object_release_unref (data->object, &ev); - CORBA_exception_free (&ev); - g_free (data->iid); - g_free (data->name); - g_free (data->blurb); - continue; - } - if (data->control != CORBA_OBJECT_NIL) { - data->widget = bonobo_widget_new_control_from_objref (data->control, CORBA_OBJECT_NIL); - /* Ref this widget so even if we remove it from the - containers it will always have an extra ref. */ - gtk_widget_show (data->widget); - gtk_widget_ref (data->widget); - } else { - data->widget = gtk_label_new (""); - } - - CORBA_exception_free (&ev); - - d->importers = g_list_prepend (d->importers, data); - gtk_notebook_prepend_page (GTK_NOTEBOOK (d->placeholder), - data->widget, NULL); - text[0] = data->name; - gtk_clist_prepend (GTK_CLIST (clist), text); - } - - d->running = running; - dummy = gtk_drawing_area_new (); - gtk_widget_show (dummy); - gtk_notebook_append_page (GTK_NOTEBOOK (d->placeholder), - dummy, NULL); - /* Set the start to the blank page */ - gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), running); - - gtk_signal_connect (GTK_OBJECT (clist), "select-row", - GTK_SIGNAL_FUNC (select_row_cb), d); - gtk_signal_connect (GTK_OBJECT (clist), "unselect-row", - GTK_SIGNAL_FUNC (unselect_row_cb), d); - - gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox); - return d; -} - -void -intelligent_importer_init (void) -{ - GList *importers, *l, *selected = NULL; - IntelligentImporterDialog *d; - char *prefix; - gboolean dontaskagain; - - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - dontaskagain = gnome_config_get_bool ("Dontaskagain=False"); - gnome_config_pop_prefix (); - - if (dontaskagain) { - return; - } - - importers = get_intelligent_importers (); - if (importers == NULL) - return; /* No intelligent importers. Easy :) */ - - d = create_gui (importers); - if (d->running == 0) { - free_importer_dialog (d); - return; /* No runnable intelligent importers. */ - } - - switch (gnome_dialog_run_and_close (GNOME_DIALOG (d->dialog))) { - case 0: /* Okay button */ - /* Make a list of the importers */ - - /* FIXME: Sort this list and don't do it a slow way */ - for (l = GTK_CLIST (d->clist)->selection; l; l = l->next) { - IntelligentImporterData *data; - SelectedImporterData *new_data; - CORBA_Environment ev; - char *iid; - - data = g_list_nth_data (d->importers, GPOINTER_TO_INT (l->data)); - iid = g_strdup (data->iid); - - new_data = g_new (SelectedImporterData, 1); - new_data->iid = iid; - - /* Reference the remote object, and duplicate the - local one. */ - CORBA_exception_init (&ev); - new_data->importer = bonobo_object_dup_ref (data->object, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Error duplicating %s\n%s", iid, - CORBA_exception_id (&ev)); - g_free (iid); - CORBA_exception_free (&ev); - g_free (new_data); - continue; - } - CORBA_exception_free (&ev); - - selected = g_list_prepend (selected, new_data); - } - - /* Now destroy all the importers, as we've kept references to - the ones we need */ - free_importer_dialog (d); - - if (selected != NULL) { - /* Restart the selected ones */ - start_importers (selected); - - /* Free the selected list */ - for (l = selected; l; l = l->next) { - CORBA_Environment ev; - SelectedImporterData *selection = l->data; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (selection->importer, &ev); - CORBA_exception_free (&ev); - - g_free (selection->iid); - g_free (selection); - } - g_list_free (selected); - } - - break; - - case 1: /* No button */ - free_importer_dialog (d); - break; - - case 2: /* Dont ask again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", - gnome_util_user_home ()); - gnome_config_push_prefix (prefix); - g_free (prefix); - - gnome_config_set_bool ("Dontaskagain", TRUE); - gnome_config_pop_prefix (); - - gnome_config_sync (); - gnome_config_drop_all (); - g_print ("Not asking again"); - free_importer_dialog (d); - break; - - default: - free_importer_dialog (d); - break; - } - - g_list_free (importers); -} diff --git a/shell/importer/intelligent.h b/shell/importer/intelligent.h deleted file mode 100644 index 5e1523a8e1..0000000000 --- a/shell/importer/intelligent.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* importer.c - * - * Copyright (C) 2000 Ximian, 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: Kjartan Maraas <kmaraas@gnome.org> - */ - -#ifndef __INTELLIGENT_H__ -#define __INTELLIGENT_H__ - -void intelligent_importer_init (void); - -#endif diff --git a/shell/main.c b/shell/main.c deleted file mode 100644 index 95f0cb3454..0000000000 --- a/shell/main.c +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* main.c - * - * Copyright (C) 2000 Ximian, 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 <fcntl.h> -#include <glib.h> -#include <gtk/gtkmain.h> -#include <gtk/gtklabel.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-init.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-window-icon.h> -#include <bonobo/bonobo-main.h> -#include <glade/glade.h> -#include <liboaf/liboaf.h> - -#ifdef GTKHTML_HAVE_GCONF -#include <gconf/gconf.h> -#endif - -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-cursors.h> -#include "e-setup.h" - -#include "e-shell.h" - - -static EShell *shell = NULL; -static char *evolution_directory = NULL; -static gboolean no_splash = FALSE; -extern char *evolution_debug_log; - - -static void -no_views_left_cb (EShell *shell, gpointer data) -{ - /* FIXME: This is wrong. We should exit only when the shell is - destroyed. But refcounting is broken at present, so this is a - reasonable workaround for now. */ - - e_shell_unregister_all (shell); - - bonobo_object_unref (BONOBO_OBJECT (shell)); - - gtk_main_quit (); -} - -static void -destroy_cb (GtkObject *object, gpointer data) -{ - gtk_main_quit (); -} - - -static void -warning_dialog_clicked_callback (GnomeDialog *dialog, - int button_number, - void *data) -{ - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -development_warning (void) -{ - GtkWidget *label, *warning_dialog; - - warning_dialog = gnome_dialog_new ("Ximian Evolution " VERSION, GNOME_STOCK_BUTTON_OK, NULL); - - label = gtk_label_new ( - /* xgettext:no-c-format */ - _("Hi. Thanks for taking the time to download this preview release\n" - "of the Ximian Evolution groupware suite.\n" - "\n" - "Ximian Evolution is not yet complete. It's getting close, but there are\n" - "places where features are either missing or only half working. \n" - "\n" - "If you find bugs, please report them to us at bugzilla.ximian.com.\n" - "This product comes with no warranty and is not intended for\n" - "individuals prone to violent fits of anger.\n" - "\n" - "We hope that you enjoy the results of our hard work, and we\n" - "eagerly 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 Ximian 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); - - gtk_widget_show (warning_dialog); - gtk_signal_connect (GTK_OBJECT (warning_dialog), "clicked", - GTK_SIGNAL_FUNC (warning_dialog_clicked_callback), NULL); -} - - -/* This is for doing stuff that requires the GTK+ loop to be running already. */ - -static gint -idle_cb (void *data) -{ - GSList *uri_list; - GNOME_Evolution_Shell corba_shell; - CORBA_Environment ev; - EShellConstructResult result; - gboolean restored; - - CORBA_exception_init (&ev); - - uri_list = (GSList *) data; - - shell = e_shell_new (evolution_directory, ! no_splash, &result); - g_free (evolution_directory); - - switch (result) { - case E_SHELL_CONSTRUCT_RESULT_OK: - 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 (uri_list == NULL) - restored = e_shell_restore_from_settings (shell); - else - restored = FALSE; - - if (!getenv ("EVOLVE_ME_HARDER")) - development_warning (); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - corba_shell = CORBA_Object_duplicate (corba_shell, &ev); - break; - - case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER: - corba_shell = oaf_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot access the Ximian Evolution shell.")); - CORBA_exception_free (&ev); - gtk_main_quit (); - return FALSE; - } - - restored = FALSE; - break; - - default: - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Ximian Evolution shell: %s"), - e_shell_construct_result_to_string (result)); - CORBA_exception_free (&ev); - gtk_main_quit (); - return FALSE; - - } - - if (! restored && uri_list == NULL) { - const char *uri = E_SHELL_VIEW_DEFAULT_URI; - - GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri); - } else { - GSList *p; - - for (p = uri_list; p != NULL; p = p->next) { - char *uri; - - uri = (char *) p->data; - - GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri); - } - - g_slist_free (uri_list); - } - - CORBA_Object_release (corba_shell, &ev); - - CORBA_exception_free (&ev); - - if (shell == NULL) - gtk_main_quit (); - - return FALSE; -} - -int -main (int argc, char **argv) -{ - struct poptOption options[] = { - { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable splash screen"), NULL }, - { "debug", '\0', POPT_ARG_STRING, &evolution_debug_log, 0, N_("Send the debugging output of all components to a file."), NULL }, - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL }, - POPT_AUTOHELP - { NULL, '\0', 0, NULL, 0, NULL, NULL } - }; - GSList *uri_list; - const char **args; - poptContext popt_context; - - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - /* Make ElectricFence work. */ - free (malloc (10)); - - gnome_init_with_popt_table ("Evolution", VERSION " [" SUB_VERSION "]", argc, argv, options, 0, &popt_context); - - if (evolution_debug_log) { - int fd; - - fd = open (evolution_debug_log, O_WRONLY | O_CREAT | O_TRUNC, 0600); - if (fd) { - dup2 (fd, STDOUT_FILENO); - dup2 (fd, STDERR_FILENO); - close (fd); - } else - g_warning ("Could not set up debugging output file."); - } - - oaf_init (argc, argv); - -#ifdef GTKHTML_HAVE_GCONF - gconf_init (argc, argv, NULL); -#endif - - glade_gnome_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)) - exit (1); - - uri_list = NULL; - - args = poptGetArgs (popt_context); - if (args != NULL) { - const char **p; - - for (p = args; *p != NULL; p++) - uri_list = g_slist_prepend (uri_list, (char *) *p); - } - - gtk_idle_add (idle_cb, uri_list); - - bonobo_main (); - - return 0; -} |