static void compose_attach_update_label(Compose *compose);
static void compose_set_folder_prefs(Compose *compose, FolderItem *folder,
gboolean respect_default_to);
+static void compose_subject_entry_activated(GtkWidget *widget, gpointer data);
static GtkActionEntry compose_popup_entries[] =
{
gboolean badtxt = FALSE;
struct stat file_stat;
int ret;
+ GString *file_contents = NULL;
cm_return_val_if_fail(file != NULL, COMPOSE_INSERT_NO_FILE);
cur_encoding = conv_get_locale_charset_str_no_utf8();
+ file_contents = g_string_new("");
while (fgets(buf, sizeof(buf), fp) != NULL) {
gchar *str;
if (str[len] == '\r') str[len] = '\n';
}
- gtk_text_buffer_insert(buffer, &iter, str, -1);
+ file_contents = g_string_append(file_contents, str);
g_free(str);
}
+ gtk_text_buffer_insert(buffer, &iter, file_contents->str, -1);
+ g_string_free(file_contents, TRUE);
+
+ compose_changed_cb(NULL, compose);
g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
G_CALLBACK(text_inserted),
compose);
goto extra_headers_done;
}
while (fgets(buf, BUFFSIZE, exh) != NULL) {
- lastc = strlen(buf) - 1; /* remove trailing \n */
- buf[lastc] = (buf[lastc] == '\n')? '\0': buf[lastc];
- --lastc;
+ lastc = strlen(buf) - 1; /* remove trailing control chars */
+ while (lastc >= 0 && buf[lastc] != ':')
+ buf[lastc--] = '\0';
if (lastc > 0 && buf[0] != '#' && buf[lastc] == ':') {
buf[lastc] = '\0'; /* remove trailing : for comparison */
if (custom_header_is_allowed(buf)) {
G_CALLBACK(compose_popup_menu), compose);
#endif
g_signal_connect(G_OBJECT(subject_entry), "changed",
- G_CALLBACK(compose_changed_cb), compose);
+ G_CALLBACK(compose_changed_cb), compose);
+ g_signal_connect(G_OBJECT(subject_entry), "activate",
+ G_CALLBACK(compose_subject_entry_activated), compose);
/* drag and drop */
gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_mime_types,
tmpl = g_object_get_data(G_OBJECT(widget), "template");
cm_return_if_fail(tmpl != NULL);
- msg = g_strdup_printf(_("Do you want to apply the template '%s' ?"),
+ msg = g_strdup_printf(_("Do you want to apply the template '%s'?"),
tmpl->name);
val = alertpanel(_("Apply template"), msg,
_("_Replace"), _("_Insert"), GTK_STOCK_CANCEL);
}
#endif
+static void compose_subject_entry_activated(GtkWidget *widget, gpointer data)
+{
+ Compose *compose = (Compose *)data;
+
+ cm_return_if_fail(compose != NULL);
+
+ gtk_widget_grab_focus(compose->text);
+}
+
/*
* End of Source.
*/