* src/compose.[ch]
[claws.git] / src / compose.c
index fd28749f6a106ee7e1d08ddaf5bfe8884925a3a5..ec3531f60ab7ef5eead57c87c1d7cc51711f8fcb 100644 (file)
@@ -703,7 +703,6 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        Compose *compose;
        GtkSText *text;
        GtkItemFactory *ifactory;
-       gboolean grab_focus_on_last = TRUE;
 
        if (item && item->prefs && item->prefs->enable_default_account)
                account = account_find_from_id(item->prefs->default_account);
@@ -740,8 +739,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 
                } else if (item && item->prefs->enable_default_to) {
                        compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
-                       compose_entry_select(compose, item->prefs->default_to);
-                       grab_focus_on_last = FALSE;
+                       compose_entry_mark_default_to(compose, item->prefs->default_to);
                }
                if (item && item->ret_rcpt) {
                        menu_set_toggle(ifactory, "/Message/Request Return Receipt", TRUE);
@@ -779,9 +777,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                g_free(folderidentifier);
        }
        
-       /* Grab focus on last header only if no default_to was set */
-       if (grab_focus_on_last)
-               gtk_widget_grab_focus(compose->header_last->entry);
+       gtk_widget_grab_focus(compose->header_last->entry);
 
        if (prefs_common.auto_exteditor)
                compose_exec_ext_editor(compose);
@@ -1453,16 +1449,32 @@ void compose_entry_append(Compose *compose, const gchar *address,
        compose_add_header_entry(compose, header, (gchar *)address);
 }
 
-void compose_entry_select (Compose *compose, const gchar *mailto)
+void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
 {
-       GSList *header_list;
+       static GtkStyle *bold_style = NULL;
+       static GdkColor bold_color;
+       static GdkFont *bold_font = NULL;
+       GSList *h_list;
+       GtkEntry *entry;
                
-       for (header_list = compose->header_list; header_list != NULL; header_list = header_list->next) {
-               GtkEntry * entry = GTK_ENTRY(((ComposeHeaderEntry *)header_list->data)->entry);
-
-               if (gtk_entry_get_text(entry) && !g_strcasecmp(gtk_entry_get_text(entry), mailto)) {
-                       gtk_entry_select_region(entry, 0, -1);
-                       gtk_widget_grab_focus(GTK_WIDGET(entry));
+       for (h_list = compose->header_list; h_list != NULL; h_list = h_list->next) {
+               entry = GTK_ENTRY(((ComposeHeaderEntry *)h_list->data)->entry);
+               if (gtk_entry_get_text(entry) && 
+                   !g_strcasecmp(gtk_entry_get_text(entry), mailto)) {
+                       gtk_widget_ensure_style(GTK_WIDGET(entry));
+                       if (!bold_style) {
+                               gtkut_convert_int_to_gdk_color
+                                       (prefs_common.color_new, &bold_color);
+                               bold_style = gtk_style_copy(gtk_widget_get_style
+                                       (GTK_WIDGET(entry)));
+                               if (!bold_font)
+                                       bold_font = gtkut_font_load
+                                               (prefs_common.boldfont);
+                               if (bold_font)
+                                       bold_style->font = bold_font;
+                               bold_style->fg[GTK_STATE_NORMAL] = bold_color;
+                       }
+                       gtk_widget_set_style(GTK_WIDGET(entry), bold_style);
                }
        }
 }