diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-01-28 03:39:45 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-01-28 03:39:45 +0800 |
commit | a9ee877c3368d9db97498d23e9cd15337d06e974 (patch) | |
tree | 5bc3e76b65eefcbab95c3eac5d5b3e4c916f6f2b /calendar | |
parent | 824714d55eda1314ca5e7933084b21a58244e87f (diff) | |
download | gsoc2013-evolution-a9ee877c3368d9db97498d23e9cd15337d06e974.tar.gz gsoc2013-evolution-a9ee877c3368d9db97498d23e9cd15337d06e974.tar.zst gsoc2013-evolution-a9ee877c3368d9db97498d23e9cd15337d06e974.zip |
Committing Rajeev's patch.
svn path=/trunk/; revision=31332
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 29 | ||||
-rw-r--r-- | calendar/calendar.error.xml | 9 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-editor.c | 119 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.c | 220 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.glade | 183 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.h | 5 | ||||
-rw-r--r-- | calendar/gui/dialogs/save-comp.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 15 |
9 files changed, 356 insertions, 244 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1c29c78c4d..ffc10c704f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,32 @@ +2006-01-28 Rajeev ramanathan <rajeevramanathan_2004@yahoo.co.in> + + ** Fixes bug #328510, #328885 + + * calendar.error.xml: Added error for saving memos. + * gui/dialogs/event-editor.c: (menu_class_public_cb), + (menu_class_private_cb), (menu_class_confidential_cb): + Added change notification for event page. + * gui/dialogs/memo-editor.c: (menu_show_categories_cb), + (menu_class_public_cb), (menu_class_private_cb), + (menu_class_confidential_cb), (memo_editor_init), + (memo_editor_construct), (memo_editor_set_e_cal), + (memo_editor_finalize): Added menus to memo. + * gui/dialogs/memo-page.c: (memo_page_init), (memo_page_finalize), + (set_classification_menu), (memo_page_get_widget), + (memo_page_focus_main_widget), (clear_widgets), + (memo_page_set_classification), (sensitize_widgets), + (memo_page_fill_widgets), (memo_page_fill_component), + (memo_page_set_show_categories), (get_widgets), + (categories_clicked_cb), (field_changed_cb), (source_changed_cb), + (init_widgets), (memo_page_construct), (memo_page_new): Added code to + handle memos. + * gui/dialogs/memo-page.glade: + * gui/dialogs/memo-page.h: + * gui/dialogs/save-comp.c: (save_component_dialog): + * gui/dialogs/task-editor.c: (menu_class_public_cb), + (menu_class_private_cb), (menu_class_confidential_cb): Added code to + change notification for task page. + 2006-01-27 Srinivasa Ragavan <sragavan@novell.com> * gui/dialogs/alarm-list-dialog.c (get_widgets), diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml index 77f002f3ab..c37e1f8d47 100644 --- a/calendar/calendar.error.xml +++ b/calendar/calendar.error.xml @@ -123,6 +123,15 @@ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> <button _label="_Save Changes" response="GTK_RESPONSE_YES"/> </error> + + <error id="prompt-save-memo" type="warning" default="GTK_RESPONSE_YES"> + <title>Save Memo</title> + <_primary>Would you like to save your changes to this memo?</_primary> + <_secondary>You have made changes to this memo, but not yet saved them.</_secondary> + <button _label="_Discard Changes" response="GTK_RESPONSE_NO"/> + <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> + <button _label="_Save Changes" response="GTK_RESPONSE_YES"/> + </error> <error id="prompt-meeting-invite" type="question" default="GTK_RESPONSE_YES"> <_primary>Would you like to send meeting invitations to participants?</_primary> diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 5d574ef801..0d160d5c3a 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -240,35 +240,39 @@ menu_show_categories_cb (BonoboUIComponent *component, } static void -menu_class_public_cb (BonoboUIComponent *ui_component, +menu_class_public_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, gpointer user_data) { EventEditor *ee = (EventEditor *) user_data; - if (state[0] == '0') return; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page)); + event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PUBLIC); } static void -menu_class_private_cb (BonoboUIComponent *ui_component, +menu_class_private_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, - gpointer user_data) + gpointer user_data) { EventEditor *ee = (EventEditor *) user_data; if (state[0] == '0') return; + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page)); + event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PRIVATE); } static void -menu_class_confidential_cb (BonoboUIComponent *ui_component, +menu_class_confidential_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, @@ -277,7 +281,9 @@ menu_class_confidential_cb (BonoboUIComponent *ui_component, EventEditor *ee = (EventEditor *) user_data; if (state[0] == '0') return; - + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page)); + event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL); } diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index f81d1fd9cd..5d18450203 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -32,8 +32,11 @@ #include <glade/glade.h> #include <libgnome/gnome-i18n.h> +#include <evolution-shell-component-utils.h> +#include <e-util/e-util-private.h> #include "memo-page.h" #include "cancel-comp.h" +#include "../calendar-config.h" #include "memo-editor.h" struct _MemoEditorPrivate { @@ -98,31 +101,127 @@ client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) /* set_menu_sens (MEMO_EDITOR (user_data)); */ } +static void +menu_show_categories_cb (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + MemoEditor *me = (MemoEditor *) user_data; + + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + memo_page_set_show_categories (me->priv->memo_page, atoi(state)); + calendar_config_set_show_categories (atoi(state)); +} + +static void +menu_class_public_cb (BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + MemoEditor *me = (MemoEditor *) user_data; + + if (state[0] == '0') + return; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page)); + memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PUBLIC); +} + +static void +menu_class_private_cb (BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + MemoEditor *me = (MemoEditor *) user_data; + if (state[0] == '0') + return; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page)); + memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PRIVATE); +} + +static void +menu_class_confidential_cb (BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + MemoEditor *me = (MemoEditor *) user_data; + if (state[0] == '0') + return; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page)); + memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL); +} + /* Object initialization function for the memo editor */ static void -memo_editor_init (MemoEditor *te) +memo_editor_init (MemoEditor *me) { MemoEditorPrivate *priv; + CompEditor *editor = COMP_EDITOR(me); + gboolean status; + char *xmlfile; priv = g_new0 (MemoEditorPrivate, 1); - te->priv = priv; + me->priv = priv; priv->updating = FALSE; + bonobo_ui_component_freeze (editor->uic, NULL); + + xmlfile = g_build_filename (EVOLUTION_UIDIR, "evolution-memo-editor.xml", NULL); + bonobo_ui_util_set_ui (editor->uic, PREFIX, + xmlfile, + "evolution-memo-editor", NULL); + g_free (xmlfile); + + status = calendar_config_get_show_categories (); + bonobo_ui_component_set_prop ( + editor->uic, "/commands/ViewCategories", + "state", status ? "1" : "0", NULL); + bonobo_ui_component_add_listener ( + editor->uic, "ViewCategories", + menu_show_categories_cb, editor); + + bonobo_ui_component_set_prop ( + editor->uic, "/commands/ActionClassPublic", + "state", "1", NULL); + bonobo_ui_component_add_listener ( + editor->uic, "ActionClassPublic", + menu_class_public_cb, editor); + bonobo_ui_component_add_listener ( + editor->uic, "ActionClassPrivate", + menu_class_private_cb, editor); + bonobo_ui_component_add_listener ( + editor->uic, "ActionClassConfidential", + menu_class_confidential_cb, editor); + + bonobo_ui_component_thaw (editor->uic, NULL); + /* TODO add help stuff */ -/* comp_editor_set_help_section (COMP_EDITOR (te), "usage-calendar-memo"); */ +/* comp_editor_set_help_section (COMP_EDITOR (me), "usage-calendar-memo"); */ } MemoEditor * memo_editor_construct (MemoEditor *me, ECal *client) { MemoEditorPrivate *priv; - + CompEditor *editor = COMP_EDITOR (me); gboolean read_only = FALSE; priv = me->priv; - priv->memo_page = memo_page_new (); + priv->memo_page = memo_page_new (editor->uic); g_object_ref (priv->memo_page); gtk_object_sink (GTK_OBJECT (priv->memo_page)); comp_editor_append_page (COMP_EDITOR (me), @@ -133,7 +232,8 @@ memo_editor_construct (MemoEditor *me, ECal *client) if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; - + + bonobo_ui_component_set_prop (editor->uic, "/Toolbar/ecal3", "hidden", "1", NULL); comp_editor_set_e_cal (COMP_EDITOR (me), client); init_widgets (me); @@ -144,11 +244,11 @@ memo_editor_construct (MemoEditor *me, ECal *client) static void memo_editor_set_e_cal (CompEditor *editor, ECal *client) { - MemoEditor *te; + MemoEditor *me; MemoEditorPrivate *priv; - te = MEMO_EDITOR (editor); - priv = te->priv; + me = MEMO_EDITOR (editor); + priv = me->priv; if (COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal) COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal (editor, client); @@ -196,6 +296,7 @@ memo_editor_finalize (GObject *object) { MemoEditor *me; MemoEditorPrivate *priv; + ECalComponent *comp; g_return_if_fail (object != NULL); g_return_if_fail (IS_MEMO_EDITOR (object)); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index c7682f13f9..762b366624 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -59,7 +59,10 @@ struct _MemoPagePrivate { GtkWidget *memo_content; - GtkWidget *classification; + /* Bonobo Controller for the menu/toolbar */ + BonoboUIComponent *uic; + + ECalComponentClassification classification; GtkWidget *categories_btn; GtkWidget *categories; @@ -118,37 +121,38 @@ memo_page_class_init (MemoPageClass *klass) /* Object initialization function for the memo page */ static void -memo_page_init (MemoPage *tpage) +memo_page_init (MemoPage *mpage) { MemoPagePrivate *priv; priv = g_new0 (MemoPagePrivate, 1); - tpage->priv = priv; + mpage->priv = priv; priv->xml = NULL; priv->main = NULL; priv->memo_content = NULL; - priv->classification = NULL; + priv->classification = E_CAL_COMPONENT_CLASS_NONE; priv->categories_btn = NULL; priv->categories = NULL; priv->updating = FALSE; + } /* Destroy handler for the memo page */ static void memo_page_finalize (GObject *object) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; g_return_if_fail (object != NULL); g_return_if_fail (IS_MEMO_PAGE (object)); - tpage = MEMO_PAGE (object); - priv = tpage->priv; - + mpage = MEMO_PAGE (object); + priv = mpage->priv; + if (priv->main) gtk_widget_unref (priv->main); @@ -158,23 +162,45 @@ memo_page_finalize (GObject *object) } g_free (priv); - tpage->priv = NULL; + mpage->priv = NULL; if (G_OBJECT_CLASS (memo_page_parent_class)->finalize) (* G_OBJECT_CLASS (memo_page_parent_class)->finalize) (object); } - +static void +set_classification_menu (MemoPage *page, gint class) +{ + bonobo_ui_component_freeze (page->priv->uic, NULL); + switch (class) { + case E_CAL_COMPONENT_CLASS_PUBLIC: + bonobo_ui_component_set_prop ( + page->priv->uic, "/commands/ActionClassPublic", + "state", "1", NULL); + break; + case E_CAL_COMPONENT_CLASS_CONFIDENTIAL: + bonobo_ui_component_set_prop ( + page->priv->uic, "/commands/ActionClassConfidential", + "state", "1", NULL); + break; + case E_CAL_COMPONENT_CLASS_PRIVATE: + bonobo_ui_component_set_prop ( + page->priv->uic, "/commands/ActionClassPrivate", + "state", "1", NULL); + break; + } + bonobo_ui_component_thaw (page->priv->uic, NULL); +} /* get_widget handler for the task page */ static GtkWidget * memo_page_get_widget (CompEditorPage *page) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; - tpage = MEMO_PAGE (page); - priv = tpage->priv; + mpage = MEMO_PAGE (page); + priv = mpage->priv; return priv->main; } @@ -183,44 +209,44 @@ memo_page_get_widget (CompEditorPage *page) static void memo_page_focus_main_widget (CompEditorPage *page) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; - tpage = MEMO_PAGE (page); - priv = tpage->priv; + mpage = MEMO_PAGE (page); + priv = mpage->priv; gtk_widget_grab_focus (priv->memo_content); } /* Fills the widgets with default values */ static void -clear_widgets (MemoPage *tpage) +clear_widgets (MemoPage *mpage) { MemoPagePrivate *priv; - priv = tpage->priv; + priv = mpage->priv; /* memo content */ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)), "", 0); /* Classification */ - e_dialog_option_menu_set (priv->classification, E_CAL_COMPONENT_CLASS_PRIVATE, classification_map); + priv->classification = E_CAL_COMPONENT_CLASS_PRIVATE; + set_classification_menu (mpage, priv->classification); /* Categories */ e_dialog_editable_set (priv->categories, NULL); } -/* Decode the radio button group for classifications */ -static ECalComponentClassification -classification_get (GtkWidget *widget) +void +memo_page_set_classification (MemoPage *page, ECalComponentClassification class) { - return e_dialog_option_menu_get (widget, classification_map); + page->priv->classification = class; } static void sensitize_widgets (MemoPage *mpage) { - gboolean read_only; + gboolean read_only, sens, sensitize; MemoPagePrivate *priv; priv = mpage->priv; @@ -228,30 +254,48 @@ sensitize_widgets (MemoPage *mpage) if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL)) read_only = TRUE; + if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_IS_ASSIGNED) + sens = COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_USER_ORG; + + sensitize = (!read_only && sens); + + priv = mpage->priv; + + if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL)) + read_only = TRUE; + gtk_widget_set_sensitive (priv->memo_content, !read_only); - gtk_widget_set_sensitive (priv->classification, !read_only); gtk_widget_set_sensitive (priv->categories_btn, !read_only); gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only); + + bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPublic", "sensitive", sensitize ? "1" : "0" + , NULL); + bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPrivate", "sensitive", sensitize ? "1" : "0" + , NULL); + bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassConfidential", "sensitive", + sensitize ? "1" : "0", NULL); + bonobo_ui_component_set_prop (priv->uic, "/commands/ViewCategories", "sensitive", sensitize ? "1" : "0" + , NULL); } /* fill_widgets handler for the memo page */ static gboolean memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; ECalComponentClassification cl; GSList *l; const char *categories; ESource *source; - tpage = MEMO_PAGE (page); - priv = tpage->priv; + mpage = MEMO_PAGE (page); + priv = mpage->priv; priv->updating = TRUE; /* Clean the screen */ - clear_widgets (tpage); + clear_widgets (mpage); e_cal_component_get_description_list (comp, &l); if (l && l->data) { @@ -271,15 +315,26 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) switch (cl) { case E_CAL_COMPONENT_CLASS_PUBLIC: + { + cl = E_CAL_COMPONENT_CLASS_PUBLIC; + break; + } case E_CAL_COMPONENT_CLASS_PRIVATE: + { + cl = E_CAL_COMPONENT_CLASS_PRIVATE; + break; + } case E_CAL_COMPONENT_CLASS_CONFIDENTIAL: - break; + { + cl = E_CAL_COMPONENT_CLASS_CONFIDENTIAL; + break; + } default: /* default to PUBLIC */ cl = E_CAL_COMPONENT_CLASS_PUBLIC; break; } - e_dialog_option_menu_set (priv->classification, cl, classification_map); + set_classification_menu (mpage, cl); /* Categories */ e_cal_component_get_categories (comp, &categories); @@ -291,7 +346,7 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) priv->updating = FALSE; - sensitize_widgets (tpage); + sensitize_widgets (mpage); return TRUE; } @@ -300,15 +355,15 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) static gboolean memo_page_fill_component (CompEditorPage *page, ECalComponent *comp) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; char *cat, *str; int i; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; - tpage = MEMO_PAGE (page); - priv = tpage->priv; + mpage = MEMO_PAGE (page); + priv = mpage->priv; text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)); /* Memo Content */ @@ -365,7 +420,7 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp) g_free (str); /* Classification. */ - e_cal_component_set_classification (comp, classification_get (priv->classification)); + e_cal_component_set_classification (comp, priv->classification); /* Categories */ cat = e_dialog_editable_get (priv->categories); @@ -381,19 +436,28 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp) return TRUE; } - - +void +memo_page_set_show_categories (MemoPage *page, gboolean state) +{ + if (state) { + gtk_widget_show (page->priv->categories_btn); + gtk_widget_show (page->priv->categories); + } else { + gtk_widget_hide (page->priv->categories_btn); + gtk_widget_hide (page->priv->categories); + } +} /* Gets the widgets from the XML file and returns if they are all available. */ static gboolean -get_widgets (MemoPage *tpage) +get_widgets (MemoPage *mpage) { - CompEditorPage *page = COMP_EDITOR_PAGE (tpage); + CompEditorPage *page = COMP_EDITOR_PAGE (mpage); MemoPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; - priv = tpage->priv; + priv = mpage->priv; #define GW(name) glade_xml_get_widget (priv->xml, name) @@ -417,8 +481,6 @@ get_widgets (MemoPage *tpage) priv->memo_content = GW ("memo_content"); - priv->classification = GW ("classification"); - priv->categories_btn = GW ("categories-button"); priv->categories = GW ("categories"); @@ -426,8 +488,7 @@ get_widgets (MemoPage *tpage) #undef GW - return (priv->classification - && priv->memo_content + return (priv->memo_content && priv->categories_btn && priv->categories); } @@ -438,12 +499,12 @@ get_widgets (MemoPage *tpage) static void categories_clicked_cb (GtkWidget *button, gpointer data) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; GtkWidget *entry; - tpage = MEMO_PAGE (data); - priv = tpage->priv; + mpage = MEMO_PAGE (data); + priv = mpage->priv; entry = priv->categories; e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); @@ -453,24 +514,24 @@ categories_clicked_cb (GtkWidget *button, gpointer data) static void field_changed_cb (GtkWidget *widget, gpointer data) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; - tpage = MEMO_PAGE (data); - priv = tpage->priv; + mpage = MEMO_PAGE (data); + priv = mpage->priv; if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); } static void source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) { - MemoPage *tpage; + MemoPage *mpage; MemoPagePrivate *priv; - tpage = MEMO_PAGE (data); - priv = tpage->priv; + mpage = MEMO_PAGE (data); + priv = mpage->priv; if (!priv->updating) { ECal *client; @@ -483,7 +544,7 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) g_object_unref (client); e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), - e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client)); + e_cal_get_source (COMP_EDITOR_PAGE (mpage)->client)); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, @@ -495,19 +556,19 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) comp_editor_notify_client_changed ( COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), client); - sensitize_widgets (tpage); + sensitize_widgets (mpage); } } } /* Hooks the widget signals */ static gboolean -init_widgets (MemoPage *tpage) +init_widgets (MemoPage *mpage) { MemoPagePrivate *priv; GtkTextBuffer *text_buffer; - priv = tpage->priv; + priv = mpage->priv; /* Memo Content */ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)); @@ -516,44 +577,44 @@ init_widgets (MemoPage *tpage) /* Categories button */ g_signal_connect((priv->categories_btn), "clicked", - G_CALLBACK (categories_clicked_cb), tpage); + G_CALLBACK (categories_clicked_cb), mpage); /* Source selector */ g_signal_connect((priv->source_selector), "source_selected", - G_CALLBACK (source_changed_cb), tpage); + G_CALLBACK (source_changed_cb), mpage); /* Connect the default signal handler to use to make sure the "changed" field gets set whenever a field is changed. */ /* Belongs to priv->memo_content */ g_signal_connect ((text_buffer), "changed", - G_CALLBACK (field_changed_cb), tpage); + G_CALLBACK (field_changed_cb), mpage); - g_signal_connect((priv->classification), "changed", - G_CALLBACK (field_changed_cb), tpage); g_signal_connect((priv->categories), "changed", - G_CALLBACK (field_changed_cb), tpage); - + G_CALLBACK (field_changed_cb), mpage); + + memo_page_set_show_categories (mpage, calendar_config_get_show_categories()); + return TRUE; } /** * memo_page_construct: - * @tpage: An memo page. + * @mpage: An memo page. * * Constructs an memo page by loading its Glade data. * - * Return value: The same object as @tpage, or NULL if the widgets could not be + * Return value: The same object as @mpage, or NULL if the widgets could not be * created. **/ MemoPage * -memo_page_construct (MemoPage *tpage) +memo_page_construct (MemoPage *mpage) { MemoPagePrivate *priv; char *gladefile; - priv = tpage->priv; + priv = mpage->priv; gladefile = g_build_filename (EVOLUTION_GLADEDIR, "memo-page.glade", @@ -567,19 +628,19 @@ memo_page_construct (MemoPage *tpage) return NULL; } - if (!get_widgets (tpage)) { + if (!get_widgets (mpage)) { g_message ("memo_page_construct(): " "Could not find all widgets in the XML file!"); return NULL; } - if (!init_widgets (tpage)) { + if (!init_widgets (mpage)) { g_message ("memo_page_construct(): " "Could not initialize the widgets!"); return NULL; } - return tpage; + return mpage; } /** @@ -591,17 +652,18 @@ memo_page_construct (MemoPage *tpage) * not be created. **/ MemoPage * -memo_page_new (void) +memo_page_new (BonoboUIComponent *uic) { - MemoPage *tpage; + MemoPage *mpage; - tpage = gtk_type_new (TYPE_MEMO_PAGE); - if (!memo_page_construct (tpage)) { - g_object_unref (tpage); + mpage = gtk_type_new (TYPE_MEMO_PAGE); + mpage->priv->uic = uic; + if (!memo_page_construct (mpage)) { + g_object_unref (mpage); return NULL; } - return tpage; + return mpage; } GtkWidget *memo_page_create_source_option_menu (void); diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index 2553e1a4f2..ab9d2e2473 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -24,86 +24,19 @@ <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">Basics</span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> <widget class="GtkHBox" id="hbox7"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> - <widget class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> <widget class="GtkTable" id="table3"> <property name="visible">True</property> - <property name="n_rows">4</property> + <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> <property name="column_spacing">12</property> - - <child> - <widget class="GtkLabel" id="label100"> - <property name="visible">True</property> - <property name="label" translatable="yes">Classi_fication:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">classification</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> <child> <widget class="GtkHBox" id="hbox10"> @@ -112,70 +45,6 @@ <property name="spacing">0</property> <child> - <widget class="GtkOptionMenu" id="classification"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu1"> - - <child> - <widget class="GtkMenuItem" id="public1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Public</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="private1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Private</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="confidential1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Confidential</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Group:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">source</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> <widget class="Custom" id="source"> <property name="visible">True</property> <property name="creation_function">memo_page_create_source_option_menu</property> @@ -193,8 +62,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> @@ -212,8 +81,8 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -234,8 +103,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> @@ -271,8 +140,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">expand|shrink|fill</property> <property name="y_options">expand|shrink|fill</property> </packing> @@ -296,12 +165,42 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> </child> + + <child> + <widget class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Group:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">12</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">source</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + + </packing> + </child> </widget> <packing> <property name="padding">0</property> diff --git a/calendar/gui/dialogs/memo-page.h b/calendar/gui/dialogs/memo-page.h index 8df3b5ff65..45928d96e0 100644 --- a/calendar/gui/dialogs/memo-page.h +++ b/calendar/gui/dialogs/memo-page.h @@ -24,6 +24,9 @@ #ifndef MEMO_PAGE_H #define MEMO_PAGE_H +#include <bonobo/bonobo-window.h> +#include <bonobo/bonobo-ui-util.h> +#include <bonobo/bonobo-widget.h> #include "comp-editor-page.h" G_BEGIN_DECLS @@ -49,7 +52,7 @@ typedef struct { GtkType memo_page_get_type (void); MemoPage *memo_page_construct (MemoPage *epage); -MemoPage *memo_page_new (void); +MemoPage *memo_page_new (BonoboUIComponent *uic); G_END_DECLS diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index 2c9146dac6..1fb77dedb3 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -48,6 +48,8 @@ save_component_dialog (GtkWindow *parent, ECalComponent *comp) return e_error_run (parent, "calendar:prompt-save-appointment", NULL); case E_CAL_COMPONENT_TODO: return e_error_run (parent, "calendar:prompt-save-task", NULL); + case E_CAL_COMPONENT_JOURNAL: + return e_error_run (parent, "calendar:prompt-save-memo", NULL); default: return GTK_RESPONSE_NO; } diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 9dabb2059f..4416fabc93 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -196,7 +196,7 @@ menu_show_categories_cb (BonoboUIComponent *component, } static void -menu_class_public_cb (BonoboUIComponent *ui_component, +menu_class_public_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, @@ -206,27 +206,28 @@ menu_class_public_cb (BonoboUIComponent *ui_component, if (state[0] == '0') return; - printf("Setting to public\n"); + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page)); task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PUBLIC); } static void -menu_class_private_cb (BonoboUIComponent *ui_component, +menu_class_private_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, - gpointer user_data) + gpointer user_data) { TaskEditor *te = (TaskEditor *) user_data; if (state[0] == '0') return; - printf("Setting to private\n"); + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page)); task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PRIVATE); } static void -menu_class_confidential_cb (BonoboUIComponent *ui_component, +menu_class_confidential_cb (BonoboUIComponent *ui_component, const char *path, Bonobo_UIComponent_EventType type, const char *state, @@ -236,7 +237,7 @@ menu_class_confidential_cb (BonoboUIComponent *ui_component, if (state[0] == '0') return; - printf("Setting to confidential\n"); + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page)); task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL); } |