*(strstr(left_from, "@")) = '\0';
}
- if (left_ml && left_from && right_ml && right_from
+ if (right_ml && right_from
&& !strncmp(left_from, left_ml, strlen(left_ml))
&& !strcmp(right_from, right_ml)) {
result = TRUE;
gint len;
FILE *fp;
gboolean prev_autowrap;
- gboolean badtxt = FALSE;
struct stat file_stat;
int ret;
GString *file_contents = NULL;
fclose(fp);
- if (badtxt)
- return COMPOSE_INSERT_INVALID_CHARACTER;
- else
- return COMPOSE_INSERT_SUCCESS;
+ return COMPOSE_INSERT_SUCCESS;
}
static gboolean compose_attach_append(Compose *compose, const gchar *file,
(tmp, CS_INTERNAL, conv_get_locale_charset_str());
g_free(tmp);
- if (!chars) return -1;
-
+ if (!chars) {
+ fclose(fp);
+ claws_unlink(file);
+ return -1;
+ }
/* write body */
len = strlen(chars);
if (fwrite(chars, sizeof(gchar), len, fp) != len) {
}
continue;
}
+ if (g_stat(ainfo->file, &statbuf) < 0)
+ return -1;
+
mimepart = procmime_mimeinfo_new();
mimepart->content = MIMECONTENT_FILE;
mimepart->data.filename = g_strdup(ainfo->file);
mimepart->tmp = FALSE; /* or we destroy our attachment */
mimepart->offset = 0;
-
- g_stat(ainfo->file, &statbuf);
mimepart->length = statbuf.st_size;
type = g_strdup(ainfo->content_type);
gboolean standard_header = FALSE;
GtkListStore *model;
GtkTreeIter iter;
-#if !(GTK_CHECK_VERSION(2,12,0))
- GtkTooltips *tips = compose->tooltips;
-#endif
headerentry = g_new0(ComposeHeaderEntry, 1);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(combo))), "grab_focus",
G_CALLBACK(compose_grab_focus_cb), compose);
gtk_widget_show(combo);
-
+
+ /* Putting only the combobox child into focus chain of its parent causes
+ * the parent to be skipped when changing focus via Tab or Shift+Tab.
+ * This eliminates need to pres Tab twice in order to really get from the
+ * combobox to next widget. */
GList *l = NULL;
l = g_list_prepend(l, gtk_bin_get_child(GTK_BIN(combo)));
gtk_container_set_focus_chain(GTK_CONTAINER(combo), l);
{
Compose *compose = (Compose *) data;
- if(compose->gtkaspell &&
- compose->gtkaspell->recheck_when_changing_dict == FALSE)
+ if(!compose->gtkaspell)
+ return;
+ if(compose->gtkaspell->recheck_when_changing_dict == FALSE)
return;
gtkaspell_highlight_all(compose->gtkaspell);
compose->mutex = cm_mutex_new();
compose->set_cursor_pos = -1;
-#if !(GTK_CHECK_VERSION(2,12,0))
- compose->tooltips = tips;
-#endif
-
window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose");
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
gtk_container_set_border_width(GTK_CONTAINER(subject), 0);
gtk_widget_show(subject);
- label = gtk_label_new_with_mnemonic(_("Subject:"));
+ label = gtk_label_new_with_mnemonic(_("_Subject:"));
gtk_box_pack_start(GTK_BOX(subject), label, FALSE, FALSE, 0);
gtk_widget_show(label);
GtkListStore *menu;
GtkTreeIter iter;
GtkWidget *from_name = NULL;
-#if !(GTK_CHECK_VERSION(2,12,0))
- GtkTooltips *tips = compose->tooltips;
-#endif
gint num = 0, def_menu = 0;
gtk_box_pack_start(GTK_BOX(hbox), optmenubox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), from_name, TRUE, TRUE, 0);
+
+ /* Putting only the GtkEntry into focus chain of parent hbox causes
+ * the account selector combobox next to it to be unreachable when
+ * navigating widgets in GtkTable with up/down arrow keys.
+ * Note: gtk_widget_set_can_focus() was not enough. */
+ GList *l = NULL;
+ l = g_list_prepend(l, from_name);
+ gtk_container_set_focus_chain(GTK_CONTAINER(hbox), l);
+ g_list_free(l);
CLAWS_SET_TIP(optmenubox,
_("Account to use for this email"));
}
}
+ if (tmpl->replyto && *tmpl->replyto != '\0') {
+#ifdef USE_ENCHANT
+ quote_fmt_init(msginfo, NULL, NULL, FALSE, compose->account, FALSE,
+ compose->gtkaspell);
+#else
+ quote_fmt_init(msginfo, NULL, NULL, FALSE, compose->account, FALSE);
+#endif
+ quote_fmt_scan_string(tmpl->replyto);
+ quote_fmt_parse();
+
+ buf = quote_fmt_get_buffer();
+ if (buf == NULL) {
+ alertpanel_error(_("Template Reply-To format error."));
+ } else {
+ compose_entry_append(compose, buf, COMPOSE_REPLYTO, PREF_TEMPLATE);
+ }
+ }
+
/* process the subject */
if (tmpl->subject && *tmpl->subject != '\0') {
#ifdef USE_ENCHANT
gtk_widget_hide(attach_prop.window);
gtk_window_set_modal(GTK_WINDOW(attach_prop.window), FALSE);
- if (cancelled)
+ if (cancelled)
break;
entry_text = gtk_entry_get_text(GTK_ENTRY(attach_prop.mimetype_entry));
/* Get ID of active account in the combo box */
menu = gtk_combo_box_get_model(optmenu);
- gtk_combo_box_get_active_iter(optmenu, &iter);
+ cm_return_if_fail(gtk_combo_box_get_active_iter(optmenu, &iter));
gtk_tree_model_get(menu, &iter, 1, &account_id, -1);
ac = account_find_from_id(account_id);
GdkEventKey *event,
Compose *compose)
{
- GtkTextBuffer *buffer;
- GtkTextMark *mark;
- GtkTextIter iter;
-
cm_return_val_if_fail(compose != NULL, FALSE);
/* make backtab move to subject field */
gtk_widget_grab_focus(compose->subject_entry);
return TRUE;
}
-
- // Up key should also move the focus to subject field, if the cursor
- // is on the first line.
- if ((event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)
- && (event->state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) == 0) {
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
- g_return_val_if_fail(buffer != NULL, FALSE);
-
- mark = gtk_text_buffer_get_mark(buffer, "insert");
- g_return_val_if_fail(mark != NULL, FALSE);
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
-
- if (gtk_text_iter_get_line(&iter) == 0) {
- gtk_widget_grab_focus(compose->subject_entry);
- return TRUE;
- }
- }
-
return FALSE;
}
g_list_free(list);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
return;
- } else {
- return;
}
- gtk_drag_finish(drag_context, TRUE, FALSE, time);
}
static void compose_header_drag_received_cb (GtkWidget *widget,