diff options
author | nobody <nobody@localhost> | 2000-05-22 06:40:15 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2000-05-22 06:40:15 +0800 |
commit | dc29053b0bf6030dc903fbb79962443276c776a1 (patch) | |
tree | 70ea22d6a4da2e07bedfe85a5cddc5e7ad0a1246 /shell | |
parent | 3f5d9cb60827ca2a5e032e95aa241cc8376ab46f (diff) | |
download | gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.gz gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.bz2 gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.lz gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.xz gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.zst gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.zip |
This commit was manufactured by cvs2svn to create taggnome-debug-0-1-0
'gnome-debug-0-1-0'.
svn path=/tags/gnome-debug-0-1-0/; revision=3160
Diffstat (limited to 'shell')
46 files changed, 0 insertions, 8485 deletions
diff --git a/shell/.cvsignore b/shell/.cvsignore deleted file mode 100644 index aec0a5ed9a..0000000000 --- a/shell/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -.deps -.libs -.pure -Shell-stubs.c -Shell-skels.c -Shell-common.c -Shell.h -evolution -evolution.pure -Makefile.in -Makefile -Evolution-stubs.c -Evolution-skels.c -Evolution-common.c -Evolution.h diff --git a/shell/ChangeLog b/shell/ChangeLog deleted file mode 100644 index 395510285b..0000000000 --- a/shell/ChangeLog +++ /dev/null @@ -1,665 +0,0 @@ -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.idl b/shell/Evolution.idl deleted file mode 100644 index c9026e2083..0000000000 --- a/shell/Evolution.idl +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * CORBA interface for the Evolution shell - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <Bonobo.idl> -#include <Shell.idl> -#include <evolution-service-repository.idl> - diff --git a/shell/Makefile.am b/shell/Makefile.am deleted file mode 100644 index 607d827396..0000000000 --- a/shell/Makefile.am +++ /dev/null @@ -1,86 +0,0 @@ -imagesdir = $(datadir)/images/evolution - -bin_PROGRAMS = evolution - -INCLUDES = \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir) \ - $(BONOBO_GNOME_CFLAGS) \ - -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DG_LOG_DOMAIN=\"evolution-shell\" - -EVOLUTION_CORBA_GENERATED = \ - Evolution.h \ - Evolution-common.c \ - Evolution-skels.c \ - Evolution-stubs.c - -CLEANFILES = $(EVOLUTION_CORBA_GENERATED) - -evolution_SOURCES = \ - $(EVOLUTION_CORBA_GENERATED) \ - e-folder-type-repository.c \ - e-folder-type-repository.h \ - e-folder.c \ - e-folder.h \ - e-local-folder.c \ - e-local-folder.h \ - e-local-storage.c \ - e-local-storage.h \ - e-setup.c \ - e-setup.h \ - e-shell-constants.h \ - e-shell-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.c \ - e-shortcuts-view.h \ - e-shortcuts.c \ - e-shortcuts.h \ - e-storage-set-view.c \ - e-storage-set-view.h \ - e-storage-set.c \ - e-storage-set.h \ - e-storage-watcher.c \ - e-storage-watcher.h \ - e-storage.c \ - e-storage.h \ - evolution-service-repository.c \ - evolution-service-repository.h \ - main.c - -Evolution-impl.o: Evolution.h - -$(EVOLUTION_CORBA_GENERATED): Evolution.idl evolution-service-repository.idl - $(ORBIT_IDL) -I$(datadir)/idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Evolution.idl - -evolution_LDADD = \ - $(top_builddir)/widgets/shortcut-bar/libshortcut-bar.a \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(BONOBO_GNOME_LIBS) - -EXTRA_DIST = Evolution.idl \ - Shell.idl \ - evolution-service-repository.idl - -if ENABLE_PURIFY -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution.pure - -evolution.pure: evolution - @rm -f evolution.pure - $(PLINK) $(evolution_LDFLAGS) $(evolution_OBJECTS) $(evolution_LDADD) $(LIBS) - -endif diff --git a/shell/Shell.idl b/shell/Shell.idl deleted file mode 100644 index 07dfbbf191..0000000000 --- a/shell/Shell.idl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CORBA interface for the Evolution shell - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <bonobo.idl> - - -module Evolution { - interface Shell : Bonobo::Unknown { - enum NewType { - APPOINTMENT, - MEETING_REQUEST, - TASK, - TASK_REQUEST, - CONTACT, - MAIL_MESSAGE, - DISTRIBUTION_LIST, - JOURNAL_ENTRY, - NOTE - }; - - enum ServiceType { - MAIL_STORE, - MAIL_TRANSPORT - }; - - void new (in NewType type); - - /** - * register_service : register a service into the shell - * - * @type : type of the service - * @uri : uri of the service, uniquely determine the service. - * - */ - void register_service (in ServiceType type, - in string uri); - - - }; -}; diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c deleted file mode 100644 index 3170f3173e..0000000000 --- a/shell/e-folder-type-repository.c +++ /dev/null @@ -1,303 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-repository.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gtk/gtktypeutils.h> - -#include "e-util/e-util.h" - -#include "e-shell-utils.h" - -#include "e-folder-type-repository.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _FolderType { - char *name; - char *icon_name; - char *control_id; - - /* The icon, standard (48x48) and mini (16x16) versions. */ - GdkPixbuf *icon_pixbuf; - GdkPixbuf *mini_icon_pixbuf; -}; -typedef struct _FolderType FolderType; - -struct _EFolderTypeRepositoryPrivate { - GHashTable *name_to_type; -}; - - -/* FIXME these are hardcoded for now. */ - -#ifdef USING_OAF -# define CALENDAR_CONTROL_ID "OAFIID:control:calendar:dd34ddae-25c6-486b-a8a8-3e8f0286b54c" -# define CONTACTS_CONTROL_ID "OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" -# define MAIL_CONTROL_ID "OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45" -#else -# define CALENDAR_CONTROL_ID "control:calendar" -# define CONTACTS_CONTROL_ID "control:addressbook" -# define MAIL_CONTROL_ID "control:evolution-mail" -#endif - - -/* FolderType handling. */ - -static FolderType * -folder_type_new (const char *name, - const char *icon_name, - const char *control_id) -{ - FolderType *new; - char *icon_path; - - new = g_new (FolderType, 1); - - new->name = g_strdup (name); - new->icon_name = g_strdup (icon_name); - new->control_id = g_strdup (control_id); - - 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); - - 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->control_id); - - 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); - - g_free (folder_type); -} - -static const FolderType * -get_folder_type (EFolderTypeRepository *folder_type_repository, - const char *type_name) -{ - EFolderTypeRepositoryPrivate *priv; - - priv = folder_type_repository->priv; - - return g_hash_table_lookup (priv->name_to_type, type_name); -} - -static gboolean -add_folder_type (EFolderTypeRepository *folder_type_repository, - const char *name, - const char *icon_name, - const char *control_id) -{ - EFolderTypeRepositoryPrivate *priv; - FolderType *folder_type; - - priv = folder_type_repository->priv; - - /* Make sure we don't add the same type twice. */ - if (get_folder_type (folder_type_repository, name) != NULL) - return FALSE; - - folder_type = folder_type_new (name, icon_name, control_id); - g_hash_table_insert (priv->name_to_type, folder_type->name, folder_type); - - 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) -{ - EFolderTypeRepository *folder_type_repository; - EFolderTypeRepositoryPrivate *priv; - - folder_type_repository = E_FOLDER_TYPE_REPOSITORY (object); - priv = folder_type_repository->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 (EFolderTypeRepositoryClass *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 (EFolderTypeRepository *folder_type_repository) -{ - EFolderTypeRepositoryPrivate *priv; - - priv = g_new (EFolderTypeRepositoryPrivate, 1); - priv->name_to_type = g_hash_table_new (g_str_hash, g_str_equal); - - folder_type_repository->priv = priv; -} - - -void -e_folder_type_repository_construct (EFolderTypeRepository *folder_type_repository) -{ - g_return_if_fail (folder_type_repository != NULL); - g_return_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository)); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (folder_type_repository), GTK_FLOATING); - - /* FIXME these are hardcoded for now. */ - - add_folder_type (folder_type_repository, - "mail", "evolution-inbox.png", MAIL_CONTROL_ID); - add_folder_type (folder_type_repository, - "calendar", "evolution-calendar.png", CALENDAR_CONTROL_ID); - add_folder_type (folder_type_repository, - "contacts", "evolution-contacts.png", CONTACTS_CONTROL_ID); -} - -EFolderTypeRepository * -e_folder_type_repository_new (void) -{ - EFolderTypeRepository *new; - - new = gtk_type_new (e_folder_type_repository_get_type ()); - - e_folder_type_repository_construct (new); - - return new; -} - - -const char * -e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_repository != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_repository, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - return folder_type->icon_name; -} - -GdkPixbuf * -e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name, - gboolean mini) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_repository != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_repository, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - if (mini) - return folder_type->mini_icon_pixbuf; - else - return folder_type->icon_pixbuf; -} - -const char * -e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name) -{ - const FolderType *folder_type; - - g_return_val_if_fail (folder_type_repository != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL); - g_return_val_if_fail (type_name != NULL, NULL); - - folder_type = get_folder_type (folder_type_repository, type_name); - if (folder_type == NULL) { - g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name); - return NULL; - } - - return folder_type->control_id; -} - - -E_MAKE_TYPE (e_folder_type_repository, "EFolderTypeRepository", EFolderTypeRepository, - class_init, init, PARENT_TYPE) diff --git a/shell/e-folder-type-repository.h b/shell/e-folder-type-repository.h deleted file mode 100644 index fe2b06eaf6..0000000000 --- a/shell/e-folder-type-repository.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder-type-repository.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_FOLDER_TYPE_REPOSITORY_H_ -#define _E_FOLDER_TYPE_REPOSITORY_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_FOLDER_TYPE_REPOSITORY (e_folder_type_repository_get_type ()) -#define E_FOLDER_TYPE_REPOSITORY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY, EFolderTypeRepository)) -#define E_FOLDER_TYPE_REPOSITORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER_TYPE_REPOSITORY, EFolderTypeRepositoryClass)) -#define E_IS_FOLDER_TYPE_REPOSITORY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY)) -#define E_IS_FOLDER_TYPE_REPOSITORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY)) - - -typedef struct _EFolderTypeRepository EFolderTypeRepository; -typedef struct _EFolderTypeRepositoryPrivate EFolderTypeRepositoryPrivate; -typedef struct _EFolderTypeRepositoryClass EFolderTypeRepositoryClass; - -struct _EFolderTypeRepository { - GtkObject parent; - - EFolderTypeRepositoryPrivate *priv; -}; - -struct _EFolderTypeRepositoryClass { - GtkObjectClass parent_class; -}; - - -GtkType e_folder_type_repository_get_type (void); -void e_folder_type_repository_construct (EFolderTypeRepository *folder_type_repository); -EFolderTypeRepository *e_folder_type_repository_new (void); - -GdkPixbuf *e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name, - gboolean mini); -const char *e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name); -const char *e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_TYPE_REPOSITORY_H_ */ diff --git a/shell/e-folder.c b/shell/e-folder.c deleted file mode 100644 index c5be881180..0000000000 --- a/shell/e-folder.c +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> - -#include "e-util/e-util.h" - -#include "e-folder.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _EFolderPrivate { - char *name; - char *type; - char *description; -}; - -#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) -{ - g_warning ("`%s' does not implement `EFolder::remove()'", - gtk_type_name (GTK_OBJECT_TYPE (folder))); - return NULL; -} - - -/* 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); - - (* 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; - - 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); - g_return_if_fail (description != 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; -} - - -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]); -} - - -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 (* EF_CLASS (folder)->get_physical_uri) (folder); -} - - -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 cf49c68864..0000000000 --- a/shell/e-folder.h +++ /dev/null @@ -1,92 +0,0 @@ - /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-folder.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_FOLDER_H_ -#define _E_FOLDER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_FOLDER (e_folder_get_type ()) -#define E_FOLDER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER, EFolder)) -#define E_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER, EFolderClass)) -#define E_IS_FOLDER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER)) -#define E_IS_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER)) - - -typedef struct _EFolder EFolder; -typedef struct _EFolderPrivate EFolderPrivate; -typedef struct _EFolderClass EFolderClass; - -struct _EFolder { - GtkObject parent; - - EFolderPrivate *priv; -}; - -struct _EFolderClass { - GtkObjectClass parent_class; - - /* Virtual methods. */ - gboolean (* save_info) (EFolder *folder); - gboolean (* load_info) (EFolder *folder); - gboolean (* remove) (EFolder *folder); - const char * (* get_physical_uri) (EFolder *folder); - - /* Signals. */ - void (* changed) (EFolder *folder); -}; - - -GtkType e_folder_get_type (void); -void e_folder_construct (EFolder *folder, - const char *name, - const char *type, - const char *description); -EFolder *e_folder_new (const char *name, - const char *type, - const char *description); - -const char *e_folder_get_physical_uri (EFolder *folder); - -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); - -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); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_FOLDER_H_ */ diff --git a/shell/e-init.c b/shell/e-init.c deleted file mode 100644 index 34ccdbcfc3..0000000000 --- a/shell/e-init.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * e-init.c: Initializes Evolution for first time users - * - */ -#include <config.h> -#include <gnome.h> -#include "e-init.h" -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> -#include "e-util/e-gui-utils.h" - -char *evolution_base_dir; - -static void -e_init_local (void) -{ - evolution_base_dir = g_concat_dir_and_file (g_get_home_dir (), "Evolution"); - - if (g_file_exists (evolution_base_dir)) - return; - - if (-1 == mkdir (evolution_base_dir, 0755)){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Evolution can not create its local folders")); - exit (0); - } -} - -void -e_init (void) -{ - e_init_local (); -} diff --git a/shell/e-init.h b/shell/e-init.h deleted file mode 100644 index 5684f87b44..0000000000 --- a/shell/e-init.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef E_INIT_H -#define E_INIT_H - -extern char *evolution_base_dir; - -void e_init (void); - -#endif /* E_INIT_H */ diff --git a/shell/e-local-folder.c b/shell/e-local-folder.c deleted file mode 100644 index b164eb1e95..0000000000 --- a/shell/e-local-folder.c +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* The metafile goes like this: - - <?xml version="1.0"?> - <efolder> - <type>mail</type> - <description>This is the folder where I store mail from my gf</description> - <homepage>http://www.somewhere.net</homepage> - </efolder> - - FIXME: Do we want to use a namespace for this? - FIXME: Do we want to have an internationalized description? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" - -#include "e-local-folder.h" - - -#define PARENT_TYPE E_TYPE_FOLDER -static EFolderClass *parent_class = NULL; - -#define URI_PREFIX "file://" -#define URI_PREFIX_LEN 7 - -#define METADATA_FILE_NAME "folder-metadata.xml" -#define METADATA_FILE_NAME_LEN 19 - - -static char * -get_string_value (xmlNode *node, - const char *name) -{ - xmlNode *p; - xmlChar *xml_string; - char *retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return NULL; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) - return NULL; - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = g_strdup ((char *) xml_string); - xmlFree (xml_string); - - return retval; -} - -static gboolean -construct_loading_metadata (ELocalFolder *local_folder, - const char *path) -{ - EFolder *folder; - xmlDoc *doc; - xmlNode *root; - char *type; - char *description; - char *metadata_path; - - folder = E_FOLDER (local_folder); - - metadata_path = g_concat_dir_and_file (path, METADATA_FILE_NAME); - - doc = xmlParseFile (metadata_path); - if (doc == NULL) { - g_free (metadata_path); - return FALSE; - } - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "efolder") != 0) { - g_free (metadata_path); - xmlFreeDoc (doc); - return FALSE; - } - - type = get_string_value (root, "type"); - description = get_string_value (root, "description"); - - e_folder_construct (folder, g_basename (path), type, description); - - g_free (type); - g_free (description); - - xmlFreeDoc (doc); - - local_folder->physical_uri = g_strconcat (URI_PREFIX, path, NULL); - - g_free (metadata_path); - - return TRUE; -} - -static gboolean -save_metadata (ELocalFolder *local_folder) -{ - EFolder *folder; - xmlDoc *doc; - xmlNode *root; - const 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)); - xmlNewChild (root, NULL, (xmlChar *) "description", (xmlChar *) e_folder_get_description (folder)); - - physical_path = local_folder->physical_uri + URI_PREFIX_LEN - 1; - - if (xmlSaveFile (physical_path, doc) < 0) { - xmlFreeDoc (doc); - return FALSE; - } - - xmlFreeDoc (doc); - return TRUE; -} - - -/* EFolder methods. */ - -static const char * -get_physical_uri (EFolder *folder) -{ - ELocalFolder *local_folder; - - local_folder = E_LOCAL_FOLDER (folder); - return local_folder->physical_uri; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - ELocalFolder *folder; - - folder = E_LOCAL_FOLDER (object); - - g_free (folder->physical_uri); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (ELocalFolderClass *klass) -{ - GtkObjectClass *object_class; - EFolderClass *folder_class; - - parent_class = gtk_type_class (e_folder_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - folder_class = E_FOLDER_CLASS (klass); - folder_class->get_physical_uri = get_physical_uri; -} - -static void -init (ELocalFolder *local_folder) -{ - local_folder->physical_uri = NULL; -} - - -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); - - return save_metadata (local_folder); -} - - -E_MAKE_TYPE (e_local_folder, "ELocalFolder", ELocalFolder, class_init, init, PARENT_TYPE) diff --git a/shell/e-local-folder.h b/shell/e-local-folder.h deleted file mode 100644 index 6092532791..0000000000 --- a/shell/e-local-folder.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-folder.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_LOCAL_FOLDER_H_ -#define _E_LOCAL_FOLDER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#include "e-folder.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_LOCAL_FOLDER (e_local_folder_get_type ()) -#define E_LOCAL_FOLDER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_LOCAL_FOLDER, ELocalFolder)) -#define E_LOCAL_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_LOCAL_FOLDER, ELocalFolderClass)) -#define E_IS_LOCAL_FOLDER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_LOCAL_FOLDER)) -#define E_IS_LOCAL_FOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_LOCAL_FOLDER)) - -typedef struct _ELocalFolder ELocalFolder; -typedef struct _ELocalFolderClass ELocalFolderClass; - -struct _ELocalFolder { - EFolder parent; - - char *physical_uri; -}; - -struct _ELocalFolderClass { - EFolderClass parent_class; -}; - - -GtkType e_local_folder_get_type (void); -EFolder *e_local_folder_new_from_path (const char *physical_path); -gboolean e_local_folder_save (ELocalFolder *local_folder); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_LOCAL_FOLDER_H__ */ diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c deleted file mode 100644 index f559d30f34..0000000000 --- a/shell/e-local-storage.c +++ /dev/null @@ -1,337 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* FIXMEs: - * - * - If we have `.' or `..' as path elements, we lose. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#define _POSIX_SOURCE /* Yuck. */ -#include <dirent.h> - -#include <string.h> -#include <sys/param.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include <gnome.h> - -#include "e-util/e-util.h" -#include "e-local-folder.h" - -#include "e-local-storage.h" - - -#define PARENT_TYPE E_TYPE_STORAGE -static EStorageClass *parent_class = NULL; - -#define SUBFOLDER_DIR_NAME "subfolders" -#define SUBFOLDER_DIR_NAME_LEN 10 - -struct _ELocalStoragePrivate { - char *base_path; -}; - - -/* Utility functions. */ - -#if 0 -/* Translate a storage path into a real path on the file system. */ -static char * -get_real_path (ELocalStorage *local_storage, - const char *path) -{ - EStorage *storage; - ELocalStoragePrivate *priv; - const char *p, *newp; - char *dp; - char *real_path; - int real_path_len; - int base_path_len; - - storage = E_STORAGE (local_storage); - priv = local_storage->priv; - - /* @path is always absolute, so it starts with a slash. The base class should - make sure this is the case; if not, it's broken. */ - g_assert (*path != G_DIR_SEPARATOR); - path++; - - /* Calculate the length of the real path. */ - - real_path_len = strlen (path); - real_path_len++; /* For the ending zero. */ - - base_path_len = strlen (priv->base_path); - real_path_len += base_path_len; - real_path_len++; /* For the separating slash. */ - - /* Take account for the fact that we need to translate every separator into - `children/'. */ - p = path; - while (1) { - newp = strchr (p, G_DIR_SEPARATOR); - if (newp == NULL) - break; - - real_path_len += SUBFOLDER_DIR_NAME_LEN; - real_path_len++; /* For the separating slash. */ - - /* Skip consecutive slashes. */ - while (*newp == G_DIR_SEPARATOR) - newp++; - - p = newp; - }; - - real_path = g_malloc (real_path_len); - dp = real_path; - - memcpy (dp, priv->base_path, base_path_len); - dp += base_path_len; - *(dp++) = G_DIR_SEPARATOR; - - /* Copy the mangled path. */ - p = path; - while (1) { - newp = strchr (p, G_DIR_SEPARATOR); - if (newp == NULL) - break; - - memcpy (dp, p, newp - p + 1); /* `+ 1' to copy the slash too. */ - dp += newp - p + 1; - - memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN); - dp += SUBFOLDER_DIR_NAME_LEN; - - *(dp++) = G_DIR_SEPARATOR; - - /* Skip consecutive slashes. */ - while (*newp == G_DIR_SEPARATOR) - newp++; - - p = newp; - } - - return real_path; -} -#endif - -static gboolean -load_folders (ELocalStorage *local_storage, - const char *parent_path, - const char *path, - const char *physical_path) -{ - DIR *dir; - char *subfolder_directory_path; - - if (parent_path == NULL) { - /* On the top level, we don't have any folders and, consequently, no - subfolder directory. */ - - subfolder_directory_path = g_strdup (physical_path); - } else { - EFolder *folder; - - /* Otherwise, we have to load the corresponding folder. */ - - folder = e_local_folder_new_from_path (physical_path); - if (folder == NULL) - return FALSE; - - e_storage_new_folder (E_STORAGE (local_storage), parent_path, folder); - - subfolder_directory_path = g_concat_dir_and_file (physical_path, SUBFOLDER_DIR_NAME); - } - - /* Now scan the subfolders and load them. The subfolders are represented by - directories under the "SUBFOLDER_DIR_NAME" directory. */ - - dir = opendir (subfolder_directory_path); - - if (dir == NULL) { - g_free (subfolder_directory_path); - return FALSE; - } - - while (1) { - struct stat file_stat; - struct dirent *dirent; - char *file_path; - char *new_path; - - dirent = readdir (dir); - if (dirent == NULL) - break; - - if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0) - continue; - - file_path = g_concat_dir_and_file (subfolder_directory_path, - dirent->d_name); - - if (stat (file_path, &file_stat) < 0) { - g_free (file_path); - continue; - } - if (! S_ISDIR (file_stat.st_mode)) { - g_free (file_path); - continue; - } - - new_path = g_concat_dir_and_file (path, dirent->d_name); - - load_folders (local_storage, path, new_path, file_path); - - g_free (file_path); - g_free (new_path); - } - - closedir (dir); - g_free (subfolder_directory_path); - - return TRUE; -} - -static gboolean -load_all_folders (ELocalStorage *local_storage) -{ - const char *base_path; - - base_path = e_local_storage_get_base_path (local_storage); - - return load_folders (local_storage, NULL, G_DIR_SEPARATOR_S, base_path); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - ELocalStorage *local_storage; - ELocalStoragePrivate *priv; - - local_storage = E_LOCAL_STORAGE (object); - priv = local_storage->priv; - - g_free (priv->base_path); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* EStorage methods. */ - -static const char * -get_name (EStorage *storage) -{ - /* FIXME this sucks. */ - return "local"; -} - - -/* 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); - object_class->destroy = destroy; - - storage_class = E_STORAGE_CLASS (class); - storage_class->get_name = get_name; -} - -static void -init (ELocalStorage *local_storage) -{ - ELocalStoragePrivate *priv; - - priv = g_new (ELocalStoragePrivate, 1); - - priv->base_path = NULL; - - local_storage->priv = priv; -} - - -static gboolean -construct (ELocalStorage *local_storage, - const char *base_path) -{ - int base_path_len; - - e_storage_construct (E_STORAGE (local_storage)); - - 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); - - local_storage->priv->base_path = g_strndup (base_path, base_path_len); - - return load_all_folders (local_storage); -} - -EStorage * -e_local_storage_open (const char *base_path) -{ - EStorage *new; - - g_return_val_if_fail (base_path != NULL, NULL); - - new = gtk_type_new (e_local_storage_get_type ()); - - if (! construct (E_LOCAL_STORAGE (new), 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; -} - - -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 569216941e..0000000000 --- a/shell/e-local-storage.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-local-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_LOCAL_STORAGE_H_ -#define _E_LOCAL_STORAGE_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-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; -}; - - -GtkType e_local_storage_get_type (void); -EStorage *e_local_storage_open (const char *base_path); -const char *e_local_storage_get_base_path (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 366022493e..0000000000 --- a/shell/e-setup.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-setup.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/* This needs to be a lot better. */ - -#include <glib.h> -#include <gnome.h> - -#include <errno.h> -#include <sys/stat.h> - -#include "e-util/e-gui-utils.h" - -#include "e-setup.h" - - -static gboolean -copy_default_stuff (const char *evolution_directory) -{ - GtkWidget *dialog; - GtkWidget *label1; - GtkWidget *label2; - GtkWidget *label3; - gboolean retval; - char *command; - int result; - - dialog = gnome_dialog_new (_("Evolution installation"), - GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, - NULL); - - label1 = gtk_label_new (_("This seems to be the first time you run Evolution.")); - label2 = gtk_label_new (_("Please click \"OK\" to install the Evolution user files under")); - label3 = gtk_label_new (evolution_directory); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label1, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label2, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label3, TRUE, TRUE, 0); - - gtk_widget_show (label1); - gtk_widget_show (label2); - gtk_widget_show (label3); - - result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - if (result != 0) - return FALSE; - - if (mkdir (evolution_directory, 0700)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot create the directory\n%s\nError: %s"), - evolution_directory, - g_strerror (errno)); - return FALSE; - } - - command = g_strconcat ("cp -r ", - EVOLUTION_DATADIR, - "/evolution/default_user/* ", - evolution_directory, - NULL); - - if (system (command) != 0) { - /* FIXME: Give more help. */ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot copy files into\n`%s'."), evolution_directory); - retval = FALSE; - } else { - e_notice (NULL, GNOME_MESSAGE_BOX_INFO, - _("Evolution files successfully installed.")); - retval = TRUE; - } - - g_free (command); - - return retval; -} - - -gboolean -e_setup (const char *evolution_directory) -{ - struct stat statinfo; - - 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 remove it in order to allow installation\n" - "of the Evolution user files.")); - return FALSE; - } - - return TRUE; -} diff --git a/shell/e-setup.h b/shell/e-setup.h deleted file mode 100644 index a69d216b94..0000000000 --- a/shell/e-setup.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-setup.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SETUP_H -#define _E_SETUP_H - -#include <glib.h> - -gboolean e_setup (const char *evolution_directory); - -#endif /* _E_SETUP_H */ diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h deleted file mode 100644 index 70986144d0..0000000000 --- a/shell/e-shell-constants.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_CONSTANTS_H -#define E_SHELL_CONSTANTS_H - -#define E_SHELL_URI_PREFIX "evolution:" -#define E_SHELL_URI_PREFIX_LEN 10 - -#define E_SHELL_MINI_ICON_SUFFIX "-mini" -#define E_SHELL_MINI_ICON_SUFFIX_LEN 5 - -#define E_SHELL_ICON_SIZE 48 -#define E_SHELL_MINI_ICON_SIZE 16 - -#endif diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c deleted file mode 100644 index 9065fc224c..0000000000 --- a/shell/e-shell-utils.c +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "e-shell-constants.h" - -#include "e-shell-utils.h" - - -static char * -get_icon_path (const char *icon_name) -{ - char *icon_path; - - if (g_path_is_absolute (icon_name)) { - icon_path = g_strdup (icon_name); - } else { - icon_path = gnome_pixmap_file (icon_name); - - if (icon_path == NULL) - icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, - icon_name); - } - - if (g_file_exists (icon_path)) { - return icon_path; - } else { - g_free (icon_path); - return NULL; - } -} - -static char * -get_mini_name (const char *icon_name) -{ - const char *dot_ptr; - const char *basename; - char *name_without_extension; - char *mini_name; - - basename = g_basename (icon_name); - if (basename == NULL) - return NULL; - - dot_ptr = strrchr (basename, '.'); - - if (dot_ptr == NULL) { - /* No extension. */ - return g_strconcat (icon_name, E_SHELL_MINI_ICON_SUFFIX, NULL); - } - - name_without_extension = g_strndup (icon_name, dot_ptr - icon_name); - mini_name = g_strconcat (name_without_extension, E_SHELL_MINI_ICON_SUFFIX, - dot_ptr, NULL); - g_free (name_without_extension); - - return mini_name; -} - - -char * -e_shell_get_icon_path (const char *icon_name, - gboolean try_mini) -{ - if (try_mini) { - char *path; - char *mini_name; - - mini_name = get_mini_name (icon_name); - if (mini_name == NULL) { - path = NULL; - } else { - path = get_icon_path (mini_name); - g_free (mini_name); - } - - if (path != NULL) - return path; - } - - return get_icon_path (icon_name); -} diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h deleted file mode 100644 index a701dd38eb..0000000000 --- a/shell/e-shell-utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-utils.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef E_SHELL_UTILS_H -#define E_SHELL_UTILS_H - -char *e_shell_get_icon_path (const char *icon_name, - gboolean try_mini); - -#endif diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c deleted file mode 100644 index 42003a1e42..0000000000 --- a/shell/e-shell-view-menu.c +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Miguel de Icaza - * Ettore Perazzoli - */ - -#include <config.h> -#include <gnome.h> - -#include "e-shell-view.h" -#include "e-shell-view-menu.h" - - -static void -command_quit (GtkWidget *widget, - gpointer data) -{ - EShellView *shell_view; - EShell *shell; - - shell_view = E_SHELL_VIEW (data); - - shell = e_shell_view_get_shell (shell_view); - e_shell_quit (shell); -} - -static void -command_run_bugbuddy (GtkWidget *menuitem, gpointer data) -{ - int pid; - char *args[] = { - "bug-buddy", - "--sm-disable", - "--package=evolution", - "--package-ver="VERSION, - NULL - }; - args[0] = gnome_is_program_in_path ("bug-buddy"); - if (!args[0]) { - /* you might have to call gnome_dialog_run() on the - * dialog returned here, I don't remember... - */ - gnome_error_dialog (_("Bug buddy was not found in your $PATH.")); - } - pid = gnome_execute_async (NULL, 4, args); - g_free (args[0]); - if (pid == -1) { - /* same as above */ - gnome_error_dialog (_("Bug buddy could not be run.")); - } -} - -static void -zero_pointer(GtkObject *object, void **pointer) -{ - *pointer = NULL; -} - -static void -command_about_box (GtkWidget *menuitem, gpointer data) -{ - static GtkWidget *about_box = NULL; - - if (about_box) - gdk_window_raise(GTK_WIDGET(about_box)->window); - else { - const gchar *authors[] = { - "Seth Alves", - "Anders Carlsson", - "Damon Chaplin", - "Clifford R. Conover", - "Miguel de Icaza", - "Arturo Espinoza", - "Larry Ewing", - "Bertrand Guiheneuf", - "Tuomas Kuosmanen", - "Christopher J. Lahey", - "Matthew Loper", - "Federico Mena", - "Eskil Heyn Olsen", - "Nat Friedman", - "Ettore Perazzoli", - "Russell Steinthal", - "Peter Teichman", - "Chris Toshok", - "Radek Doulik", - "Dan Winship", - "Michael Zucchi", - NULL}; - - about_box = gnome_about_new(_("Evolution"), - VERSION, - _("Copyright 1999, 2000 Helix Code, Inc."), - authors, - _("Evolution is a suite of groupware applications\n" - "for mail, calendaring, and contact management\n" - "within the GNOME desktop environment."), - NULL); - gtk_signal_connect(GTK_OBJECT(about_box), "destroy", - GTK_SIGNAL_FUNC(zero_pointer), &about_box); - gtk_widget_show(about_box); - } -} - - - -/* Unimplemented commands. */ - - - -#define DEFINE_UNIMPLEMENTED(func) \ -static void \ -func (GtkWidget *widget, gpointer data) \ -{ \ - g_warning ("EShellView: %s: not implemented.", __FUNCTION__); \ -} \ - -DEFINE_UNIMPLEMENTED (command_new_folder) -DEFINE_UNIMPLEMENTED (command_new_shortcut) -DEFINE_UNIMPLEMENTED (command_new_mail_message) -DEFINE_UNIMPLEMENTED (command_new_meeting_request) -DEFINE_UNIMPLEMENTED (command_new_contact) -DEFINE_UNIMPLEMENTED (command_new_task) -DEFINE_UNIMPLEMENTED (command_new_task_request) -DEFINE_UNIMPLEMENTED (command_new_journal_entry) -DEFINE_UNIMPLEMENTED (command_new_note) -DEFINE_UNIMPLEMENTED (command_open_selected_items) -DEFINE_UNIMPLEMENTED (command_save_as) -DEFINE_UNIMPLEMENTED (command_close_open_items) -DEFINE_UNIMPLEMENTED (command_toggle_shortcut_bar) -DEFINE_UNIMPLEMENTED (command_toggle_treeview) - - -/* - * FIXME - * - * This menu is actually pretty dynamic, it changes de values of various entries - * depending on the current data being displayed - * - * This is currently only a placeholder. We need to figure what to do about this. - */ -static GnomeUIInfo menu_file_new [] = { - - { GNOME_APP_UI_ITEM, N_("_Folder"), - NULL, command_new_folder, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - { GNOME_APP_UI_ITEM, N_("Evolution _Bar Shortcut"), - NULL, command_new_shortcut, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, N_("_Mail message"), - N_("Composes a new mail message"), command_new_mail_message, NULL, - NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Appointment"), - N_("Composes a new mail message"), command_new_mail_message, NULL, - NULL, 0, 0, 'a', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("Meeting Re_quest"), NULL, - command_new_meeting_request, NULL, - NULL, 0, 0, 'q', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Contact"), NULL, - command_new_contact, NULL, - NULL, 0, 0, 'c', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Task"), NULL, - command_new_task, NULL, - NULL, 0, 0, 'k', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("Task _Request"), NULL, - command_new_task_request, NULL, - NULL, 0, 0, 'u', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Journal Entry"), NULL, - command_new_journal_entry, NULL, - NULL, 0, 0, 'j', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Note"), NULL, - command_new_note, NULL, - NULL, 0, 0, 'o', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_file_open [] = { - { GNOME_APP_UI_ITEM, N_("_Selected Items"), NULL, - command_open_selected_items, NULL, - NULL, 0, 0, 'o', GDK_CONTROL_MASK }, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_folder [] = { - { GNOME_APP_UI_ITEM, N_("_New Folder"), NULL, - command_new_folder, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_file [] = { - GNOMEUIINFO_SUBTREE_STOCK (N_("_New"), menu_file_new, GNOME_STOCK_MENU_NEW), - GNOMEUIINFO_SUBTREE_STOCK (N_("_Open"), menu_file_open, GNOME_STOCK_MENU_NEW), - GNOMEUIINFO_ITEM_NONE (N_("Clos_e All Items"), N_("Closes all the open items"), command_close_open_items), - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_MENU_SAVE_AS_ITEM (command_save_as, NULL), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_SUBTREE (N_("_Folder"), menu_folder), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_MENU_EXIT_ITEM(command_quit, NULL), - - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_edit [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_view [] = { - { GNOME_APP_UI_ITEM, N_("_Toggle Shortcut Bar"), - N_("Toggles the shortcut bar"), command_toggle_shortcut_bar, NULL, - NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Toggle Treeview"), - N_("Toggles the tree view"), command_toggle_treeview, NULL, - NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_tools [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_actions [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo menu_help [] = { - GNOMEUIINFO_MENU_ABOUT_ITEM(command_about_box, NULL), - { GNOME_APP_UI_ITEM, N_("_Submit bug"), - N_("Submit bug-report via bug-buddy"), command_run_bugbuddy, NULL, - NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - GNOMEUIINFO_END -}; - - -/* Menu bar. */ - -GnomeUIInfo e_shell_view_menu [] = { - GNOMEUIINFO_MENU_FILE_TREE (menu_file), - GNOMEUIINFO_MENU_EDIT_TREE (menu_edit), - GNOMEUIINFO_MENU_VIEW_TREE (menu_view), - - /* FIXME: add Favorites here */ - - { GNOME_APP_UI_SUBTREE, N_("_Tools"), NULL, menu_tools }, - { GNOME_APP_UI_SUBTREE, N_("_Actions"), NULL, menu_actions }, - GNOMEUIINFO_MENU_HELP_TREE (menu_help), - -#warning Should provide a help menu here; Bonobo needs it - - GNOMEUIINFO_END -}; diff --git a/shell/e-shell-view-menu.h b/shell/e-shell-view-menu.h deleted file mode 100644 index 52526c4187..0000000000 --- a/shell/e-shell-view-menu.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Miguel de Icaza - * Ettore Perazzoli - */ - -#ifndef E_SHELL_VIEW_MENU_H -#define E_SHELL_VIEW_MENU_H - -#include <gnome.h> - -extern GnomeUIInfo e_shell_view_menu[]; - -#endif diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c deleted file mode 100644 index f3dd6d1a9d..0000000000 --- a/shell/e-shell-view.c +++ /dev/null @@ -1,814 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * Miguel de Icaza <miguel@helixcode.com> - * Matt Loper <matt@helixcode.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> -#include <bonobo.h> -#include <libgnomeui/gnome-window-icon.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-util/e-util.h" - -#include "e-shell-view.h" -#include "e-shell-view-menu.h" - - -#define PARENT_TYPE gnome_app_get_type () /* Losing GnomeApp does not define GNOME_TYPE_APP. */ -static GnomeAppClass *parent_class = NULL; - -struct _EShellViewPrivate { - /* The shell. */ - EShell *shell; - - /* The UI handler. */ - BonoboUIHandler *uih; - - /* Currently displayed URI. */ - char *uri; - - /* The widgetry. */ - GtkWidget *hpaned1; - GtkWidget *hpaned2; - GtkWidget *contents; - GtkWidget *notebook; - GtkWidget *shortcut_bar; - GtkWidget *shortcut_bar_box; - GtkWidget *storage_set_view; - GtkWidget *storage_set_view_box; - - /* The view we have already open. */ - GHashTable *uri_to_control; - - /* Position of the handles in the paneds, to be restored when we show elements - after hiding them. */ - unsigned int hpaned1_position; - unsigned int hpaned2_position; -}; - -/* FIXME this should probably go somewhere else. */ -#define EVOLUTION_URI_PREFIX "evolution:" -#define EVOLUTION_URI_PREFIX_LEN 10 - -#define DEFAULT_SHORTCUT_BAR_WIDTH 100 -#define DEFAULT_TREE_WIDTH 100 - -#define DEFAULT_WIDTH 600 -#define DEFAULT_HEIGHT 600 - - -static GtkWidget * -create_label_for_empty_page (void) -{ - GtkWidget *label; - - label = gtk_label_new (_("(No folder displayed)")); - gtk_widget_show (label); - - return label; -} - -static void -setup_menus (EShellView *shell_view) -{ - BonoboUIHandlerMenuItem *list; - EShellViewPrivate *priv; - - priv = shell_view->priv; - - priv->uih = bonobo_ui_handler_new (); - bonobo_ui_handler_set_app (priv->uih, GNOME_APP (shell_view)); - bonobo_ui_handler_create_menubar (priv->uih); - - list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (e_shell_view_menu, shell_view); - bonobo_ui_handler_menu_add_list (priv->uih, "/", list); - bonobo_ui_handler_menu_free_list (list); -} - -static gboolean -bonobo_widget_is_dead (BonoboWidget *bw) -{ - BonoboObject *boc = BONOBO_OBJECT (bonobo_widget_get_server (bw)); - CORBA_Object obj = bonobo_object_corba_objref (boc); - - CORBA_Environment ev; - - gboolean is_dead = FALSE; - - CORBA_exception_init (&ev); - if (CORBA_Object_non_existent(obj, &ev)) - is_dead = TRUE; - CORBA_exception_free (&ev); - - return is_dead; -} - - -/* Callbacks. */ - -/* Callback called when an icon on the shortcut bar gets clicked. */ -static void -activate_shortcut_cb (EShortcutsView *shortcut_view, - EShortcuts *shortcuts, - const char *uri, - gpointer data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_display_uri (shell_view, uri); -} - -/* Callback called when a folder on the tree view gets clicked. */ -static void -folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - gpointer data) -{ - EShellView *shell_view; - char *uri; - - shell_view = E_SHELL_VIEW (data); - - uri = g_strconcat (EVOLUTION_URI_PREFIX, path, NULL); - e_shell_view_display_uri (shell_view, uri); - g_free (uri); -} - -/* Callback called when the close button on the tree's title bar is clicked. */ -static void -storage_set_view_close_button_clicked_cb (ETitleBar *title_bar, - gpointer data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_show_folders (shell_view, FALSE); -} - -/* Callback called when the close button on the shorcut bar's title bar is clicked. */ -static void -shortcut_bar_close_button_clicked_cb (ETitleBar *title_bar, - gpointer data) -{ - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (data); - - e_shell_view_show_shortcuts (shell_view, FALSE); -} - - -static void -setup_widgets (EShellView *shell_view) -{ - EShellViewPrivate *priv; - GtkWidget *shortcut_bar_title_bar; - GtkWidget *storage_set_view_title_bar; - GtkWidget *storage_set_view_scrolled_window; - - 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); - - priv->shortcut_bar_box = gtk_vbox_new (FALSE, 0); - - shortcut_bar_title_bar = e_title_bar_new (_("Shortcuts")); - gtk_widget_show (shortcut_bar_title_bar); - - gtk_box_pack_start (GTK_BOX (priv->shortcut_bar_box), shortcut_bar_title_bar, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (priv->shortcut_bar_box), priv->shortcut_bar, - TRUE, TRUE, 0); - - gtk_signal_connect (GTK_OBJECT (shortcut_bar_title_bar), "close_button_clicked", - GTK_SIGNAL_FUNC (shortcut_bar_close_button_clicked_cb), shell_view); - - /* The storage set view. */ - - priv->storage_set_view = e_storage_set_view_new (e_shell_get_storage_set (priv->shell)); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "folder_selected", - GTK_SIGNAL_FUNC (folder_selected_cb), shell_view); - - storage_set_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (storage_set_view_scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (storage_set_view_scrolled_window), - priv->storage_set_view); - - priv->storage_set_view_box = gtk_vbox_new (FALSE, 0); - storage_set_view_title_bar = e_title_bar_new (_("Folders")); - - gtk_box_pack_start (GTK_BOX (priv->storage_set_view_box), storage_set_view_title_bar, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (priv->storage_set_view_box), storage_set_view_scrolled_window, - TRUE, TRUE, 0); - - gtk_signal_connect (GTK_OBJECT (storage_set_view_title_bar), "close_button_clicked", - GTK_SIGNAL_FUNC (storage_set_view_close_button_clicked_cb), 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->hpaned2 = gtk_hpaned_new (); - gtk_paned_add1 (GTK_PANED (priv->hpaned2), priv->storage_set_view_box); - gtk_paned_add2 (GTK_PANED (priv->hpaned2), priv->notebook); - gtk_paned_set_position (GTK_PANED (priv->hpaned2), DEFAULT_SHORTCUT_BAR_WIDTH); - - priv->hpaned1 = gtk_hpaned_new (); - gtk_paned_add1 (GTK_PANED (priv->hpaned1), priv->shortcut_bar_box); - gtk_paned_add2 (GTK_PANED (priv->hpaned1), priv->hpaned2); - gtk_paned_set_position (GTK_PANED (priv->hpaned1), DEFAULT_SHORTCUT_BAR_WIDTH); - - gtk_container_set_border_width (GTK_CONTAINER (priv->hpaned1), 0); - gtk_container_set_border_width (GTK_CONTAINER (priv->hpaned2), 0); - - gnome_app_set_contents (GNOME_APP (shell_view), priv->hpaned1); - - /* Show stuff. */ - - gtk_widget_show (priv->shortcut_bar); - gtk_widget_show (priv->shortcut_bar_box); - gtk_widget_show (priv->storage_set_view); - gtk_widget_show (priv->storage_set_view_box); - gtk_widget_show (storage_set_view_scrolled_window); - gtk_widget_show (storage_set_view_title_bar); - gtk_widget_show (priv->notebook); - gtk_widget_show (priv->hpaned1); - gtk_widget_show (priv->hpaned2); - - /* FIXME: Session management and stuff? */ - gtk_window_set_default_size (GTK_WINDOW (shell_view), DEFAULT_WIDTH, DEFAULT_HEIGHT); -} - - -/* GtkObject methods. */ - -static void -hash_forall_destroy_control (gpointer name, - gpointer value, - gpointer data) -{ - CORBA_Object corba_control; - CORBA_Environment ev; - BonoboObject *bonobo_object; - BonoboWidget *bonobo_widget; - - bonobo_widget = BONOBO_WIDGET (value); - bonobo_object = BONOBO_OBJECT (bonobo_widget_get_server (bonobo_widget)); - corba_control = bonobo_object_corba_objref (bonobo_object); - - g_return_if_fail (corba_control != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - Bonobo_Unknown_unref (corba_control, &ev); - CORBA_exception_free (&ev); - - g_free (name); -} - -static void -destroy (GtkObject *object) -{ - EShellView *shell_view; - EShellViewPrivate *priv; - - shell_view = E_SHELL_VIEW (object); - priv = shell_view->priv; - - g_hash_table_foreach (priv->uri_to_control, hash_forall_destroy_control, NULL); - g_hash_table_destroy (priv->uri_to_control); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -class_init (EShellViewClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - parent_class = gtk_type_class (gnome_app_get_type ()); -} - -static void -init (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = g_new (EShellViewPrivate, 1); - - priv->shell = NULL; - priv->uih = NULL; - priv->uri = NULL; - priv->hpaned1 = NULL; - priv->hpaned2 = NULL; - priv->contents = NULL; - priv->notebook = NULL; - priv->storage_set_view = NULL; - priv->storage_set_view_box = NULL; - priv->shortcut_bar = NULL; - priv->shortcut_bar_box = NULL; - - priv->hpaned1_position = 0; - priv->hpaned2_position = 0; - - priv->uri_to_control = g_hash_table_new (g_str_hash, g_str_equal); - - shell_view->priv = priv; -} - - -void -e_shell_view_construct (EShellView *shell_view, - EShell *shell) -{ - EShellViewPrivate *priv; - - g_return_if_fail (shell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - gnome_app_construct (GNOME_APP (shell_view), "evolution", "Evolution"); - - priv = shell_view->priv; - - gtk_object_ref (GTK_OBJECT (shell)); - priv->shell = shell; - - setup_widgets (shell_view); - setup_menus (shell_view); -} - -GtkWidget * -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 ()); - e_shell_view_construct (E_SHELL_VIEW (new), shell); - - return new; -} - - -static const char * -get_storage_set_path_from_uri (const char *uri) -{ - const char *colon; - - if (g_path_is_absolute (uri)) - return NULL; - - colon = strchr (uri, ':'); - if (colon == NULL || colon == uri || colon[1] == '\0') - return NULL; - - if (! g_path_is_absolute (colon + 1)) - return NULL; - - if (g_strncasecmp (uri, EVOLUTION_URI_PREFIX, colon - uri) != 0) - return NULL; - - return colon + 1; -} - -static void -set_icon (EShellView *shell_view, - EFolder *folder) -{ - EShellViewPrivate *priv; - const char *type; - const char *icon_name; - char *icon_path; - - priv = shell_view->priv; - - type = e_folder_get_type_string (folder); - if (type == NULL) { - icon_path = NULL; - } else { - EFolderTypeRepository *folder_type_repository; - - folder_type_repository = e_shell_get_folder_type_repository (priv->shell); - icon_name = e_folder_type_repository_get_icon_name_for_type (folder_type_repository, - 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_for_current_uri (EShellView *shell_view) -{ - EShellViewPrivate *priv; - EFolder *folder; - const char *folder_name; - const char *path; - char *window_title; - - priv = shell_view->priv; - - path = get_storage_set_path_from_uri (priv->uri); - - if (path == NULL) - folder = NULL; - else - folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), - path); - - if (folder == NULL) - folder_name = _("None"); - else - folder_name = e_folder_get_name (folder); - - window_title = g_strdup_printf (_("Evolution - %s"), folder_name); - gtk_window_set_title (GTK_WINDOW (shell_view), window_title); - g_free (window_title); - - set_icon (shell_view, folder); - - gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (folder_selected_cb), - shell_view); - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), - path); - gtk_signal_handler_unblock_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (folder_selected_cb), - shell_view); -} - -/* This displays the specified page, doing the appropriate Bonobo activation/deactivation - magic to make sure things work nicely. FIXME: Crappy way to solve the issue. */ -static void -set_current_notebook_page (EShellView *shell_view, - int page_num) -{ - EShellViewPrivate *priv; - GtkNotebook *notebook; - GtkWidget *current; - BonoboControlFrame *control_frame; - int current_page; - - priv = shell_view->priv; - notebook = GTK_NOTEBOOK (priv->notebook); - - current_page = gtk_notebook_get_current_page (notebook); - if (current_page == page_num) - return; - - if (current_page != -1 && current_page != 0) { - current = gtk_notebook_get_nth_page (notebook, current_page); - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (current)); - - bonobo_control_frame_set_autoactivate (control_frame, FALSE); - bonobo_control_frame_control_deactivate (control_frame); - } - - gtk_notebook_set_page (notebook, page_num); - - if (page_num == -1 || page_num == 0) - return; - - current = gtk_notebook_get_nth_page (notebook, page_num); - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (current)); - - bonobo_control_frame_set_autoactivate (control_frame, FALSE); - bonobo_control_frame_control_activate (control_frame); -} - -static void -show_error (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - GtkWidget *label; - char *s; - - priv = shell_view->priv; - - s = g_strdup_printf (_("Cannot open location: %s\n"), uri); - label = gtk_label_new (s); - g_free (s); - - gtk_widget_show (label); - - gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0); - gtk_notebook_prepend_page (GTK_NOTEBOOK (priv->notebook), label, NULL); -} - -/* Create a new view for @uri with @control. It assumes a view for @uri does - not exist yet. */ -static GtkWidget * -get_control_for_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - EFolderTypeRepository *folder_type_repository; - EStorageSet *storage_set; - EFolder *folder; - Bonobo_UIHandler corba_uih; - const char *control_id; - const char *path; - const char *folder_type; - GtkWidget *control; - - priv = shell_view->priv; - - path = strchr (uri, ':'); - if (path == NULL) - return NULL; - - path++; - if (*path == '\0') - return NULL; - - storage_set = e_shell_get_storage_set (priv->shell); - folder_type_repository = e_shell_get_folder_type_repository (priv->shell); - - folder = e_storage_set_get_folder (storage_set, path); - if (folder == NULL) - return NULL; - - folder_type = e_folder_get_type_string (folder); - if (folder_type == NULL) - return NULL; - - control_id = e_folder_type_repository_get_control_id_for_type (folder_type_repository, - folder_type); - if (control_id == NULL) - return NULL; - - corba_uih = bonobo_object_corba_objref (BONOBO_OBJECT (priv->uih)); - control = bonobo_widget_new_control (control_id, corba_uih); - - if (control == NULL) - return NULL; - - bonobo_widget_set_property (BONOBO_WIDGET (control), - "folder_uri", e_folder_get_physical_uri (folder), - NULL); - - return control; -} - -static gboolean -show_existing_view (EShellView *shell_view, - const char *uri, - GtkWidget *control) -{ - EShellViewPrivate *priv; - int notebook_page; - - priv = shell_view->priv; - - notebook_page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - g_assert (notebook_page != -1); - - /* A BonoboWidget can be a "zombie" in the sense that its actual - control is dead; if it's zombie, we have to recreate it. */ - if (bonobo_widget_is_dead (BONOBO_WIDGET (control))) { - GtkWidget *parent; - Bonobo_UIHandler uih; - - parent = control->parent; - uih = bonobo_object_corba_objref (BONOBO_OBJECT (priv->uih)); - - /* Out with the old. */ - gtk_container_remove (GTK_CONTAINER (parent), control); - g_hash_table_remove (priv->uri_to_control, uri); - - /* In with the new. */ - control = get_control_for_uri (shell_view, uri); - if (control == NULL) - return FALSE; - - gtk_container_add (GTK_CONTAINER (parent), control); - g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control); - - /* Show. */ - gtk_widget_show (control); - } - - set_current_notebook_page (shell_view, notebook_page); - - return TRUE; -} - -static gboolean -create_new_view_for_uri (EShellView *shell_view, - const char *uri) -{ - GtkWidget *control; - EShellViewPrivate *priv; - int page_num; - - priv = shell_view->priv; - - control = get_control_for_uri (shell_view, uri); - if (control == NULL) { - show_error (shell_view, uri); - return FALSE; - } - - gtk_widget_show (control); - - gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), control, NULL); - - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - g_assert (page_num != -1); - set_current_notebook_page (shell_view, page_num); - - g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control); - - return TRUE; -} - -gboolean -e_shell_view_display_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - GtkWidget *control; - gboolean retval; - - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - - priv = shell_view->priv; - - if (uri == NULL) { - gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0); - gtk_notebook_prepend_page (GTK_NOTEBOOK (priv->notebook), - create_label_for_empty_page (), NULL); - - set_current_notebook_page (shell_view, 0); - - if (priv->uri != NULL) { - g_free (priv->uri); - priv->uri = NULL; - } - - retval = TRUE; - goto end; - } - - g_free (priv->uri); - priv->uri = g_strdup (uri); - - if (strncmp (uri, EVOLUTION_URI_PREFIX, EVOLUTION_URI_PREFIX_LEN) != 0) { - show_error (shell_view, uri); - return FALSE; - } - - control = g_hash_table_lookup (priv->uri_to_control, uri); - if (control != NULL) { - g_assert (GTK_IS_WIDGET (control)); - show_existing_view (shell_view, uri, control); - retval = TRUE; - goto end; - } - - if (! create_new_view_for_uri (shell_view, uri)) { - show_error (shell_view, uri); - retval = FALSE; - goto end; - } - - retval = TRUE; - - end: - update_for_current_uri (shell_view); - return retval; -} - - -void -e_shell_view_show_shortcuts (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) { - if (! GTK_WIDGET_VISIBLE (priv->shortcut_bar_box)) { - gtk_widget_show (priv->shortcut_bar_box); - gtk_paned_set_position (GTK_PANED (priv->hpaned1), priv->hpaned1_position); - } - } else { - if (GTK_WIDGET_VISIBLE (priv->shortcut_bar_box)) { - gtk_widget_hide (priv->shortcut_bar_box); - /* FIXME this is a private field! */ - priv->hpaned1_position = GTK_PANED (priv->hpaned1)->child1_size; - gtk_paned_set_position (GTK_PANED (priv->hpaned1), 0); - } - } -} - -void -e_shell_view_show_folders (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) { - if (! GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) { - gtk_widget_show (priv->storage_set_view_box); - gtk_paned_set_position (GTK_PANED (priv->hpaned2), priv->hpaned2_position); - } - } else { - if (GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) { - gtk_widget_hide (priv->storage_set_view_box); - /* FIXME this is a private field! */ - priv->hpaned2_position = GTK_PANED (priv->hpaned2)->child1_size; - gtk_paned_set_position (GTK_PANED (priv->hpaned2), 0); - } - } -} - - -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; -} - - -E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h deleted file mode 100644 index 10745b5c62..0000000000 --- a/shell/e-shell-view.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHELL_VIEW_H_ -#define _E_SHELL_VIEW_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "e-shell.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - - -#define E_TYPE_SHELL_VIEW (e_shell_view_get_type ()) -#define E_SHELL_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView)) -#define E_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass)) -#define E_IS_SHELL_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_VIEW)) -#define E_IS_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW)) - -typedef struct _EShellView EShellView; -typedef struct _EShellViewPrivate EShellViewPrivate; -typedef struct _EShellViewClass EShellViewClass; - -struct _EShellView { - GnomeApp parent; - - EShellViewPrivate *priv; -}; - -struct _EShellViewClass { - GnomeAppClass parent_class; -}; - - -GtkType e_shell_view_get_type (void); -void e_shell_view_construct (EShellView *shell_view, - EShell *shell); -GtkWidget *e_shell_view_new (EShell *shell); - -gboolean e_shell_view_display_uri (EShellView *shell_view, - const char *uri); - -void e_shell_view_show_shortcuts (EShellView *shell_view, - gboolean show); -void e_shell_view_show_folders (EShellView *shell_view, - gboolean show); - -EShell *e_shell_view_get_shell (EShellView *shell_view); - -#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 a0851af27a..0000000000 --- a/shell/e-shell.c +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtktypeutils.h> - -#include "e-util/e-util.h" - -#include "e-folder-type-repository.h" -#include "e-local-storage.h" -#include "e-shell-view.h" -#include "e-shortcuts.h" -#include "e-storage-set.h" - -#include "e-shell.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _EShellPrivate { - char *local_directory; - - GList *views; - - EStorageSet *storage_set; - EShortcuts *shortcuts; - EFolderTypeRepository *folder_type_repository; -}; - -#define SHORTCUTS_FILE_NAME "shortcuts.xml" -#define LOCAL_STORAGE_DIRECTORY "local" - -enum { - NO_VIEWS_LEFT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Initialization of the storages. */ - -static gboolean -setup_storages (EShell *shell) -{ - EStorage *local_storage; - EShellPrivate *priv; - gchar *local_storage_path; - - priv = shell->priv; - - local_storage_path = g_concat_dir_and_file (priv->local_directory, - LOCAL_STORAGE_DIRECTORY); - local_storage = e_local_storage_open (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); - - g_assert (shell->priv->folder_type_repository); - - priv->storage_set = e_storage_set_new (shell->priv->folder_type_repository); - e_storage_set_add_storage (priv->storage_set, local_storage); - - return TRUE; -} - - -/* EShellView destruction callback. */ - -static void -view_destroy_cb (GtkObject *object, - gpointer data) -{ - EShell *shell; - - g_assert (E_IS_SHELL_VIEW (object)); - - shell = E_SHELL (data); - shell->priv->views = g_list_remove (shell->priv->views, object); - - if (shell->priv->views == NULL) - gtk_signal_emit (GTK_OBJECT (shell), signals[NO_VIEWS_LEFT]); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShell *shell; - EShellPrivate *priv; - GList *p; - - shell = E_SHELL (object); - priv = shell->priv; - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - if (priv->shortcuts != NULL) - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - - if (priv->folder_type_repository != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_repository)); - - for (p = priv->views; p != NULL; p = p->next) { - EShellView *view; - - view = E_SHELL_VIEW (p->data); - - gtk_signal_disconnect_by_func (GTK_OBJECT (view), - GTK_SIGNAL_FUNC (view_destroy_cb), shell); - gtk_object_destroy (GTK_OBJECT (view)); - } - - g_list_free (priv->views); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EShellClass *klass) -{ - GtkObjectClass *object_class; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - signals[NO_VIEWS_LEFT] = - gtk_signal_new ("no_views_left", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EShellClass, no_views_left), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShell *shell) -{ - EShellPrivate *priv; - - priv = g_new (EShellPrivate, 1); - - priv->views = NULL; - - priv->local_directory = NULL; - priv->storage_set = NULL; - priv->shortcuts = NULL; - priv->folder_type_repository = NULL; - - shell->priv = priv; -} - - -void -e_shell_construct (EShell *shell, - const char *local_directory) -{ - EShellPrivate *priv; - gchar *shortcut_path; - - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (local_directory != NULL); - g_return_if_fail (g_path_is_absolute (local_directory)); - - GTK_OBJECT_UNSET_FLAGS (shell, GTK_FLOATING); - - priv = shell->priv; - - priv->local_directory = g_strdup (local_directory); - - priv->folder_type_repository = e_folder_type_repository_new (); - - if (! setup_storages (shell)) - return; - - priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_repository); - - shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml"); - - if (! e_shortcuts_load (priv->shortcuts, shortcut_path)) { - gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - priv->shortcuts = NULL; - - g_warning ("Cannot load shortcuts -- %s", shortcut_path); - } - - g_free (shortcut_path); -} - -EShell * -e_shell_new (const char *local_directory) -{ - EShell *new; - EShellPrivate *priv; - - new = gtk_type_new (e_shell_get_type ()); - e_shell_construct (new, local_directory); - - priv = new->priv; - - if (priv->shortcuts == NULL || priv->storage_set == NULL) { - gtk_object_unref (GTK_OBJECT (new)); - return NULL; - } - - return new; -} - - -GtkWidget * -e_shell_new_view (EShell *shell, - const char *uri) -{ - GtkWidget *view; - - g_return_val_if_fail (shell != NULL, NULL); - g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - view = e_shell_view_new (shell); - - gtk_widget_show (view); - gtk_signal_connect (GTK_OBJECT (view), "destroy", GTK_SIGNAL_FUNC (view_destroy_cb), shell); - - if (uri != NULL) - e_shell_view_display_uri (E_SHELL_VIEW (view), uri); - - shell->priv->views = g_list_prepend (shell->priv->views, view); - - return view; -} - - -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; -} - -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; -} - -EFolderTypeRepository * -e_shell_get_folder_type_repository (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_repository; -} - - -void -e_shell_quit (EShell *shell) -{ - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - - gtk_object_destroy (GTK_OBJECT (shell)); -} - - -E_MAKE_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell.h b/shell/e-shell.h deleted file mode 100644 index 10b42f527d..0000000000 --- a/shell/e-shell.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHELL_H_ -#define _E_SHELL_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#include "e-shortcuts.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#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)) - - -typedef struct _EShell EShell; -typedef struct _EShellPrivate EShellPrivate; -typedef struct _EShellClass EShellClass; - -struct _EShell { - GtkObject parent; - - EShellPrivate *priv; -}; - -struct _EShellClass { - GtkObjectClass parent_class; - - void (* no_views_left) (EShell *shell); -}; - - -GtkType e_shell_get_type (void); -void e_shell_construct (EShell *shell, - const char *local_directory); -EShell *e_shell_new (const char *local_directory); - -GtkWidget *e_shell_new_view (EShell *shell, - const char *uri); - -EShortcuts *e_shell_get_shortcuts (EShell *shell); -EStorageSet *e_shell_get_storage_set (EShell *shell); -EFolderTypeRepository *e_shell_get_folder_type_repository (EShell *shell); - -void e_shell_quit (EShell *shell); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHELL_H_ */ diff --git a/shell/e-shortcut.c b/shell/e-shortcut.c deleted file mode 100644 index 532f38b175..0000000000 --- a/shell/e-shortcut.c +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Shortcut.c: implements shortcuts and shortcut group models - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - * - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmisc.h> -#include <libgnome/libgnome.h> -#include "e-util/e-util.h" -#include "e-shortcut.h" -#include "shortcut-bar/e-shortcut-bar.h" -#include "shortcut-bar/e-clipped-label.h" - -#define SHORTCUT_PARENT_TYPE gtk_object_get_type () -#define SHORTCUT_BAR_MODEL_PARENT_TYPE gtk_object_get_type () -#define SHORTCUT_GROUP_PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *shortcut_parent_class; -static GtkObjectClass *shortcut_group_parent_class; -static GtkObjectClass *shortcut_bar_model_parent_class; - -enum { - STRUCTURE_CHANGED, - LAST_SIGNAL -}; - -static void -es_destroy (GtkObject *object) -{ - EShortcut *ef = E_SHORTCUT (object); - - if (ef->efolder != NULL) - gtk_object_unref (GTK_OBJECT (ef->efolder)); - - shortcut_parent_class->destroy (object); -} - -static void -e_shortcut_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = es_destroy; - shortcut_parent_class = gtk_type_class (SHORTCUT_PARENT_TYPE); -} - -static void -esg_destroy (GtkObject *object) -{ - EShortcutGroup *efg = E_SHORTCUT_GROUP (object); - const int shortcut_count = efg->shortcuts->len; - int i; - - g_free (efg->title); - - for (i = 0; i < shortcut_count; i++){ - EShortcut *es = g_array_index (efg->shortcuts, EShortcut *, i); - - if (es != NULL) - gtk_object_unref (GTK_OBJECT (es)); - } - - g_array_free (efg->shortcuts, TRUE); - efg->model = NULL; - - shortcut_group_parent_class->destroy (object); -} - -static void -e_shortcut_group_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = esg_destroy; - shortcut_parent_class = gtk_type_class (SHORTCUT_GROUP_PARENT_TYPE); -} - -static void -e_shortcut_group_init (GtkObject *object) -{ - EShortcutGroup *esg = E_SHORTCUT_GROUP (object); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (object), GTK_FLOATING); - - esg->shortcuts = g_array_new (FALSE, FALSE, sizeof (EShortcut *)); -} - -EShortcut * -e_shortcut_new (EFolder *efolder) -{ - EShortcut *shortcut = gtk_type_new (e_shortcut_get_type ()); - - shortcut->efolder = efolder; - gtk_object_ref (GTK_OBJECT (efolder)); - - return shortcut; -} - -EShortcutGroup * -e_shortcut_group_new (const char *title, EIconBarViewType type) -{ - EShortcutGroup *shortcut_group = gtk_type_new (e_shortcut_group_get_type ()); - - shortcut_group->title = g_strdup (title); - shortcut_group->type = type; - return shortcut_group; -} - -void -e_shortcut_group_append (EShortcutGroup *sg, EShortcut *shortcut) -{ - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - g_return_if_fail (shortcut != NULL); - g_return_if_fail (E_IS_SHORTCUT (shortcut)); - - gtk_object_ref (GTK_OBJECT (shortcut)); - gtk_object_sink (GTK_OBJECT (shortcut)); - - g_array_append_val (sg->shortcuts, shortcut); - - /* FIXME: Broadcast change */ -} - -void -e_shortcut_group_remove (EShortcutGroup *sg, EShortcut *shortcut) -{ - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - g_return_if_fail (shortcut != NULL); - g_return_if_fail (E_IS_SHORTCUT (sg)); - - { - const int len = sg->shortcuts->len; - int i; - - for (i = 0; i < len; i++){ - EShortcut *es = g_array_index (sg->shortcuts, EShortcut *, i); - - if (es == shortcut){ - g_array_remove_index (sg->shortcuts, i); - /* FIXME: Broadcast change */ - return; - } - } - } -} - -void -e_shortcut_group_move (EShortcutGroup *sg, int from, int to) -{ - EShortcut *t; - - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - g_return_if_fail (from < sg->shortcuts->len); - g_return_if_fail (to < sg->shortcuts->len); - g_return_if_fail (from >= 0); - g_return_if_fail (to >= 0); - - if (from == to) - return; - - t = g_array_index (sg->shortcuts, EShortcut *, from); - g_array_index (sg->shortcuts, EShortcut *, from) = - g_array_index (sg->shortcuts, EShortcut *, to); - g_array_index (sg->shortcuts, EShortcut *, to) = t; - - /* FIXME: Broadcast change */ -} - -void -e_shortcut_group_rename (EShortcutGroup *sg, const char *text) -{ - GSList *l; - int id; - - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - id = e_group_num_from_group_ptr (sg->model, sg); - for (l = sg->model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - GtkWidget *label; - - label = e_clipped_label_new (text); - - gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); - gtk_widget_show (label); - - e_group_bar_set_group_button_label ( - E_GROUP_BAR (shortcut_bar), id, label); - } -} - -static void -esb_destroy (GtkObject *object) -{ - EShortcutBarModel *esb = E_SHORTCUT_BAR_MODEL (object); - const int count = esb->groups->len; - int i; - - for (i = 0; i < count; i++){ - EShortcutGroup *esg = g_array_index (esb->groups, EShortcutGroup *, i); - - gtk_object_destroy (GTK_OBJECT (esg)); - } - - g_array_free (esb->groups, TRUE); - shortcut_bar_model_parent_class->destroy (object); -} - -static void -e_shortcut_bar_model_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = esb_destroy; - shortcut_bar_model_parent_class = gtk_type_class (SHORTCUT_BAR_MODEL_PARENT_TYPE); -} - -static void -e_shortcut_bar_model_init (GtkObject *object) -{ - EShortcutBarModel *esb = E_SHORTCUT_BAR_MODEL (object); - - /* The shortcut bar model is self owned */ - GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING); - - esb->groups = g_array_new (FALSE, FALSE, sizeof (EShortcutGroup *)); -} - -EShortcutBarModel * -e_shortcut_bar_model_new (void) -{ - EShortcutBarModel *bm; - - bm = gtk_type_new (e_shortcut_bar_model_get_type ()); - - return bm; -} - -void -e_shortcut_bar_model_append (EShortcutBarModel *bm, EShortcutGroup *sg) -{ - g_return_if_fail (bm != NULL); - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_BAR_MODEL (bm)); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - gtk_object_ref (GTK_OBJECT (sg)); - gtk_object_sink (GTK_OBJECT (sg)); - - sg->model = bm; - - g_array_append_val (bm->groups, sg); -} - -EShortcutGroup * -e_shortcut_group_from_pos (EShortcutBarModel *bm, int group_num) -{ - EShortcutGroup *group; - - if (group_num == -1) - return NULL; - - group = g_array_index (bm->groups, EShortcutGroup *, group_num); - return group; -} - -EShortcut * -e_shortcut_from_pos (EShortcutGroup *group, int item_num) -{ - EShortcut *shortcut; - - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUT_GROUP (group), NULL); - - if (item_num == -1) - return NULL; - - g_return_val_if_fail (item_num < group->shortcuts->len, NULL); - - shortcut = g_array_index (group->shortcuts, EShortcut *, item_num); - return shortcut; -} - -static void -populate_group (EShortcutBarModel *bm, EShortcutGroup *esg, EShortcutBar *shortcut_bar) -{ - int group_num, i; - const int items = esg->shortcuts->len; - - group_num = e_shortcut_bar_add_group (shortcut_bar, esg->title); - e_shortcut_bar_set_view_type (shortcut_bar, group_num, esg->type); - - for (i = 0; i < items; i++){ - EShortcut *shortcut = E_SHORTCUT (g_array_index (esg->shortcuts, EShortcut *, i)); - EFolder *folder = shortcut->efolder; - char *type = NULL; - - switch (folder->type){ - case E_FOLDER_SUMMARY: - type = "summary:"; - break; - - case E_FOLDER_MAIL: - type = "mail:"; - break; - - case E_FOLDER_CONTACTS: - type = "contacts:"; - break; - - case E_FOLDER_CALENDAR: - type = "calendar:"; - break; - - case E_FOLDER_TASKS: - type = "todo:"; - break; - - case E_FOLDER_OTHER: - type = "file:"; - break; - - default: - g_assert_not_reached (); - } - - e_shortcut_bar_add_item (shortcut_bar, group_num, type, folder->name); - } -} - -static void -populate_from_model (EShortcutBarModel *bm, EShortcutBar *shortcut_bar) -{ - const int groups = bm->groups->len; - int i; - - for (i = 0; i < groups; i++){ - EShortcutGroup *esg; - - esg = g_array_index (bm->groups, EShortcutGroup *, i); - - populate_group (bm, esg, shortcut_bar); - } - -} - -static struct { - char *prefix, *path; - GdkPixbuf *image; -} shell_icons[] = { - { "summary:", "evolution-today.png", NULL }, - { "mail:", "evolution-inbox.png", NULL }, - { "calendar:", "evolution-calendar.png", NULL }, - { "contacts:", "evolution-contacts.png", NULL }, - { "notes:", "evolution-notes.png", NULL }, - { "todo:", "evolution-tasks.png", NULL } -}; -#define NSHELL_ICONS (sizeof (shell_icons) / sizeof (shell_icons[0])) - -static GdkPixbuf * -shell_icon_cb (EShortcutBar *shortcut_bar, const gchar *url, gpointer data) -{ - int i; - - for (i = 0; i < NSHELL_ICONS; i++) { - if (!strncmp (shell_icons[i].prefix, url, - strlen (shell_icons[i].prefix))) { - if (!shell_icons[i].image) { - char *pixmap_path; - - pixmap_path = g_strconcat (EVOLUTION_IMAGES "/", shell_icons[i].path, NULL); - if (pixmap_path) - shell_icons[i].image = gdk_pixbuf_new_from_file (pixmap_path); - else { - g_warning ("Couldn't find image: %s", - pixmap_path); - } - g_free (pixmap_path); - } - return shell_icons[i].image; - } - } - - return NULL; -} - -static void -view_destroyed (EShortcutBar *shortcut_bar, EShortcutBarModel *bm) -{ - bm->views = g_slist_remove (bm->views, shortcut_bar); -} - -GtkWidget * -e_shortcut_bar_view_new (EShortcutBarModel *bm) -{ - GtkWidget *shortcut_bar; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - shortcut_bar = e_shortcut_bar_new (); - e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcut_bar), - shell_icon_cb, NULL); - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - populate_from_model (bm, E_SHORTCUT_BAR (shortcut_bar)); - - bm->views = g_slist_prepend (bm->views, shortcut_bar); - gtk_signal_connect (GTK_OBJECT (shortcut_bar), "destroy", GTK_SIGNAL_FUNC (view_destroyed), bm); - - return shortcut_bar; -} - -int -e_group_num_from_group_ptr (EShortcutBarModel *bm, EShortcutGroup *group) -{ - const int n = bm->groups->len; - int i; - - for (i = 0; i < n; i++) - if (g_array_index (bm->groups, EShortcutGroup *, i) == group) - return i; - return -1; -} - -/* - * Sets the view mode in all the views - */ -void -e_shortcut_group_set_view_type (EShortcutGroup *group, EIconBarViewType type) -{ - GSList *l; - int group_num; - - g_return_if_fail (group != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (group)); - - group_num = e_group_num_from_group_ptr (group->model, group); - - g_assert (group_num != -1); - - group->type = type; - - for (l = group->model->views; l ; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - e_shortcut_bar_set_view_type (shortcut_bar, group_num, type); - } -} - -gint -e_shortcut_bar_model_add_group (EShortcutBarModel *model) -{ - int id = -1; - GSList *l = NULL; - - g_return_val_if_fail (model != NULL, -1); - g_return_val_if_fail (E_IS_SHORTCUT_BAR_MODEL (model), -1); - - for (l = model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - id = e_shortcut_bar_add_group (shortcut_bar, _("New group")); - } - - return id; -} - -void -e_shortcut_bar_model_remove_group (EShortcutBarModel *model, EShortcutGroup *sg) -{ - GSList *l = NULL; - int group_num; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SHORTCUT_BAR_MODEL (model)); - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - group_num = e_group_num_from_group_ptr (model, sg); - - for (l = model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - e_shortcut_bar_remove_group (shortcut_bar, group_num); - } - -} - -E_MAKE_TYPE (e_shortcut, "EShortcut", EShortcut, e_shortcut_class_init, NULL, SHORTCUT_PARENT_TYPE); -E_MAKE_TYPE (e_shortcut_group, "EShortcutGroup", EShortcutGroup, e_shortcut_group_class_init, e_shortcut_group_init, SHORTCUT_GROUP_PARENT_TYPE); -E_MAKE_TYPE (e_shortcut_bar_model, "EShortcutBarModel", EShortcutBarModel, e_shortcut_bar_model_class_init, e_shortcut_bar_model_init, SHORTCUT_BAR_MODEL_PARENT_TYPE); - diff --git a/shell/e-shortcut.h b/shell/e-shortcut.h deleted file mode 100644 index e7dde69124..0000000000 --- a/shell/e-shortcut.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SHELL_SHORTCUT_H -#define SHELL_SHORTCUT_H - -#include <gtk/gtkobject.h> -#include "e-folder.h" -#include "shortcut-bar/e-icon-bar.h" - -typedef struct _EShortcut EShortcut; -typedef struct _EShortcutGroup EShortcutGroup; -typedef struct _EShortcutBarModel EShortcutBarModel; - -#define E_SHORTCUT_TYPE (e_shortcut_get_type ()) -#define E_SHORTCUT(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_TYPE, EShortcut)) -#define E_SHORTCUT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_TYPE, EShortcutClass)) -#define E_IS_SHORTCUT(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_TYPE)) -#define E_IS_SHORTCUT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_TYPE)) - -struct _EShortcut { - GtkObject object; - EFolder *efolder; -}; - -typedef struct { - GtkObjectClass parent_class; -} EShortcutClass; - -#define E_SHORTCUT_GROUP_TYPE (e_shortcut_group_get_type ()) -#define E_SHORTCUT_GROUP(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_GROUP_TYPE, EShortcutGroup)) -#define E_SHORTCUT_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_GROUP_TYPE, EShortcutGroupClass)) -#define E_IS_SHORTCUT_GROUP(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_GROUP_TYPE)) -#define E_IS_SHORTCUT_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_GROUP_TYPE)) - -struct _EShortcutGroup { - GtkObject object; - EShortcutBarModel *model; - char *group_name; - GArray *shortcuts; - char *title; - EIconBarViewType type; -}; - -typedef struct { - GtkObjectClass parent_class; -} EShortcutGroupClass; - -GtkType e_shortcut_get_type (void); -EShortcut *e_shortcut_new (EFolder *efolder); - -GtkType e_shortcut_group_get_type (void); -EShortcutGroup *e_shortcut_group_new (const char *name, EIconBarViewType type); -void e_shortcut_group_append (EShortcutGroup *sg, EShortcut *shortcut); -void e_shortcut_group_destroy (EShortcutGroup *sg); -void e_shortcut_group_remove (EShortcutGroup *sg, EShortcut *shortcut); -void e_shortcut_group_move (EShortcutGroup *sg, int from, int to); -void e_shortcut_group_set_view_type (EShortcutGroup *sg, EIconBarViewType type); -void e_shortcut_group_rename (EShortcutGroup *sg, const char *text); - -#define E_SHORTCUT_BAR_MODEL_TYPE (e_shortcut_bar_model_get_type ()) -#define E_SHORTCUT_BAR_MODEL(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_BAR_MODEL_TYPE, EShortcutBarModel)) -#define E_SHORTCUT_BAR_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_BAR_MODEL_TYPE, EShortcutBarMNodelClass)) -#define E_IS_SHORTCUT_BAR_MODEL(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_BAR_MODEL_TYPE)) -#define E_IS_SHORTCUT_BAR_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_BAR_MODEL_TYPE)) - -struct _EShortcutBarModel { - GtkObject object; - - GArray *groups; - GSList *views; -}; - -typedef struct { - GtkObjectClass object_class; -} EShortcutBarModelClass; - -GtkType e_shortcut_bar_model_get_type (void); -EShortcutBarModel *e_shortcut_bar_model_new (void); -void e_shortcut_bar_model_append (EShortcutBarModel *shortcut_bar, - EShortcutGroup *group); -int e_shortcut_bar_model_add_group (EShortcutBarModel *shortcut_bar); -void e_shortcut_bar_model_remove_group - (EShortcutBarModel *model, - EShortcutGroup *sg); - -/* Ugly api name */ -int e_group_num_from_group_ptr (EShortcutBarModel *bm, - EShortcutGroup *group); - -/* - * Produces a new view of the Shortcut Bar model - */ -GtkWidget *e_shortcut_bar_view_new (EShortcutBarModel *bm); - -/* - * Locating objects - */ -EShortcutGroup *e_shortcut_group_from_pos (EShortcutBarModel *bm, - int group_num); -EShortcut *e_shortcut_from_pos (EShortcutGroup *group, - int item_num); - -#endif - diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c deleted file mode 100644 index dd17326d8c..0000000000 --- a/shell/e-shortcuts-view.c +++ /dev/null @@ -1,294 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "e-util/e-util.h" - -#include "e-shortcuts-view.h" - - -#define PARENT_TYPE E_TYPE_SHORTCUT_BAR -static EShortcutBarClass *parent_class = NULL; - -struct _EShortcutsViewPrivate { - EShortcuts *shortcuts; -}; - -enum { - ACTIVATE_SHORTCUT, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* View initialization. */ - -static const char * -get_storage_set_path_from_uri (const char *uri) -{ - const char *colon; - - if (g_path_is_absolute (uri)) - return NULL; - - colon = strchr (uri, ':'); - if (colon == NULL || colon == uri || colon[1] == '\0') - return NULL; - - if (! g_path_is_absolute (colon + 1)) - return NULL; - - if (g_strncasecmp (uri, "evolution", colon - uri) != 0) - return NULL; - - return colon + 1; -} - -static void -load_group (EShortcutsView *shortcuts_view, - const char *group_title, - int group_num) -{ - EShortcutsViewPrivate *priv; - EShortcuts *shortcuts; - EStorageSet *storage_set; - GList *shortcut_list; - GList *p; - - priv = shortcuts_view->priv; - shortcuts = priv->shortcuts; - - storage_set = e_shortcuts_get_storage_set (shortcuts); - g_assert (storage_set != NULL); - - shortcut_list = e_shortcuts_get_shortcuts_in_group (shortcuts, group_title); - if (shortcut_list == NULL) - return; - - for (p = shortcut_list; p != NULL; p = p->next) { - EFolder *folder; - const char *path; - const char *uri; - const char *name; - - uri = (const char *) p->data; - path = get_storage_set_path_from_uri (uri); - if (path != NULL) - folder = e_storage_set_get_folder (storage_set, path); - - if (path == NULL || folder == NULL) { - /* FIXME */ - g_warning ("Invalid link while loading shortcut bar view -- %s\n", - uri); - continue; - } - - name = e_folder_get_name (folder); - e_shortcut_bar_add_item (E_SHORTCUT_BAR (shortcuts_view), group_num, uri, name); - } - - e_free_string_list (shortcut_list); -} - -static void -load_all_shortcuts (EShortcutsView *shortcuts_view) -{ - EShortcutsViewPrivate *priv; - EShortcuts *shortcuts; - GList *group_titles; - GList *p; - int group_num; - - priv = shortcuts_view->priv; - shortcuts = priv->shortcuts; - - group_titles = e_shortcuts_get_group_titles (shortcuts); - - for (p = group_titles; p != NULL; p = p->next) { - const char *group_title; - - group_title = (const char *) p->data; - group_num = e_shortcut_bar_add_group (E_SHORTCUT_BAR (shortcuts_view), - group_title); - - load_group (shortcuts_view, group_title, group_num); - } - - e_free_string_list (group_titles); -} - -/* Icon callback for the shortcut bar. */ -static GdkPixbuf * -icon_callback (EShortcutBar *shortcut_bar, - const char *uri, - gpointer data) -{ - EFolderTypeRepository *folder_type_repository; - EShortcuts *shortcuts; - EStorageSet *storage_set; - EFolder *folder; - GdkPixbuf *pixbuf; - const char *type; - - shortcuts = E_SHORTCUTS (data); - - storage_set = e_shortcuts_get_storage_set (shortcuts); - folder_type_repository = e_storage_set_get_folder_type_repository (storage_set); - - folder = e_storage_set_get_folder (storage_set, - get_storage_set_path_from_uri (uri)); - - if (folder == NULL) - return NULL; - - type = e_folder_get_type_string (folder); - if (type == NULL) - return NULL; - - /* FIXME mini icons? */ - pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, type, FALSE); - if (pixbuf != NULL) - gdk_pixbuf_ref (pixbuf); - - return pixbuf; -} - - -static void -destroy (GtkObject *object) -{ - EShortcutsViewPrivate *priv; - EShortcutsView *shortcuts_view; - - shortcuts_view = E_SHORTCUTS_VIEW (object); - - priv = shortcuts_view->priv; - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -selected_item (EShortcutBar *shortcut_bar, - GdkEvent *event, - int group_num, - int item_num) -{ - EShortcuts *shortcuts; - const char *uri; - - shortcuts = E_SHORTCUTS_VIEW (shortcut_bar)->priv->shortcuts; - - uri = e_shortcuts_get_uri (shortcuts, group_num, item_num); - - /* Lame EShortcutBar. This can happen. */ - if (uri == NULL) - return; - - gtk_signal_emit (GTK_OBJECT (shortcut_bar), signals[ACTIVATE_SHORTCUT], - shortcuts, uri); -} - - -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->selected_item = selected_item; - - parent_class = gtk_type_class (e_shortcut_bar_get_type ()); - - signals[ACTIVATE_SHORTCUT] = - gtk_signal_new ("activate_shortcut", - GTK_RUN_LAST | GTK_RUN_ACTION, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutsViewClass, activate_shortcut), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EShortcutsView *shortcuts_view) -{ - EShortcutsViewPrivate *priv; - - priv = g_new (EShortcutsViewPrivate, 1); - priv->shortcuts = NULL; - - shortcuts_view->priv = priv; -} - - -void -e_shortcuts_view_construct (EShortcutsView *shortcuts_view, - EShortcuts *shortcuts) -{ - EShortcutsViewPrivate *priv; - - g_return_if_fail (shortcuts != NULL); - g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); - - priv = shortcuts_view->priv; - - gtk_object_ref (GTK_OBJECT (shortcuts)); - priv->shortcuts = shortcuts; - - e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcuts_view), icon_callback, - shortcuts); - - load_all_shortcuts (shortcuts_view); -} - -GtkWidget * -e_shortcuts_view_new (EShortcuts *shortcuts) -{ - GtkWidget *new; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - new = gtk_type_new (e_shortcuts_view_get_type ()); - e_shortcuts_view_construct (E_SHORTCUTS_VIEW (new), shortcuts); - - return new; -} - - -E_MAKE_TYPE (e_shortcuts_view, "EShortcutsView", EShortcutsView, class_init, init, PARENT_TYPE) diff --git a/shell/e-shortcuts-view.h b/shell/e-shortcuts-view.h deleted file mode 100644 index 8f6f8cb0af..0000000000 --- a/shell/e-shortcuts-view.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHORTCUTS_VIEW_H_ -#define _E_SHORTCUTS_VIEW_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-shortcuts.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHORTCUTS_VIEW (e_shortcuts_view_get_type ()) -#define E_SHORTCUTS_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS_VIEW, EShortcutsView)) -#define E_SHORTCUTS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS_VIEW, EShortcutsViewClass)) -#define E_IS_SHORTCUTS_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW)) -#define E_IS_SHORTCUTS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW)) - - -typedef struct _EShortcutsView EShortcutsView; -typedef struct _EShortcutsViewPrivate EShortcutsViewPrivate; -typedef struct _EShortcutsViewClass EShortcutsViewClass; - -struct _EShortcutsView { - EShortcutBar parent; - - EShortcutsViewPrivate *priv; -}; - -struct _EShortcutsViewClass { - EShortcutBarClass parent_class; - - void (* activate_shortcut) (EShortcutsView *view, - EShortcuts *shortcuts, - const char *uri); -}; - - -GtkType e_shortcuts_view_get_type (void); -void e_shortcuts_view_construct (EShortcutsView *shortcuts_view, - EShortcuts *shortcuts); -GtkWidget *e_shortcuts_view_new (EShortcuts *shortcuts); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUTS_VIEW_H_ */ diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c deleted file mode 100644 index 34abe467bb..0000000000 --- a/shell/e-shortcuts.c +++ /dev/null @@ -1,477 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -/* The shortcut list goes this: - - <?xml version="1.0"?> - <shortcuts> - <group title="Evolution shortcuts"> - <item>evolution:/local/Inbox</item> - <item>evolution:/local/Trash</item> - <item>evolution:/local/Calendar</item> - </group> - - <group title="Personal shortcuts"> - <item>evolution:/local/Personal</item> - </group> - </shortcuts> - - FIXME: Do we want to use a namespace for this? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtktypeutils.h> - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <string.h> - -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" - -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-shortcuts-view.h" - -#include "e-shortcuts.h" - - -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class = NULL; - -struct _ShortcutGroup { - /* Title of the group. */ - char *title; - - /* A list of strings with the URI for the shortcut. */ - GList *shortcuts; -}; -typedef struct _ShortcutGroup ShortcutGroup; - -struct _EShortcutsPrivate { - /* The storage set to which these shortcuts are associated. */ - EStorageSet *storage_set; - - /* The folder type repository. */ - EFolderTypeRepository *folder_type_repository; - - /* A list of ShortcutGroups. */ - GList *groups; - - /* A list of ShortcutViews. */ - GList *views; - - /* A hash table to get a group given its name. */ - GHashTable *title_to_group; -}; - - -static void -unload_shortcuts (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - GList *p, *q; - - priv = shortcuts->priv; - - for (p = priv->groups; p != NULL; p = p->next) { - ShortcutGroup *group; - - group = (ShortcutGroup *) p->data; - g_free (group->title); - - for (q = group->shortcuts; q != NULL; q = q->next) - g_free (q->data); - - g_list_free (group->shortcuts); - } - - if (priv->groups != NULL) - g_list_free (priv->groups); - - priv->groups = NULL; - - g_hash_table_destroy (priv->title_to_group); - priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal); - - /* FIXME update the views. */ -} - -static gboolean -load_shortcuts (EShortcuts *shortcuts, - const char *path) -{ - EShortcutsPrivate *priv; - xmlDoc *doc; - xmlNode *root; - xmlNode *p, *q; - - priv = shortcuts->priv; - - doc = xmlParseFile (path); - if (doc == NULL) - return FALSE; - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "shortcuts") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - unload_shortcuts (shortcuts); - - for (p = root->childs; p != NULL; p = p->next) { - ShortcutGroup *shortcut_group; - char *shortcut_group_title; - - if (strcmp ((char *) p->name, "group") != 0) - continue; - - shortcut_group_title = (char *) xmlGetProp (p, "title"); - if (shortcut_group_title == NULL) - continue; - - shortcut_group = g_hash_table_lookup (priv->title_to_group, - shortcut_group_title); - if (shortcut_group != NULL) { - g_warning ("Duplicate shortcut title -- %s", - shortcut_group_title); - xmlFree (shortcut_group_title); - continue; - } - - shortcut_group = g_new (ShortcutGroup, 1); - shortcut_group->title = g_strdup (shortcut_group_title); - xmlFree (shortcut_group_title); - - shortcut_group->shortcuts = NULL; - for (q = p->childs; q != NULL; q = q->next) { - char *content; - - if (strcmp ((char *) q->name, "item") != 0) - continue; - - content = xmlNodeListGetString (doc, q->childs, 1); - shortcut_group->shortcuts = g_list_prepend (shortcut_group->shortcuts, - g_strdup (content)); - xmlFree (content); - } - shortcut_group->shortcuts = g_list_reverse (shortcut_group->shortcuts); - - priv->groups = g_list_prepend (priv->groups, shortcut_group); - g_hash_table_insert (priv->title_to_group, shortcut_group->title, shortcut_group); - } - - priv->groups = g_list_reverse (priv->groups); - - xmlFreeDoc (doc); - - return TRUE; -} - -static gboolean -save_shortcuts (EShortcuts *shortcuts, - const char *path) -{ - EShortcutsPrivate *priv; - xmlDoc *doc; - xmlNode *root; - GList *p, *q; - - priv = shortcuts->priv; - - doc = xmlNewDoc ((xmlChar *) "1.0"); - root = xmlNewDocNode (doc, NULL, (xmlChar *) "shortcuts", NULL); - xmlDocSetRootElement (doc, root); - - for (p = priv->groups; p != NULL; p = p->next) { - ShortcutGroup *group; - xmlNode *group_node; - - group = (ShortcutGroup *) p->data; - group_node = xmlNewChild (root, NULL, (xmlChar *) "group", NULL); - - xmlSetProp (group_node, (xmlChar *) "title", group->title); - - for (q = group->shortcuts; q != NULL; q = q->next) { - const char *shortcut; - - shortcut = (const char *) q->data; - xmlNewChild (group_node, NULL, (xmlChar *) "item", (xmlChar *) shortcut); - } - } - - if (xmlSaveFile (path, doc) < 0) { - xmlFreeDoc (doc); - return FALSE; - } - - xmlFreeDoc (doc); - return TRUE; -} - - -/* Signal handlers for the views. */ - -static void -view_destroyed_cb (GtkObject *object, - gpointer data) -{ - EShortcuts *shortcuts; - EShortcutsPrivate *priv; - - shortcuts = E_SHORTCUTS (data); - priv = shortcuts->priv; - - priv->views = g_list_remove (priv->views, object); -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EShortcuts *shortcuts; - EShortcutsPrivate *priv; - - shortcuts = E_SHORTCUTS (object); - priv = shortcuts->priv; - - if (priv->storage_set != NULL) - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - if (priv->folder_type_repository != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_repository)); - - unload_shortcuts (shortcuts); - - g_hash_table_destroy (priv->title_to_group); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static void -class_init (EShortcutsClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - object_class->destroy = destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); -} - - -static void -init (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - - priv = g_new (EShortcutsPrivate, 1); - - priv->storage_set = NULL; - priv->groups = NULL; - priv->views = NULL; - priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal); - - shortcuts->priv = priv; -} - - -void -e_shortcuts_construct (EShortcuts *shortcuts, - EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository) -{ - 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 (storage_set), GTK_FLOATING); - - priv = shortcuts->priv; - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; - - gtk_object_ref (GTK_OBJECT (folder_type_repository)); - priv->folder_type_repository = folder_type_repository; -} - -EShortcuts * -e_shortcuts_new (EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository) -{ - 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_repository); - - return new; -} - - -GList * -e_shortcuts_get_group_titles (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *list; - GList *p; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - list = NULL; - - for (p = priv->groups; p != NULL; p = p->next) { - group = (ShortcutGroup *) p->data; - list = g_list_prepend (list, g_strdup (group->title)); - } - - return g_list_reverse (list); -} - -GList * -e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - const char *group_title) -{ - EShortcutsPrivate *priv; - ShortcutGroup *shortcut_group; - GList *list; - GList *p; - - priv = shortcuts->priv; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - g_return_val_if_fail (group_title != NULL, NULL); - - shortcut_group = g_hash_table_lookup (priv->title_to_group, group_title); - if (shortcut_group == NULL) - return NULL; - - list = NULL; - - for (p = shortcut_group->shortcuts; p != NULL; p = p->next) - list = g_list_prepend (list, g_strdup ((const char *) p->data)); - - return g_list_reverse (list); -} - - -EStorageSet * -e_shortcuts_get_storage_set (EShortcuts *shortcuts) -{ - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - return shortcuts->priv->storage_set; -} - - -GtkWidget * -e_shortcuts_new_view (EShortcuts *shortcuts) -{ - EShortcutsPrivate *priv; - GtkWidget *new; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - new = e_shortcuts_view_new (shortcuts); - priv->views = g_list_prepend (priv->views, new); - - gtk_signal_connect (GTK_OBJECT (new), "destroy", view_destroyed_cb, shortcuts); - - return new; -} - - -gboolean -e_shortcuts_load (EShortcuts *shortcuts, - const char *path) -{ - g_return_val_if_fail (shortcuts != NULL, FALSE); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - return load_shortcuts (shortcuts, path); -} - -gboolean -e_shortcuts_save (EShortcuts *shortcuts, - const char *path) -{ - g_return_val_if_fail (shortcuts != NULL, FALSE); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (path), FALSE); - - return save_shortcuts (shortcuts, path); -} - - -const char * -e_shortcuts_get_uri (EShortcuts *shortcuts, int group_num, int num) -{ - EShortcutsPrivate *priv; - ShortcutGroup *group; - GList *shortcut_element; - - g_return_val_if_fail (shortcuts != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); - - priv = shortcuts->priv; - - group = g_list_nth (priv->groups, group_num)->data; - if (group == NULL) - return NULL; - - shortcut_element = g_list_nth (group->shortcuts, num); - if (shortcut_element == NULL) - return NULL; - - return shortcut_element->data; -} - - -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 bdc9126d68..0000000000 --- a/shell/e-shortcuts.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shortcuts.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SHORTCUTS_H_ -#define _E_SHORTCUTS_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkwidget.h> - -#include "e-folder-type-repository.h" -#include "e-storage-set.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SHORTCUTS (e_shortcuts_get_type ()) -#define E_SHORTCUTS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS, EShortcuts)) -#define E_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS, EShortcutsClass)) -#define E_IS_SHORTCUTS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS)) -#define E_IS_SHORTCUTS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS)) - - -typedef struct _EShortcuts EShortcuts; -typedef struct _EShortcutsPrivate EShortcutsPrivate; -typedef struct _EShortcutsClass EShortcutsClass; - -struct _EShortcuts { - GtkObject parent; - - EShortcutsPrivate *priv; -}; - -struct _EShortcutsClass { - GtkObjectClass parent_class; -}; - - -GtkType e_shortcuts_get_type (void); -void e_shortcuts_construct (EShortcuts *shortcuts, - EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository); -EShortcuts *e_shortcuts_new (EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository); - -GList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); -GList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, - const char *group_title); - -EStorageSet *e_shortcuts_get_storage_set (EShortcuts *shortcuts); - -GtkWidget *e_shortcuts_new_view (EShortcuts *shortcuts); - -gboolean e_shortcuts_load (EShortcuts *shortcuts, - const char *path); -gboolean e_shortcuts_save (EShortcuts *shortcuts, - const char *path); - -const char *e_shortcuts_get_uri (EShortcuts *shortcuts, - int group_num, - int num); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUTS_H_ */ diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c deleted file mode 100644 index 1e2a9a5807..0000000000 --- a/shell/e-storage-set-view.c +++ /dev/null @@ -1,637 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include "e-util/e-util.h" -#include "e-shell-constants.h" - -#include "e-storage-set-view.h" - - -#define PARENT_TYPE GTK_TYPE_CTREE -static GtkCTreeClass *parent_class = NULL; - -struct _EStorageSetViewPrivate { - EStorageSet *storage_set; - - /* These tables must always be kept in sync, and one cannot exist - without the other, as they share the dynamically allocated path. */ - GHashTable *ctree_node_to_path; - GHashTable *path_to_ctree_node; - - /* Path of the row selected by the latest "tree_select_row" signal. */ - const char *selected_row_path; - - /* Path of the row currently being dragged. */ - const char *dragged_row_path; - - /* Path of the row that was selected before the latest click. */ - const char *selected_row_path_before_click; - - /* Whether we are currently performing a drag from this view. */ - int in_drag : 1; - - /* Button used for the drag. This is initialized in the `button_press_event' - handler. */ - int drag_button; -}; - - -enum { - FOLDER_SELECTED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* DND stuff. */ - -enum _DndTargetType { - DND_TARGET_TYPE_URI_LIST, - DND_TARGET_TYPE_E_SHORTCUT -}; -typedef enum _DndTargetType DndTargetType; - -#define URI_LIST_TYPE "text/uri-list" -#define E_SHORTCUT_TYPE "E-SHORTCUT" - -static GtkTargetEntry drag_types [] = { - { URI_LIST_TYPE, 0, DND_TARGET_TYPE_URI_LIST }, - { E_SHORTCUT_TYPE, 0, DND_TARGET_TYPE_E_SHORTCUT } -}; -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -static GtkTargetList *target_list; - - -/* GtkObject methods. */ - -static void -hash_foreach_free_path (gpointer key, - gpointer value, - gpointer data) -{ - g_free (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; - - gtk_object_unref (GTK_OBJECT (priv->storage_set)); - - g_hash_table_foreach (priv->ctree_node_to_path, hash_foreach_free_path, NULL); - g_hash_table_destroy (priv->ctree_node_to_path); - g_hash_table_destroy (priv->path_to_ctree_node); - - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* GtkWidget methods. */ - -static int -button_press_event (GtkWidget *widget, - GdkEventButton *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - priv->selected_row_path_before_click = priv->selected_row_path; - - (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event); - - if (priv->in_drag) - return FALSE; - - priv->drag_button = event->button; - - /* KLUDGE ALERT. So look at this. We need to grab the pointer now, to check for - motion events and maybe start a drag operation. And GtkCTree seems to do it - already in the `button_press_event'. *But* for some reason something is very - broken somewhere and the grab misbehaves when done by GtkCTree's - `button_press_event'. So we have to ungrab the pointer and re-grab it our way. - Weee! */ - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gdk_flush (); - gtk_grab_remove (widget); - - gdk_pointer_grab (GTK_CLIST (widget)->clist_window, FALSE, - GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - NULL, NULL, event->time); - gtk_grab_add (widget); - - return TRUE; -} - -static int -motion_notify_event (GtkWidget *widget, - GdkEventMotion *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - if (event->window != GTK_CLIST (widget)->clist_window) - return (* GTK_WIDGET_CLASS (parent_class)->motion_notify_event) (widget, event); - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - if (priv->in_drag || priv->drag_button == 0) - return FALSE; - - priv->in_drag = TRUE; - priv->dragged_row_path = priv->selected_row_path; - - gtk_drag_begin (widget, target_list, GDK_ACTION_MOVE, - priv->drag_button, (GdkEvent *) event); - - return TRUE; -} - -static int -button_release_event (GtkWidget *widget, - GdkEventButton *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - if (event->window != GTK_CLIST (widget)->clist_window) - return (* GTK_WIDGET_CLASS (parent_class)->button_release_event) (widget, event); - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - if (! priv->in_drag && priv->selected_row_path != NULL) { - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (widget); - gdk_flush (); - - gtk_signal_emit (GTK_OBJECT (widget), signals[FOLDER_SELECTED], - priv->selected_row_path); - priv->selected_row_path = NULL; - } - - priv->selected_row_path_before_click = NULL; - - return TRUE; -} - -static void -drag_end (GtkWidget *widget, - GdkDragContext *context) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - if (priv->dragged_row_path != NULL) - e_storage_set_view_set_current_folder (storage_set_view, - priv->selected_row_path_before_click); - - priv->in_drag = FALSE; - priv->drag_button = 0; - priv->dragged_row_path = NULL; -} - -static void -set_uri_list_selection (EStorageSetView *storage_set_view, - GtkSelectionData *selection_data) -{ - EStorageSetViewPrivate *priv; - char *uri_list; - - priv = storage_set_view->priv; - - /* FIXME: Get `evolution:' from somewhere instead of hardcoding it here. */ - uri_list = g_strconcat ("evolution:", priv->selected_row_path, "\n", NULL); - gtk_selection_data_set (selection_data, selection_data->target, - 8, (guchar *) uri_list, strlen (uri_list)); - g_free (uri_list); -} - -static void -set_e_shortcut_selection (EStorageSetView *storage_set_view, - GtkSelectionData *selection_data) -{ - EStorageSetViewPrivate *priv; - int shortcut_len; - char *shortcut; - const char *trailing_slash; - const char *name; - - 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 -drag_data_get (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint32 time) -{ - EStorageSetView *storage_set_view; - - storage_set_view = E_STORAGE_SET_VIEW (widget); - - switch (info) { - case DND_TARGET_TYPE_URI_LIST: - set_uri_list_selection (storage_set_view, selection_data); - break; - case DND_TARGET_TYPE_E_SHORTCUT: - set_e_shortcut_selection (storage_set_view, selection_data); - break; - default: - g_assert_not_reached (); - } -} - - -/* GtkCTree methods. */ - -static void -tree_select_row (GtkCTree *ctree, - GtkCTreeNode *row, - gint column) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - const char *path; - - (* GTK_CTREE_CLASS (parent_class)->tree_select_row) (ctree, row, column); - - storage_set_view = E_STORAGE_SET_VIEW (ctree); - priv = storage_set_view->priv; - - path = g_hash_table_lookup (storage_set_view->priv->ctree_node_to_path, row); - if (path == NULL) - return; - - priv->selected_row_path = path; -} - - -static void -class_init (EStorageSetViewClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkCTreeClass *ctree_class; - - parent_class = gtk_type_class (gtk_ctree_get_type ()); - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; - - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->button_press_event = button_press_event; - widget_class->motion_notify_event = motion_notify_event; - widget_class->button_release_event = button_release_event; - widget_class->drag_end = drag_end; - widget_class->drag_data_get = drag_data_get; - - ctree_class = GTK_CTREE_CLASS (klass); - ctree_class->tree_select_row = tree_select_row; - - 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); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - - /* Set up DND. */ - - target_list = gtk_target_list_new (drag_types, num_drag_types); - g_assert (target_list != NULL); -} - -static void -init (EStorageSetView *storage_set_view) -{ - EStorageSetViewPrivate *priv; - - /* Avoid GtkCTree's broken focusing behavior. FIXME: Other ways? */ - GTK_WIDGET_UNSET_FLAGS (storage_set_view, GTK_CAN_FOCUS); - - priv = g_new (EStorageSetViewPrivate, 1); - - priv->storage_set = NULL; - priv->ctree_node_to_path = g_hash_table_new (g_direct_hash, g_direct_equal); - priv->path_to_ctree_node = g_hash_table_new (g_str_hash, g_str_equal); - priv->selected_row_path = NULL; - priv->dragged_row_path = NULL; - priv->selected_row_path_before_click = NULL; - priv->in_drag = FALSE; - - storage_set_view->priv = priv; -} - - -static void -get_pixmap_and_mask_for_folder (EStorageSetView *storage_set_view, - EFolder *folder, - GdkPixmap **pixmap_return, - GdkBitmap **mask_return) -{ - EFolderTypeRepository *folder_type_repository; - EStorageSet *storage_set; - const char *type_name; - GdkPixbuf *icon_pixbuf; - GdkPixbuf *scaled_pixbuf; - GdkVisual *visual; - GdkGC *gc; - - storage_set = storage_set_view->priv->storage_set; - folder_type_repository = e_storage_set_get_folder_type_repository (storage_set); - - type_name = e_folder_get_type_string (folder); - icon_pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, - type_name, TRUE); - - 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); - - visual = gdk_rgb_get_visual (); - *pixmap_return = gdk_pixmap_new (NULL, - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - visual->depth); - - gc = gdk_gc_new (*pixmap_return); - gdk_pixbuf_render_to_drawable (scaled_pixbuf, *pixmap_return, gc, 0, 0, 0, 0, - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - GDK_RGB_DITHER_NORMAL, 0, 0); - gdk_gc_unref (gc); - - *mask_return = gdk_pixmap_new (NULL, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, 1); - gdk_pixbuf_render_threshold_alpha (scaled_pixbuf, *mask_return, - 0, 0, 0, 0, - E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, - 0x7f); - - gdk_pixbuf_unref (scaled_pixbuf); -} - -static int -folder_compare_cb (gconstpointer a, gconstpointer b) -{ - EFolder *folder_a; - EFolder *folder_b; - const char *name_a; - const char *name_b; - - folder_a = E_FOLDER (a); - folder_b = E_FOLDER (b); - - name_a = e_folder_get_name (folder_a); - name_b = e_folder_get_name (folder_b); - - return strcmp (name_a, name_b); -} - -static void -insert_folders (EStorageSetView *storage_set_view, - GtkCTreeNode *parent, - EStorage *storage, - const char *path, - int level) -{ - EStorageSetViewPrivate *priv; - GtkCTree *ctree; - GtkCTreeNode *node; - GList *folder_list; - GList *p; - const char *storage_name; - - ctree = GTK_CTREE (storage_set_view); - priv = storage_set_view->priv; - - storage_name = e_storage_get_name (storage); - - folder_list = e_storage_list_folders (storage, path); - if (folder_list == NULL) - return; - - folder_list = g_list_sort (folder_list, folder_compare_cb); - - for (p = folder_list; p != NULL; p = p->next) { - EFolder *folder; - const char *folder_name; - char *text[2]; - char *subpath; - char *full_path; - GdkPixmap *pixmap; - GdkBitmap *mask; - - folder = E_FOLDER (p->data); - folder_name = e_folder_get_name (folder); - - text[0] = (char *) folder_name; /* Yuck. */ - text[1] = NULL; - - get_pixmap_and_mask_for_folder (storage_set_view, folder, &pixmap, &mask); - - node = gtk_ctree_insert_node (ctree, parent, NULL, - text, 3, - pixmap, mask, pixmap, mask, - FALSE, TRUE); - - subpath = g_concat_dir_and_file (path, folder_name); - insert_folders (storage_set_view, node, storage, subpath, level + 1); - - full_path = g_strconcat("/", storage_name, subpath, NULL); - g_hash_table_insert (priv->ctree_node_to_path, node, full_path); - g_hash_table_insert (priv->path_to_ctree_node, full_path, node); - - g_free (subpath); - } - - e_free_object_list (folder_list); -} - -void -e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set) -{ - EStorageSetViewPrivate *priv; - GtkCTreeNode *parent; - GtkCTree *ctree; - EStorage *storage; - GList *storage_list; - GList *p; - const char *name; - char *text[2]; - char *path; - - 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)); - - ctree = GTK_CTREE (storage_set_view); - - /* Set up GtkCTree/GtkCList parameters. */ - gtk_ctree_construct (ctree, 1, 0, NULL); - gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED); - gtk_clist_set_selection_mode (GTK_CLIST (ctree), GTK_SELECTION_BROWSE); - gtk_clist_set_row_height (GTK_CLIST (ctree), E_SHELL_MINI_ICON_SIZE); - - priv = storage_set_view->priv; - - gtk_object_ref (GTK_OBJECT (storage_set)); - priv->storage_set = storage_set; - - storage_list = e_storage_set_get_storage_list (storage_set); - - text[1] = NULL; - - for (p = storage_list; p != NULL; p = p->next) { - storage = E_STORAGE (p->data); - - name = e_storage_get_name (storage); - text[0] = (char *) name; /* Yuck. */ - - parent = gtk_ctree_insert_node (ctree, NULL, NULL, - text, 3, - NULL, NULL, NULL, NULL, - FALSE, TRUE); - - path = g_strconcat ("/", name, NULL); - g_hash_table_insert (priv->ctree_node_to_path, parent, path); - g_hash_table_insert (priv->path_to_ctree_node, parent, path); - - insert_folders (storage_set_view, parent, storage, "/", 1); - } - - e_free_object_list (storage_list); -} - -GtkWidget * -e_storage_set_view_new (EStorageSet *storage_set) -{ - GtkWidget *new; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - new = gtk_type_new (e_storage_set_view_get_type ()); - e_storage_set_view_construct (E_STORAGE_SET_VIEW (new), storage_set); - - return new; -} - - -void -e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, - const char *path) -{ - EStorageSetViewPrivate *priv; - GtkCTreeNode *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; - - if (path == NULL) { - gtk_clist_unselect_all (GTK_CLIST (storage_set_view)); - return; - } - - node = g_hash_table_lookup (priv->path_to_ctree_node, path); - if (node == NULL) { - gtk_clist_unselect_all (GTK_CLIST (storage_set_view)); - return; - } - - gtk_ctree_select (GTK_CTREE (storage_set_view), node); - - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], path); -} - - -E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h deleted file mode 100644 index d865eb426c..0000000000 --- a/shell/e-storage-set-view.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set-view.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_STORAGE_SET_VIEW_H__ -#define __E_STORAGE_SET_VIEW_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkctree.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 { - GtkCTree parent; - - EStorageSetViewPrivate *priv; -}; - -struct _EStorageSetViewClass { - GtkCTreeClass parent_class; - - /* Signals. */ - - void (* folder_selected) (EStorageSetView *storage_set_view, - const char *uri); -}; - - -GtkType e_storage_set_view_get_type (void); -GtkWidget *e_storage_set_view_new (EStorageSet *storage_set); -void e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set); -void e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, - const char *path); - -#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 6fcb4c24ba..0000000000 --- a/shell/e-storage-set.c +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <string.h> - -#include "e-util/e-util.h" - -#include "e-storage-set-view.h" -#include "e-storage-set.h" - - -enum { - NEW_STORAGE, - REMOVED_STORAGE, - LAST_SIGNAL -}; - - -#define PARENT_TYPE GTK_TYPE_OBJECT - -static GtkObjectClass *parent_class = NULL; -static guint signals[LAST_SIGNAL] = { 0 }; - -struct _EStorageSetPrivate { - GList *storages; - - EFolderTypeRepository *folder_type_repository; -}; - - -/* 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_repository)); - - 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 = (GtkObjectClass*) 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); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EStorageSet *storage_set) -{ - EStorageSetPrivate *priv; - - priv = g_new (EStorageSetPrivate, 1); - - priv->storages = NULL; - priv->folder_type_repository = NULL; - - storage_set->priv = priv; -} - - -void -e_storage_set_construct (EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository) -{ - 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_repository)); - storage_set->priv->folder_type_repository = folder_type_repository; -} - -EStorageSet * -e_storage_set_new (EFolderTypeRepository *folder_type_repository) -{ - EStorageSet *new; - - new = gtk_type_new (e_storage_set_get_type ()); - - e_storage_set_construct (new, folder_type_repository); - - 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 this won't ref the @storage, so - * after the call @storage_set actually owns @storage. - **/ -void -e_storage_set_add_storage (EStorageSet *storage_set, - EStorage *storage) -{ - EStorageSetPrivate *priv; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - - priv = storage_set->priv; - - priv->storages = g_list_append (priv->storages, storage); - - gtk_signal_emit (GTK_OBJECT (storage_set), signals[NEW_STORAGE], storage); -} - -void -e_storage_set_remove_storage (EStorageSet *storage_set, - EStorage *storage) -{ - EStorageSetPrivate *priv; - - g_return_if_fail (storage_set != NULL); - g_return_if_fail (E_IS_STORAGE_SET (storage_set)); - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - - priv = storage_set->priv; - - 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)); -} - -EStorage * -e_storage_set_get_storage (EStorageSet *storage_set, - const char *name) -{ - 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 (name != NULL, NULL); - - priv = storage_set->priv; - - for (p = priv->storages; p != NULL; p = p->next) { - const char *storage_name; - EStorage *storage; - - storage = E_STORAGE (p->data); - storage_name = e_storage_get_name (storage); - if (strcmp (storage_name, name) == 0) - return storage; - } - - return NULL; -} - -EFolder * -e_storage_set_get_folder (EStorageSet *storage_set, - const char *path) -{ - EStorage *storage; - const char *first_separator; - char *storage_name; - - 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); - - /* Skip initial separator. */ - path++; - - first_separator = strchr (path, G_DIR_SEPARATOR); - - if (first_separator == NULL || first_separator == path || first_separator[1] == 0) - return NULL; - - storage_name = g_strndup (path, first_separator - path); - storage = e_storage_set_get_storage (storage_set, storage_name); - g_free (storage_name); - - if (storage == NULL) - return NULL; - - return e_storage_get_folder (storage, first_separator); -} - - -GtkWidget * -e_storage_set_new_view (EStorageSet *storage_set) -{ - GtkWidget *storage_set_view; - - g_return_val_if_fail (storage_set != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL); - - storage_set_view = e_storage_set_view_new (storage_set); - - return storage_set_view; -} - - -EFolderTypeRepository * -e_storage_set_get_folder_type_repository (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_repository; -} - - -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 fddf0f0ce9..0000000000 --- a/shell/e-storage-set.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-set.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_STORAGE_SET_H_ -#define _E_STORAGE_SET_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-folder-type-repository.h" - -#include "e-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE_SET (e_storage_set_get_type ()) -#define E_STORAGE_SET(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE_SET, EStorageSet)) -#define E_STORAGE_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE_SET, EStorageSetClass)) -#define E_IS_STORAGE_SET(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE_SET)) -#define E_IS_STORAGE_SET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE_SET)) - - -typedef struct _EStorageSet EStorageSet; -typedef struct _EStorageSetPrivate EStorageSetPrivate; -typedef struct _EStorageSetClass EStorageSetClass; - -struct _EStorageSet { - GtkObject parent; - - EStorageSetPrivate *priv; -}; - -struct _EStorageSetClass { - GtkObjectClass parent_class; - - /* Virtual methods. */ - - void (* add_storage) (EStorageSet *storage_set, EStorage *storage); - void (* remove_storage) (EStorageSet *storage_set, EStorage *storage); - - /* Signals. */ - - void (* new_storage) (EStorageSet *storage_set, EStorage *storage); - void (* removed_storage) (EStorageSet *storage_set, EStorage *storage); -}; - - -GtkType e_storage_set_get_type (void); -void e_storage_set_construct (EStorageSet *storage_set, - EFolderTypeRepository *folder_type_repository); -EStorageSet *e_storage_set_new (EFolderTypeRepository *folder_type_repository); - -GList *e_storage_set_get_storage_list (EStorageSet *storage_set); -EStorage *e_storage_set_get_storage (EStorageSet *storage_set, - const char *name); -void e_storage_set_add_storage (EStorageSet *storage_set, - EStorage *storage); -void e_storage_set_remove_storage (EStorageSet *storage_set, - EStorage *storage); - -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); - -EFolderTypeRepository *e_storage_set_get_folder_type_repository (EStorageSet *storage_set); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_STORAGE_SET_H_ */ diff --git a/shell/e-storage-watcher.c b/shell/e-storage-watcher.c deleted file mode 100644 index 8312273d27..0000000000 --- a/shell/e-storage-watcher.c +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-watcher.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtk.h> - -#include "e-util/e-util.h" - -#include "e-storage-watcher.h" - - -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; - -struct _EStorageWatcherPrivate { - EStorage *storage; - char *path; -}; - - -enum { - NEW_FOLDER, - REMOVED_FOLDER, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EStorageWatcher *storage_watcher; - EStorageWatcherPrivate *priv; - - storage_watcher = E_STORAGE_WATCHER (object); - priv = storage_watcher->priv; - - g_free (priv->path); - g_free (priv); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Initialization. */ - -static void -class_init (EStorageWatcherClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - object_class->destroy = destroy; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - signals[NEW_FOLDER] = - gtk_signal_new ("new_folder", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EStorageWatcherClass, new_folder), - gtk_marshal_NONE__POINTER_STRING_STRING, - 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 (EStorageWatcherClass, removed_folder), - gtk_marshal_NONE__POINTER_STRING_STRING, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -init (EStorageWatcher *storage_watcher) -{ - EStorageWatcherPrivate *priv; - - priv = g_new (EStorageWatcherPrivate, 1); - priv->storage = NULL; - priv->path = NULL; - - storage_watcher->priv = priv; -} - - -/* Initialization. */ - -void -e_storage_watcher_construct (EStorageWatcher *watcher, - EStorage *storage, - const char *path) -{ - EStorageWatcherPrivate *priv; - - g_return_if_fail (watcher != NULL); - g_return_if_fail (E_IS_STORAGE_WATCHER (watcher)); - g_return_if_fail (path != NULL); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (watcher), GTK_FLOATING); - - priv = watcher->priv; - - priv->storage = storage; - priv->path = g_strdup (path); -} - -EStorageWatcher * -e_storage_watcher_new (EStorage *storage, - const char *path) -{ - EStorageWatcher *watcher; - - g_return_val_if_fail (path != NULL, NULL); - - watcher = gtk_type_new (e_storage_watcher_get_type ()); - - e_storage_watcher_construct (watcher, storage, path); - - return watcher; -} - - -const char * -e_storage_watcher_get_path (EStorageWatcher *storage_watcher) -{ - g_return_val_if_fail (storage_watcher != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE_WATCHER (storage_watcher), NULL); - - return storage_watcher->priv->path; -} - - -void -e_storage_watcher_emit_new_folder (EStorageWatcher *storage_watcher, - const char *name) -{ - g_return_if_fail (storage_watcher != NULL); - g_return_if_fail (E_IS_STORAGE_WATCHER (storage_watcher)); - g_return_if_fail (name != NULL); - - gtk_signal_emit (GTK_OBJECT (storage_watcher), signals[NEW_FOLDER], name); -} - -void -e_storage_watcher_emit_removed_folder (EStorageWatcher *storage_watcher, - const char *name) -{ - g_return_if_fail (storage_watcher != NULL); - g_return_if_fail (E_IS_STORAGE_WATCHER (storage_watcher)); - g_return_if_fail (name != NULL); - - gtk_signal_emit (GTK_OBJECT (storage_watcher), signals[REMOVED_FOLDER], name); -} - - -E_MAKE_TYPE (e_storage_watcher, "EStorageWatcher", EStorageWatcher, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-watcher.h b/shell/e-storage-watcher.h deleted file mode 100644 index 26c6edffaf..0000000000 --- a/shell/e-storage-watcher.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage-watcher.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_STORAGE_WATCHER_H_ -#define _E_STORAGE_WATCHER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE_WATCHER (e_storage_watcher_get_type ()) -#define E_STORAGE_WATCHER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE_WATCHER, EStorageWatcher)) -#define E_STORAGE_WATCHER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE_WATCHER, EStorageWatcherClass)) -#define E_IS_STORAGE_WATCHER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE_WATCHER)) -#define E_IS_STORAGE_WATCHER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE_WATCHER)) - - -typedef struct _EStorageWatcher EStorageWatcher; -typedef struct _EStorageWatcherPrivate EStorageWatcherPrivate; -typedef struct _EStorageWatcherClass EStorageWatcherClass; - -#include "e-storage.h" - -struct _EStorageWatcher { - GtkObject parent; - - EStorageWatcherPrivate *priv; -}; - -struct _EStorageWatcherClass -{ - GtkObjectClass parent_class; - - /* Signals. */ - - void (* new_folder) (EStorageWatcher *storage_watcher, - EStorage *storage, - const char *path, - const char *name); - - void (* removed_folder) (EStorageWatcher *storage_watcher, - EStorage *storage, - const char *path, - const char *name); -}; - - -GtkType e_storage_watcher_get_type (void); -void e_storage_watcher_construct (EStorageWatcher *watcher, - EStorage *storage, - const char *path); -EStorageWatcher *e_storage_watcher_new (EStorage *storage, - const char *path); - -const char *e_storage_watcher_get_path (EStorageWatcher *storage_watcher); - -void e_storage_watcher_emit_new_folder (EStorageWatcher *storage_watcher, - const char *name); -void e_storage_watcher_emit_removed_folder (EStorageWatcher *storage_watcher, - const char *name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_STORAGE_WATCHER_H__ */ diff --git a/shell/e-storage.c b/shell/e-storage.c deleted file mode 100644 index 5d5b1dd7a8..0000000000 --- a/shell/e-storage.c +++ /dev/null @@ -1,473 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> - -#include <gnome.h> - -#include "e-util/e-util.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 _WatcherList { - char *path; - GList *watchers; -}; -typedef struct _WatcherList WatcherList; - -/* This describes a folder and its children. */ -struct _Folder { - struct _Folder *parent; - EFolder *e_folder; - GList *subfolders; -}; -typedef struct _Folder Folder; - -struct _EStoragePrivate { - GHashTable *path_to_watcher_list; - GHashTable *watcher_to_watcher_list; - - /* Every element here is a list of subfolders, hashed to the path of the parent. */ - GHashTable *path_to_folder; -}; - - -static Folder * -folder_new (EFolder *e_folder) -{ - Folder *folder; - - folder = g_new (Folder, 1); - folder->parent = NULL; - folder->e_folder = e_folder; - folder->subfolders = NULL; - - return folder; -} - -static void -folder_remove_subfolder (Folder *folder, Folder *subfolder) -{ - g_list_remove (folder->subfolders, folder); -} - -static void -folder_add_subfolder (Folder *folder, Folder *subfolder) -{ - folder->subfolders = g_list_prepend (folder->subfolders, subfolder); - subfolder->parent = folder; -} - -static void -folder_destroy (Folder *folder) -{ - GList *p; - - if (folder->parent != NULL) - folder_remove_subfolder (folder->parent, folder); - - gtk_object_unref (GTK_OBJECT (folder->e_folder)); - - for (p = folder->subfolders; p != NULL; p = p->next) - folder_destroy (p->data); - - g_free (folder); -} - - -/* Watcher management. */ - -static void -watcher_destroyed_cb (GtkObject *object, - gpointer data) -{ - EStorageWatcher *watcher; - EStorage *storage; - EStoragePrivate *priv; - WatcherList *list; - - watcher = E_STORAGE_WATCHER (object); - storage = E_STORAGE (data); - priv = storage->priv; - - list = g_hash_table_lookup (priv->watcher_to_watcher_list, watcher); - g_return_if_fail (list != NULL); - - list->watchers = g_list_remove (list->watchers, watcher); -} - -static void -free_watcher_list (EStorage *storage, - WatcherList *watcher_list) -{ - GtkObject *watcher_object; - GList *p; - - for (p = watcher_list->watchers; p != NULL; p = p->next) { - watcher_object = GTK_OBJECT (p->data); - gtk_signal_disconnect_by_func (watcher_object, watcher_destroyed_cb, storage); - - gtk_object_destroy (watcher_object); /* Make sure it does not live when we are dead. */ - gtk_object_unref (watcher_object); - } - - g_free (watcher_list->path); - - g_free (watcher_list); -} - -static void -hash_foreach_free_watcher_list (gpointer key, - gpointer value, - gpointer data) -{ - WatcherList *watcher_list; - EStorage *storage; - - storage = E_STORAGE (data); - watcher_list = (WatcherList *) value; - - free_watcher_list (storage, watcher_list); -} - -static void -free_private (EStorage *storage) -{ - EStoragePrivate *priv; - - priv = storage->priv; - - g_hash_table_foreach (priv->path_to_watcher_list, hash_foreach_free_watcher_list, storage); - g_hash_table_destroy (priv->path_to_watcher_list); - - g_hash_table_destroy (priv->watcher_to_watcher_list); - - g_free (priv); -} - - -/* EStorage methods. */ - -static GList * -list_folders (EStorage *storage, - const char *path) -{ - Folder *folder; - Folder *subfolder; - GList *list; - GList *p; - - folder = g_hash_table_lookup (storage->priv->path_to_folder, path); - if (folder == NULL) - return NULL; - - list = NULL; - for (p = folder->subfolders; p != NULL; p = p->next) { - subfolder = (Folder *) p->data; - - gtk_object_ref (GTK_OBJECT (subfolder->e_folder)); - list = g_list_prepend (list, subfolder->e_folder); - } - - return list; -} - -static EStorageWatcher * -get_watcher_for_path (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - EStorageWatcher *watcher; - WatcherList *watcher_list; - - priv = storage->priv; - - watcher = e_storage_watcher_new (storage, path); - - watcher_list = g_hash_table_lookup (priv->path_to_watcher_list, path); - if (watcher_list == NULL) { - watcher_list = g_new (WatcherList, 1); - watcher_list->path = g_strdup (path); - watcher_list->watchers = NULL; - - g_hash_table_insert (priv->path_to_watcher_list, watcher_list->path, watcher_list); - } - - g_hash_table_insert (priv->watcher_to_watcher_list, watcher, watcher_list); - - watcher_list->watchers = g_list_prepend (watcher_list->watchers, watcher); - - gtk_signal_connect (GTK_OBJECT (watcher), "destroy", - GTK_SIGNAL_FUNC (watcher_destroyed_cb), storage); - - return watcher; -} - -static EFolder * -get_folder (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - Folder *folder; - - priv = storage->priv; - - folder = g_hash_table_lookup (priv->path_to_folder, path); - if (folder == NULL) - return NULL; - - return folder->e_folder; -} - -static const char * -get_name (EStorage *storage) -{ - return "(No name)"; -} - - -/* GtkObject methods. */ - -static void -destroy (GtkObject *object) -{ - EStorage *storage; - - storage = E_STORAGE (object); - - free_private (storage); - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* 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->list_folders = list_folders; - class->get_watcher_for_path = get_watcher_for_path; - class->get_folder = get_folder; - class->get_name = get_name; -} - -static void -init (EStorage *storage) -{ - EStoragePrivate *priv; - - priv = g_new (EStoragePrivate, 1); - - priv->path_to_watcher_list = g_hash_table_new (g_str_hash, g_str_equal); - priv->watcher_to_watcher_list = g_hash_table_new (g_direct_hash, g_direct_equal); - priv->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal); - - storage->priv = priv; -} - - -/* Creation. */ - -void -e_storage_construct (EStorage *storage) -{ - Folder *root_folder; - - g_return_if_fail (storage != NULL); - g_return_if_fail (E_IS_STORAGE (storage)); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING); - - root_folder = folder_new (NULL); - g_hash_table_insert (storage->priv->path_to_folder, G_DIR_SEPARATOR_S, root_folder); -} - -EStorage * -e_storage_new (void) -{ - EStorage *new; - - new = gtk_type_new (e_storage_get_type ()); - - e_storage_construct (new); - - return new; -} - - -gboolean -e_storage_path_is_absolute (const char *path) -{ - g_return_val_if_fail (path != NULL, FALSE); - - return *path == G_DIR_SEPARATOR; -} - -gboolean -e_storage_path_is_relative (const char *path) -{ - g_return_val_if_fail (path != NULL, FALSE); - - return *path != G_DIR_SEPARATOR; -} - - -GList * -e_storage_list_folders (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)->list_folders) (storage, path); -} - -EStorageWatcher * -e_storage_get_watcher_for_path (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_watcher_for_path) (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); -} - - -/* These functions are used by subclasses to add and remove folders from the - state stored in the storage object. */ - -void -e_storage_new_folder (EStorage *storage, - const char *path, - EFolder *e_folder) -{ - EStoragePrivate *priv; - Folder *folder; - Folder *parent_folder; - const char *name; - char *full_path; - - 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 (e_folder != NULL); - g_return_if_fail (E_IS_FOLDER (e_folder)); - - priv = storage->priv; - - parent_folder = g_hash_table_lookup (priv->path_to_folder, path); - if (parent_folder == NULL) { - g_warning ("%s: Trying to add a subfolder to a path that does not exist yet -- %s", - __FUNCTION__, path); - return; - } - - name = e_folder_get_name (e_folder); - g_assert (name != NULL); - g_return_if_fail (*name != G_DIR_SEPARATOR); - - full_path = g_concat_dir_and_file (path, name); - - folder = g_hash_table_lookup (priv->path_to_folder, full_path); - if (folder != NULL) { - g_warning ("%s: Trying to add a subfolder for a path that already exists -- %s", - __FUNCTION__, full_path); - return; - } - - folder = folder_new (e_folder); - folder_add_subfolder (parent_folder, folder); - - g_hash_table_insert (priv->path_to_folder, full_path, folder); -} - -void -e_storage_remove_folder (EStorage *storage, - const char *path) -{ - EStoragePrivate *priv; - Folder *folder; - - 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)); - - priv = storage->priv; - - folder = g_hash_table_lookup (priv->path_to_folder, path); - if (folder == NULL) { - g_warning ("%s: Folder not found -- %s", __FUNCTION__, path); - return; - } - - folder_destroy (folder); -} - - -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 9c54f05eb8..0000000000 --- a/shell/e-storage.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_STORAGE_H_ -#define _E_STORAGE_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_STORAGE (e_storage_get_type ()) -#define E_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE, EStorage)) -#define E_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE, EStorageClass)) -#define E_IS_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE)) -#define E_IS_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE)) - - -typedef struct _EStorage EStorage; -typedef struct _EStoragePrivate EStoragePrivate; -typedef struct _EStorageClass EStorageClass; - -#include "e-folder.h" -#include "e-storage-watcher.h" - -struct _EStorage { - GtkObject parent; - - EStoragePrivate *priv; -}; - -struct _EStorageClass { - GtkObjectClass parent_class; - - /* Virtual methods. */ - GList * (* list_folders) (EStorage *storage, const char *path); - EStorageWatcher * (* get_watcher_for_path) (EStorage *storage, const char *path); - EFolder * (* get_folder) (EStorage *storage, const char *path); - const char * (* get_name) (EStorage *storage); -}; - - -GtkType e_storage_get_type (void); -void e_storage_construct (EStorage *storage); -EStorage *e_storage_new (void); - -gboolean e_storage_path_is_relative (const char *path); -gboolean e_storage_path_is_absolute (const char *path); - -GList *e_storage_list_folders (EStorage *storage, - const char *path); -EStorageWatcher *e_storage_get_watcher_for_path (EStorage *storage, - const char *path); -EFolder *e_storage_get_folder (EStorage *storage, - const char *path); - -const char *e_storage_get_name (EStorage *storage); - -/* Protected. C++ anyone? */ -void e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder); -void e_storage_remove_folder (EStorage *storage, const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_STORAGE_H_ */ diff --git a/shell/evolution-directory.idl b/shell/evolution-directory.idl deleted file mode 100644 index 76dc184528..0000000000 --- a/shell/evolution-directory.idl +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * evolution-directory.idl - * - * Copyright (C) 1999 Helix Code, Inc. - * - * This interface 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 - */ - -module Evolution { - struct FolderInfo { - /* Name of the folder, i.e. the last part of the path. */ - string name; - - /* Name of the service handling this folder, e.g. "mail" - or "calendar" or "contacts". */ - string service_name; - }; - - /* Listener interface associated to the directory. */ - interface DirectoryListener { - enum Result { - SUCCESS, - IN_PROGRESS, - NOT_FOUND, - OVERWRITING - }; - - typedef int ListenerHandle; - - /* You get this when you first open a path in the directory. */ - void open_result (in string path, in ListenerHandle handle); - - /* This is called to inform the listener that there is a new folder in the - specified path. */ - void new_folder (in string path, in FolderInfo info); - - /* This informs the listener that a folder does not exist anymore. */ - void removed_folder (in string path, in string name); - - /* These report result of the corresponding operation. If this implies a - change in the directory, the listener will also get `new_folder' and - `removed_folder' calls appropriately. */ - void remove_folder_result (in string path, in Result result); - void create_folder_result (in string path, in Result result); - void copy_folder_result (in string old_path, in string new_path, in Result result); - void move_folder_result (in string old_path, in string new_path, in Result result); - - /* This reports the result for a `get_folder' operation. */ - void get_folder_result (in string path, in Result, in FolderInfo info); - }; - - interface Directory { - /* Open a subpath in the directory. @listener will be updated of all the - changes in it. */ - void open (in string path, in DirectoryListener listener); - - /* This removes a listener. @handle is passed through `open_result' after - the initial `open' call. */ - void close (in ListenerHandle handle); - - /* These calls create/remove a folder in the folder specified by @path. - An empty @path corresponds to the root of the directory. */ - void create_folder (in string path, in FolderInfo info); - void remove_folder (in string path, in string name); - - /* These are used to copy or move folders around. */ - void copy_folder (in string old_path, in string new_path); - void move_folder (in string old_path, in string new_path); - - /* This call retrieves information for a folder. */ - void get_folder (in string path); - }; -}; diff --git a/shell/evolution-service-repository.c b/shell/evolution-service-repository.c deleted file mode 100644 index 3714ac5a62..0000000000 --- a/shell/evolution-service-repository.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author: - * Bertrand Guiheneuf (bg@aful.org) - * - * Dumped from bonobo/bonobo-persist-stream.c - * - * (C) 2000 Helix Code, Inc. - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmarshal.h> -#include "evolution-service-repository.h" - -/* Parent class */ -static BonoboObjectClass *evolution_service_repository_parent_class; - - -/* CORBA implementation Entry Point Vector */ -POA_Evolution_ServiceRepository__vepv evolution_service_repository_vepv; - - - - - -/* - *function assigned to the - * Evolution::ServiceRepository::set_shell - * method. - * This function calls the set_shell_fn in - * the EvolutionServiceRepository - */ -static void -impl_set_shell (PortableServer_Servant servant, - Evolution_Shell shell, - CORBA_Environment *ev) -{ - BonoboObject *object = bonobo_object_from_servant (servant); - EvolutionServiceRepository *sr = EVOLUTION_SERVICE_REPOSITORY (object); - - if (sr->set_shell_fn != NULL) { - (*sr->set_shell_fn)(sr, shell, sr->closure); - } else { - GtkObjectClass *oc = GTK_OBJECT (sr)->klass; - EvolutionServiceRepositoryClass *class = EVOLUTION_SERVICE_REPOSITORY_CLASS (oc); - (*class->set_shell)(sr, shell); - } - -} - -/** - * evolution_service_repository_get_epv: - * create and initialize the ServiceRepository - * epv. - */ -POA_Evolution_ServiceRepository__epv * -evolution_service_repository_get_epv (void) -{ - POA_Evolution_ServiceRepository__epv *epv; - - epv = g_new0 (POA_Evolution_ServiceRepository__epv, 1); - - epv->set_shell = impl_set_shell; - - return epv; -} - - -/* create the Evolution_ServiceRepository vepv */ -static void -init_service_repository_corba_class (void) -{ - /* create the Bonobo interface epv */ - evolution_service_repository_vepv.Bonobo_Unknown_epv = - bonobo_object_get_epv (); - - /* create the ServiceRepository interface epv. - * Defined above */ - evolution_service_repository_vepv.Evolution_ServiceRepository_epv = - evolution_service_repository_get_epv (); -} - - -/* default implementation for the ::set_shell method */ -static void -evolution_service_repository_set_shell_default (EvolutionServiceRepository *service_repository, - Evolution_Shell shell) -{ - /* do nothing */ -} - - - -static void -evolution_service_repository_destroy (GtkObject *object) -{ - GTK_OBJECT_CLASS (evolution_service_repository_parent_class)->destroy (object); -} - - -/* initialize the Gtk object class */ -static void -evolution_service_repository_class_init (EvolutionServiceRepositoryClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - evolution_service_repository_parent_class = gtk_type_class (bonobo_object_get_type ()); - - /* - * Override and initialize methods - */ - object_class->destroy = evolution_service_repository_destroy; - klass->set_shell = evolution_service_repository_set_shell_default; - - /* create the corba class */ - init_service_repository_corba_class (); -} - -static void -evolution_service_repository_init (EvolutionServiceRepository *service_repository) -{ -} - - -/** - * evolution_service_repository_get_type: - * - * Returns: the GtkType for the EvolutionServiceRepository class. - */ -GtkType -evolution_service_repository_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "EvolutionServiceRepository", - sizeof (EvolutionServiceRepository), - sizeof (EvolutionServiceRepositoryClass), - (GtkClassInitFunc) evolution_service_repository_class_init, - (GtkObjectInitFunc) evolution_service_repository_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - - - - -/** - * evolution_service_repository_construct: construct the object - * @sr: the gtk service repository object to construct - * @corba_service_repository: the corresponding corba object - * @set_shell_fn: the ::set_shell implementation for this object - * @closure: data to pass to the set_shell operation - * - * This construct an EvolutionServiceRepository object. - * The caller can give the function that will implement - * the Corba interface. If those methods are %NULL then the - * default class method will be called instead. - * - * Return value: The constructed service repository. - **/ -EvolutionServiceRepository * -evolution_service_repository_construct (EvolutionServiceRepository *sr, - Evolution_ServiceRepository corba_service_repository, - EvolutionServiceRepositorySetShellFn set_shell_fn, - void *closure) -{ - g_return_val_if_fail (sr != NULL, NULL); - g_return_val_if_fail (EVOLUTION_IS_SERVICE_REPOSITORY (sr), NULL); - g_return_val_if_fail (corba_service_repository != CORBA_OBJECT_NIL, NULL); - - bonobo_object_construct (BONOBO_OBJECT (sr), - corba_service_repository); - - sr->closure = closure; - sr->set_shell_fn = set_shell_fn; - - return sr; -} - - -/* - * construct the corba - * Evolution_ServiceRepository object - */ -static Evolution_ServiceRepository -create_evolution_service_repository (BonoboObject *object) -{ - POA_Evolution_ServiceRepository *servant; - CORBA_Environment ev; - - /* create a servant */ - servant = (POA_Evolution_ServiceRepository *) g_new0 (BonoboObjectServant, 1); - - /* initialize its virtual entry point vector */ - servant->vepv = &evolution_service_repository_vepv; - - CORBA_exception_init (&ev); - - /* initialise the servant */ - POA_Evolution_ServiceRepository__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); - - /* activate it and return */ - return (Evolution_ServiceRepository) bonobo_object_activate_servant (object, servant); -} - - - - - -/** - * evolution_service_repository_new: create a new EvolutionServiceRepository object - * @set_shell_fn: The ::set_shell method - * @closure: The data passed to the ::set_shell method - * - * Create a full EvolutionServiceRepository. Also create the correspoding - * servant. The ::set_shell method calls set_shell_fn unless set_shell_fn - * is %NULL, in which case, the class default method is called. - * - * Return value: The newly created EvolutionServiceRepository object - **/ -EvolutionServiceRepository * -evolution_service_repository_new (EvolutionServiceRepositorySetShellFn set_shell_fn, - void *closure) -{ - Evolution_ServiceRepository corba_sr; - EvolutionServiceRepository *sr; - - /* create the gtk object */ - sr = gtk_type_new (evolution_service_repository_get_type ()); - - /* create the Corba object */ - corba_sr = create_evolution_service_repository ( - BONOBO_OBJECT (sr)); - - /* check for an error in the creation of the corba object */ - if (corba_sr == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (sr)); - return NULL; - } - - /* construct the object */ - evolution_service_repository_construct (sr, corba_sr, set_shell_fn, closure); - - return sr; -} diff --git a/shell/evolution-service-repository.h b/shell/evolution-service-repository.h deleted file mode 100644 index 88a0f621d7..0000000000 --- a/shell/evolution-service-repository.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _EVOLUTION_SERVICE_REPOSITORY_H -#define _EVOLUTION_SERVICE_REPOSITORY_H 1 - -#include <bonobo/bonobo-object.h> -#include "Evolution.h" - -BEGIN_GNOME_DECLS - -#define EVOLUTION_SERVICE_REPOSITORY_TYPE (evolution_service_repository_get_type ()) -#define EVOLUTION_SERVICE_REPOSITORY(o) (GTK_CHECK_CAST ((o), EVOLUTION_SERVICE_REPOSITORY_TYPE, EvolutionServiceRepository)) -#define EVOLUTION_SERVICE_REPOSITORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EVOLUTION_SERVICE_REPOSITORY_TYPE, EvolutionServiceRepositoryClass)) -#define EVOLUTION_IS_SERVICE_REPOSITORY(o) (GTK_CHECK_TYPE ((o), EVOLUTION_SERVICE_REPOSITORY_TYPE)) -#define EVOLUTION_IS_SERVICE_REPOSITORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EVOLUTION_SERVICE_REPOSITORY_TYPE)) - -typedef struct _EvolutionServiceRepository EvolutionServiceRepositoryPrivate; -typedef struct _EvolutionServiceRepository EvolutionServiceRepository; - -typedef void (*EvolutionServiceRepositorySetShellFn) (EvolutionServiceRepository *sr, const Evolution_Shell shell, void *closure); - - -struct _EvolutionServiceRepository { - BonoboObject object; - - - EvolutionServiceRepositorySetShellFn set_shell_fn; - - void *closure; - - EvolutionServiceRepositoryPrivate *priv; - -}; - - - -typedef struct { - BonoboObjectClass parent_class; - - void (*set_shell) (EvolutionServiceRepository *sr, Evolution_Shell shell); - -} EvolutionServiceRepositoryClass; - - - -GtkType evolution_service_repository_get_type (void); - -EvolutionServiceRepository * evolution_service_repository_new ( - EvolutionServiceRepositorySetShellFn set_shell_fn, - void *closure); - -EvolutionServiceRepository * evolution_service_repository_construct ( - EvolutionServiceRepository *sr, - Evolution_ServiceRepository corba_service_repository, - EvolutionServiceRepositorySetShellFn set_shell_fn, - void *closure); - - -POA_Evolution_ServiceRepository__epv *evolution_service_repository_get_epv (void); - -extern POA_Evolution_ServiceRepository__vepv evolution_service_repository_vepv; - -END_GNOME_DECLS - - -#endif /* _EVOLUTION_SERVICE_REPOSITORY_H */ - diff --git a/shell/evolution-service-repository.idl b/shell/evolution-service-repository.idl deleted file mode 100644 index 809ccbdc21..0000000000 --- a/shell/evolution-service-repository.idl +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Component Interface - * - * Authors: - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include <Bonobo.idl> - -module Evolution { - interface ServiceRepository : Bonobo::Unknown { - - void set_shell (in Shell shell); - - - }; -}; - diff --git a/shell/idl/folder.idl b/shell/idl/folder.idl deleted file mode 100644 index 4a9850a468..0000000000 --- a/shell/idl/folder.idl +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder.idl - * Copyright (C) 2000 Helix Code, Inc. - * Author: Christopher James Lahey <clahey@helixcode.com> - * - * Based on original from Matt Loper. - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -module Evolution { - - interface FolderListener { - - enum CallStatus { - Success, - RepositoryOffline, - PermissionDenied, - WrongFolderType, - WrongFolderDomain, - FolderNotFound - }; - - void folder_listener_ready (in CallStatus status, - in Folder folder); - - void respond_add_subfolder (in CallStatus status, - in Folder folder); - void respond_move_subfolder (in CallStatus status); - void respond_delete_subfolder (in CallStatus status); - - /* This signals that some piece of data has changed. - The name or icon has changed. */ - void signal_name_changed(in Folder folder); - void signal_icon_changed(in Folder folder); - - /* This says a child/children has been added. */ - void signal_subfolder_added(in FolderList folders); - /* This says a child has been removed. */ - void signal_subfolder_removed(in Folder folder); - }; - - interface Folder { - void set_listener (in FolderListener listener); - - /* - * get a bonobo control for this view; a client won't - * use the goad_id gathered in the above function, b/c - * only the wombat knows how to do that, by surfing - * the physical evolution directory structure - */ - Bonobo::control get_control(); - - /* - * You must know what interface to query_interface() - * for once you get a data source! - */ - Bonobo::Unknown get_data_source(); - - char *get_name(); - char *get_icon(); - - void add_subfolder (in string data_source_id, - in string control_id, - in string viewable_name); - void move_subfolder (in Folder subfolder); - void delete_subfolder (in Folder subfolder); - }; - - interface Wombat { - void get_root_folder(FolderListener listener); - }; -}; diff --git a/shell/main.c b/shell/main.c deleted file mode 100644 index e8885ecfc9..0000000000 --- a/shell/main.c +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* .c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#include <gnome.h> -#include <bonobo.h> -#include <libgnomeui/gnome-window-icon.h> - -#include "e-util/e-gui-utils.h" -#include "e-setup.h" - -#include "e-shell.h" - - -#define STARTUP_URI "evolution:/local/Inbox" - - -static void -no_views_left_cb (EShell *shell, gpointer data) -{ - gtk_main_quit (); -} - -static void -destroy_cb (GtkObject *object, gpointer data) -{ - gtk_main_quit (); -} - - -#ifdef USING_OAF - -#include <liboaf/liboaf.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table ("Evolution", VERSION, *argc, argv, oaf_popt_options, 0, NULL); - - oaf_init (*argc, argv); -} - -#else /* USING_OAF */ - -#include <libgnorba/gnorba.h> - -static void -init_corba (int *argc, char **argv) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ("Evolution", VERSION, argc, argv, - NULL, 0, NULL, - GNORBA_INIT_SERVER_FUNC, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_error ("Cannot initialize GNOME"); - - CORBA_exception_free (&ev); -} - -#endif /* USING_OAF */ - - -static void -development_warning () -{ - GtkWidget *label, *warning_dialog; - - warning_dialog = gnome_dialog_new ( - "Evolution 0.0", - GNOME_STOCK_BUTTON_OK, - NULL); - - label = gtk_label_new ( - _( - "Hi. Thanks for taking the time to download this preview release of\n" - "the Evolution groupware suite.\n" - "\n" - "The Evolution team has worked hard to make Evolution as robust,\n" - "extensible, pretty, fast and well-suited to heavy internet users as\n" - "possible. And we're very tired. But we're not done -- not yet.\n" - "\n" - "As you explore Evolution, please understand that most of our work has\n" - "been focused on the backend engine which drives the entire system and\n" - "not on the user interface. We are just cresting the hill now, though,\n" - "and will be pouring most of our love and attention into the UI from\n" - "here out. But at least you know that you're not using demoware.\n" - "\n" - "So, time for the nerdy disclaimer. Evolution will: crash, lose your\n" - "mail, leave stray processes running, consume 100% CPU, race, lock,\n" - "send HTML mail to random mailing lists, and embarass you in front of\n" - "your friends and co-workers. Use at your own risk.\n" - "\n" - "We hope that you enjoy the results of our hard work, and we eagerly\n" - "await your contributions!\n" - )); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - - label = gtk_label_new ( - _( - "Thanks\n" - "The Evolution Team\n" - )); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment(GTK_MISC(label), 1, .5); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - - gnome_dialog_run (GNOME_DIALOG (warning_dialog)); - - gtk_object_destroy (GTK_OBJECT (warning_dialog)); -} - -static gint -new_view_idle_cb (gpointer data) -{ - EShell *shell; - - shell = E_SHELL (data); - e_shell_new_view (shell, STARTUP_URI); - - if (!getenv ("EVOLVE_ME_HARDER")) - development_warning (); - - return FALSE; -} - - -int -main (int argc, char **argv) -{ - EShell *shell; - char *evolution_directory; - - init_corba (&argc, argv); - - gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png"); - - - if (! bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Bonobo component system.")); - exit (1); - } - - /* FIXME */ - evolution_directory = g_concat_dir_and_file (g_get_home_dir (), "evolution"); - - if (! e_setup (evolution_directory)) { - g_free (evolution_directory); - exit (1); - } - - shell = e_shell_new (evolution_directory); - if (shell == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize the Evolution shell.")); - exit (1); - } - - gtk_signal_connect (GTK_OBJECT (shell), "no_views_left", - GTK_SIGNAL_FUNC (no_views_left_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (destroy_cb), NULL); - - gtk_idle_add (new_view_idle_cb, shell); - - bonobo_main (); - - g_free (evolution_directory); - - return 0; -} |