ew = g_new0(ExifWin, 1);
- ew->window = window_new(GTK_WINDOW_TOPLEVEL, "view", nullptr, nullptr, _("Metadata"));
+ ew->window = window_new("view", nullptr, nullptr, _("Metadata"));
DEBUG_NAME(ew->window);
geometry.min_width = 900;
}
}
+static void expander_height_cb(GtkWindow *widget, GdkEvent *, gpointer)
+{
+ gq_gtk_widget_destroy(GTK_WIDGET(widget));
+}
+
static void bar_expander_height_cb(GtkWidget *, gpointer data)
{
auto expander = static_cast<GtkWidget *>(data);
list = gtk_container_get_children(GTK_CONTAINER(expander));
data_box = static_cast<GtkWidget *>(list->data);
- window = gtk_window_new(GTK_WINDOW_POPUP);
+#ifdef HAVE_GTK4
+ window = gtk_window_new();
+#else
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+#endif
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+ gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
gq_gtk_window_set_keep_above(GTK_WINDOW(window), TRUE);
gtk_window_set_default_size(GTK_WINDOW(window), 50, 30); //** @FIXME set these values in a more sensible way */
+ g_signal_connect(window, "key-press-event", G_CALLBACK(expander_height_cb), nullptr);
gtk_window_move(GTK_WINDOW(window), x, y);
gtk_widget_show(window);
cw->cd = collection_new(path);
- cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, nullptr, nullptr);
+ cw->window = window_new("collection", PIXBUF_INLINE_ICON_BOOK, nullptr, nullptr);
DEBUG_NAME(cw->window);
geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
ew = g_new0(EditorWindow, 1);
- ew->window = window_new(GTK_WINDOW_TOPLEVEL, "Desktop", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Desktop file"));
+ ew->window = window_new("Desktop", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Desktop file"));
DEBUG_NAME(ew->window);
gtk_window_set_type_hint(GTK_WINDOW(ew->window), GDK_WINDOW_TYPE_HINT_DIALOG);
editor_list_window = ewl = g_new0(EditorListWindow, 1);
- ewl->window = window_new(GTK_WINDOW_TOPLEVEL, "editors", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Plugins"));
+ ewl->window = window_new("editors", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Plugins"));
DEBUG_NAME(ewl->window);
gtk_window_set_type_hint(GTK_WINDOW(ewl->window), GDK_WINDOW_TYPE_HINT_DIALOG);
g_signal_connect(G_OBJECT(ewl->window), "delete_event",
if (options->duplicates_match == DUPE_MATCH_NAME_CI_CONTENT) dw->match_mask = DUPE_MATCH_NAME_CI_CONTENT;
if (options->duplicates_match == DUPE_MATCH_ALL) dw->match_mask = DUPE_MATCH_ALL;
- dw->window = window_new(GTK_WINDOW_TOPLEVEL, "dupe", nullptr, nullptr, _("Find duplicates"));
+ dw->window = window_new("dupe", nullptr, nullptr, _("Find duplicates"));
DEBUG_NAME(dw->window);
geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
fullscreen_prefs_get_geometry(options->fullscreen.screen, window, &x, &y, &w, &h,
&screen, &fs->same_region);
- fs->window = window_new(GTK_WINDOW_TOPLEVEL, "fullscreen", nullptr, nullptr, _("Full screen"));
+ fs->window = window_new("fullscreen", nullptr, nullptr, _("Full screen"));
DEBUG_NAME(fs->window);
g_signal_connect(G_OBJECT(fs->window), "delete_event",
vw = g_new0(ViewWindow, 1);
- vw->window = window_new(GTK_WINDOW_TOPLEVEL, "view", PIXBUF_INLINE_ICON_VIEW, nullptr, nullptr);
+ vw->window = window_new("view", PIXBUF_INLINE_ICON_VIEW, nullptr, nullptr);
DEBUG_NAME(vw->window);
geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
GdkGeometry geometry;
GdkWindowHints hints;
- lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, nullptr, _("Tools"));
+ lw->tools = window_new("tools", PIXBUF_INLINE_ICON_TOOLS, nullptr, _("Tools"));
DEBUG_NAME(lw->tools);
g_signal_connect(G_OBJECT(lw->tools), "delete_event",
G_CALLBACK(layout_tools_delete_cb), lw);
layout_sync_options_with_current_state(lw);
copy_layout_options(&lc->options, &lw->options);
- lc->configwindow = window_new(GTK_WINDOW_TOPLEVEL, "Layout", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Window options and layout"));
+ lc->configwindow = window_new("Layout", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Window options and layout"));
DEBUG_NAME(lc->configwindow);
gtk_window_set_type_hint(GTK_WINDOW(lc->configwindow), GDK_WINDOW_TYPE_HINT_DIALOG);
/* window */
- lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_APPNAME_LC, nullptr, nullptr, nullptr);
+ lw->window = window_new(GQ_APPNAME_LC, nullptr, nullptr, nullptr);
DEBUG_NAME(lw->window);
gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE);
gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0);
logwin = g_new0(LogWindow, 1);
- window = window_new(GTK_WINDOW_TOPLEVEL, "log", nullptr, nullptr, _("Log"));
+ window = window_new("log", nullptr, nullptr, _("Log"));
DEBUG_NAME(window);
win_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
gq_gtk_container_add(GTK_WIDGET(window), win_vbox);
pw->idle_id = 0;
- pw->window = window_new(GTK_WINDOW_TOPLEVEL, "panview", nullptr, nullptr, _("Pan View"));
+ pw->window = window_new("panview", nullptr, nullptr, _("Pan View"));
DEBUG_NAME(pw->window);
geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
if (!c_options) c_options = init_options(nullptr);
- configwindow = window_new(GTK_WINDOW_TOPLEVEL, "preferences", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Preferences"));
+ configwindow = window_new("preferences", PIXBUF_INLINE_ICON_CONFIG, nullptr, _("Preferences"));
DEBUG_NAME(configwindow);
gtk_window_set_type_hint(GTK_WINDOW(configwindow), GDK_WINDOW_TYPE_HINT_DIALOG);
g_signal_connect(G_OBJECT(configwindow), "delete_event",
sd->search_similarity_path = g_strdup(example_file->path);
}
- sd->window = window_new(GTK_WINDOW_TOPLEVEL, "search", nullptr, nullptr, _("Image search"));
+ sd->window = window_new("search", nullptr, nullptr, _("Image search"));
DEBUG_NAME(sd->window);
gtk_window_set_resizable(GTK_WINDOW(sd->window), TRUE);
/* window */
- window = window_new(GTK_WINDOW_TOPLEVEL, subclass, nullptr, nullptr, title);
+ window = window_new(subclass, nullptr, nullptr, title);
DEBUG_NAME(window);
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
gtk_window_set_default_size(GTK_WINDOW(window), HELP_WINDOW_WIDTH, HELP_WINDOW_HEIGHT);
gd->data = data;
gd->cancel_cb = cancel_cb;
- gd->dialog = window_new(GTK_WINDOW_TOPLEVEL, role, nullptr, nullptr, title);
+ gd->dialog = window_new(role, nullptr, nullptr, title);
DEBUG_NAME(gd->dialog);
gtk_window_set_type_hint(GTK_WINDOW(gd->dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
#include "ui-misc.h"
#include "ui-utildlg.h"
-GtkWidget *window_new(GtkWindowType type, const gchar *role, const gchar *icon,
- const gchar *icon_file, const gchar *subtitle)
+GtkWidget *window_new(const gchar *role, const gchar *icon, const gchar *icon_file, const gchar *subtitle)
{
gchar *title;
GtkWidget *window;
- window = gtk_window_new(type);
+#ifdef HAVE_GTK4
+ window = gtk_window_new();
+#else
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+#endif
if (!window) return nullptr;
if (subtitle)
#ifndef WINDOW_H
#define WINDOW_H
-GtkWidget *window_new(GtkWindowType type, const gchar *role, const gchar *icon,
+GtkWidget *window_new(const gchar *role, const gchar *icon,
const gchar *icon_file, const gchar *subtitle);
void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file);
gboolean window_maximized(GtkWidget *window);