summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Bícha <jeremy.bicha@canonical.com>2023-08-10 14:14:33 -0400
committerJeremy Bícha <jeremy.bicha@canonical.com>2023-08-10 14:14:33 -0400
commit1b96d51275d1d913188767ed74c874ef5dedd2e4 (patch)
treeaaa1a66d3397c5b03be6e6ae9af8f54aa9386453 /src
parentNew upstream version 3.44.0 (diff)
parent3.44.2 (diff)
downloadzenity-1b96d51275d1d913188767ed74c874ef5dedd2e4.tar.gz
zenity-1b96d51275d1d913188767ed74c874ef5dedd2e4.tar.bz2
zenity-1b96d51275d1d913188767ed74c874ef5dedd2e4.zip
New upstream version 3.44.2
Diffstat (limited to 'src')
-rw-r--r--src/msg.c18
-rw-r--r--src/tree.c8
-rw-r--r--src/util.c12
-rw-r--r--src/zenity.h9
4 files changed, 39 insertions, 8 deletions
diff --git a/src/msg.c b/src/msg.c
index 92651525..641dad6c 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -199,8 +199,24 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
gtk_window_set_default_size (
GTK_WINDOW (dialog), data->width, data->height);
- if (data->width > -1)
+ if (data->width > -1) {
gtk_widget_set_size_request (GTK_WIDGET (text), data->width, -1);
+
+ if (!msg_data->no_wrap) {
+ /* Minimum width */
+ gtk_label_set_width_chars (GTK_LABEL(text), 10);
+
+ /* If we don't set max-width-chars, gtk may set the natural width
+ * of the label to be wider than what we want for the window. So we
+ * want to set it to something relatively small, because,
+ * according to TFM, even if max_width_chars is set to anything
+ * other than -1, for wrapping labels the label will still be
+ * rewrapped to use all of the available width. So we'll just set
+ * it to the same value as width-chars for posterity.
+ */
+ gtk_label_set_max_width_chars (GTK_LABEL(text), 10);
+ }
+ }
else if (!msg_data->ellipsize && !msg_data->no_wrap) {
/* The magic number 60 is taken from gtk+/gtk/ui/gtkmessagedialog.ui
with 10 as a minimum width. */
diff --git a/src/tree.c b/src/tree.c
index 7d98ad2d..d3efe573 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -642,10 +642,10 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
tree_data->editable);
}
- /* GTK will automatically pick the image column as the search column
- * despite it not containing any user readable text.
- * Set it to second column instead if it exists. */
- if (tree_data->imagebox && n_columns > 1) {
+ /* GTK will automatically pick the image/checkbox/radiobox column as the
+ * search column despite it not containing any user readable text.
+ * Set it to second column instead if any of the above exists. */
+ if ((tree_data->imagebox || tree_data->radiobox || tree_data->checkbox) && n_columns > 1) {
gtk_tree_view_set_search_column (GTK_TREE_VIEW (tree_view),
1);
}
diff --git a/src/util.c b/src/util.c
index 2887fd96..a242526a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -49,6 +49,14 @@
#define ZENITY_ERROR_DEFAULT -1
#define ZENITY_EXTRA_DEFAULT 127
+/* This exit code number is arbitrary, but since for the entire 3.x release
+ * cycle, zenity would essentially exit(ZENITY_TIMEOUT), which happened to be
+ * defined as 5 based on where it was placed in the enum sequence. So
+ * hardcoding it as 5 now in case any pre-existing scripts relied upon that
+ * being the exit status for timeouts.
+ */
+#define ZENITY_TIMEOUT_DEFAULT 5
+
GtkBuilder *
zenity_util_load_ui_file (const gchar *root_widget, ...) {
va_list args;
@@ -298,7 +306,7 @@ zenity_util_return_exit_code (ZenityExitCode value) {
if (!env_var)
env_var = g_getenv ("DIALOG_TIMEOUT");
if (!env_var)
- retval = ZENITY_TIMEOUT;
+ retval = ZENITY_TIMEOUT_DEFAULT;
break;
default:
@@ -412,7 +420,7 @@ zenity_util_timeout_handle (gpointer data) {
gtk_dialog_response (dialog, ZENITY_TIMEOUT);
else {
gtk_main_quit ();
- exit (ZENITY_TIMEOUT);
+ exit (ZENITY_TIMEOUT_DEFAULT);
}
return FALSE;
}
diff --git a/src/zenity.h b/src/zenity.h
index 404eec77..c50a76bd 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -33,7 +33,14 @@ typedef enum {
ZENITY_ESC,
ZENITY_ERROR,
ZENITY_EXTRA,
- ZENITY_TIMEOUT
+ /* Previously, this was not specified to any value, which could cause it to
+ * clash with the custom response ID that happened to match it. We could set
+ * this to a negative value tha doesn't clash with one of GtkDialog's
+ * predefined response ID's as it's doubtful GTK will ever extend the GtkDialog
+ * API at this stage -- but technically negative values are reserved for the
+ * library and positive values for applications, according to gtkdialog.c
+ */
+ ZENITY_TIMEOUT = INT_MAX
} ZenityExitCode;
typedef struct {
bgstack15