From: Oliver Haertel Date: Tue, 20 Aug 2002 19:09:46 +0000 (+0000) Subject: Bug Fix #596834 and #596832 X-Git-Tag: rel_0_8_2~49 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=437ee830a4cb7b1e01fcd1ff48e2de088cabd1b4 Bug Fix #596834 and #596832 --- diff --git a/ChangeLog.claws b/ChangeLog.claws index e7be08ac1..aad32b067 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,15 @@ +2002-08-20 [oliver] 0.8.1claws84 + + * src/mainwindow.c + remove toolbar_create_popups + * src/toolbar.[ch] + o remove toolbar_create_popups + o fix toolbar_set_sensitive + (Bug reports #596834 and #596832) + * src/prefs_toolbar.c + o add "Set default" button + o align label and text + combo widgets + 2002-08-20 [hoa] 0.8.1claws84 * src/imap.c diff --git a/configure.in b/configure.in index fb56062b7..ee11cd925 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ MINOR_VERSION=8 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws83 +EXTRA_VERSION=claws84 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/mainwindow.c b/src/mainwindow.c index 5a391f27d..39b6ae2cb 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -769,8 +769,7 @@ MainWindow *main_window_create(SeparateType type) gtk_widget_show(handlebox); gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0); - /* create the popup menus for the reply buttons specials */ - toolbar_popups_create(mainwin, window); + /* create toolbar */ toolbar_create(mainwin, handlebox); /* vbox that contains body */ diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c index 48480987e..8dedf3ad6 100644 --- a/src/prefs_toolbar.c +++ b/src/prefs_toolbar.c @@ -66,6 +66,7 @@ static struct _Toolbar { GtkWidget *combo_entry; GtkWidget *combo_list; GtkWidget *label_icon_text; + GtkWidget *label_action_sel; GtkWidget *entry_icon_text; GtkWidget *combo_syl_action; GtkWidget *combo_syl_list; @@ -133,6 +134,55 @@ void prefs_toolbar_close(void) gtk_widget_hide(mtoolbar.window); } +static void prefs_toolbar_set_displayed(void) +{ + GdkPixmap *xpm; + GdkBitmap *xpmmask; + gchar *activ[4]; + GSList *cur; + GtkCList *clist_set = GTK_CLIST(mtoolbar.clist_set); + + gtk_clist_clear(clist_set); + gtk_clist_freeze(clist_set); + + /* set currently active toolbar entries */ + for (cur = toolbar_list; cur != NULL; cur = cur->next) { + ToolbarItem *item = (ToolbarItem*) cur->data; + + if (g_strcasecmp(item->file, SEPARATOR) != 0) { + gint row_num; + StockPixmap icon = stock_pixmap_get_icon(item->file); + + stock_pixmap_gdk(mtoolbar.clist_set, icon, + &xpm, &xpmmask); + activ[0] = g_strdup(""); + activ[1] = g_strdup(item->file); + activ[2] = g_strdup(item->text); + activ[3] = g_strdup(toolbar_ret_descr_from_val(item->action)); + row_num = gtk_clist_append(clist_set, activ); + gtk_clist_set_pixmap(clist_set, + row_num, 0, xpm, xpmmask); + + } else { + activ[0] = g_strdup(SEPARATOR_PIXMAP); + activ[1] = g_strdup(item->file); + activ[2] = g_strdup(""); + activ[3] = g_strdup(""); + gtk_clist_append(clist_set, activ); + } + + g_free(activ[0]); + g_free(activ[1]); + g_free(activ[2]); + g_free(activ[3]); + } + + gtk_clist_thaw(clist_set); + gtk_clist_columns_autosize(clist_set); + gtk_clist_set_row_height(clist_set, CELL_SPACING); + gtk_clist_select_row(clist_set, 0, 0); +} + static void prefs_toolbar_populate(void) { gint i; @@ -140,18 +190,13 @@ static void prefs_toolbar_populate(void) GList *combo_action_items; GList *syl_actions = NULL; GtkCList *clist_icons = GTK_CLIST(mtoolbar.clist_icons); - GtkCList *clist_set = GTK_CLIST(mtoolbar.clist_set); GdkPixmap *xpm; GdkBitmap *xpmmask; gchar *avail[2]; - gchar *activ[5] = {0}; gchar *act; gtk_clist_clear(clist_icons); - gtk_clist_clear(clist_set); - gtk_clist_freeze(clist_icons); - gtk_clist_freeze(clist_set); /* set available icons */ avail[0] = g_strdup(SEPARATOR_PIXMAP); @@ -195,49 +240,12 @@ static void prefs_toolbar_populate(void) g_free(avail[1]); } - /* set currently active toolbar entries */ - for (cur = toolbar_list; cur != NULL; cur = cur->next) { - ToolbarItem *item = (ToolbarItem*) cur->data; - - if (g_strcasecmp(item->file, SEPARATOR) != 0) { - gint row_num; - StockPixmap icon = stock_pixmap_get_icon(item->file); - - stock_pixmap_gdk(mtoolbar.clist_set, icon, - &xpm, &xpmmask); - activ[0] = g_strdup(""); - activ[1] = g_strdup(item->file); - activ[2] = g_strdup(item->text); - activ[3] = g_strdup(toolbar_ret_descr_from_val(item->action)); - row_num = gtk_clist_append(clist_set, activ); - gtk_clist_set_pixmap(clist_set, - row_num, 0, xpm, xpmmask); - - } else { - activ[0] = g_strdup(SEPARATOR_PIXMAP); - activ[1] = g_strdup(item->file); - activ[2] = g_strdup(""); - activ[3] = g_strdup(""); - gtk_clist_append(clist_set, activ); - } - - g_free(activ[0]); - g_free(activ[1]); - g_free(activ[2]); - g_free(activ[3]); - } - gtk_clist_thaw(clist_icons); - gtk_clist_thaw(clist_set); - gtk_clist_columns_autosize(clist_icons); - gtk_clist_columns_autosize(clist_set); - gtk_clist_set_row_height(clist_icons, CELL_SPACING); - gtk_clist_set_row_height(clist_set, CELL_SPACING); - gtk_clist_select_row(clist_icons, 0, 0); - gtk_clist_select_row(clist_set, 0, 0); + + prefs_toolbar_set_displayed(); toolbar_clear_list(); } @@ -298,8 +306,8 @@ static void prefs_toolbar_save(void) } while(gtk_clist_get_text(clist, row, 3, &entry)); } + toolbar_save_config_file(); - toolbar_update(); main_window_reflect_prefs_all_real(TRUE); } @@ -311,11 +319,17 @@ static void prefs_toolbar_ok(void) static void prefs_toolbar_cancel(void) { - toolbar_update(); main_window_reflect_prefs_all_real(TRUE); prefs_toolbar_close(); } +static void prefs_toolbar_default(void) +{ + toolbar_clear_list(); + toolbar_set_default_toolbar(); + prefs_toolbar_set_displayed(); +} + static void get_action_name(gchar *entry, gchar **menu) { gchar *act, *act_p; @@ -344,10 +358,12 @@ static gint prefs_toolbar_register(void) if (clist_icons->rows == 0) return -1; - if (clist_icons->selection) + if (clist_icons->selection) { if (clist_icons->selection->data) row_icons = GPOINTER_TO_INT(clist_icons->selection->data); - + } else + return -1; + gtk_clist_get_text(clist_icons, row_icons, 1, &item[1]); item[3] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_entry))); @@ -408,14 +424,18 @@ static gint prefs_toolbar_substitute(void) /* no rows or nothing selected */ if ((clist_set->rows == 0) || (clist_set->selection == 0)) return -1; - if (clist_icons->selection) + if (clist_icons->selection) { if (clist_icons->selection->data) row_icons = GPOINTER_TO_INT(clist_icons->selection->data); - - if (clist_set->selection) + } else + return -1; + + if (clist_set->selection) { if (clist_set->selection->data) row_set = GPOINTER_TO_INT(clist_set->selection->data); - + } else + return -1; + gtk_clist_get_text(clist_icons, row_icons, 1, &item[1]); gtk_clist_get_text(clist_set, row_set, 3, &ac_set); item[3] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_entry))); @@ -468,10 +488,12 @@ static gint prefs_toolbar_delete(void) gint row_set = 0; if (clist_set->rows == 0) return -1; - if (clist_set->selection) + if (clist_set->selection) { if (clist_set->selection->data) row_set = GPOINTER_TO_INT(clist_set->selection->data); - + } else + return -1; + if (clist_set->row_list != NULL) { row_set = GPOINTER_TO_INT(clist_set->selection->data); @@ -588,12 +610,15 @@ static void prefs_toolbar_selection_changed(GtkList *list, if (prefs_common.actions_list == NULL) { gtk_widget_set_sensitive(mtoolbar.combo_syl_action, FALSE); } - + } else { gtk_widget_hide(mtoolbar.combo_syl_action); gtk_widget_show(mtoolbar.entry_icon_text); gtk_label_set_text(GTK_LABEL(mtoolbar.label_icon_text), _("Toolbar text")); } + + gtk_misc_set_alignment(GTK_MISC(mtoolbar.label_icon_text), 1, 0.5); + gtk_widget_show(mtoolbar.label_icon_text); } static gint prefs_toolbar_key_pressed(GtkWidget *widget, @@ -620,13 +645,13 @@ static void prefs_toolbar_create(void) GtkWidget *subst_btn; GtkWidget *del_btn; GtkWidget *vbox_frame; + GtkWidget *table; GtkWidget *scrolledwindow_clist_icon; GtkWidget *clist_icons; - GtkWidget *hbox_icon_text; GtkWidget *label_icon_text; GtkWidget *entry_icon_text; - GtkWidget *hbox_action; GtkWidget *label_action_sel; + GtkWidget *empty_label; GtkWidget *combo_action; GtkWidget *combo_entry; GtkWidget *combo_list; @@ -641,10 +666,11 @@ static void prefs_toolbar_create(void) GtkWidget *btn_vbox; GtkWidget *up_btn; GtkWidget *down_btn; - + GtkWidget *confirm_area; GtkWidget *ok_btn; GtkWidget *cancel_btn; + GtkWidget *default_btn; gchar *titles[N_DISPLAYED_ITEMS_COLS]; @@ -694,40 +720,60 @@ static void prefs_toolbar_create(void) gtk_clist_set_column_width(GTK_CLIST(clist_icons), 1, 200); gtk_clist_column_titles_hide(GTK_CLIST(clist_icons)); gtk_widget_set_usize(clist_icons, 225, 108); + + table = gtk_table_new (2, 3, FALSE); + gtk_container_add (GTK_CONTAINER (vbox_frame), table); + gtk_container_set_border_width (GTK_CONTAINER (table), 8); + gtk_table_set_row_spacings (GTK_TABLE (table), 8); + gtk_table_set_col_spacings (GTK_TABLE (table), 8); /* icon description */ - hbox_icon_text = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(vbox_frame), hbox_icon_text); - label_icon_text = gtk_label_new(""); - gtk_box_pack_start(GTK_BOX(hbox_icon_text), label_icon_text, FALSE, FALSE, 5); - + gtk_misc_set_alignment(GTK_MISC(label_icon_text), 0, 0.5); + gtk_widget_show (label_icon_text); + gtk_table_attach (GTK_TABLE (table), label_icon_text, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + entry_icon_text = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox_icon_text), entry_icon_text, FALSE, FALSE, 0); + gtk_table_attach (GTK_TABLE (table), entry_icon_text, 1, 2, 0, 1, + (GtkAttachOptions) (/*GTK_EXPAND | */GTK_FILL), + (GtkAttachOptions) (0), 0, 0); - /* Sylpheed Action Combo Box */ + /* Sylpheed Action Combo Box */ combo_syl_action = gtk_combo_new(); - gtk_box_pack_start(GTK_BOX(hbox_icon_text), combo_syl_action, FALSE, FALSE, 0); - combo_syl_list = GTK_COMBO(combo_syl_action)->list; combo_syl_entry = GTK_COMBO(combo_syl_action)->entry; gtk_entry_set_editable(GTK_ENTRY(combo_syl_entry), FALSE); - + gtk_table_attach (GTK_TABLE (table), combo_syl_action, 1, 2, 0, 1, + (GtkAttachOptions) (/*GTK_EXPAND | */GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + empty_label = gtk_label_new(""); + gtk_table_attach (GTK_TABLE (table), empty_label, 2, 3, 0, 1, + (GtkAttachOptions) (GTK_EXPAND), + (GtkAttachOptions) (0), 0, 0); /* available actions */ - hbox_action = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(vbox_frame), hbox_action); - gtk_container_set_border_width(GTK_CONTAINER(hbox_action), 5); - label_action_sel = gtk_label_new(_("Event executed on click")); - gtk_box_pack_start(GTK_BOX(hbox_action), label_action_sel, FALSE, FALSE, 0); - + gtk_misc_set_alignment(GTK_MISC(label_action_sel), 0, 0.5); + gtk_table_attach (GTK_TABLE (table), label_action_sel, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + combo_action = gtk_combo_new(); - gtk_box_pack_start(GTK_BOX(hbox_action), combo_action, FALSE, FALSE, 0); + gtk_table_attach (GTK_TABLE (table), combo_action, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); combo_list = GTK_COMBO(combo_action)->list; combo_entry = GTK_COMBO(combo_action)->entry; gtk_entry_set_editable(GTK_ENTRY(combo_entry), FALSE); + empty_label = gtk_label_new(""); + gtk_table_attach (GTK_TABLE (table), empty_label, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_EXPAND), + (GtkAttachOptions) (0), 0, 0); + /* register / substitute / delete */ reg_hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(main_vbox), reg_hbox, FALSE, FALSE, 0); @@ -800,7 +846,7 @@ static void prefs_toolbar_create(void) gtk_box_pack_start(GTK_BOX(btn_vbox), down_btn, FALSE, FALSE, 0); gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"), - &cancel_btn, _("Cancel"), NULL, NULL); + &cancel_btn, _("Cancel"), &default_btn, _("Set default")); gtk_box_pack_end(GTK_BOX(main_vbox), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); gtk_widget_grab_default(ok_btn); @@ -809,6 +855,8 @@ static void prefs_toolbar_create(void) GTK_SIGNAL_FUNC(prefs_toolbar_ok), NULL); gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked", GTK_SIGNAL_FUNC(prefs_toolbar_cancel), NULL); + gtk_signal_connect(GTK_OBJECT(default_btn), "clicked", + GTK_SIGNAL_FUNC(prefs_toolbar_default), NULL); gtk_signal_connect(GTK_OBJECT(clist_set), "select_row", GTK_SIGNAL_FUNC(prefs_toolbar_select_row_set), NULL); @@ -835,6 +883,7 @@ static void prefs_toolbar_create(void) mtoolbar.combo_syl_entry = combo_syl_entry; mtoolbar.label_icon_text = label_icon_text; + mtoolbar.label_action_sel = label_action_sel; gtk_widget_show_all(window); } diff --git a/src/toolbar.c b/src/toolbar.c index 1b0acfaa7..f70ed8dfc 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -108,15 +108,15 @@ static void toolbar_next_unread_cb (GtkWidget *widget, static void toolbar_actions_execute_cb (GtkWidget *widget, gpointer data); -static void toolbar_reply_popup_cb (GtkWidget *widget, - GdkEventButton *event, - gpointer data); -static void toolbar_reply_popup_closed_cb(GtkMenuShell *menu_shell, - gpointer data); +static void toolbar_reply_popup_cb (GtkWidget *widget, + GdkEventButton *event, + gpointer data); +static void toolbar_reply_popup_closed_cb (GtkMenuShell *menu_shell, + gpointer data); -static void toolbar_reply_to_all_popup_cb(GtkWidget *widget, - GdkEventButton *event, - gpointer data); +static void toolbar_reply_to_all_popup_cb (GtkWidget *widget, + GdkEventButton *event, + gpointer data); static void toolbar_reply_to_all_popup_closed_cb (GtkMenuShell *menu_shell, @@ -140,7 +140,6 @@ static void toolbar_forward_popup_closed_cb static void activate_compose_button (MainToolbar *toolbar, ToolbarStyle style, ComposeButtonType type); - static ToolbarAction t_action[] = { { "A_RECEIVE_ALL", N_("Receive Mail on all Accounts"), toolbar_inc_all_cb }, @@ -700,23 +699,23 @@ void toolbar_set_sensitive(MainWindow *mainwin) { SensitiveCond state; gboolean sensitive; - guint no_items = g_slist_length(toolbar_list); MainToolbar *toolbar = mainwin->toolbar; GSList *cur; - gint i = 0; - gint total = 0; - - struct { + GSList *entry_list = NULL; + + typedef struct _Entry Entry; + struct _Entry { GtkWidget *widget; SensitiveCond cond; gboolean empty; - } entry[no_items + 1]; + }; #define SET_WIDGET_COND(w, c) \ -{ \ - entry[total].widget = w; \ - entry[total].cond = c; \ - total++; \ +{ \ + Entry *e = g_new0(Entry, 1); \ + e->widget = w; \ + e->cond = c; \ + entry_list = g_slist_append(entry_list, e); \ } SET_WIDGET_COND(toolbar->get_btn, M_HAVE_ACCOUNT|M_UNLOCKED); @@ -745,64 +744,28 @@ void toolbar_set_sensitive(MainWindow *mainwin) state = main_window_get_current_state(mainwin); - for (i = 0; i < total; i++) { - - if (entry[i].widget == NULL) continue; - sensitive = ((entry[i].cond & state) == entry[i].cond); - gtk_widget_set_sensitive(entry[i].widget, sensitive); - } + for (cur = entry_list; cur != NULL; cur = cur->next) { + Entry *e = (Entry*) cur->data; - activate_compose_button(toolbar, - prefs_common.toolbar_style, - toolbar->compose_btn_type); -} + if (e->widget != NULL) { + sensitive = ((e->cond & state) == e->cond); + gtk_widget_set_sensitive(e->widget, sensitive); + } + } + + while (entry_list != NULL) { + Entry *e = (Entry*) entry_list->data; -void toolbar_popups_create(MainWindow *mainwin, GtkWidget *window) -{ - guint n_menu_entries; - GtkWidget *reply_popup; - GtkWidget *replyall_popup; - GtkWidget *replysender_popup; - GtkWidget *fwd_popup; + if (e) + g_free(e); + entry_list = g_slist_remove(entry_list, e); + } - if (mainwin->toolbar != NULL) - g_free(mainwin->toolbar); + g_slist_free(entry_list); - mainwin->toolbar = g_new0(MainToolbar, 1); - - /* store mainwin localy */ - mwin = mainwin; - - n_menu_entries = sizeof(reply_popup_entries) / - sizeof(reply_popup_entries[0]); - reply_popup = popupmenu_create(window, reply_popup_entries, n_menu_entries, - "", mainwin); - gtk_signal_connect(GTK_OBJECT(reply_popup), "selection_done", - GTK_SIGNAL_FUNC(toolbar_reply_popup_closed_cb), mainwin); - n_menu_entries = sizeof(replyall_popup_entries) / - sizeof(replyall_popup_entries[0]); - replyall_popup = popupmenu_create(window, replyall_popup_entries, n_menu_entries, - "", mainwin); - gtk_signal_connect(GTK_OBJECT(replyall_popup), "selection_done", - GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_closed_cb), mainwin); - n_menu_entries = sizeof(replysender_popup_entries) / - sizeof(replysender_popup_entries[0]); - replysender_popup = popupmenu_create(window, replysender_popup_entries, n_menu_entries, - "", mainwin); - gtk_signal_connect(GTK_OBJECT(replysender_popup), "selection_done", - GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_closed_cb), mainwin); - /* create the popup menu for the forward button */ - n_menu_entries = sizeof(fwd_popup_entries) / - sizeof(fwd_popup_entries[0]); - fwd_popup = popupmenu_create(window, fwd_popup_entries, n_menu_entries, - "", mainwin); - gtk_signal_connect(GTK_OBJECT(fwd_popup), "selection_done", - GTK_SIGNAL_FUNC(toolbar_forward_popup_closed_cb), mainwin); - - mainwin->toolbar->reply_popup = reply_popup; - mainwin->toolbar->replyall_popup = replyall_popup; - mainwin->toolbar->replysender_popup = replysender_popup; - mainwin->toolbar->fwd_popup = fwd_popup; + activate_compose_button(toolbar, + prefs_common.toolbar_style, + toolbar->compose_btn_type); } void toolbar_update(void) @@ -862,11 +825,26 @@ void toolbar_create(MainWindow *mainwin, ToolbarSylpheedActions *syl_action; GSList *cur; + guint n_menu_entries; + GtkWidget *reply_popup; + GtkWidget *replyall_popup; + GtkWidget *replysender_popup; + GtkWidget *fwd_popup; + toolbar_tips = gtk_tooltips_new(); - toolbar_destroy(mainwin); + /* store mainwin localy */ + mwin = mainwin; + + if (mainwin->toolbar != NULL) { + toolbar_destroy(mainwin); + g_free(mainwin->toolbar); + } + toolbar_read_config_file(); + mainwin->toolbar = g_new0(MainToolbar, 1); + toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gtk_container_add(GTK_CONTAINER(container), toolbar); @@ -875,8 +853,6 @@ void toolbar_create(MainWindow *mainwin, gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_SPACE_LINE); - mainwin->toolbar->exec_btn = NULL; - for (cur = toolbar_list; cur != NULL; cur = cur->next) { toolbar_item = (ToolbarItem*) cur->data; @@ -889,7 +865,7 @@ void toolbar_create(MainWindow *mainwin, icon_wid = stock_pixmap_widget(container, stock_pixmap_get_icon(toolbar_item->file)); item = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), toolbar_item->text, - toolbar_ret_descr_from_val(toolbar_item->action), + (""), (""), icon_wid, toolbar_actions_cb, toolbar_item); @@ -939,6 +915,13 @@ void toolbar_create(MainWindow *mainwin, "button_press_event", GTK_SIGNAL_FUNC(toolbar_reply_popup_cb), mainwin); + n_menu_entries = sizeof(reply_popup_entries) / + sizeof(reply_popup_entries[0]); + reply_popup = popupmenu_create(mainwin->window, reply_popup_entries, n_menu_entries, + "", mainwin); + gtk_signal_connect(GTK_OBJECT(reply_popup), "selection_done", + GTK_SIGNAL_FUNC(toolbar_reply_popup_closed_cb), mainwin); + mainwin->toolbar->reply_popup = reply_popup; break; case A_REPLY_SENDER: mainwin->toolbar->replysender_btn = item; @@ -949,6 +932,14 @@ void toolbar_create(MainWindow *mainwin, "button_press_event", GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_cb), mainwin); + n_menu_entries = sizeof(replysender_popup_entries) / + sizeof(replysender_popup_entries[0]); + replysender_popup = popupmenu_create(mainwin->window, + replysender_popup_entries, n_menu_entries, + "", mainwin); + gtk_signal_connect(GTK_OBJECT(replysender_popup), "selection_done", + GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_closed_cb), mainwin); + mainwin->toolbar->replysender_popup = replysender_popup; break; case A_REPLY_ALL: mainwin->toolbar->replyall_btn = item; @@ -959,6 +950,14 @@ void toolbar_create(MainWindow *mainwin, "button_press_event", GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_cb), mainwin); + n_menu_entries = sizeof(replyall_popup_entries) / + sizeof(replyall_popup_entries[0]); + replyall_popup = popupmenu_create(mainwin->window, + replyall_popup_entries, n_menu_entries, + "", mainwin); + gtk_signal_connect(GTK_OBJECT(replyall_popup), "selection_done", + GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_closed_cb), mainwin); + mainwin->toolbar->replyall_popup = replyall_popup; break; case A_FORWARD: mainwin->toolbar->fwd_btn = item; @@ -969,6 +968,14 @@ void toolbar_create(MainWindow *mainwin, "button_press_event", GTK_SIGNAL_FUNC(toolbar_forward_popup_cb), mainwin); + n_menu_entries = sizeof(fwd_popup_entries) / + sizeof(fwd_popup_entries[0]); + fwd_popup = popupmenu_create(mainwin->window, + fwd_popup_entries, n_menu_entries, + "", mainwin); + gtk_signal_connect(GTK_OBJECT(fwd_popup), "selection_done", + GTK_SIGNAL_FUNC(toolbar_forward_popup_closed_cb), mainwin); + mainwin->toolbar->fwd_popup = fwd_popup; break; case A_DELETE: mainwin->toolbar->delete_btn = item; @@ -978,9 +985,6 @@ void toolbar_create(MainWindow *mainwin, break; case A_EXECUTE: mainwin->toolbar->exec_btn = item; - gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), - mainwin->toolbar->exec_btn, - _("Execute"), NULL); break; case A_GOTO_NEXT: mainwin->toolbar->next_btn = item; @@ -1003,7 +1007,32 @@ void toolbar_create(MainWindow *mainwin, } mainwin->toolbar->toolbar = toolbar; - + + /* we always create an exec button, if there isn't one yet + the user might decide to change prefs_common.immediate_exec + --> better be prepared + */ + if (!mainwin->toolbar->exec_btn) { + toolbar_item = g_new0(ToolbarItem, 1); + toolbar_item->action = A_EXECUTE; + toolbar_item->file = stock_pixmap_get_name(STOCK_PIXMAP_EXEC); + toolbar_item->text = toolbar_ret_descr_from_val(A_EXECUTE); + + icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_EXEC); + item = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), + toolbar_item->text, + (""), + (""), + icon_wid, toolbar_actions_cb, + toolbar_item); + mainwin->toolbar->exec_btn = item; + g_free(toolbar_item); + } + + gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), + mainwin->toolbar->exec_btn, + _("Execute"), NULL); + activate_compose_button(mainwin->toolbar, prefs_common.toolbar_style, mainwin->toolbar->compose_btn_type); diff --git a/src/toolbar.h b/src/toolbar.h index 9d50f5958..8b4e722b3 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -99,12 +99,11 @@ struct _MainToolbar { GtkWidget *delete_btn; GtkWidget *next_btn; + GtkWidget *exec_btn; GSList *syl_action; GtkWidget *separator; - GtkWidget *exec_btn; - /* for the reply buttons */ GtkWidget *reply_popup; GtkWidget *replyall_popup; @@ -135,9 +134,6 @@ gchar *toolbar_ret_text_from_val (gint val); void toolbar_create (MainWindow *mainwin, GtkWidget *container); -void toolbar_popups_create (MainWindow *mainwin, - GtkWidget *window); - void toolbar_set_sensitive (MainWindow *mainwin); void toolbar_set_compose_button (MainToolbar *toolbar, ComposeButtonType compose_btn_type);