aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog15
-rw-r--r--composer/e-msg-composer-hdrs.c35
-rw-r--r--composer/e-msg-composer-hdrs.h2
-rw-r--r--composer/e-msg-composer.c21
4 files changed, 65 insertions, 8 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 6b9e8bfd75..b5c8492f3e 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,18 @@
+2001-01-17 Jason Leach <jasonleach@usa.net>
+
+ (Bug #1192: Set the Composer window title to something useful)
+
+ * e-msg-composer.c (e_msg_composer_construct): Connect up the new
+ signal here.
+ (subject_changed_cb): Set the composer window title to the subject
+ as it's changed, or if it goes blank make it the default "Compose
+ a message".
+
+ * e-msg-composer-hdrs.c (class_init): Create a new signal
+ "subject_changed".
+ (entry_changed): Emit the signal here when the subject entry is
+ changed.
+
2001-01-17 Iain Holmes <iain@ximian.com>
* e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index 862938f665..66aa80a88b 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -67,6 +67,7 @@ static GtkTableClass *parent_class = NULL;
enum {
SHOW_ADDRESS_DIALOG,
+ SUBJECT_CHANGED,
LAST_SIGNAL
};
@@ -228,8 +229,17 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs,
static void
entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs)
{
- /* Set the has_changed var to TRUE */
+ gchar *tmp;
+ gchar *subject;
+
+ /* Mark the headers as changed */
hdrs->has_changed = TRUE;
+
+ tmp = e_msg_composer_hdrs_get_subject (hdrs);
+ subject = e_utf8_to_gtk_string (GTK_WIDGET (entry), tmp);
+
+ gtk_signal_emit (GTK_OBJECT (hdrs), signals[SUBJECT_CHANGED], subject);
+ g_free (tmp);
}
static GtkWidget *
@@ -248,7 +258,7 @@ add_header (EMsgComposerHdrs *hdrs,
if (type == HEADER_ADDRBOOK) {
label = gtk_button_new_with_label (name);
- GTK_OBJECT_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+ GTK_OBJECT_UNSET_FLAGS (label, GTK_CAN_FOCUS);
gtk_signal_connect (GTK_OBJECT (label), "clicked",
GTK_SIGNAL_FUNC (address_button_clicked_cb),
hdrs);
@@ -274,13 +284,14 @@ add_header (EMsgComposerHdrs *hdrs,
case HEADER_OPTIONMENU:
entry = create_optionmenu (hdrs, name);
break;
+ case HEADER_ENTRYBOX:
default:
entry = e_entry_new ();
- gtk_object_set(GTK_OBJECT(entry),
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
+ gtk_object_set (GTK_OBJECT(entry),
+ "editable", TRUE,
+ "use_ellipsis", TRUE,
+ "allow_newlines", FALSE,
+ NULL);
gtk_signal_connect (GTK_OBJECT (entry), "changed",
GTK_SIGNAL_FUNC (entry_changed), hdrs);
}
@@ -397,6 +408,16 @@ class_init (EMsgComposerHdrsClass *class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ signals[SUBJECT_CHANGED] =
+ gtk_signal_new ("subject_changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
+ subject_changed),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE,
+ 1, GTK_TYPE_STRING);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index 1521cc94a3..8be7375b98 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -58,6 +58,8 @@ struct _EMsgComposerHdrsClass {
GtkTableClass parent_class;
void (* show_address_dialog) (EMsgComposerHdrs *hdrs);
+
+ void (* subject_changed) (EMsgComposerHdrs *hdrs, gchar *subject);
};
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 539d0d4f8b..2b12abad04 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1142,6 +1142,23 @@ attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar,
e_msg_composer_show_attachments (composer, FALSE);
}
+static void
+subject_changed_cb (EMsgComposerHdrs *hdrs,
+ gchar *subject,
+ void *data)
+{
+ EMsgComposer *composer;
+
+ composer = E_MSG_COMPOSER (data);
+
+ if (strlen (subject))
+ gtk_window_set_title (GTK_WINDOW (composer), subject);
+ else
+ gtk_window_set_title (GTK_WINDOW (composer),
+ _("Compose a message"));
+ g_free (subject);
+}
+
/* GtkObject methods. */
@@ -1373,6 +1390,8 @@ e_msg_composer_construct (EMsgComposer *composer)
composer->hdrs = e_msg_composer_hdrs_new ();
gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0);
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed",
+ GTK_SIGNAL_FUNC (subject_changed_cb), composer);
gtk_widget_show (composer->hdrs);
/* Editor component. */
@@ -1418,7 +1437,7 @@ e_msg_composer_construct (EMsgComposer *composer)
gtk_widget_show (vbox);
e_msg_composer_show_attachments (composer, FALSE);
-
+
/* Set focus on the `To:' field.
gtk_widget_grab_focus (e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs)));