From: Colin Clark Date: Sun, 10 Sep 2017 18:24:20 +0000 (+0100) Subject: Save Collection window geometry X-Git-Tag: v1.4~94 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=babefee67961a4c6c9dd8e66c5bca4a6fd979e07 Save Collection window geometry Previously collection window geometry was preserved only when an explicit save was made. This patch ensures the window position is always saved, unless the window has unsaved data. --- diff --git a/src/collect-table.c b/src/collect-table.c index 3eed2e04..75be016e 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -2502,6 +2502,16 @@ static void collection_table_destroy(GtkWidget *widget, gpointer data) { CollectTable *ct = data; + /* If there is no unsaved data, save the window geometry + */ + if (!ct->cd->changed) + { + if (!collection_save(ct->cd, ct->cd->path)) + { + log_printf("failed saving to collection path: %s\n", ct->cd->path); + } + } + if (ct->popup) { g_signal_handlers_disconnect_matched(G_OBJECT(ct->popup), G_SIGNAL_MATCH_DATA, diff --git a/src/collect.c b/src/collect.c index 358091ba..94cfab10 100644 --- a/src/collect.c +++ b/src/collect.c @@ -1194,19 +1194,39 @@ void collection_window_close_by_collection(CollectionData *cd) if (cw) collection_window_close_final(cw); } +/** + * @brief Check if any Collection windows have unsaved data + * @returns TRUE if unsaved data exists + * + * Also saves window geometry for Collection windows that have + * no unsaved data + */ gboolean collection_window_modified_exists(void) { GList *work; + gboolean ret; + + ret = FALSE; work = collection_window_list; while (work) { CollectWindow *cw = work->data; - if (cw->cd->changed) return TRUE; + if (cw->cd->changed) + { + ret = TRUE; + } + else + { + if (!collection_save(cw->table->cd, cw->table->cd->path)) + { + log_printf("failed saving to collection path: %s\n", cw->table->cd->path); + } + } work = work->next; } - return FALSE; + return ret; } static gboolean collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)