diff options
-rw-r--r-- | calendar/gui/calendar-commands.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/Makefile.am | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 331 |
3 files changed, 43 insertions, 295 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 428aea937d..6ee9f34755 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -484,7 +484,7 @@ properties_cmd (BonoboUIHandler *uih, void *user_data, const char *path) } -BonoboUIVerb verbs [] = { +static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("CalendarNew", new_calendar_cmd), BONOBO_UI_UNSAFE_VERB ("CalendarOpen", open_calendar_cmd), BONOBO_UI_UNSAFE_VERB ("CalendarSaveAs", save_as_calendar_cmd), @@ -515,8 +515,6 @@ calendar_control_activate (BonoboControl *control, uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); - g_print ("In calendar_control_activate\n"); - remote_uih = bonobo_control_get_remote_ui_container (control); bonobo_ui_component_set_container (uic, remote_uih); bonobo_object_release_unref (remote_uih, NULL); @@ -584,8 +582,6 @@ calendar_control_deactivate (BonoboControl *control) BonoboUIComponent *uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); - g_print ("In calendar_control_deactivate\n"); - bonobo_ui_component_rm (uic, "/", NULL); bonobo_ui_component_unset_container (uic); } diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index b39c2a7eac..98c8be9f97 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -7,6 +7,7 @@ INCLUDES = \ -I$(top_srcdir)/libical/src/libical \ -I$(top_builddir)/libical/src/libical \ -I$(includedir) \ + -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ $(BONOBO_VFS_GNOME_CFLAGS) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 8a7a93d212..d64db8ab6b 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -43,7 +43,7 @@ typedef struct { GladeXML *xml; /* UI handler */ - BonoboUIHandler *uih; + BonoboUIComponent *uic; /* Client to use */ CalClient *client; @@ -133,8 +133,6 @@ static gint app_delete_event_cb (GtkWidget *widget, static void close_dialog (TaskEditor *tedit); static gboolean get_widgets (TaskEditor *tedit); static void init_widgets (TaskEditor *tedit); -static void create_menu (TaskEditor *tedit); -static void create_toolbar (TaskEditor *tedit); static void task_editor_destroy (GtkObject *object); static char * make_title_from_comp (CalComponent *comp); static void clear_widgets (TaskEditor *tedit); @@ -145,6 +143,8 @@ static void file_save_and_close_cb (GtkWidget *widget, gpointer data); static void file_delete_cb (GtkWidget *widget, gpointer data); static void file_close_cb (GtkWidget *widget, gpointer data); +static void debug_xml_cb (GtkWidget *widget, gpointer data); + static void save_todo_object (TaskEditor *tedit); static void dialog_to_comp_object (TaskEditor *tedit); @@ -213,6 +213,17 @@ task_editor_new (void) return task_editor_construct (tedit); } +static BonoboUIVerb verbs [] = { + + BONOBO_UI_UNSAFE_VERB ("FileSave", file_save_cb), + BONOBO_UI_UNSAFE_VERB ("FileDelete", file_delete_cb), + BONOBO_UI_UNSAFE_VERB ("FileClose", file_close_cb), + BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", file_save_and_close_cb), + + BONOBO_UI_UNSAFE_VERB ("DebugDumpXml", debug_xml_cb), + + BONOBO_UI_VERB_END +}; /** * task_editor_construct: @@ -228,7 +239,7 @@ TaskEditor * task_editor_construct (TaskEditor *tedit) { TaskEditorPrivate *priv; - GtkWidget *bonobo_win; + GtkWidget *bonobo_win; g_return_val_if_fail (tedit != NULL, NULL); g_return_val_if_fail (IS_TASK_EDITOR (tedit), NULL); @@ -252,9 +263,9 @@ task_editor_construct (TaskEditor *tedit) /* Construct the app */ - priv->uih = bonobo_ui_handler_new (); - if (!priv->uih) { - g_message ("task_editor_construct(): Could not create the UI handler"); + priv->uic = bonobo_ui_component_new ("task-editor-dialog"); + if (!priv->uic) { + g_message ("task_editor_construct(): Could not create the UI component"); goto error; } @@ -277,18 +288,25 @@ task_editor_construct (TaskEditor *tedit) priv->app = GTK_WIDGET (bonobo_win); } - bonobo_ui_handler_set_app (priv->uih, BONOBO_WIN (priv->app)); + { + BonoboUIContainer *container = bonobo_ui_container_new (); + bonobo_ui_container_set_win (container, BONOBO_WIN (priv->app)); + bonobo_ui_component_set_container ( + priv->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container))); + } - create_menu (tedit); - create_toolbar (tedit); + bonobo_ui_component_add_verb_list_with_data ( + priv->uic, verbs, tedit); - /* Hook to destruction of the dialog */ + bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, + "evolution-task-editor-dialog.xml", + "evolution-task-editor"); + /* Hook to destruction of the dialog */ gtk_signal_connect (GTK_OBJECT (priv->app), "delete_event", GTK_SIGNAL_FUNC (app_delete_event_cb), tedit); /* Show the dialog */ - gtk_widget_show (priv->app); return tedit; @@ -420,280 +438,6 @@ init_widgets (TaskEditor *tedit) GTK_SIGNAL_FUNC (percent_complete_changed), tedit); } - -/* Menu bar */ - -static GnomeUIInfo file_new_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Journal Entry"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Note"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_page_setup_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Memo Style"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Define Print _Styles..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_menu[] = { - GNOMEUIINFO_MENU_NEW_SUBTREE (file_new_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), - GNOMEUIINFO_MENU_SAVE_AS_ITEM (NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("_Delete"), NULL, - file_delete_cb, GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), - GNOMEUIINFO_MENU_PRINT_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_object_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: what goes here?", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_menu[] = { - GNOMEUIINFO_MENU_UNDO_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_REDO_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CUT_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_COPY_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_PASTE_ITEM (NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Paste _Special..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLEAR_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_SELECT_ALL_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Mark as U_nread"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_FIND_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_FIND_AGAIN_ITEM (NULL, NULL), - GNOMEUIINFO_SUBTREE (N_("_Object"), edit_object_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_previous_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: In_complete Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Fi_rst Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_next_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: In_complete Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Last Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_toolbars_menu[] = { - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: _Standard"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: __Formatting"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Customize..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_menu[] = { - GNOMEUIINFO_SUBTREE (N_("Pre_vious"), view_previous_menu), - GNOMEUIINFO_SUBTREE (N_("Ne_xt"), view_next_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Toolbars"), view_toolbars_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo insert_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _File..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: It_em..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Object..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo format_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Font..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Paragraph..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_forms_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Desi_gn This Form"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: D_esign a Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Publish _Form..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Pu_blish Form As..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Script _Debugger"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Spelling..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Chec_k Names"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Address _Book..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Forms"), tools_forms_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo actions_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _New Task"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end Status Report"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mark Complete"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Rec_urrence..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_kip Occurrence"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Assig_n Task"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Reply"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Reply to A_ll"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo help_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: fix Bonobo so it supports help items!", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo main_menu[] = { - GNOMEUIINFO_MENU_FILE_TREE (file_menu), - GNOMEUIINFO_MENU_EDIT_TREE (edit_menu), - GNOMEUIINFO_MENU_VIEW_TREE (view_menu), - GNOMEUIINFO_SUBTREE (N_("_Insert"), insert_menu), - GNOMEUIINFO_SUBTREE (N_("F_ormat"), format_menu), - GNOMEUIINFO_SUBTREE (N_("_Tools"), tools_menu), - GNOMEUIINFO_SUBTREE (N_("Actio_ns"), actions_menu), - GNOMEUIINFO_MENU_HELP_TREE (help_menu), - GNOMEUIINFO_END -}; - - -/* Creates the menu bar for the event editor */ -static void -create_menu (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - BonoboUIHandlerMenuItem *list; - - priv = tedit->priv; - - bonobo_ui_handler_create_menubar (priv->uih); - - list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, - tedit); - bonobo_ui_handler_menu_add_list (priv->uih, "/", list); -} - - -/* Toolbar */ - -static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"), - N_("Save the task and close the dialog box"), - file_save_and_close_cb, - GNOME_STOCK_PIXMAP_SAVE), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Print..."), - N_("Print this item"), - NULL, - GNOME_STOCK_PIXMAP_PRINT), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), - NULL, - GNOME_STOCK_PIXMAP_ATTACH), - GNOMEUIINFO_SEPARATOR, -#if 0 - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Assign Task..."), - N_("Assign the task to someone"), - NULL), - GNOMEUIINFO_SEPARATOR, -#endif - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), - N_("Delete this task"), - file_delete_cb, - GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), - N_("Go to the previous item"), - NULL, - GNOME_STOCK_PIXMAP_BACK), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), - N_("Go to the next item"), - NULL, - GNOME_STOCK_PIXMAP_FORWARD), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), - NULL, - GNOME_STOCK_PIXMAP_HELP), - GNOMEUIINFO_END -}; - - -/* Creates the toolbar for the event editor */ -static void -create_toolbar (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - BonoboUIHandlerToolbarItem *list; - GnomeDockItem *dock_item; - GtkWidget *toolbar_child; - - priv = tedit->priv; - - bonobo_ui_handler_create_toolbar (priv->uih, "Toolbar"); - -#warning This should be converted to xml. -#if 0 - /* Fetch the toolbar. What a pain in the ass. */ - - dock_item = bonobo_win_get_dock_item_by_name (BONOBO_WIN (priv->app), BONOBO_WIN_TOOLBAR_NAME); - g_assert (dock_item != NULL); - - toolbar_child = gnome_dock_item_get_child (dock_item); - g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); - - /* Turn off labels as GtkToolbar sucks */ - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); -#endif - list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, - tedit); - bonobo_ui_handler_toolbar_add_list (priv->uih, "/Toolbar", list); -} - - static void task_editor_destroy (GtkObject *object) { @@ -706,9 +450,9 @@ task_editor_destroy (GtkObject *object) tedit = TASK_EDITOR (object); priv = tedit->priv; - if (priv->uih) { - bonobo_object_unref (BONOBO_OBJECT (priv->uih)); - priv->uih = NULL; + if (priv->uic) { + bonobo_object_unref (BONOBO_OBJECT (priv->uic)); + priv->uic = NULL; } if (priv->app) { @@ -1192,7 +936,14 @@ dialog_to_comp_object (TaskEditor *tedit) cal_component_commit_sequence (comp); } - +static void +debug_xml_cb (GtkWidget *widget, gpointer data) +{ + TaskEditor *tedit = TASK_EDITOR (data); + TaskEditorPrivate *priv = tedit->priv; + + bonobo_win_dump (BONOBO_WIN (priv->app), "on demand"); +} /* File/Save callback */ static void |