[evolution-patches] [Mailer] Fix for 323127
- From: Johnny Jacob <johnnyjacob gmail com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] [Mailer] Fix for 323127
- Date: Fri, 13 Jan 2006 18:30:11 +0530
HI
Worked on bug #323127. Added a expander for hte attachment bar.
Please review.
Thanks
Johnny
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.729
diff -u -p -r1.729 ChangeLog
--- composer/ChangeLog 10 Jan 2006 07:49:54 -0000 1.729
+++ composer/ChangeLog 13 Jan 2006 12:55:56 -0000
@@ -1,3 +1,11 @@
+2006-1-13 Johnny Jacob <johnnyjacob gmail com>
+
+ Fixes #323127
+ * e-msg-composer.c (create_composer) : Add a EExpander
+ for attachments barr.
+ (show_attachments): Show/Hide attachment bar.
+ (attachment_expander_activate_cb) : Event handler for attachment bar.
+
2005-12-21 Rohini S <srohini novell com>
** See bug #246237
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.527
diff -u -p -r1.527 e-msg-composer.c
--- composer/e-msg-composer.c 10 Jan 2006 07:49:54 -0000 1.527
+++ composer/e-msg-composer.c 13 Jan 2006 12:56:08 -0000
@@ -1289,6 +1289,15 @@ set_editor_text(EMsgComposer *composer,
/* Commands. */
static void
+show_attachments (EMsgComposer *composer,
+ gboolean show)
+{
+ EMsgComposerPrivate *p = composer->priv;
+
+ e_expander_set_expanded (E_EXPANDER (p->attachment_expander), show);
+}
+
+static void
save (EMsgComposer *composer, const char *filename)
{
EMsgComposerPrivate *p = composer->priv;
@@ -2475,8 +2483,7 @@ attachment_bar_changed_cb (EAttachmentBa
} else {
gtk_label_set_text (GTK_LABEL (p->attachment_expander_num), "");
- gtk_widget_hide (p->attachment_expander);
- gtk_widget_hide (p->attachment_scrolled_window);
+ show_attachments (composer, FALSE);
}
@@ -2484,7 +2491,26 @@ attachment_bar_changed_cb (EAttachmentBa
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 (drop attachments here)"));
+ else
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label),
+ _("Show _Attachment Bar (drop attachments here)"));
+
+ /* Update the GUI. */
+ bonobo_ui_component_set_prop (
+ composer->priv->uic, "/commands/ViewAttach",
+ "state", show ? "1" : "0", NULL);
+ }
static void
subject_changed_cb (EMsgComposerHdrs *hdrs,
gchar *subject,
@@ -3042,8 +3068,7 @@ drop_action(EMsgComposer *composer, GdkD
}
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 +3841,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 (drop attachments here)"));
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 +3861,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 +4867,22 @@ e_msg_composer_new_from_url (const char
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 +5010,8 @@ e_msg_composer_attach (EMsgComposer *com
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 +6135,8 @@ e_msg_composer_show_attachments_ui (EMsg
{
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]