Skip to content

Instantly share code, notes, and snippets.

@holishing
Created June 12, 2022 08:40
Show Gist options
  • Save holishing/397bb2304ccbe41653de6dd9aab66cae to your computer and use it in GitHub Desktop.
Save holishing/397bb2304ccbe41653de6dd9aab66cae to your computer and use it in GitHub Desktop.
hack it and let Zenity run on Win32
From 5f77c68c183febcd20060e9531bbee88d4bb6de3 Mon Sep 17 00:00:00 2001
From: r2 <[email protected]>
Date: Sun, 12 Jun 2022 16:36:41 +0800
Subject: [PATCH] work around
HEAD: https://gitlab.gnome.org/GNOME/zenity/-/tree/d3b2a8728d11e3b0466bc7a1abc0c7a9794d5135
---
meson.build | 4 +++-
meson_post_install.py | 13 +++++++------
src/main.c | 2 +-
src/option.c | 20 ++++++++++----------
src/option.h | 2 +-
src/progress.c | 6 +++---
6 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/meson.build b/meson.build
index 6f28790..9b97044 100644
--- a/meson.build
+++ b/meson.build
@@ -41,7 +41,7 @@ zenity_conf.set('DEBUG', get_option('debug'))
check_headers = [
'sys/types.h',
'unistd.h',
- 'langinfo.h',
+ #'langinfo.h',
'locale.h'
]
@@ -87,6 +87,8 @@ if perl.found()
zenity_conf.set('PERL', perl.path())
endif
+add_global_link_arguments('-static',language:'c')
+
configure_file(
output: 'config.h',
configuration: zenity_conf
diff --git a/meson_post_install.py b/meson_post_install.py
index 2654e49..8012a87 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -7,9 +7,10 @@ prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = os.path.join(prefix, 'share')
# Packaging tools define DESTDIR and this isn't needed for them
-if 'DESTDIR' not in os.environ:
- print('Updating icon cache...')
- icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
- if not os.path.exists(icon_cache_dir):
- os.makedirs(icon_cache_dir)
- subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
+#if 'DESTDIR' not in os.environ:
+# print('Updating icon cache...')
+# icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
+# if not os.path.exists(icon_cache_dir):
+# os.makedirs(icon_cache_dir)
+# subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
+
diff --git a/src/main.c b/src/main.c
index 18b2a72..48e9421 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,7 +28,7 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <langinfo.h>
+//#include <langinfo.h>
#include <stdlib.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
diff --git a/src/option.c b/src/option.c
index 61df34d..ade538a 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1415,11 +1415,11 @@ zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group,
results->calendar_data->month = zenity_calendar_month;
results->calendar_data->year = zenity_calendar_year;
- if (zenity_calendar_date_format)
- results->calendar_data->date_format = zenity_calendar_date_format;
- else
- results->calendar_data->date_format =
- g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
+ //if (zenity_calendar_date_format)
+ results->calendar_data->date_format = zenity_calendar_date_format;
+ //else
+ // results->calendar_data->date_format =
+ // g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
} else {
if (zenity_calendar_day > -1)
@@ -1840,11 +1840,11 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
values = zenity_forms_combo_values[++i];
}
}
- if (zenity_forms_date_format)
- results->forms_data->date_format = zenity_forms_date_format;
- else
- results->forms_data->date_format =
- g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
+ //if (zenity_forms_date_format)
+ results->forms_data->date_format = zenity_forms_date_format;
+ //else
+ // results->forms_data->date_format =
+ // g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
} else {
if (zenity_forms_date_format)
zenity_option_error (zenity_option_get_name (forms_dialog_options,
diff --git a/src/option.h b/src/option.h
index b495e0e..5d620f8 100644
--- a/src/option.h
+++ b/src/option.h
@@ -25,7 +25,7 @@
#include "zenity.h"
#include <glib.h>
-#include <langinfo.h>
+//#include <langinfo.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
diff --git a/src/progress.c b/src/progress.c
index 00bb8aa..d9637cb 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -430,9 +430,9 @@ zenity_progress_dialog_response (
But we want to give people the option to choose this behavior.
-- Monday 27, March 2006
*/
- if (autokill) {
- kill (getppid (), 1);
- }
+ //if (autokill) {
+ // kill (getppid (), 1);
+ //}
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
--
2.36.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment