* src/compose.[ch]
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 12 Feb 2004 19:19:06 +0000 (19:19 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 12 Feb 2004 19:19:06 +0000 (19:19 +0000)
don't select text in header entry when composing to a
default address, but rather give the header entry a
different color / style (same as the folder new color)

ChangeLog.claws
configure.ac
src/compose.c
src/compose.h

index 5a3e3b8..b5b12e3 100644 (file)
@@ -1,3 +1,10 @@
+2004-02-12 [alfons]    0.9.9claws6
+
+       * src/compose.[ch]
+               don't select text in header entry when composing to a 
+               default address, but rather give the header entry a
+               different color / style (same as the folder new color)
+
 2004-02-12 [alfons]    0.9.9claws5
 
        * src/plugins/clamav/clamav_plugin.c
index e02a36b..7c596a1 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=9
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index fd28749..ec3531f 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);
                }
        }
 }
index 94618e9..f179ab3 100644 (file)
@@ -259,7 +259,7 @@ void compose_entry_append           (Compose          *compose,
                                         const gchar      *address,
                                         ComposeEntryType  type);
 
-void compose_entry_select              (Compose          *compose,
+void compose_entry_mark_default_to     (Compose          *compose,
                                         const gchar      *address);
 
 gint compose_send                      (Compose          *compose);