1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| | Fix the build of Transmission 4.0.5:
https://github.com/transmission/transmission/issues/6392
Patches copied from upstream pull request:
https://github.com/transmission/transmission/pull/6393
From 64b0933e713c725867ba5817bd197d668923161e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C5=93ur?= <coeur@gmx.fr>
Date: Sun, 17 Dec 2023 00:11:11 +0100
Subject: [PATCH] build fix get_files2 behind IF_GTKMM4_10
---
gtk/GtkCompat.h | 6 ++++++
gtk/OptionsDialog.cc | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gtk/GtkCompat.h b/gtk/GtkCompat.h
index 34d1bbe22dd..6dde2a5ef8b 100644
--- a/gtk/GtkCompat.h
+++ b/gtk/GtkCompat.h
@@ -44,6 +44,12 @@
#define IF_GTKMM4(ThenValue, ElseValue) ElseValue
#endif
+#if GTKMM_CHECK_VERSION(4, 10, 0)
+#define IF_GTKMM4_10(ThenValue, ElseValue) ThenValue
+#else
+#define IF_GTKMM4_10(ThenValue, ElseValue) ElseValue
+#endif
+
#if GLIBMM_CHECK_VERSION(2, 68, 0)
#define IF_GLIBMM2_68(ThenValue, ElseValue) ThenValue
#else
diff --git a/gtk/OptionsDialog.cc b/gtk/OptionsDialog.cc
index 08198540c10..bff4286286a 100644
--- a/gtk/OptionsDialog.cc
+++ b/gtk/OptionsDialog.cc
@@ -338,7 +338,7 @@ void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<S
bool const do_prompt = get_choice(std::string(ShowOptionsDialogChoice)) == "true";
bool const do_notify = false;
- auto const files = IF_GTKMM4(get_files2, get_files)();
+ auto const files = IF_GTKMM4_10(get_files2, get_files)();
g_assert(!files.empty());
/* remember this folder the next time we use this dialog */
From 49ce9ab1d59347a529dcbfcc378b7423d13750e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C5=93ur?= <coeur@gmx.fr>
Date: Sun, 17 Dec 2023 02:54:33 +0100
Subject: [PATCH] code review: revert bd31d805003909bd5927f26a02eb60b78a82355b
---
gtk/GtkCompat.h | 6 ------
gtk/OptionsDialog.cc | 11 ++++++++++-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/gtk/GtkCompat.h b/gtk/GtkCompat.h
index 6dde2a5ef8b..34d1bbe22dd 100644
--- a/gtk/GtkCompat.h
+++ b/gtk/GtkCompat.h
@@ -44,12 +44,6 @@
#define IF_GTKMM4(ThenValue, ElseValue) ElseValue
#endif
-#if GTKMM_CHECK_VERSION(4, 10, 0)
-#define IF_GTKMM4_10(ThenValue, ElseValue) ThenValue
-#else
-#define IF_GTKMM4_10(ThenValue, ElseValue) ElseValue
-#endif
-
#if GLIBMM_CHECK_VERSION(2, 68, 0)
#define IF_GLIBMM2_68(ThenValue, ElseValue) ThenValue
#else
diff --git a/gtk/OptionsDialog.cc b/gtk/OptionsDialog.cc
index bff4286286a..8c28fc76f98 100644
--- a/gtk/OptionsDialog.cc
+++ b/gtk/OptionsDialog.cc
@@ -338,7 +338,16 @@ void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<S
bool const do_prompt = get_choice(std::string(ShowOptionsDialogChoice)) == "true";
bool const do_notify = false;
- auto const files = IF_GTKMM4_10(get_files2, get_files)();
+#if GTKMM_CHECK_VERSION(4, 0, 0)
+ auto files = std::vector<Glib::RefPtr<Gio::File>>();
+ auto files_model = get_files();
+ for (auto i = guint{ 0 }; i < files_model->get_n_items(); ++i)
+ {
+ files.push_back(gtr_ptr_dynamic_cast<Gio::File>(files_model->get_object(i)));
+ }
+#else
+ auto const files = get_files();
+#endif
g_assert(!files.empty());
/* remember this folder the next time we use this dialog */
|