[balsa/gtk4: 116/312] Various: Use libbalsa_add_button_to_box()
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 116/312] Various: Use libbalsa_add_button_to_box()
- Date: Tue, 5 Oct 2021 20:01:01 +0000 (UTC)
commit 59af2f1065bd6ce32db20ada836739ab42fdc884
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Aug 29 17:02:24 2020 -0400
Various: Use libbalsa_add_button_to_box()
modified: src/ab-main.c
modified: src/ab-window.c
modified: src/balsa-mime-widget-crypto.c
modified: src/balsa-mime-widget-vcalendar.c
modified: src/filter-edit-dialog.c
modified: src/filter-run-dialog.c
src/ab-main.c | 11 +++--------
src/ab-window.c | 11 ++---------
src/balsa-mime-widget-crypto.c | 20 ++++++--------------
src/balsa-mime-widget-vcalendar.c | 12 +++---------
src/filter-edit-dialog.c | 29 +++++++----------------------
src/filter-run-dialog.c | 29 ++++++++++++++++++-----------
6 files changed, 39 insertions(+), 73 deletions(-)
---
diff --git a/src/ab-main.c b/src/ab-main.c
index 1a62da9ed..b83d984e6 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -832,23 +832,18 @@ static GtkWidget*
bab_get_edit_button_box(struct ABMainWindow *abmw)
{
GtkWidget *box;
- GtkSizeGroup *size_group;
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
- abmw->apply_button = libbalsa_button_box_button(_("_Apply"), size_group, GTK_ALIGN_START);
- gtk_container_add(GTK_CONTAINER(box), abmw->apply_button);
+ abmw->apply_button = libbalsa_add_button_to_box(_("_Apply"), box, GTK_ALIGN_START);
g_signal_connect(abmw->apply_button, "clicked",
G_CALLBACK(apply_button_cb), (gpointer) NULL);
- abmw->remove_button = libbalsa_button_box_button(_("_Remove"), size_group, GTK_ALIGN_CENTER);
- gtk_container_add(GTK_CONTAINER(box), abmw->remove_button);
+ abmw->remove_button = libbalsa_add_button_to_box(_("_Remove"), box, GTK_ALIGN_CENTER);
g_signal_connect(abmw->remove_button, "clicked",
G_CALLBACK(remove_button_cb), (gpointer) NULL);
- abmw->cancel_button = libbalsa_button_box_button(_("_Cancel"), size_group, GTK_ALIGN_END);
- gtk_container_add(GTK_CONTAINER(box), abmw->cancel_button);
+ abmw->cancel_button = libbalsa_add_button_to_box(_("_Cancel"), box, GTK_ALIGN_END);
g_signal_connect(abmw->cancel_button, "clicked",
G_CALLBACK(cancel_button_cb), abmw);
diff --git a/src/ab-window.c b/src/ab-window.c
index 49fdbedb2..9bdec0d29 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -236,7 +236,6 @@ balsa_ab_window_init(BalsaAbWindow *ab)
*box2,
*scrolled_window,
*frame;
- GtkSizeGroup *size_group;
ab->current_address_book = NULL;
@@ -329,20 +328,14 @@ balsa_ab_window_init(BalsaAbWindow *ab)
gtk_grid_attach(GTK_GRID(grid), hbox, 0, 2, 1, 1);
gtk_widget_show(GTK_WIDGET(hbox));
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
- w = libbalsa_button_box_button(_("Run _Editor"), size_group, GTK_ALIGN_CENTER);
+ w = libbalsa_add_button_to_box(_("Run _Editor"), hbox, GTK_ALIGN_CENTER);
g_signal_connect(w, "clicked",
G_CALLBACK(balsa_ab_window_run_editor), NULL);
- gtk_container_add(GTK_CONTAINER(hbox), w);
- gtk_widget_show(GTK_WIDGET(w));
- w = libbalsa_button_box_button(_("_Re-import"), size_group, GTK_ALIGN_CENTER);
+ w = libbalsa_add_button_to_box(_("_Re-import"), hbox, GTK_ALIGN_CENTER);
g_signal_connect(w, "clicked",
G_CALLBACK(balsa_ab_window_reload),
ab);
- gtk_container_add(GTK_CONTAINER(hbox), w);
- gtk_widget_show(w);
balsa_ab_window_load(ab);
diff --git a/src/balsa-mime-widget-crypto.c b/src/balsa-mime-widget-crypto.c
index bb66ee3b0..4a9a70623 100644
--- a/src/balsa-mime-widget-crypto.c
+++ b/src/balsa-mime-widget-crypto.c
@@ -129,47 +129,39 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
if (g_mime_gpgme_sigstat_protocol(mime_body->sig_info) == GPGME_PROTOCOL_OpenPGP) {
GtkWidget *hbox;
GtkWidget *button;
- GtkSizeGroup *size_group;
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, BMW_HBOX_SPACE);
gtk_widget_set_vexpand(hbox, TRUE);
gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
gtk_container_add(GTK_CONTAINER(vbox), hbox);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
if (g_mime_gpgme_sigstat_status(mime_body->sig_info) == GPG_ERR_NO_PUBKEY) {
#ifdef ENABLE_AUTOCRYPT
GBytes *autocrypt_key;
autocrypt_key = autocrypt_get_key(g_mime_gpgme_sigstat_fingerprint(mime_body->sig_info),
NULL);
if (autocrypt_key != NULL) {
- button = libbalsa_button_box_button(_("_Import Autocrypt key"),
- size_group, GTK_ALIGN_FILL);
+ button = libbalsa_add_button_to_box(_("_Import Autocrypt key"),
+ hbox, GTK_ALIGN_FILL);
g_object_set_data_full(G_OBJECT(button), "autocrypt_key", autocrypt_key,
(GDestroyNotify) g_bytes_unref);
g_signal_connect(button, "clicked", G_CALLBACK(on_key_import_button), NULL);
-<<<<<<< HEAD
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
} else if (libbalsa_message_get_headers(mime_body->message)->autocrypt_hdr_present) {
libbalsa_information(LIBBALSA_INFORMATION_WARNING,
_("The message contains an Autocrypt header, but it is either broken "
"or the signature has been created using a different key."));
-=======
gtk_container_add(GTK_CONTAINER(hbox), button);
->>>>>>> 03c35ad3b (balsa-mime-widget-crypto: Stop using GtkButtonBox)
}
#endif
- button = libbalsa_button_box_button(_("_Search key server for this key"),
- size_group, GTK_ALIGN_FILL);
+ button = libbalsa_add_button_to_box(_("_Search key server for this key"),
+ hbox, GTK_ALIGN_FILL);
} else {
- button = libbalsa_button_box_button(_("_Search key server for updates of this key"),
- size_group, GTK_ALIGN_FILL);
+ button = libbalsa_add_button_to_box(_("_Search key server for updates of this key"),
+ hbox, GTK_ALIGN_FILL);
}
g_signal_connect(button, "clicked",
G_CALLBACK(on_gpg_key_button),
(gpointer) g_mime_gpgme_sigstat_fingerprint(mime_body->sig_info));
-
- gtk_container_add(GTK_CONTAINER(hbox), button);
}
/* Hack alert: if we omit the box below and use the expander as signature widget
diff --git a/src/balsa-mime-widget-vcalendar.c b/src/balsa-mime-widget-vcalendar.c
index 65d6c5ead..835b7d0ad 100644
--- a/src/balsa-mime-widget-vcalendar.c
+++ b/src/balsa-mime-widget-vcalendar.c
@@ -251,7 +251,6 @@ balsa_vevent_widget(LibBalsaVEvent *event, LibBalsaVCal *vcal, gboolean may_repl
GtkWidget *label;
GtkWidget *bbox;
GtkWidget *button;
- GtkSizeGroup *size_group;
/* add the callback data to the event object */
g_object_set_data_full(G_OBJECT(event), "ev:sender",
@@ -269,9 +268,7 @@ balsa_vevent_widget(LibBalsaVEvent *event, LibBalsaVCal *vcal, gboolean may_repl
bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add(GTK_CONTAINER(box), bbox);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
- button = libbalsa_button_box_button(_("Accept"), size_group, GTK_ALIGN_CENTER);
+ button = libbalsa_add_button_to_box(_("Accept"), bbox, GTK_ALIGN_CENTER);
g_object_set_data(G_OBJECT(button), "event", event);
/* Note: we must ref the full VCal object here as time zone information is stored in it. Only
ref'ing the event would thus
@@ -282,23 +279,20 @@ balsa_vevent_widget(LibBalsaVEvent *event, LibBalsaVCal *vcal, gboolean may_repl
GINT_TO_POINTER(ICAL_PARTSTAT_ACCEPTED));
g_signal_connect(button, "clicked",
G_CALLBACK(vevent_reply), bbox);
- gtk_container_add(GTK_CONTAINER(bbox), button);
- button = libbalsa_button_box_button(_("Accept tentatively"), size_group, GTK_ALIGN_CENTER);
+ button = libbalsa_add_button_to_box(_("Accept tentatively"), bbox, GTK_ALIGN_CENTER);
g_object_set_data(G_OBJECT(button), "event", event);
g_object_set_data(G_OBJECT(button), "mode",
GINT_TO_POINTER(ICAL_PARTSTAT_TENTATIVE));
g_signal_connect(button, "clicked",
G_CALLBACK(vevent_reply), bbox);
- gtk_container_add(GTK_CONTAINER(bbox), button);
- button = libbalsa_button_box_button(_("Decline"), size_group, GTK_ALIGN_CENTER);
+ button = libbalsa_add_button_to_box(_("Decline"), bbox, GTK_ALIGN_CENTER);
g_object_set_data(G_OBJECT(button), "event", event);
g_object_set_data(G_OBJECT(button), "mode",
GINT_TO_POINTER(ICAL_PARTSTAT_DECLINED));
g_signal_connect(button, "clicked",
G_CALLBACK(vevent_reply), bbox);
- gtk_container_add(GTK_CONTAINER(bbox), button);
return box;
} else
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 8a239e611..049bb6af7 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -180,7 +180,6 @@ static GtkWidget *
build_left_side(void)
{
GtkWidget *vbox, *bbox;
- GtkSizeGroup *size_group;
GtkWidget *sw;
/*
@@ -219,21 +218,18 @@ build_left_side(void)
/* new and delete buttons */
bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
gtk_container_add(GTK_CONTAINER(vbox), bbox);
/* new button */
/* Translators: button "New" filter */
- fe_new_button = libbalsa_button_box_button(C_("filter", "_New"), size_group, GTK_ALIGN_CENTER);
+ fe_new_button = libbalsa_add_button_to_box(C_("filter", "_New"), bbox, GTK_ALIGN_CENTER);
g_signal_connect(fe_new_button, "clicked",
G_CALLBACK(fe_new_pressed), NULL);
- gtk_container_add(GTK_CONTAINER(bbox), fe_new_button);
/* delete button */
- fe_delete_button = libbalsa_button_box_button(("_Delete"), size_group, GTK_ALIGN_CENTER);
+ fe_delete_button = libbalsa_add_button_to_box(("_Delete"), bbox, GTK_ALIGN_CENTER);
g_signal_connect(fe_delete_button, "clicked",
G_CALLBACK(fe_delete_pressed), NULL);
- gtk_container_add(GTK_CONTAINER(bbox), fe_delete_button);
gtk_widget_set_sensitive(fe_delete_button, FALSE);
return vbox;
@@ -250,7 +246,6 @@ build_match_page()
GtkWidget *page, *button;
GtkWidget *label, *scroll;
GtkWidget *box = NULL;
- GtkSizeGroup *size_group;
/* The notebook page */
page = gtk_grid_new();
@@ -313,21 +308,16 @@ build_match_page()
gtk_widget_set_hexpand(box, TRUE);
gtk_grid_attach(GTK_GRID(page), box, 0, 3, 2, 1);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
- fe_condition_edit_button = libbalsa_button_box_button(_("_Edit"), size_group, GTK_ALIGN_START);
+ fe_condition_edit_button = libbalsa_add_button_to_box(_("_Edit"), box, GTK_ALIGN_START);
gtk_widget_set_sensitive(fe_condition_edit_button,FALSE);
- gtk_container_add(GTK_CONTAINER(box), fe_condition_edit_button);
g_signal_connect(fe_condition_edit_button, "clicked",
G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(0));
/* Translators: button "New" filter match */
- button = libbalsa_button_box_button(C_("filter match", "Ne_w"), size_group, GTK_ALIGN_CENTER);
- gtk_container_add(GTK_CONTAINER(box), button);
+ button = libbalsa_add_button_to_box(C_("filter match", "Ne_w"), box, GTK_ALIGN_CENTER);
g_signal_connect(button, "clicked",
G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(1));
- fe_condition_delete_button = libbalsa_button_box_button(_("_Remove"), size_group, GTK_ALIGN_END);
+ fe_condition_delete_button = libbalsa_add_button_to_box(_("_Remove"), box, GTK_ALIGN_END);
gtk_widget_set_sensitive(fe_condition_delete_button,FALSE);
- gtk_container_add(GTK_CONTAINER(box), fe_condition_delete_button);
g_signal_connect(fe_condition_delete_button, "clicked",
G_CALLBACK(fe_condition_remove_pressed), NULL);
@@ -495,7 +485,6 @@ build_right_side(GtkWindow * window)
GtkWidget *rightside;
GtkWidget *notebook, *page;
GtkWidget *bbox;
- GtkSizeGroup *size_group;
rightside = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
@@ -517,17 +506,13 @@ build_right_side(GtkWindow * window)
bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add(GTK_CONTAINER(rightside), bbox);
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
- fe_apply_button = libbalsa_button_box_button(_("_Apply"), size_group, GTK_ALIGN_START);
+ fe_apply_button = libbalsa_add_button_to_box(_("_Apply"), bbox, GTK_ALIGN_START);
g_signal_connect(fe_apply_button, "clicked",
G_CALLBACK(fe_apply_pressed), NULL);
- gtk_container_add(GTK_CONTAINER(bbox), fe_apply_button);
- fe_revert_button = libbalsa_button_box_button(_("Re_vert"), size_group, GTK_ALIGN_END);
+ fe_revert_button = libbalsa_add_button_to_box(_("Re_vert"), bbox, GTK_ALIGN_END);
g_signal_connect(fe_revert_button, "clicked",
G_CALLBACK(fe_revert_pressed), NULL);
- gtk_container_add(GTK_CONTAINER(bbox), fe_revert_button);
gtk_widget_set_sensitive(fe_apply_button, FALSE);
gtk_widget_set_sensitive(fe_revert_button, FALSE);
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index 1ad14b7eb..468eca1e8 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -279,6 +279,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
GtkTreeSelection *selection;
GtkWidget *button;
GtkWidget *sw;
+ GtkSizeGroup *size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
/*
@@ -339,25 +340,20 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
gtk_container_add(GTK_CONTAINER(vbox), sw);
/* To keep a consistent look, make a button box for a single button. */
- bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
- gtk_box_set_spacing(GTK_BOX(bbox), 2);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
+ bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_widget_set_margin_top(bbox, 2);
gtk_widget_set_margin_bottom(bbox, 2);
gtk_container_add(GTK_CONTAINER(vbox), bbox);
/* "Apply selected" button */
p->apply_selected_button = button =
- gtk_button_new_with_mnemonic(_("_Apply Selected"));
+ libbalsa_add_button_to_box(_("_Apply Selected"), bbox, GTK_ALIGN_CENTER);
gtk_widget_set_sensitive(button, FALSE);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(fr_apply_selected_pressed), p);
- gtk_container_add(GTK_CONTAINER(bbox), button);
/* Buttons between the 2 lists */
- bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
- gtk_box_set_spacing(GTK_BOX(bbox), 2);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
+ bbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
/* Right/Add button */
p->add_button = button =
@@ -368,6 +364,8 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
gtk_widget_set_sensitive(button, FALSE);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(fr_add_pressed), p);
+ gtk_widget_set_vexpand(button, TRUE);
+ gtk_widget_set_valign(button, GTK_ALIGN_END);
gtk_container_add(GTK_CONTAINER(bbox), button);
/* Left/Remove button */
p->remove_button = button =
@@ -378,6 +376,8 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
gtk_widget_set_sensitive(button, FALSE);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(fr_remove_pressed), p);
+ gtk_widget_set_vexpand(button, TRUE);
+ gtk_widget_set_valign(button, GTK_ALIGN_START);
gtk_container_add(GTK_CONTAINER(bbox), button);
gtk_widget_set_margin_start(bbox, 6);
@@ -410,9 +410,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
gtk_container_add(GTK_CONTAINER(vbox), sw);
/* up down arrow buttons */
- bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
- gtk_box_set_spacing(GTK_BOX(bbox), 2);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
+ bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_widget_set_margin_top(bbox, 2);
gtk_widget_set_margin_bottom(bbox, 2);
@@ -427,6 +425,9 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
_("Move selected filter up"));
g_signal_connect(button, "clicked",
G_CALLBACK(fr_up_pressed), p);
+ gtk_widget_set_hexpand(button, TRUE);
+ gtk_widget_set_halign(button, GTK_ALIGN_CENTER);
+ gtk_size_group_add_widget(size_group, button);
gtk_container_add(GTK_CONTAINER(bbox), button);
/* down button */
p->move_down_button = button =
@@ -437,6 +438,9 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
_("Move selected filter down"));
g_signal_connect(button, "clicked",
G_CALLBACK(fr_down_pressed), p);
+ gtk_widget_set_hexpand(button, TRUE);
+ gtk_widget_set_halign(button, GTK_ALIGN_CENTER);
+ gtk_size_group_add_widget(size_group, button);
gtk_container_add(GTK_CONTAINER(bbox), button);
p->apply_now_button = button =
@@ -444,6 +448,9 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
gtk_widget_set_sensitive(button, FALSE);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(fr_apply_now_pressed), p);
+ gtk_widget_set_hexpand(button, TRUE);
+ gtk_widget_set_halign(button, GTK_ALIGN_CENTER);
+ gtk_size_group_add_widget(size_group, button);
gtk_container_add(GTK_CONTAINER(bbox), button);
p->filters_modified = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]