[balsa/gtk4: 166/206] Various: Use libbalsa_add_button_to_box()
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 166/206] Various: Use libbalsa_add_button_to_box()
- Date: Tue, 20 Oct 2020 22:19:23 +0000 (UTC)
commit c0c3be154716014733651d46e306cd65985c530b
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 | 7 ++-----
src/balsa-mime-widget-crypto.c | 18 ++++++------------
src/balsa-mime-widget-vcalendar.c | 9 +++------
src/filter-edit-dialog.c | 23 +++++++----------------
src/filter-run-dialog.c | 6 ++----
6 files changed, 23 insertions(+), 51 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 52e6df23e..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,13 +328,11 @@ 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);
- 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);
diff --git a/src/balsa-mime-widget-crypto.c b/src/balsa-mime-widget-crypto.c
index 17ef0f218..b7a624292 100644
--- a/src/balsa-mime-widget-crypto.c
+++ b/src/balsa-mime-widget-crypto.c
@@ -129,39 +129,33 @@ 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);
- gtk_container_add(GTK_CONTAINER(hbox), button);
}
#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 6c204fe05..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
@@ -283,14 +280,14 @@ balsa_vevent_widget(LibBalsaVEvent *event, LibBalsaVCal *vcal, gboolean may_repl
g_signal_connect(button, "clicked",
G_CALLBACK(vevent_reply), bbox);
- 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);
- 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));
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 7c8ee8807..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,17 +218,16 @@ 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);
/* 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_widget_set_sensitive(fe_delete_button, FALSE);
@@ -248,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();
@@ -311,18 +308,15 @@ 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);
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);
g_signal_connect(fe_condition_delete_button, "clicked",
G_CALLBACK(fe_condition_remove_pressed), NULL);
@@ -491,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);
@@ -513,13 +506,11 @@ 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);
- 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_widget_set_sensitive(fe_apply_button, FALSE);
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index 17b110021..3383047b0 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -340,16 +340,14 @@ 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 =
- libbalsa_add_mnemonic_button_to_box(_("_Apply Selected"), bbox, GTK_ALIGN_CENTER);
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]