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 &&
wcs = g_utf8_to_ucs4(str, -1, &items_read, &items_written, &error);
if (error != NULL) {
- g_warning("An error occurred while converting a string from UTF-8 to UCS-4: %s\n",
+ g_warning("An error occurred while converting a string from UTF-8 to UCS-4: %s",
error->message);
g_error_free(error);
}
wcs = g_utf8_to_ucs4(str, -1, &items_read, &items_written, &error);
if (error != NULL) {
- g_warning("An error occurred while converting a string from UTF-8 to UCS-4: %s\n",
+ g_warning("An error occurred while converting a string from UTF-8 to UCS-4: %s",
error->message);
g_error_free(error);
}
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;
}
xface[sizeof(xface) - 1] = '\0';
if (uncompface(xface) < 0) {
- g_warning("uncompface failed\n");
+ g_warning("uncompface failed");
return NULL;
}
if (!gdk_pixbuf_loader_write (loader, face_png, pngsize, &error) ||
!gdk_pixbuf_loader_close (loader, &error)) {
- g_warning("loading face failed\n");
+ g_warning("loading face failed");
g_object_unref(loader);
g_free(face_png);
return NULL;
if ((gdk_pixbuf_get_width(pixbuf) != 48) || (gdk_pixbuf_get_height(pixbuf) != 48)) {
g_object_unref(pixbuf);
- g_warning("wrong_size\n");
+ g_warning("wrong_size");
return NULL;
}
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\n");
+ g_warning("color allocation failed");
#endif
g_signal_connect(G_OBJECT(btn), "enter",
#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);
}