Move all colors into an array
[claws.git] / src / gtk / gtkutils.c
index 15503f89ad003d05329412456b869f2a57da254d..1669191d3105b1b71b147a201311563929b4f2d0 100644 (file)
@@ -232,6 +232,7 @@ void gtkut_ctree_node_move_if_on_the_edge(GtkCMCTree *ctree, GtkCMCTreeNode *nod
        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);
@@ -244,7 +245,12 @@ void gtkut_ctree_node_move_if_on_the_edge(GtkCMCTree *ctree, GtkCMCTreeNode *nod
        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 &&
@@ -858,6 +864,7 @@ void gtkut_set_widget_bgcolor_rgb(GtkWidget *widget, guint rgbvalue)
        newstyle->bg[GTK_STATE_PRELIGHT] = gdk_color;
        newstyle->bg[GTK_STATE_ACTIVE]   = gdk_color;
        gtk_widget_set_style(widget, newstyle);
+       gtk_style_unref(newstyle);
 }
   
 /*!
@@ -1227,9 +1234,9 @@ GtkWidget *gtkut_get_link_btn(GtkWidget *window, const gchar *url, const gchar *
        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);
@@ -1248,6 +1255,7 @@ GtkWidget *gtkut_get_link_btn(GtkWidget *window, const gchar *url, const gchar *
                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");
@@ -1873,6 +1881,8 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, int box_width,
 #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);
@@ -1898,7 +1908,15 @@ static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl,
                                /* 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