add compose_entry_select(), used to select the default_to
authorColin Leroy <colin@colino.net>
Sat, 22 Jun 2002 23:37:14 +0000 (23:37 +0000)
committerColin Leroy <colin@colino.net>
Sat, 22 Jun 2002 23:37:14 +0000 (23:37 +0000)
email address - hopefully avoiding people sending mails to
wrong recipients.

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

index ce8f9da1fc965d62f75e05f0a309f8e8cca1cc8f..e5c8fa71f46e68ad4df6dc268c5600689a01a7fc 100644 (file)
@@ -1,3 +1,10 @@
+2002-06-23 [colin]     0.7.8claws16
+
+       * src/compose.[ch]
+               add compose_entry_select(), used to select the default_to
+               email address - hopefully avoiding people sending mails to
+               wrong recipients.
+
 2002-06-22 [alfons]    0.7.8claws15
 
        * AUTHORS
index 29f3ba99ab0c7c5f418f57e26f87b79dc68e7772..a3331185f308caa87951e5348b2f6dc4012fec83 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws15
+EXTRA_VERSION=claws16
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 0d99380943b28f94b3b5b9ffc60d4c7cedf7bdf9..07bdb5cbd7ea9f483e63bd8391cd5fe692addced 100644 (file)
@@ -743,6 +743,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 {
        Compose *compose;
        GtkSText *text;
+       gboolean grab_focus_on_last = TRUE;
 
        if (item && item->prefs && item->prefs->enable_default_account)
                account = account_find_from_id(item->prefs->default_account);
@@ -773,6 +774,8 @@ 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;
                }
                if (item && item->ret_rcpt) {
                        GtkItemFactory *ifactory;
@@ -796,8 +799,10 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
                g_free(folderidentifier);
        }
-
-       gtk_widget_grab_focus(compose->header_last->entry);
+       
+       /* 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);
 
        if (prefs_common.auto_exteditor)
                compose_exec_ext_editor(compose);
@@ -1359,6 +1364,20 @@ 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)
+{
+       GSList *header_list;
+               
+       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));
+               }
+       }
+}
+
 static void compose_entries_set(Compose *compose, const gchar *mailto)
 {
        gchar *subject = NULL;
index 3d531f85031b27da608dd85b3d6619471e821889..afb967c8386f2bc96015c65362f70421bcb4ba4a 100644 (file)
@@ -246,6 +246,9 @@ void compose_entry_append           (Compose          *compose,
                                         const gchar      *address,
                                         ComposeEntryType  type);
 
+void compose_entry_select              (Compose          *compose,
+                                        const gchar      *address);
+
 gint compose_send                      (Compose          *compose);
 
 void compose_reflect_prefs_all                 (void);