# HG changeset patch
# Node ID e70c3c1ceb66
# Parent  7f0fbe7e68d6
diff --git a/demo/talkatudemo.c b/demo/talkatudemo.c
--- a/demo/talkatudemo.c
+++ b/demo/talkatudemo.c
@@ -86,11 +86,7 @@
 	textdomain(GETTEXT_PACKAGE);
 
 	app = gtk_application_new("org.imfreedom.keep.talkatu.TalkatuDemo",
-#if GLIB_CHECK_VERSION(2,74,0)
 	                          G_APPLICATION_DEFAULT_FLAGS);
-#else
-	                          G_APPLICATION_FLAGS_NONE);
-#endif
 	g_application_add_main_option_entries(G_APPLICATION(app), entries);
 
 	g_signal_connect(app, "handle-local-options",
diff --git a/demo/talkatudemowindow.c b/demo/talkatudemowindow.c
--- a/demo/talkatudemowindow.c
+++ b/demo/talkatudemowindow.c
@@ -47,7 +47,6 @@
 
 G_DEFINE_TYPE(TalkatuDemoWindow, talkatu_demo_window, GTK_TYPE_APPLICATION_WINDOW);
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 static void
 talkatu_demo_window_insert_html_response_cb(GObject *obj, GAsyncResult *result,
                                             gpointer data)
@@ -84,45 +83,12 @@
 
 	g_object_unref(file);
 }
-#else
-static void
-talkatu_demo_window_insert_html_response_cb(GtkNativeDialog *dialog,
-                                            gint response, gpointer data)
-{
-	TalkatuDemoWindow *window = TALKATU_DEMO_WINDOW(data);
-
-	if(response == GTK_RESPONSE_ACCEPT) {
-		GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog));
-		gchar *contents = NULL;
-		gsize len;
-
-		if(g_file_load_contents(file, NULL, &contents, &len, NULL, NULL)) {
-			GtkTextMark *mark = NULL;
-			GtkTextIter iter;
-
-			mark = gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(window->buffer_html));
-			gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(window->buffer_html),
-			                                 &iter, mark);
-
-			talkatu_markup_insert_html(TALKATU_BUFFER(window->buffer_html),
-			                           &iter, contents, len);
-			g_free(contents);
-		}
-
-		g_object_unref(file);
-	}
-
-	gtk_native_dialog_destroy(dialog);
-	g_object_unref(dialog);
-}
-#endif
 
 static void
 talkatu_demo_window_insert_html_cb(G_GNUC_UNUSED GtkButton *toggle,
                                    gpointer data) {
 	TalkatuDemoWindow *window = TALKATU_DEMO_WINDOW(data);
 	GtkFileFilter *filter = NULL;
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkFileDialog *dialog = NULL;
 	GListStore *store = NULL;
 
@@ -141,31 +107,8 @@
 	                     talkatu_demo_window_insert_html_response_cb,
 	                     window);
 
-#else
-	GtkFileChooserNative *dialog = NULL;
-
-	dialog = gtk_file_chooser_native_new(
-		_("Insert html..."),
-		GTK_WINDOW(window),
-		GTK_FILE_CHOOSER_ACTION_OPEN,
-		"OK",
-		"Cancel"
-	);
-
-	filter = gtk_file_filter_new();
-	gtk_file_filter_set_name(filter, "HTML files");
-	gtk_file_filter_add_pattern(filter, "*.html");
-	gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
-
-	g_signal_connect(dialog, "response",
-	                 G_CALLBACK(talkatu_demo_window_insert_html_response_cb),
-	                 window);
-	gtk_native_dialog_set_modal(GTK_NATIVE_DIALOG(dialog), TRUE);
-	gtk_native_dialog_show(GTK_NATIVE_DIALOG(dialog));
-#endif
 }
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 static void
 talkatu_demo_window_insert_markdown_response_cb(GObject *obj,
                                                 GAsyncResult *result,
@@ -203,45 +146,12 @@
 
 	g_object_unref(file);
 }
-#else
-static void
-talkatu_demo_window_insert_markdown_response_cb(GtkNativeDialog *dialog,
-                                                gint response, gpointer data)
-{
-	TalkatuDemoWindow *window = TALKATU_DEMO_WINDOW(data);
-
-	if(response == GTK_RESPONSE_ACCEPT) {
-		GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog));
-		gchar *contents = NULL;
-		gsize len;
-
-		if(g_file_load_contents(file, NULL, &contents, &len, NULL, NULL)) {
-			GtkTextMark *mark = NULL;
-			GtkTextIter iter;
-
-			mark = gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(window->buffer_markdown));
-			gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(window->buffer_markdown),
-			                                 &iter, mark);
-
-			talkatu_markdown_insert(TALKATU_BUFFER(window->buffer_markdown),
-			                        &iter, contents, len);
-			g_free(contents);
-		}
-
-		g_object_unref(file);
-	}
-
-	gtk_native_dialog_destroy(dialog);
-	g_object_unref(dialog);
-}
-#endif
 
 static void
 talkatu_demo_window_insert_markdown_cb(G_GNUC_UNUSED GtkButton *toggle,
                                        gpointer data) {
 	TalkatuDemoWindow *window = TALKATU_DEMO_WINDOW(data);
 	GtkFileFilter *filter = NULL;
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkFileDialog *dialog = NULL;
 	GListStore *store = NULL;
 
@@ -259,28 +169,6 @@
 	gtk_file_dialog_open(dialog, GTK_WINDOW(window), NULL,
 	                     talkatu_demo_window_insert_markdown_response_cb,
 	                     window);
-#else
-	GtkFileChooserNative *dialog = NULL;
-
-	dialog = gtk_file_chooser_native_new(
-		_("Insert markdown..."),
-		GTK_WINDOW(window),
-		GTK_FILE_CHOOSER_ACTION_OPEN,
-		"OK",
-		"Cancel"
-	);
-
-	filter = gtk_file_filter_new();
-	gtk_file_filter_set_name(filter, "Markdown files");
-	gtk_file_filter_add_pattern(filter, "*.md");
-	gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
-
-	g_signal_connect(dialog, "response",
-	                 G_CALLBACK(talkatu_demo_window_insert_markdown_response_cb),
-	                 window);
-	gtk_native_dialog_set_modal(GTK_NATIVE_DIALOG(dialog), TRUE);
-	gtk_native_dialog_show(GTK_NATIVE_DIALOG(dialog));
-#endif
 }
 
 static void
@@ -327,15 +215,11 @@
 talkatu_demo_window_view_open_url_cb(G_GNUC_UNUSED TalkatuView *view,
                                      const gchar *url, gpointer data)
 {
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkUriLauncher *launcher = NULL;
 
 	launcher = gtk_uri_launcher_new(url);
 	gtk_uri_launcher_launch(launcher, GTK_WINDOW(data), NULL, NULL, NULL);
 	g_object_unref(launcher);
-#else
-	gtk_show_uri(GTK_WINDOW(data), url, GDK_CURRENT_TIME);
-#endif
 }
 
 static void
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -34,10 +34,10 @@
 gnome = import('gnome')
 pkgconfig = import('pkgconfig')
 
-GLIB = dependency('glib-2.0', version : '>=2.52.0')
+GLIB = dependency('glib-2.0', version : '>=2.76.0')
 GOBJECT = dependency('gobject-2.0')
 
-GTK4 = dependency('gtk4', version : '>=4.6.0')
+GTK4 = dependency('gtk4', version : '>=4.10.0')
 
 GUMBO = dependency('gumbo', version : '>=0.10')
 
diff --git a/talkatu/talkatuactiongroup.c b/talkatu/talkatuactiongroup.c
--- a/talkatu/talkatuactiongroup.c
+++ b/talkatu/talkatuactiongroup.c
@@ -394,7 +394,6 @@
 	g_object_unref(dialog);
 }
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 static void
 talkatu_action_attach_file_response_cb(GObject *obj, GAsyncResult *result,
                                        gpointer data)
@@ -440,47 +439,6 @@
 	                 data);
 	gtk_window_present(GTK_WINDOW(attach_dialog));
 }
-#else
-static void
-talkatu_action_attach_file_response_cb(GtkDialog *dialog, gint response,
-                                       gpointer data)
-{
-	if(response == GTK_RESPONSE_ACCEPT) {
-		TalkatuActionGroup *ag = TALKATU_ACTION_GROUP(data);
-		TalkatuActionGroupPrivate *priv = NULL;
-		TalkatuAttachment *attachment = NULL;
-		GtkWidget *attach_dialog = NULL;
-		GFile *file = NULL;
-		gchar *filename = NULL, *content_type = NULL, *comment = NULL;
-
-		priv = talkatu_action_group_get_instance_private(ag);
-
-		file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog));
-		filename = g_file_get_path(file);
-		content_type = g_content_type_guess(filename, NULL, 0, NULL);
-
-		attachment = talkatu_simple_attachment_new(G_GUINT64_CONSTANT(0),
-		                                           content_type);
-		g_free(content_type);
-
-		talkatu_attachment_set_local_uri(attachment, filename);
-		g_free(filename);
-		g_object_unref(file);
-
-		comment = talkatu_markup_get_html(priv->buffer, NULL);
-		attach_dialog = talkatu_attachment_dialog_new(attachment, comment);
-		g_free(comment);
-
-		g_signal_connect(G_OBJECT(attach_dialog), "response",
-		                 G_CALLBACK(talkatu_action_attach_file_attach_response_cb),
-		                 data);
-		gtk_widget_show(attach_dialog);
-	}
-
-	gtk_native_dialog_destroy(GTK_NATIVE_DIALOG(dialog));
-	g_object_unref(dialog);
-}
-#endif
 
 static void
 talkatu_action_attach_file(G_GNUC_UNUSED GSimpleAction *action,
@@ -489,32 +447,16 @@
 {
 	TalkatuActionGroup *ag = TALKATU_ACTION_GROUP(data);
 	TalkatuActionGroupPrivate *priv = NULL;
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkFileDialog *dialog = NULL;
-#else
-	GtkFileChooserNative *dialog = NULL;
-#endif
 
 	priv = talkatu_action_group_get_instance_private(ag);
 	g_return_if_fail(TALKATU_IS_INPUT(priv->input));
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 	dialog = gtk_file_dialog_new();
 	gtk_file_dialog_set_title(dialog, _("Attach file..."));
 	gtk_file_dialog_open(dialog, NULL, NULL,
 	                     talkatu_action_attach_file_response_cb,
 	                     ag);
-#else
-	dialog = gtk_file_chooser_native_new(_("Attach file..."),
-	                                     NULL,
-	                                     GTK_FILE_CHOOSER_ACTION_OPEN,
-	                                     _("Open"),
-	                                     _("Cancel"));
-	g_signal_connect(G_OBJECT(dialog), "response",
-	                 G_CALLBACK(talkatu_action_attach_file_response_cb),
-	                 ag);
-	gtk_native_dialog_show(GTK_NATIVE_DIALOG(dialog));
-#endif
 }
 
 static void
