/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2018 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#ifdef HAVE_CONFIG_H
GtkCMCList *clist = GTK_CMCLIST(ctree);
gint row;
GtkVisibility row_visibility, prev_row_visibility, next_row_visibility;
+ gfloat row_align;
cm_return_if_fail(ctree != NULL);
cm_return_if_fail(node != NULL);
next_row_visibility = gtk_cmclist_row_is_visible(clist, row + 1);
if (row_visibility == GTK_VISIBILITY_NONE) {
- gtk_cmclist_moveto(clist, row, -1, 0.5, 0);
+ row_align = 0.5;
+ if (gtk_cmclist_row_is_above_viewport(clist, row))
+ row_align = 0.2;
+ else if (gtk_cmclist_row_is_below_viewport(clist, row))
+ row_align = 0.8;
+ gtk_cmclist_moveto(clist, row, -1, row_align, 0);
return;
}
if (row_visibility == GTK_VISIBILITY_FULL &&
cm_return_if_fail(gtk_widget_get_window(widget) != NULL);
if (!icon_list) {
GdkPixbuf *icon = NULL, *big_icon = NULL;
- stock_pixbuf_gdk(widget, STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon);
- stock_pixbuf_gdk(widget, STOCK_PIXMAP_CLAWS_MAIL_LOGO, &big_icon);
+ stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon);
+ stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_LOGO, &big_icon);
if (icon)
icon_list = g_list_append(icon_list, icon);
if (big_icon)
cm_return_if_fail(gtk_widget_get_window(widget) != NULL);
if (!icon_list) {
GdkPixbuf *icon = NULL, *big_icon = NULL;
- stock_pixbuf_gdk(widget, STOCK_PIXMAP_MAIL_COMPOSE, &icon);
- stock_pixbuf_gdk(widget, STOCK_PIXMAP_MAIL_COMPOSE_LOGO, &big_icon);
+ stock_pixbuf_gdk(STOCK_PIXMAP_MAIL_COMPOSE, &icon);
+ stock_pixbuf_gdk(STOCK_PIXMAP_MAIL_COMPOSE_LOGO, &big_icon);
if (icon)
icon_list = g_list_append(icon_list, icon);
if (big_icon)
newstyle->bg[GTK_STATE_PRELIGHT] = gdk_color;
newstyle->bg[GTK_STATE_ACTIVE] = gdk_color;
gtk_widget_set_style(widget, newstyle);
+ gtk_style_unref(newstyle);
}
/*!
_end_iter = *iter;
if (!gtk_text_iter_forward_to_tag_toggle(&_end_iter, tag)) {
- debug_print("Can't find end");
+ debug_print("Can't find end.\n");
return FALSE;
}
_start_iter = _end_iter;
if (!gtk_text_iter_backward_to_tag_toggle(&_start_iter, tag)) {
- debug_print("Can't find start.");
+ debug_print("Can't find start.\n");
return FALSE;
}
if (!url)
return NULL;
- gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
&uri_color[0]);
- gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
&uri_color[1]);
btn = gtk_button_new_with_label(label?label:url);
style->fg[GTK_STATE_ACTIVE] = uri_color[1];
style->fg[GTK_STATE_PRELIGHT] = uri_color[0];
gtk_widget_set_style(btn_label, style);
+ gtk_style_unref(style);
#if !GTK_CHECK_VERSION(3, 0, 0)
} else
g_warning("color allocation failed");
#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl, AutoConfigureData *data)
{
+ gboolean smtp = strcmp(data->tls_service, "submission") == 0 ? TRUE : FALSE;
+
if (hostname != NULL) {
if (data->hostname_entry)
gtk_entry_set_text(data->hostname_entry, hostname);
/* Wizard where TLS is [x]SSL + [x]TLS */
gtk_toggle_button_set_active(data->ssl_checkbtn, TRUE);
}
- gtk_toggle_button_set_active(data->tls_checkbtn, TRUE);
+
+ /* Even though technically this is against the RFCs,
+ * if a "_submission._tcp" SRV record uses port 465,
+ * it is safe to assume TLS-only service, instead of
+ * plaintext + STARTTLS one. */
+ if (smtp && port == 465)
+ gtk_toggle_button_set_active(data->ssl_checkbtn, TRUE);
+ else
+ gtk_toggle_button_set_active(data->tls_checkbtn, TRUE);
}
/* Check authentication by default. This is probably required if
gtk_label_set_text(data->info_label, _("Done."));
} else {
- gtk_label_set_text(data->info_label, _("Failed."));
+ gchar *msg;
+ switch (data->resolver_error) {
+ case G_RESOLVER_ERROR_NOT_FOUND:
+ msg = g_strdup(_("Failed: no service record found."));
+ break;
+ case G_RESOLVER_ERROR_TEMPORARY_FAILURE:
+ msg = g_strdup(_("Failed: network error."));
+ break;
+ default:
+ msg = g_strdup_printf(_("Failed: unknown error (%d)."), data->resolver_error);
+ }
+ gtk_label_set_text(data->info_label, msg);
+ g_free(msg);
}
gtk_widget_show(GTK_WIDGET(data->configure_button));
gtk_widget_hide(GTK_WIDGET(data->cancel_button));
} else if (error) {
if (error->code == G_IO_ERROR_CANCELLED)
abort = TRUE;
+ else
+ data->resolver_error = error->code;
debug_print("error %s\n", error->message);
g_error_free(error);
}