From b350d13830761c4378890bb8cb1e8b661f5fe8cb Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 6 Mar 2006 09:23:31 +0000 Subject: always enable To, Cc, and Bcc button of the address book. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1029 ee746299-78ed-0310-b773-934348b2243d --- src/addressbook.c | 32 ++++++++------------------------ src/compose.c | 17 +++++------------ src/compose.h | 4 ++-- 3 files changed, 15 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/addressbook.c b/src/addressbook.c index fb469c3e..19a7d485 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -147,7 +147,6 @@ static GList *_addressBookTypeList_ = NULL; static void addressbook_create (void); static gint addressbook_close (void); -static void addressbook_button_set_sensitive (void); /* callback functions */ static void addressbook_del_clicked (GtkButton *button, @@ -416,8 +415,6 @@ void addressbook_open(Compose *target) void addressbook_set_target_compose(Compose *target) { addrbook.target_compose = target; - - addressbook_button_set_sensitive(); } Compose *addressbook_get_target_compose(void) @@ -787,26 +784,6 @@ static void addressbook_ds_show_message( AddressDataSource *ds ) { addressbook_status_show( addressbook_msgbuf ); } -static void addressbook_button_set_sensitive(void) -{ - gboolean to_sens = FALSE; - gboolean cc_sens = FALSE; - gboolean bcc_sens = FALSE; - - if (!addrbook.window) return; - - if (addrbook.target_compose) { - to_sens = TRUE; - cc_sens = TRUE; - if (addrbook.target_compose->use_bcc) - bcc_sens = TRUE; - } - - gtk_widget_set_sensitive(addrbook.to_btn, to_sens); - gtk_widget_set_sensitive(addrbook.cc_btn, cc_sens); - gtk_widget_set_sensitive(addrbook.bcc_btn, bcc_sens); -} - /* * Delete one or more objects from address list. */ @@ -985,10 +962,17 @@ gchar *addressbook_format_address( AddressObject * obj ) { static void addressbook_to_clicked(GtkButton *button, gpointer data) { GList *node = _addressListSelection_; - if (!addrbook.target_compose) return; + + if (!addrbook.target_compose) { + addrbook.target_compose = compose_new(NULL, NULL, NULL, NULL); + if (!addrbook.target_compose) + return; + } + while( node ) { AddressObject *obj = node->data; Compose *compose = addrbook.target_compose; + node = g_list_next( node ); if( obj->type == ADDR_ITEM_PERSON || obj->type == ADDR_ITEM_EMAIL ) { gchar *addr = addressbook_format_address( obj ); diff --git a/src/compose.c b/src/compose.c index 775d56e0..844b8f53 100644 --- a/src/compose.c +++ b/src/compose.c @@ -682,8 +682,8 @@ static GtkTargetEntry compose_drag_types[] = }; -void compose_new(PrefsAccount *account, FolderItem *item, const gchar *mailto, - GPtrArray *attach_files) +Compose *compose_new(PrefsAccount *account, FolderItem *item, + const gchar *mailto, GPtrArray *attach_files) { Compose *compose; GtkTextView *text; @@ -691,7 +691,7 @@ void compose_new(PrefsAccount *account, FolderItem *item, const gchar *mailto, GtkTextIter iter; if (!account) account = cur_account; - g_return_if_fail(account != NULL); + g_return_val_if_fail(account != NULL, NULL); compose = compose_create(account, COMPOSE_NEW); @@ -752,6 +752,8 @@ void compose_new(PrefsAccount *account, FolderItem *item, const gchar *mailto, autosave_timeout, compose); if (prefs_common.auto_exteditor) compose_exec_ext_editor(compose); + + return compose; } void compose_reply(MsgInfo *msginfo, FolderItem *item, ComposeMode mode, @@ -6344,9 +6346,6 @@ static void compose_toggle_to_cb(gpointer data, guint action, gtk_widget_queue_resize(compose->table_vbox); compose->use_to = FALSE; } - - if (addressbook_get_target_compose() == compose) - addressbook_set_target_compose(compose); } static void compose_toggle_cc_cb(gpointer data, guint action, @@ -6366,9 +6365,6 @@ static void compose_toggle_cc_cb(gpointer data, guint action, gtk_widget_queue_resize(compose->table_vbox); compose->use_cc = FALSE; } - - if (addressbook_get_target_compose() == compose) - addressbook_set_target_compose(compose); } static void compose_toggle_bcc_cb(gpointer data, guint action, @@ -6388,9 +6384,6 @@ static void compose_toggle_bcc_cb(gpointer data, guint action, gtk_widget_queue_resize(compose->table_vbox); compose->use_bcc = FALSE; } - - if (addressbook_get_target_compose() == compose) - addressbook_set_target_compose(compose); } static void compose_toggle_replyto_cb(gpointer data, guint action, diff --git a/src/compose.h b/src/compose.h index 1c23e9ce..fdf2d133 100644 --- a/src/compose.h +++ b/src/compose.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,7 +200,7 @@ struct _AttachInfo off_t size; }; -void compose_new (PrefsAccount *account, +Compose *compose_new (PrefsAccount *account, FolderItem *item, const gchar *mailto, GPtrArray *attach_files); -- cgit v1.2.3