aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-19 06:11:02 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-19 06:11:02 +0800
commite31a8b9678ee651cfe883e80a11b9353fc7d1e50 (patch)
treeb92892ed2b3a319c4f53b8043f25dfc22bf5244f /composer
parente977f1be9e5b5a5dae943c3cf44ea8810c5e8ec3 (diff)
downloadgsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar.gz
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar.bz2
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar.lz
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar.xz
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.tar.zst
gsoc2013-evolution-e31a8b9678ee651cfe883e80a11b9353fc7d1e50.zip
e_msg_composer_hdrs_get_subject() now returns const so don't g_free() it
2003-03-18 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (do_exit): e_msg_composer_hdrs_get_subject() now returns const so don't g_free() it :-) (map_default_cb): Same as above. Also, the subject entry no longer derives from GnomeCanvas so eliminate the now unneeded casting to grab the focus of the subject widget. (e_msg_composer_get_subject): Return a const char * now. * e-msg-composer-hdrs.c (create_headers): Make the subject entry into a GtkEntry so we don't have to worry about i18n and other EEntry bugs anymore. Fixes numerous bugs (including #39924). (e_msg_composer_hdrs_set_subject): Use gtk_entry_set_text(). (e_msg_composer_hdrs_to_message_internal): e_msg_composer_hdrs_get_subject() now returns const. (e_msg_composer_hdrs_get_subject): Return a const char *. (entry_changed): e_msg_composer_hdrs_get_subject() now returns const. svn path=/trunk/; revision=20350
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog19
-rw-r--r--composer/e-msg-composer-hdrs.c26
-rw-r--r--composer/e-msg-composer-hdrs.h2
-rw-r--r--composer/e-msg-composer.c45
-rw-r--r--composer/e-msg-composer.h2
5 files changed, 50 insertions, 44 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 0def2175cc..62dbdb6e1a 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,22 @@
+2003-03-18 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer.c (do_exit): e_msg_composer_hdrs_get_subject()
+ now returns const so don't g_free() it :-)
+ (map_default_cb): Same as above. Also, the subject entry no longer
+ derives from GnomeCanvas so eliminate the now unneeded casting to
+ grab the focus of the subject widget.
+ (e_msg_composer_get_subject): Return a const char * now.
+
+ * e-msg-composer-hdrs.c (create_headers): Make the subject entry
+ into a GtkEntry so we don't have to worry about i18n and other
+ EEntry bugs anymore. Fixes numerous bugs (including #39924).
+ (e_msg_composer_hdrs_set_subject): Use gtk_entry_set_text().
+ (e_msg_composer_hdrs_to_message_internal):
+ e_msg_composer_hdrs_get_subject() now returns const.
+ (e_msg_composer_hdrs_get_subject): Return a const char *.
+ (entry_changed): e_msg_composer_hdrs_get_subject() now returns
+ const.
+
2003-03-13 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (create_composer): Default the composer's title
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index 2102cf9198..2d3a9fccdc 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -487,11 +487,10 @@ header_new_recipient (EMsgComposerHdrs *hdrs, const char *name, const char *tip)
static void
entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs)
{
- char *subject;
+ const char *subject;
subject = e_msg_composer_hdrs_get_subject (hdrs);
g_signal_emit (hdrs, signals[SUBJECT_CHANGED], 0, subject);
- g_free (subject);
g_signal_emit (hdrs, signals[HDRS_CHANGED], 0);
}
@@ -526,12 +525,7 @@ create_headers (EMsgComposerHdrs *hdrs)
* Subject
*/
priv->subject.label = gtk_label_new (_("Subject:"));
- priv->subject.entry = e_entry_new ();
- g_object_set (priv->subject.entry,
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
+ priv->subject.entry = gtk_entry_new ();
g_signal_connect (priv->subject.entry, "changed",
G_CALLBACK (entry_changed), hdrs);
@@ -939,14 +933,14 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
{
EDestination **to_destv, **cc_destv, **bcc_destv;
CamelInternetAddress *addr;
- char *subject, *header;
+ const char *subject;
+ char *header;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
subject = e_msg_composer_hdrs_get_subject (hdrs);
camel_mime_message_set_subject (msg, subject);
- g_free (subject);
addr = e_msg_composer_hdrs_get_from (hdrs);
if (redirect) {
@@ -1127,8 +1121,7 @@ e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
g_return_if_fail (subject != NULL);
- g_object_set ((GObject *) hdrs->priv->subject.entry,
- "text", subject, NULL);
+ gtk_entry_set_text ((GtkEntry *) hdrs->priv->subject.entry, subject);
}
@@ -1283,17 +1276,12 @@ e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs)
return folder ? g_strdup (folder->physicalUri) : NULL;
}
-char *
+const char *
e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs)
{
- char *subject;
-
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
- g_object_get((hdrs->priv->subject.entry),
- "text", &subject, NULL);
-
- return subject;
+ return gtk_entry_get_text ((GtkEntry *) hdrs->priv->subject.entry);
}
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index 7ba370140c..eae32c6ef6 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -128,7 +128,7 @@ EDestination **e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
EDestination **e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
EDestination **e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs);
char *e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs);
-char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
+const char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index b109767c4d..85dfc04668 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1525,7 +1525,7 @@ menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
static void
do_exit (EMsgComposer *composer)
{
- char *subject;
+ const char *subject;
GtkWidget *dialog;
int button;
@@ -1535,27 +1535,27 @@ do_exit (EMsgComposer *composer)
}
gdk_window_raise (GTK_WIDGET (composer)->window);
-
+
subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE,
- _("The message \"%s\" has not been sent.\n\n"
- "Do you wish to save your changes?"),
- subject);
- g_free(subject);
- gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (composer),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE,
+ _("The message \"%s\" has not been sent.\n\n"
+ "Do you wish to save your changes?"),
+ subject);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
_("_Discard Changes"), GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_YES,
NULL);
gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Modified Message"));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
- button = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
-
- switch(button) {
+ button = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ switch (button) {
case GTK_RESPONSE_YES:
/* Save */
g_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], 0, TRUE);
@@ -2687,8 +2687,9 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
GtkWidget *to;
BonoboControlFrame *cf;
Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
- char *text;
CORBA_Environment ev;
+ const char *subject;
+ char *text;
/* If the 'To:' field is empty, focus it (This is ridiculously complicated) */
@@ -2708,17 +2709,15 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
/* If not, check the subject field */
- text = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
+ subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
- if (!text || text[0] == '\0') {
+ if (!subject || subject[0] == '\0') {
GtkWidget *widget;
widget = e_msg_composer_hdrs_get_subject_entry (E_MSG_COMPOSER_HDRS (composer->hdrs));
- gtk_widget_grab_focus (GTK_WIDGET (E_ENTRY (widget)->canvas));
- g_free (text);
+ gtk_widget_grab_focus (widget);
return;
}
- g_free (text);
/* Jump to the editor as a last resort. */
@@ -4642,12 +4641,12 @@ e_msg_composer_get_bcc (EMsgComposer *composer)
return composer->hdrs ? e_msg_composer_hdrs_get_bcc (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL;
}
-char *
+const char *
e_msg_composer_get_subject (EMsgComposer *composer)
{
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
- return composer->hdrs ? e_msg_composer_hdrs_get_subject(E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL;
+ return composer->hdrs ? e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL;
}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 21a1d6dc41..94be69a153 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -169,7 +169,7 @@ EDestination **e_msg_composer_get_recipients (EMsgCo
EDestination **e_msg_composer_get_to (EMsgComposer *composer);
EDestination **e_msg_composer_get_cc (EMsgComposer *composer);
EDestination **e_msg_composer_get_bcc (EMsgComposer *composer);
-char *e_msg_composer_get_subject (EMsgComposer *composer);
+const char *e_msg_composer_get_subject (EMsgComposer *composer);
EAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);