messageview toolbar patch 2 by Ivan Francolin Martinez (ivanfm@sourceforge.net)
authorOliver Haertel <o.h.a@gmx.net>
Thu, 28 Nov 2002 22:50:47 +0000 (22:50 +0000)
committerOliver Haertel <o.h.a@gmx.net>
Thu, 28 Nov 2002 22:50:47 +0000 (22:50 +0000)
ChangeLog.claws
configure.in
src/compose.c
src/compose.h

index 23f10944a7e3397d53c610c8753991c5c5850816..682d1536c1dc800b5180c821c43a1d25a28e3ded 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-28 [Ivan Francolin Martinez (ivanfm@sourceforge.net)]  0.8.6claws29
+
+       * src/compose.[ch]
+               add patch by Ivan F. Martinez introducing messageview Toolbar
+               some changes and committed by oliver    
+
 2002-11-28 [Ivan Francolin Martinez (ivanfm@sourceforge.net)]  0.8.6claws28
        
        * src/toolbar.[ch]
index 17b7f7ff6dad0b3f14c41e68f7170d5c58a96869..2399bbe3123007fbb0be08d151be8761aec439e8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws28
+EXTRA_VERSION=claws29
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 7c08e2a0185e108f52de25c03364398163c9e8b3..befcf40185ea21519c0d4f687bb1e01444a16c3c 100644 (file)
@@ -315,11 +315,9 @@ static void toolbar_linewrap_cb            (GtkWidget      *widget,
                                         gpointer        data);
 static void toolbar_address_cb         (GtkWidget      *widget,
                                         gpointer        data);
-static void toolbar_actions_execute_cb  (GtkWidget      *widget,
-                                        gpointer        data);
 static void toolbar_compose_buttons_cb  (GtkWidget      *widget, 
 
-                                        ToolbarItem    *t_item);
+                                        ToolbarItem    *item);
 static void account_activated          (GtkMenuItem    *menuitem,
                                         gpointer        data);
 
@@ -949,8 +947,6 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                compose_exec_ext_editor(compose);
 }
 
-static void set_toolbar_style(Compose *compose);
-
 #define INSERT_FW_HEADER(var, hdr) \
 if (msginfo->var && *msginfo->var) { \
        gtk_stext_insert(text, NULL, NULL, NULL, hdr, -1); \
@@ -5007,7 +5003,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        activate_gnupg_mode(compose, account);
 #endif 
 
-       set_toolbar_style(compose);
+       common_toolbar_set_style(compose, TOOLBAR_COMPOSE);
 
        gtk_widget_show(window);
        
@@ -5015,32 +5011,33 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
 }
 
 static void toolbar_compose_buttons_cb(GtkWidget   *widget, 
-                                      ToolbarItem *t_item)
+                                      ToolbarItem *item)
 {
        struct {
                gint   index;
                void (*func)(GtkWidget *widget, gpointer data);
        } compose_action[] = {
-               { A_SEND,        toolbar_send_cb            },
-               { A_SENDL,       toolbar_send_later_cb      },
-               { A_DRAFT,       toolbar_draft_cb           },
-               { A_INSERT,      toolbar_insert_cb          },
-               { A_ATTACH,      toolbar_attach_cb          },
-               { A_SIG,         toolbar_sig_cb             },
-               { A_EXTEDITOR,   toolbar_ext_editor_cb      },
-               { A_LINEWRAP,    toolbar_linewrap_cb        },
-               { A_ADDRBOOK,    toolbar_address_cb         },
-               { A_SYL_ACTIONS, toolbar_actions_execute_cb }};
+               { A_SEND,        toolbar_send_cb                        },
+               { A_SENDL,       toolbar_send_later_cb                  },
+               { A_DRAFT,       toolbar_draft_cb                       },
+               { A_INSERT,      toolbar_insert_cb                      },
+               { A_ATTACH,      toolbar_attach_cb                      },
+               { A_SIG,         toolbar_sig_cb                         },
+               { A_EXTEDITOR,   toolbar_ext_editor_cb                  },
+               { A_LINEWRAP,    toolbar_linewrap_cb                    },
+               { A_ADDRBOOK,    toolbar_address_cb                     },
+               { A_SYL_ACTIONS, common_toolbar_actions_execute_cb      }};
 
 
        gint num_items = sizeof(compose_action)/sizeof(compose_action[0]);
        gint i;
-       debug_print("_buttons: index: %i \n", t_item->index);
        for (i = 0; i < num_items; i++) {
                
-               if (compose_action[i].index == t_item->index) {
-                       Compose *compose = (Compose*)t_item->parent;
-                       debug_print("_buttons: compose: %p toolbar: %p\n", compose, compose->toolbar);                  compose_action[i].func(widget, compose);
+               if (compose_action[i].index == item->index) {
+                       if (item->index == A_SYL_ACTIONS)
+                               compose_action[i].func(widget, (gpointer)item->parent);
+                       else /* this won`t be necessary if everything is moved to toolbar.c */
+                               compose_action[i].func(widget, (gpointer)item->parent->data);
                        break;
                }
        }
@@ -5062,8 +5059,8 @@ static void compose_toolbar_update(Compose *compose)
        compose->toolbar->linewrap_btn  = NULL; 
        compose->toolbar->addrbook_btn  = NULL; 
 
-       TOOLBAR_DESTROY_ITEMS(compose->toolbar->t_item_list);   
-       TOOLBAR_DESTROY_ACTIONS(compose->toolbar->t_action_list);
+       TOOLBAR_DESTROY_ITEMS(compose->toolbar->item_list);     
+       TOOLBAR_DESTROY_ACTIONS(compose->toolbar->action_list);
        compose_toolbar_create(compose, compose->handlebox);    
 }
 
@@ -5076,7 +5073,7 @@ static void compose_toolbar_create(Compose   *compose,
        GtkWidget *icon_wid  = NULL;
        GtkWidget *item;
        GtkTooltips *toolbar_tips;
-       ToolbarSylpheedActions *t_action_item;
+       ToolbarSylpheedActions *action_item;
        GSList *cur;
        GSList *toolbar_list;
        GList *elem;
@@ -5085,13 +5082,7 @@ static void compose_toolbar_create(Compose   *compose,
        toolbar_read_config_file(TOOLBAR_COMPOSE);
        toolbar_list = toolbar_get_list(TOOLBAR_COMPOSE);
 
-       compose->toolbar = g_new0(ComposeToolbar, 1); 
-       
-       for (elem = compose_list; elem != NULL; elem = elem->next) {
-               Compose *c = (Compose*)elem->data;
-               debug_print("toolbar_create: compose: %p toolbar: %p\n", 
-                           c, c->toolbar);
-       }
+       compose->toolbar = g_new0(Toolbar, 1); 
        
        toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
                                  GTK_TOOLBAR_BOTH);
@@ -5113,11 +5104,13 @@ static void compose_toolbar_create(Compose   *compose,
                toolbar_item->text = g_strdup(((ToolbarItem*)cur->data)->text);
                toolbar_item->index = ((ToolbarItem*)cur->data)->index;
 
-               toolbar_item->parent = (gpointer)compose;
+               toolbar_item->parent = g_new0(ToolbarParent, 1);
+               toolbar_item->parent->data = (gpointer)compose;
+               toolbar_item->parent->type = TOOLBAR_COMPOSE;
 
                /* collect toolbar items in list to keep track */
-               compose->toolbar->t_item_list = g_slist_append(compose->toolbar->t_item_list, 
-                                                             toolbar_item);
+               compose->toolbar->item_list = g_slist_append(compose->toolbar->item_list, 
+                                                            toolbar_item);
 
                icon_wid = stock_pixmap_widget(container, stock_pixmap_get_icon(toolbar_item->file));
                item  = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
@@ -5183,17 +5176,17 @@ static void compose_toolbar_create(Compose   *compose,
                                             _("Address book"), NULL);
                        break;
                case A_SYL_ACTIONS:
-                       t_action_item = g_new0(ToolbarSylpheedActions, 1);
-                       t_action_item->widget = item;
-                       t_action_item->name   = g_strdup(toolbar_item->text);
+                       action_item = g_new0(ToolbarSylpheedActions, 1);
+                       action_item->widget = item;
+                       action_item->name   = g_strdup(toolbar_item->text);
 
-                       compose->toolbar->t_action_list = 
-                               g_slist_append(compose->toolbar->t_action_list,
-                                              t_action_item);
+                       compose->toolbar->action_list = 
+                               g_slist_append(compose->toolbar->action_list,
+                                              action_item);
 
                        gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), 
                                             item,
-                                            t_action_item->name, NULL);
+                                            action_item->name, NULL);
 
                        gtk_widget_show(item);
                        break;
@@ -5209,7 +5202,7 @@ static void compose_toolbar_create(Compose   *compose,
 
 static void compose_toolbar_set_sensitive (Compose * compose, gboolean sensitive)
 {
-       GSList *items = compose->toolbar->t_action_list;
+       GSList *items = compose->toolbar->action_list;
        if (compose->toolbar->send_btn)
                gtk_widget_set_sensitive(compose->toolbar->send_btn, sensitive);
        if (compose->toolbar->sendl_btn)
@@ -5397,7 +5390,7 @@ void compose_reflect_prefs_pixmap_theme(void)
        for (cur = compose_list; cur != NULL; cur = cur->next) {
                compose = (Compose *)cur->data;
                compose_toolbar_update(compose);
-               set_toolbar_style(compose);
+               common_toolbar_set_style(compose, TOOLBAR_COMPOSE);
        }
 }
 
@@ -5508,8 +5501,8 @@ static void compose_destroy(Compose *compose)
 
        gtk_widget_destroy(compose->paned);
 
-       TOOLBAR_DESTROY_ITEMS(compose->toolbar->t_item_list);
-       TOOLBAR_DESTROY_ACTIONS(compose->toolbar->t_action_list);
+       TOOLBAR_DESTROY_ITEMS(compose->toolbar->item_list);
+       TOOLBAR_DESTROY_ACTIONS(compose->toolbar->action_list);
        g_free(compose->toolbar);
        g_free(compose);
 
@@ -6224,14 +6217,6 @@ static void toolbar_address_cb(GtkWidget *widget, gpointer data)
        compose_address_cb(data, 0, NULL);
 }
 
-static void toolbar_actions_execute_cb(GtkWidget *widget,
-                                      gpointer   data)
-{
-       Compose *compose = (Compose*)data;
-
-       toolbar_action_execute(widget, compose->toolbar->t_action_list, data, TOOLBAR_COMPOSE);
-}
-
 static void account_activated(GtkMenuItem *menuitem, gpointer data)
 {
        Compose *compose = (Compose *)data;
@@ -7149,28 +7134,3 @@ static void compose_check_forwards_go(Compose *compose)
 }
 #endif
 
-static void set_toolbar_style(Compose *compose)
-{
-       switch (prefs_common.toolbar_style) {
-       case TOOLBAR_NONE:
-               gtk_widget_hide(compose->handlebox);
-               break;
-       case TOOLBAR_ICON:
-               gtk_toolbar_set_style(GTK_TOOLBAR(compose->toolbar->toolbar),
-                                     GTK_TOOLBAR_ICONS);
-               break;
-       case TOOLBAR_TEXT:
-               gtk_toolbar_set_style(GTK_TOOLBAR(compose->toolbar->toolbar),
-                                     GTK_TOOLBAR_TEXT);
-               break;
-       case TOOLBAR_BOTH:
-               gtk_toolbar_set_style(GTK_TOOLBAR(compose->toolbar->toolbar),
-                                     GTK_TOOLBAR_BOTH);
-               break;
-       }
-       
-       if (prefs_common.toolbar_style != TOOLBAR_NONE) {
-               gtk_widget_show(compose->handlebox);
-               gtk_widget_queue_resize(compose->handlebox);
-       }
-}
index c0707705dd57b537a4ef3c6c8cd019db864e8387..de86174d35526c98fb9c20a4e501c568e227e98b 100644 (file)
@@ -25,7 +25,6 @@
 #include <gtk/gtkitemfactory.h>
 
 typedef struct _Compose                Compose;
-typedef struct _ComposeToolbar  ComposeToolbar;
 typedef struct _AttachInfo     AttachInfo;
 
 #include "procmsg.h"
@@ -33,6 +32,7 @@ typedef struct _AttachInfo    AttachInfo;
 #include "addressbook.h"
 #include "prefs_account.h"
 #include "undo.h"
+#include "toolbar.h"
 
 #ifdef USE_ASPELL
 #include "gtkaspell.h"
@@ -80,14 +80,15 @@ typedef struct {
 
 struct _Compose
 {
+       /* start with window widget don`t change order */
        GtkWidget *window;
        GtkWidget *vbox;
        GtkWidget *menubar;
-       
+
        /* Toolbar handlebox */
        GtkWidget *handlebox;
-       ComposeToolbar *toolbar;
-
+       Toolbar *toolbar;
+       
        GtkWidget *vbox2;
 
        /* Header */
@@ -203,24 +204,6 @@ struct _Compose
        gchar *redirect_filename;
 };
 
-struct _ComposeToolbar {
-
-       GtkWidget *toolbar;
-
-       GtkWidget *send_btn;
-       GtkWidget *sendl_btn;
-       GtkWidget *draft_btn;
-       GtkWidget *insert_btn;
-       GtkWidget *attach_btn;
-       GtkWidget *sig_btn;
-       GtkWidget *exteditor_btn;
-       GtkWidget *linewrap_btn;
-       GtkWidget *addrbook_btn;
-
-       GSList    *t_action_list;
-       GSList    *t_item_list;
-};
-
 struct _AttachInfo
 {
        gchar *file;