aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorERDI Gergo <cactus@cactus.rulez.org>2004-01-11 00:14:17 +0800
committerÉRDI Gergo <cactus@src.gnome.org>2004-01-11 00:14:17 +0800
commit2fd22d547c519e90f3dc6850d2235e122964f477 (patch)
tree67adb5efced8a9edd1694eac0bbf23211d2fb7c2 /composer
parent873550ef30d4e8c8d249442fb5002095765a764f (diff)
downloadgsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar.gz
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar.bz2
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar.lz
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar.xz
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.tar.zst
gsoc2013-evolution-2fd22d547c519e90f3dc6850d2235e122964f477.zip
Implemented #127527: the attachment bar is packed inside an EExpander
2003-12-02 ERDI Gergo <cactus@cactus.rulez.org> * e-msg-composer.c: Implemented #127527: the attachment bar is packed inside an EExpander svn path=/trunk/; revision=24146
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog5
-rw-r--r--composer/e-msg-composer.c111
-rw-r--r--composer/e-msg-composer.h4
3 files changed, 91 insertions, 29 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 75ff1047f9..fe41dea0de 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -31,6 +31,11 @@
(e_msg_composer_hdrs_set_post_to): #if 0 out for now.
(e_msg_composer_hdrs_get_post_to): Likewise.
+2003-12-02 ERDI Gergo <cactus@cactus.rulez.org>
+
+ * e-msg-composer.c: Implemented #127527: the attachment bar is
+ packed inside an EExpander
+
2003-12-01 Rodney Dawes <dobey@ximian.com>
* e-msg-composer-hdrs.h: Use BASE_VERSION for repo_ids and OAFIIDs
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 4cce2eecb7..9ec314cb7a 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -81,6 +81,7 @@
#include "e-util/e-dialog-utils.h"
#include "widgets/misc/e-charset-picker.h"
+#include "widgets/misc/e-expander.h"
#include <camel/camel-session.h>
#include <camel/camel-charset-map.h>
@@ -104,6 +105,8 @@
#include "evolution-shell-component-utils.h"
+#include "art/attachment.xpm"
+
#include "Editor.h"
#include "listener.h"
@@ -1109,20 +1112,7 @@ static void
show_attachments (EMsgComposer *composer,
gboolean show)
{
- if (show) {
- gtk_widget_show (composer->attachment_scrolled_window);
- gtk_widget_show (composer->attachment_bar);
- } else {
- gtk_widget_hide (composer->attachment_scrolled_window);
- gtk_widget_hide (composer->attachment_bar);
- }
-
- composer->attachment_bar_visible = show;
-
- /* Update the GUI. */
- bonobo_ui_component_set_prop (
- composer->uic, "/commands/ViewAttach",
- "state", show ? "1" : "0", NULL);
+ e_expander_set_expanded (E_EXPANDER (composer->attachment_expander), show);
}
static void
@@ -2204,15 +2194,25 @@ static void
attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar,
void *data)
{
- EMsgComposer *composer;
- gboolean show = FALSE;
-
- composer = E_MSG_COMPOSER (data);
-
- if (e_msg_composer_attachment_bar_get_num_attachments (bar) > 0)
- show = TRUE;
+ EMsgComposer *composer = E_MSG_COMPOSER (data);
+
+ guint attachment_num = e_msg_composer_attachment_bar_get_num_attachments (
+ E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar));
+ if (attachment_num) {
+ gchar *num_text = g_strdup_printf (
+ ngettext ("<b>%d</b> File Attached", "<b>%d</b> Files Attached", attachment_num),
+ attachment_num);
+ gtk_label_set_markup (GTK_LABEL (composer->attachment_expander_num),
+ num_text);
+ g_free (num_text);
+
+ gtk_widget_show (composer->attachment_expander_icon);
+
+ } else {
+ gtk_label_set_text (GTK_LABEL (composer->attachment_expander_num), "");
+ gtk_widget_hide (composer->attachment_expander_icon);
+ }
- e_msg_composer_show_attachments (composer, show);
/* Mark the composer as changed so it prompts about unsaved
changes on close */
@@ -2220,6 +2220,27 @@ attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar,
}
static void
+attachment_expander_activate_cb (EExpander *expander,
+ void *data)
+{
+ EMsgComposer *composer = E_MSG_COMPOSER (data);
+ gboolean show = e_expander_get_expanded (expander);
+
+ /* Update the expander label */
+ if (show)
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->attachment_expander_label),
+ _("Hide _Attachment Bar (drop attachments here)"));
+ else
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->attachment_expander_label),
+ _("Show _Attachment Bar (drop attachments here)"));
+
+ /* Update the GUI. */
+ bonobo_ui_component_set_prop (
+ composer->uic, "/commands/ViewAttach",
+ "state", show ? "1" : "0", NULL);
+}
+
+static void
subject_changed_cb (EMsgComposerHdrs *hdrs,
gchar *subject,
void *data)
@@ -2919,12 +2940,13 @@ static EMsgComposer *
create_composer (int visible_mask)
{
EMsgComposer *composer;
- GtkWidget *vbox;
+ GtkWidget *vbox, *expander_hbox;
Bonobo_Unknown editor_server;
CORBA_Environment ev;
GConfClient *gconf;
int vis;
BonoboControlFrame *control_frame;
+ GdkPixbuf *attachment_pixbuf;
composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL);
gtk_window_set_title ((GtkWindow *) composer, _("Compose a message"));
@@ -3024,8 +3046,8 @@ create_composer (int visible_mask)
gtk_box_pack_start (GTK_BOX (vbox), composer->editor, TRUE, TRUE, 0);
- /* Attachment editor, wrapped into an EScrollFrame. We don't
- show it for now. */
+ /* Attachment editor, wrapped into an EScrollFrame. It's
+ hidden in an EExpander. */
composer->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (composer->attachment_scrolled_window),
@@ -3037,12 +3059,43 @@ create_composer (int visible_mask)
GTK_WIDGET_SET_FLAGS (composer->attachment_bar, GTK_CAN_FOCUS);
gtk_container_add (GTK_CONTAINER (composer->attachment_scrolled_window),
composer->attachment_bar);
- gtk_box_pack_start (GTK_BOX (vbox),
- composer->attachment_scrolled_window,
- FALSE, FALSE, GNOME_PAD_SMALL);
-
+ gtk_widget_show (composer->attachment_bar);
g_signal_connect (composer->attachment_bar, "changed",
G_CALLBACK (attachment_bar_changed_cb), composer);
+
+ composer->attachment_expander_label =
+ gtk_label_new_with_mnemonic (_("Show _Attachment Bar (drop attachments here)"));
+ composer->attachment_expander_num = gtk_label_new ("");
+ gtk_label_set_use_markup (GTK_LABEL (composer->attachment_expander_num), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (composer->attachment_expander_label), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (composer->attachment_expander_num), 1.0, 0.5);
+ expander_hbox = gtk_hbox_new (FALSE, 0);
+
+ attachment_pixbuf = gdk_pixbuf_new_from_xpm_data (attachment_xpm);
+ composer->attachment_expander_icon = gtk_image_new_from_pixbuf (attachment_pixbuf);
+ gtk_misc_set_alignment (GTK_MISC (composer->attachment_expander_icon), 1, 0.5);
+ gtk_widget_set_size_request (composer->attachment_expander_icon, 100, -1);
+ gdk_pixbuf_unref (attachment_pixbuf);
+
+ gtk_box_pack_start (GTK_BOX (expander_hbox), composer->attachment_expander_label,
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (expander_hbox), composer->attachment_expander_icon,
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (expander_hbox), composer->attachment_expander_num,
+ TRUE, TRUE, 0);
+ gtk_widget_show_all (expander_hbox);
+ gtk_widget_hide (composer->attachment_expander_icon);
+
+ composer->attachment_expander = e_expander_new ("");
+ e_expander_set_label_widget (E_EXPANDER (composer->attachment_expander), expander_hbox);
+
+ gtk_container_add (GTK_CONTAINER (composer->attachment_expander),
+ composer->attachment_scrolled_window);
+ gtk_box_pack_start (GTK_BOX (vbox), composer->attachment_expander,
+ FALSE, FALSE, GNOME_PAD_SMALL);
+ gtk_widget_show (composer->attachment_expander);
+ g_signal_connect_after (composer->attachment_expander, "activate",
+ G_CALLBACK (attachment_expander_activate_cb), composer);
bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox);
gtk_widget_show (vbox);
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index dcc308cac0..528067b2b5 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -69,6 +69,10 @@ struct _EMsgComposer {
GtkWidget *attachment_bar;
GtkWidget *attachment_scrolled_window;
+ GtkWidget *attachment_expander;
+ GtkWidget *attachment_expander_label;
+ GtkWidget *attachment_expander_icon;
+ GtkWidget *attachment_expander_num;
GtkWidget *address_dialog;