}
}
+static gint window_list_sort_cb(gconstpointer a, gconstpointer b)
+{
+ return CASE_SORT((gchar *)a, (gchar *)b);
+}
+
+GString *layout_get_window_list()
+{
+ LayoutWindow *lw;
+ GList *work;
+ GList *window_list = nullptr;
+ GString *ret = g_string_new(nullptr);
+
+ work = layout_window_list;
+ while (work)
+ {
+ lw = static_cast<LayoutWindow *>(work->data);
+ window_list = g_list_insert_sorted(window_list, g_strdup(lw->options.id), window_list_sort_cb);
+ work = work->next;
+ }
+
+ work = g_list_first(window_list);
+ g_string_append_printf(ret, "%s", (gchar *)work->data);
+ work = work->next;
+
+ while (work)
+ {
+ g_string_append_printf(ret, "\n%s", (gchar *)work->data);
+ work = work->next;
+ }
+
+ g_list_free(window_list);
+
+ return ret;
+}
+
/*
*-----------------------------------------------------------------------------
* menu, toolbar, and dir view
FileData *layout_list_get_fd(LayoutWindow *lw, gint index);
gint layout_list_get_index(LayoutWindow *lw, FileData *fd);
void layout_list_sync_fd(LayoutWindow *lw, FileData *fd);
+GString *layout_get_window_list();
GList *layout_selection_list(LayoutWindow *lw);
/* return list of pointers to int for selection */
g_free(filename);
}
+static void gr_window_list(const gchar *, GIOChannel *channel, gpointer)
+{
+ GString *window_list;
+
+ window_list = layout_get_window_list();
+
+ g_io_channel_write_chars(channel, window_list->str, -1, nullptr, nullptr);
+ g_io_channel_write_chars(channel, "<gq_end_of_command>", -1, nullptr, nullptr);
+
+ g_string_free(window_list, TRUE);
+}
+
static void gr_get_sidecars(const gchar *text, GIOChannel *channel, gpointer)
{
gchar *filename = expand_tilde(text);
{ nullptr, "--get-render-intent", gr_render_intent, FALSE, FALSE, nullptr, N_("get render intent") },
{ nullptr, "--get-selection", gr_get_selection, FALSE, FALSE, nullptr, N_("get list of selected files") },
{ nullptr, "--get-sidecars:", gr_get_sidecars, TRUE, FALSE, N_("<FILE>"), N_("get list of sidecars of FILE") },
+ { nullptr, "--get-window-list", gr_window_list, FALSE, FALSE, nullptr, N_("get window list") },
{ nullptr, "--id:", gr_lw_id, TRUE, FALSE, N_("<ID>"), N_("window id for following commands") },
{ nullptr, "--last", gr_image_last, FALSE, FALSE, nullptr, N_("last image") },
{ nullptr, "--list-add:", gr_list_add, TRUE, FALSE, N_("<FILE>"), N_("add FILE to command line collection list") },