summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2016-07-09 22:50:50 +0200
committerZenWalker <[email protected]>2016-07-10 03:06:03 +0200
commit83e41d48744bac1503b75036f347a740a964804d (patch)
tree3898b2c32236024342cad89ea27b39fe6832e3b6 /src/main.c
parent1c4f7a65536c801a4fc25b920163ffdbc3aa5bb9 (diff)
downloadengrampa-83e41d48744bac1503b75036f347a740a964804d.tar.bz2
engrampa-83e41d48744bac1503b75036f347a740a964804d.tar.xz
replace WindowList with gtk_application_get_windows
file-roller commit: https://git.gnome.org/browse/file-roller/commit/?id=f4f31f1c9e897fe32114d2ef1b21e232231c3a3b
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/src/main.c b/src/main.c
index b1058ce..bec746f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,7 +33,6 @@
#include "fr-init.h"
-GList *WindowList = NULL;
gint ForceDirectoryCreation;
static char **remaining_args;
@@ -241,9 +240,11 @@ activate_cb (GApplication *application)
{
GList *link;
- for (link = WindowList; link; link = link->next) {
- FrWindow *window = link->data;
- gtk_widget_show (GTK_WIDGET (window));
+ for (link = gtk_application_get_windows (GTK_APPLICATION (application));
+ link != NULL;
+ link = link->next)
+ {
+ gtk_widget_show (GTK_WIDGET (link->data));
}
}
@@ -253,9 +254,9 @@ fr_save_state (EggSMClient *client, GKeyFile *state, gpointer user_data)
{
/* discard command is automatically set by EggSMClient */
- GList *window;
- const char *argv[2] = { NULL };
- guint i;
+ const char *argv[2] = { NULL };
+ GApplication *application;
+ guint i = 0;
/* restart command */
argv[0] = program_argv0;
@@ -264,21 +265,30 @@ fr_save_state (EggSMClient *client, GKeyFile *state, gpointer user_data)
egg_sm_client_set_restart_command (client, 1, argv);
/* state */
- for (window = WindowList, i = 0; window; window = window->next, i++) {
- FrWindow *session = window->data;
- gchar *key;
-
- key = g_strdup_printf ("archive%d", i);
- if ((session->archive == NULL) || (session->archive->file == NULL)) {
- g_key_file_set_string (state, "Session", key, "");
- } else {
- gchar *uri;
-
- uri = g_file_get_uri (session->archive->file);
- g_key_file_set_string (state, "Session", key, uri);
- g_free (uri);
+ application = g_application_get_default ();
+ if (application != NULL) {
+ GList *window;
+
+ for (window = gtk_application_get_windows (GTK_APPLICATION (application)), i = 0;
+ window != NULL;
+ window = window->next, i++)
+ {
+ FrWindow *session = window->data;
+ gchar *key;
+
+ key = g_strdup_printf ("archive%d", i);
+ if ((session->archive == NULL) || (session->archive->file == NULL)) {
+ g_key_file_set_string (state, "Session", key, "");
+ }
+ else {
+ gchar *uri;
+
+ uri = g_file_get_uri (session->archive->file);
+ g_key_file_set_string (state, "Session", key, uri);
+ g_free (uri);
+ }
+ g_free (key);
}
- g_free (key);
}
g_key_file_set_integer (state, "Session", "archives", i);