aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2006-01-16 00:04:20 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2006-01-16 00:04:20 +0800
commitd34fc62f9f809ebfce0f8ea45ffd7c82009e05f7 (patch)
tree9de2f980e5199699c5c22207a5d783d178968b30 /composer
parent661b91415d9e0be8db4ec3dba234752aa31ee2dc (diff)
downloadgsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar.gz
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar.bz2
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar.lz
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar.xz
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.tar.zst
gsoc2013-evolution-d34fc62f9f809ebfce0f8ea45ffd7c82009e05f7.zip
2006-1-15 Srinivasa Ragavan <sragavan@novell.com
** Committing the patch for Johnny Jacob ** Fixes bug #323127 * e-msg-composer.c (create_composer) : Add a Expander for attachments bar. (show_attachments): Show/Hide attachment bar. (attachment_expander_activate_cb) : Event handler for attachment bar. svn path=/trunk/; revision=31184
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog8
-rw-r--r--composer/e-msg-composer.c86
2 files changed, 72 insertions, 22 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index f9e53faa79..eb470046f5 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,11 @@
+2006-1-13 Johnny Jacob <johnnyjacob@gmail.com>
+
+ ** Fixes bug #323127
+ * e-msg-composer.c (create_composer) : Add a Expander
+ for attachments bar.
+ (show_attachments): Show/Hide attachment bar.
+ (attachment_expander_activate_cb) : Event handler for attachment bar.
+
2006-01-13 Srinivasa Ragavan <sragavan@novell.com>
** Fixes bug #326378
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index eb2590ab8a..55eea52e44 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1289,6 +1289,21 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s
/* Commands. */
static void
+show_attachments (EMsgComposer *composer,
+ gboolean show)
+{
+ EMsgComposerPrivate *p = composer->priv;
+
+ e_expander_set_expanded (E_EXPANDER (p->attachment_expander), show);
+ if (show)
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label),
+ _("Hide _Attachment Bar"));
+ else
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label),
+ _("Show _Attachment Bar"));
+}
+
+static void
save (EMsgComposer *composer, const char *filename)
{
EMsgComposerPrivate *p = composer->priv;
@@ -2472,11 +2487,11 @@ attachment_bar_changed_cb (EAttachmentBar *bar,
g_free (num_text);
gtk_widget_show (p->attachment_expander_icon);
-
+ show_attachments (composer, TRUE);
} else {
gtk_label_set_text (GTK_LABEL (p->attachment_expander_num), "");
- gtk_widget_hide (p->attachment_expander);
- gtk_widget_hide (p->attachment_scrolled_window);
+ gtk_widget_hide (p->attachment_expander_icon);
+ show_attachments (composer, FALSE);
}
@@ -2484,7 +2499,21 @@ attachment_bar_changed_cb (EAttachmentBar *bar,
changes on close */
e_msg_composer_set_changed (composer);
}
-
+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->priv->attachment_expander_label),
+ _("Hide _Attachment Bar"));
+ else
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label),
+ _("Show _Attachment Bar"));
+ }
static void
subject_changed_cb (EMsgComposerHdrs *hdrs,
gchar *subject,
@@ -3042,8 +3071,7 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk
}
if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar))) {
- gtk_widget_show (p->attachment_expander);
- gtk_widget_show (p->attachment_scrolled_window);
+ show_attachments (composer, TRUE);
}
gtk_drag_finish(context, success, delete, time);
@@ -3816,7 +3844,7 @@ create_composer (int visible_mask)
G_CALLBACK (attachment_bar_changed_cb), composer);
p->attachment_expander_label =
- gtk_label_new_with_mnemonic (_("_Attachment Bar"));
+ gtk_label_new_with_mnemonic (_("Show _Attachment Bar"));
p->attachment_expander_num = gtk_label_new ("");
gtk_label_set_use_markup (GTK_LABEL (p->attachment_expander_num), TRUE);
gtk_misc_set_alignment (GTK_MISC (p->attachment_expander_label), 0.0, 0.5);
@@ -3836,15 +3864,16 @@ create_composer (int visible_mask)
gtk_widget_show_all (expander_hbox);
gtk_widget_hide (p->attachment_expander_icon);
-
- gtk_box_pack_start (GTK_BOX (vbox), expander_hbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), p->attachment_scrolled_window,
- FALSE, FALSE, GNOME_PAD_SMALL);
-
- p->attachment_expander = expander_hbox;
- gtk_widget_hide (p->attachment_scrolled_window);
- gtk_widget_hide (expander_hbox);
-
+ p->attachment_expander = e_expander_new ("");
+ e_expander_set_label_widget (E_EXPANDER (p->attachment_expander), expander_hbox);
+ gtk_container_add (GTK_CONTAINER (p->attachment_expander), p->attachment_scrolled_window);
+
+ gtk_box_pack_start (GTK_BOX (vbox), p->attachment_expander, FALSE, FALSE, GNOME_PAD_SMALL);
+ gtk_widget_show (p->attachment_expander);
+ e_expander_set_expanded (E_EXPANDER (p->attachment_expander), FALSE);
+ g_signal_connect_after (p->attachment_expander, "activate",
+ G_CALLBACK (attachment_expander_activate_cb), composer);
+
bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox);
gtk_widget_show (vbox);
@@ -4841,6 +4870,22 @@ e_msg_composer_new_from_url (const char *url)
return composer;
}
+/**
+* e_msg_composer_show_attachments:
+* @composer: A message composer widget
+* @show: A boolean specifying whether the attachment bar should be shown or
+* not
+*
+* If @show is %FALSE, hide the attachment bar. Otherwise, show it.
+**/
+void
+e_msg_composer_show_attachments (EMsgComposer *composer,
+ gboolean show)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ show_attachments (composer, show);
+}
/**
* e_msg_composer_set_headers:
@@ -4968,9 +5013,8 @@ e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment)
bar = E_ATTACHMENT_BAR (p->attachment_bar);
e_attachment_bar_attach_mime_part (bar, attachment);
- gtk_widget_show (p->attachment_expander);
- gtk_widget_show (p->attachment_scrolled_window);
+ show_attachments (composer, TRUE);
}
@@ -6094,10 +6138,8 @@ e_msg_composer_show_attachments_ui (EMsgComposer *composer)
{
EMsgComposerPrivate *p = composer->priv;
- if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar))) {
- gtk_widget_show (p->attachment_expander);
- gtk_widget_show (p->attachment_scrolled_window);
- }
+ if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar)))
+ show_attachments (composer, TRUE);
}
void