diff options
author | Milan Crha <mcrha@redhat.com> | 2012-05-11 18:38:38 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-05-11 18:38:38 +0800 |
commit | d2de841ec6dbae4ba9439bf3b30da8d4048ea4de (patch) | |
tree | 19a4f9b1bb8504578639cd918d26350ec5181542 /calendar/gui | |
parent | 79ba8e48f2670e16fe4eba837016880aef5a524b (diff) | |
download | gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar.gz gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar.bz2 gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar.lz gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar.xz gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.tar.zst gsoc2013-evolution-d2de841ec6dbae4ba9439bf3b30da8d4048ea4de.zip |
Bug #559710 - Do not close Event/Task/Memo editor on save
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 033d80a4a7..b647960b2f 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -160,6 +160,7 @@ static const gchar *ui = " <menubar action='main-menu'>" " <menu action='file-menu'>" " <menuitem action='save'/>" +" <menuitem action='save-and-close'/>" " <separator/>" " <menuitem action='print-preview'/>" " <menuitem action='print'/>" @@ -184,6 +185,7 @@ static const gchar *ui = " </menu>" " </menubar>" " <toolbar name='main-toolbar'>" +" <toolitem action='save-and-close'/>\n" " <toolitem action='save'/>\n" "#if !EXPRESS\n" " <toolitem action='print'/>\n" @@ -918,8 +920,8 @@ remove_event_dialog (ECalClient *client, } static void -action_save_cb (GtkAction *action, - CompEditor *editor) +save_and_close_editor (CompEditor *editor, + gboolean can_close) { CompEditorPrivate *priv = editor->priv; EAttachmentStore *store; @@ -1028,8 +1030,26 @@ action_save_cb (GtkAction *action, } else correct = FALSE; - if (correct) - close_dialog (editor); + if (correct) { + if (can_close) + close_dialog (editor); + else + comp_editor_set_changed (editor, FALSE); + } +} + +static void +action_save_cb (GtkAction *action, + CompEditor *editor) +{ + save_and_close_editor (editor, FALSE); +} + +static void +action_save_and_close_cb (GtkAction *action, + CompEditor *editor) +{ + save_and_close_editor (editor, TRUE); } static void @@ -1181,6 +1201,13 @@ static GtkActionEntry core_entries[] = { N_("Save current changes"), G_CALLBACK (action_save_cb) }, + { "save-and-close", + NULL, + N_("Save and Close"), + NULL, + N_("Save current changes and close editor"), + G_CALLBACK (action_save_and_close_cb) }, + { "select-all", GTK_STOCK_SELECT_ALL, NULL, @@ -1988,6 +2015,33 @@ comp_editor_init (CompEditor *editor) priv->ui_manager, action_group, 0); g_object_unref (action_group); + action = gtk_action_group_get_action (action_group, "save-and-close"); + if (action) { + GtkAction *save_action; + GIcon *icon; + GIcon *emblemed_icon; + GEmblem *emblem; + + icon = g_themed_icon_new (GTK_STOCK_CLOSE); + emblemed_icon = g_themed_icon_new (GTK_STOCK_SAVE); + emblem = g_emblem_new (emblemed_icon); + g_object_unref (emblemed_icon); + + emblemed_icon = g_emblemed_icon_new (icon, emblem); + g_object_unref (emblem); + g_object_unref (icon); + + gtk_action_set_gicon (action, emblemed_icon); + + g_object_unref (emblemed_icon); + + save_action = gtk_action_group_get_action (action_group, "save"); + g_object_bind_property ( + save_action, "sensitive", + action, "sensitive", + G_BINDING_SYNC_CREATE); + } + action_group = gtk_action_group_new ("individual"); gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); |