[file-roller/wip/gtk4: 4/54] gtk4: removed use of gtk_box_pack_start
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/gtk4: 4/54] gtk4: removed use of gtk_box_pack_start
- Date: Sun, 2 Oct 2022 17:56:48 +0000 (UTC)
commit 32b9ffc1d09f582afc040e2559ffba669c8a57cd
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Sep 26 22:53:18 2022 +0200
gtk4: removed use of gtk_box_pack_start
src/dlg-ask-password.c | 2 +-
src/fr-file-selector-dialog.c | 2 +-
src/fr-window.c | 47 +++++++++++++++++--------------------------
src/gtk-utils.c | 13 ++++++++++--
src/gtk-utils.h | 1 +
5 files changed, 33 insertions(+), 32 deletions(-)
---
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c
index 88eacf18..0cbacd13 100644
--- a/src/dlg-ask-password.c
+++ b/src/dlg-ask-password.c
@@ -153,7 +153,7 @@ dlg_ask_password__common (FrWindow *window,
label = gtk_label_new (_("Wrong password."));
gtk_box_append (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar))), label);
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
- gtk_box_pack_start (GTK_BOX (GET_WIDGET ("error_box")), info_bar, TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (GET_WIDGET ("error_box")), info_bar);
gtk_widget_show_all (GET_WIDGET ("error_box"));
_gtk_entry_set_locale_text (GTK_ENTRY (data->password_entry),
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index f74486b4..6ccf15b1 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -701,7 +701,7 @@ fr_file_selector_dialog_init (FrFileSelectorDialog *self)
self->file_context_menu = GTK_POPOVER (gtk_popover_new_from_model (GET_WIDGET ("files_treeview"),
G_MENU_MODEL (gtk_builder_get_object (self->builder, "file_list_context_menu_model"))));
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET
("content"), TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET
("content"));
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (GET_WIDGET ("files_liststore")),
FILE_LIST_COLUMN_NAME, files_name_column_sort_func, self, NULL);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (GET_WIDGET ("files_liststore")),
FILE_LIST_COLUMN_SIZE, files_size_column_sort_func, self, NULL);
diff --git a/src/fr-window.c b/src/fr-window.c
index 634c92da..3cb145b6 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -5738,7 +5738,7 @@ fr_window_construct (FrWindow *window)
window);
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (private->filter_bar), GTK_ENTRY
(private->filter_entry));
gtk_search_bar_set_child (GTK_SEARCH_BAR (private->filter_bar), filter_box);
- gtk_box_pack_start (GTK_BOX (filter_box), private->filter_entry, TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (filter_box), private->filter_entry);
gtk_widget_show_all (private->filter_bar);
fr_window_attach (FR_WINDOW (window), private->filter_bar, FR_WINDOW_AREA_FILTERBAR);
@@ -5790,7 +5790,7 @@ fr_window_construct (FrWindow *window)
/* side pane */
private->sidepane = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (private->sidepane), tree_scrolled_window, TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (private->sidepane), tree_scrolled_window);
/* main content */
@@ -5876,36 +5876,28 @@ fr_window_construct (FrWindow *window)
location_bar_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (location_bar_content), 4);
- gtk_box_pack_start (GTK_BOX (private->location_bar), location_bar_content, TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (private->location_bar), location_bar_content);
navigation_commands = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (navigation_commands),
- _gtk_header_bar_create_image_button ("go-previous-symbolic", _("Go to the
previous visited location"), "win.go-back"),
- FALSE,
- FALSE,
- 0);
- gtk_box_pack_start (GTK_BOX (navigation_commands),
- _gtk_header_bar_create_image_button ("go-next-symbolic", _("Go to the next
visited location"), "win.go-forward"),
- FALSE,
- FALSE,
- 0);
+ gtk_box_append (GTK_BOX (navigation_commands),
+ _gtk_header_bar_create_image_button ("go-previous-symbolic", _("Go to the previous
visited location"), "win.go-back"));
+ gtk_box_append (GTK_BOX (navigation_commands),
+ _gtk_header_bar_create_image_button ("go-next-symbolic", _("Go to the next visited
location"), "win.go-forward"));
gtk_widget_show_all (navigation_commands);
gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "raised");
gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "linked");
- gtk_box_pack_start (GTK_BOX (location_bar_content), navigation_commands, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (location_bar_content),
- _gtk_header_bar_create_image_button ("user-home-symbolic", _("Go to the home
location"), "win.go-home"),
- FALSE,
- FALSE,
- 0);
+ gtk_box_append (GTK_BOX (location_bar_content), navigation_commands);
+ gtk_box_append (GTK_BOX (location_bar_content),
+ _gtk_header_bar_create_image_button ("user-home-symbolic", _("Go to the home
location"), "win.go-home"));
/* current location */
location_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
/* Translators: after the colon there is a folder name. */
private->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
- gtk_box_pack_start (GTK_BOX (location_box), private->location_label, FALSE, FALSE, 5);
+ gtk_widget_set_margin_right (private->location_label, 5);
+ gtk_widget_set_margin_left (private->location_label, 5);
+ gtk_box_append (GTK_BOX (location_box), private->location_label);
private->location_entry = gtk_entry_new ();
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (private->location_entry),
@@ -5915,8 +5907,10 @@ fr_window_construct (FrWindow *window)
"key_press_event",
G_CALLBACK (location_entry_key_press_event_cb),
window);
- gtk_box_pack_start (GTK_BOX (location_box), private->location_entry, TRUE, TRUE, 5);
- gtk_box_pack_start (GTK_BOX (location_bar_content), location_box, TRUE, TRUE, 0);
+ gtk_widget_set_margin_right (private->location_entry, 5);
+ gtk_widget_set_margin_left (private->location_entry, 5);
+ _gtk_box_append_expanded (GTK_BOX (location_box), private->location_entry);
+ _gtk_box_append_expanded (GTK_BOX (location_bar_content), location_box);
gtk_widget_show_all (private->location_bar);
fr_window_attach (FR_WINDOW (window), private->location_bar, FR_WINDOW_AREA_LOCATIONBAR);
@@ -8143,13 +8137,10 @@ fr_window_view_last_output (FrWindow *window,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), text_view);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled,
- TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (vbox), scrolled);
gtk_widget_show_all (vbox);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
- vbox,
- TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox);
/* signals */
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 0047120f..bf873c24 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -204,14 +204,14 @@ _gtk_error_dialog_new (GtkWindow *parent,
output_box, TRUE, TRUE, 0);
label = gtk_label_new_with_mnemonic (_("C_ommand Line Output:"));
- gtk_box_pack_start (GTK_BOX (output_box), label, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (output_box), label);
scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
"shadow-type", GTK_SHADOW_IN,
"width-request", 450,
"height-request", 200,
NULL);
- gtk_box_pack_start (GTK_BOX (output_box), scrolled_window, TRUE, TRUE, 0);
+ _gtk_box_append_expanded (GTK_BOX (output_box), scrolled_window);
text_view = gtk_text_view_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), text_view);
@@ -720,3 +720,12 @@ _gtk_popover_popup_at_position (GtkPopover *popover, gdouble x, gdouble y)
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
gtk_popover_popup (GTK_POPOVER (popover));
}
+
+
+void
+_gtk_box_append_expanded (GtkBox *box, GtkWidget *child)
+{
+ gtk_widget_set_hexpand (child, TRUE);
+ gtk_widget_set_vexpand (child, TRUE);
+ gtk_box_append (box, child);
+}
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index e2eb3541..ec00f5c3 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -105,5 +105,6 @@ void _gtk_application_add_accelerators (GtkApplication *app,
int n_accelerators);
void _gtk_popover_popup_at_selected (GtkPopover *popover, GtkTreeView *view);
void _gtk_popover_popup_at_position (GtkPopover *popover, gdouble x, gdouble y);
+void _gtk_box_append_expanded (GtkBox *box, GtkWidget *child);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]