Backport several tree view fixes (#2184783)

This commit is contained in:
Adam Williamson 2023-04-20 13:53:40 -07:00
parent e68edb42ac
commit a819aa093a
4 changed files with 324 additions and 1 deletions

View File

@ -0,0 +1,248 @@
From 5db548c4368459eb71da8f2a923c8830f5e0bcba Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 20 Apr 2023 11:57:34 -0700
Subject: [PATCH] Set dialog 'heading', not 'title'
In the GTK 4 port, we made all Zenity dialogs use the libadwaita
`AdwMessageDialog` class. This dialog does not have a title bar
and does not show its title. The equivalent to title for this
class is 'heading' - everywhere we were previously setting the
title, we should set the 'heading' instead.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/calendar.c | 2 +-
src/entry.c | 2 +-
src/forms.c | 2 +-
src/msg.c | 2 +-
src/password.c | 2 +-
src/progress.c | 2 +-
src/scale.c | 2 +-
src/text.c | 2 +-
src/tree.c | 2 +-
src/zenity.ui | 22 +++++++++++-----------
10 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/calendar.c b/src/calendar.c
index f5237d1a..1eac9f3e 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -60,7 +60,7 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
G_CALLBACK(zenity_calendar_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"x-office-calendar");
diff --git a/src/entry.c b/src/entry.c
index bf94cd44..2632d280 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -73,7 +73,7 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
g_signal_connect (dialog, "response", G_CALLBACK(zenity_entry_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"insert-text");
diff --git a/src/forms.c b/src/forms.c
index 4e4a60e5..59ada04a 100644
--- a/src/forms.c
+++ b/src/forms.c
@@ -248,7 +248,7 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
G_CALLBACK (zenity_forms_dialog_response), forms_data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
if (data->width > -1 || data->height > -1) {
gtk_window_set_default_size (GTK_WINDOW(dialog),
diff --git a/src/msg.c b/src/msg.c
index 87a5beb0..8ebb2e02 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -122,7 +122,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
g_signal_connect (dialog, "response", G_CALLBACK(zenity_msg_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
if (data->ok_label)
{
diff --git a/src/password.c b/src/password.c
index 69dd6835..fc270216 100644
--- a/src/password.c
+++ b/src/password.c
@@ -120,7 +120,7 @@ zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
1, 1);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
if (data->modal)
gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
diff --git a/src/progress.c b/src/progress.c
index cae1a6c3..a33763d5 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -340,7 +340,7 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
g_signal_connect (dialog, "response", G_CALLBACK(zenity_progress_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"appointment-soon");
diff --git a/src/scale.c b/src/scale.c
index 7ac0f413..73ab015a 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -73,7 +73,7 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
}
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"dialog-question");
diff --git a/src/text.c b/src/text.c
index 7c37855c..2e9f2fbd 100644
--- a/src/text.c
+++ b/src/text.c
@@ -280,7 +280,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
G_CALLBACK(zenity_text_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"accessories-text-editor");
diff --git a/src/tree.c b/src/tree.c
index b59a9198..2f970944 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -291,7 +291,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
g_signal_connect (dialog, "response", G_CALLBACK(zenity_tree_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ adw_message_dialog_set_heading (ADW_MESSAGE_DIALOG(dialog), data->dialog_title);;
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
diff --git a/src/zenity.ui b/src/zenity.ui
index e4e6a5b7..5644aff0 100644
--- a/src/zenity.ui
+++ b/src/zenity.ui
@@ -6,7 +6,7 @@
<interface>
<requires lib="gtk" version="4.0"/>
<object class="AdwMessageDialog" id="zenity_scale_dialog">
- <property name="title" translatable="yes">Adjust the scale value</property>
+ <property name="heading" translatable="yes">Adjust the scale value</property>
<property name="default_width">300</property>
<property name="default_height">100</property>
<property name="extra-child">zenity_scale_box</property>
@@ -42,7 +42,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_text_dialog">
- <property name="title" translatable="yes">Text View</property>
+ <property name="heading" translatable="yes">Text View</property>
<property name="default_width">300</property>
<property name="default_height">200</property>
<property name="resizable">true</property>
@@ -79,7 +79,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_calendar_dialog">
- <property name="title" translatable="yes">Calendar selection</property>
+ <property name="heading" translatable="yes">Calendar selection</property>
<property name="extra-child">zenity_calendar_box</property>
<responses>
<response id="cancel" translatable="yes">_Cancel</response>
@@ -129,7 +129,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_entry_dialog">
- <property name="title" translatable="yes">Add a new entry</property>
+ <property name="heading" translatable="yes">Add a new entry</property>
<property name="extra-child">zenity_entry_box</property>
<responses>
<response id="cancel" translatable="yes">_Cancel</response>
@@ -167,7 +167,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_error_dialog">
- <property name="title" translatable="yes">Error</property>
+ <property name="heading" translatable="yes">Error</property>
<property name="extra-child">zenity_error_box</property>
<responses>
<response id="ok" translatable="yes">_OK</response>
@@ -266,7 +266,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_info_dialog">
- <property name="title" translatable="yes">Information</property>
+ <property name="heading" translatable="yes">Information</property>
<property name="extra-child">zenity_info_box</property>
<responses>
<response id="ok" translatable="yes">_OK</response>
@@ -302,7 +302,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_progress_dialog">
- <property name="title" translatable="yes">Progress</property>
+ <property name="heading" translatable="yes">Progress</property>
<property name="extra-child">zenity_progress_box</property>
</object>
<object class="GtkBox" id="zenity_progress_box">
@@ -336,7 +336,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_question_dialog">
- <property name="title" translatable="yes">Question</property>
+ <property name="heading" translatable="yes">Question</property>
<property name="extra-child">zenity_question_box</property>
<responses>
<response id="no" translatable="yes">_No</response>
@@ -372,7 +372,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_tree_dialog">
- <property name="title" translatable="yes">Select items from the list</property>
+ <property name="heading" translatable="yes">Select items from the list</property>
<property name="default_width">480</property>
<property name="default_height">320</property>
<property name="extra-child">zenity_tree_box</property>
@@ -412,7 +412,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_warning_dialog">
- <property name="title" translatable="yes">Warning</property>
+ <property name="heading" translatable="yes">Warning</property>
<property name="resizable">false</property>
<property name="extra-child">zenity_warning_box</property>
<responses>
@@ -449,7 +449,7 @@
</child>
</object>
<object class="AdwMessageDialog" id="zenity_password_dialog">
- <property name="title" translatable="yes">Warning</property>
+ <property name="heading" translatable="yes">Warning</property>
<property name="resizable">false</property>
<property name="extra-child">zenity_password_box</property>
<responses>
--
2.40.0

View File

@ -0,0 +1,27 @@
From 6dde25ea5bba5efb089d6a3cd6eaea4b5f738a44 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 20 Apr 2023 13:42:29 -0700
Subject: [PATCH] tree-column-view: don't steal children
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/zenity-tree-column-view.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/zenity-tree-column-view.c b/src/zenity-tree-column-view.c
index 9b4b5a60..5117f954 100644
--- a/src/zenity-tree-column-view.c
+++ b/src/zenity-tree-column-view.c
@@ -555,7 +555,8 @@ factory_bind_cb (ZenityTreeColumnView *self,
item = zenity_tree_row_get_item (row, col_index);
item_child = zenity_tree_item_get_child (item);
item_text = zenity_tree_item_get_text (item);
- gtk_list_item_set_child (list_item, item_child);
+ if (!gtk_widget_get_parent (item_child))
+ gtk_list_item_set_child (list_item, item_child);
gtk_widget_set_halign (item_child, GTK_ALIGN_START);
--
2.40.0

View File

@ -0,0 +1,33 @@
From da9f5f240c7d1381b87dab8c789bf0bdf47a7609 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 20 Apr 2023 13:22:19 -0700
Subject: [PATCH] tree: fix handling of multi-row stdin input (#54)
This was broken by the GtkColumnView port (7a80b67). As part of
the changes that just stopped any attempt to actually start a
new row here, so we just kept stuffing more and more items into
the only row item we ever create. So you just couldn't do multi-
row input via stdin.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/tree.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/tree.c b/src/tree.c
index b59a9198..0747fcf3 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -120,6 +120,9 @@ zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition, gpointer
/* We're starting a new row */
column_count = 0;
row_count++;
+ if (row)
+ g_list_store_append (store, row);
+ row = zenity_tree_row_new ();
}
if (toggles && column_count == 0)
--
2.40.0

View File

@ -1,6 +1,6 @@
Name: zenity
Version: 3.91.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Display dialog boxes from shell scripts
License: LGPL-2.1-or-later
@ -11,6 +11,17 @@ Source: https://download.gnome.org/sources/%{name}/3.91/%{name}-%{version
# Fix crash caused by trying to set responses that aren't there
# when --no-cancel and/or --auto-close are used
Patch0: 0001-progress-don-t-update-responses-that-aren-t-there.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2184783
# https://gitlab.gnome.org/GNOME/zenity/-/issues/54
# https://gitlab.gnome.org/GNOME/zenity/-/merge_requests/26
# https://gitlab.gnome.org/GNOME/zenity/-/merge_requests/27
# Set 'heading' not 'title' for AdwMessageDialog, fix parsing multiple
# tree rows from stdin
Patch1: 0001-Set-dialog-heading-not-title.patch
Patch2: 0001-tree-fix-handling-of-multi-row-stdin-input-54.patch
# https://gitlab.gnome.org/GNOME/zenity/-/merge_requests/28
# Fix errors shown on console when mousing over items in tree views
Patch3: 0001-tree-column-view-don-t-steal-children.patch
BuildRequires: pkgconfig(libadwaita-1) >= 1.2
BuildRequires: /usr/bin/help2man
@ -59,6 +70,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Zenity.desk
%changelog
* Thu Apr 20 2023 Adam Williamson <awilliam@redhat.com> - 3.91.0-3
- Backport MRs #26 and #27 to fix bugs in tree views (#2184783)
- Backport MR #28 to fix some console error spam
* Thu Apr 20 2023 Adam Williamson <awilliam@redhat.com> - 3.91.0-2
- Backport MR #25 for crash when --no-cancel and/or --auto-close are used (#2177287)