summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fr-window.c8
-rw-r--r--src/fr-window.h4
-rw-r--r--src/main.c37
3 files changed, 29 insertions, 20 deletions
diff --git a/src/fr-window.c b/src/fr-window.c
index df03e6c..1ddc30e 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -244,7 +244,7 @@ enum {
LAST_SIGNAL
};
-static GtkWindowClass *parent_class = NULL;
+static GtkApplicationWindowClass *parent_class = NULL;
static guint fr_window_signals[LAST_SIGNAL] = { 0 };
struct _FrWindowPrivateData {
@@ -673,8 +673,6 @@ fr_window_finalize (GObject *object)
g_hash_table_destroy (tree_pixbuf_hash);
tree_pixbuf_hash = NULL;
}
-
- gtk_main_quit ();
}
}
@@ -837,7 +835,7 @@ fr_window_get_type (void)
(GInstanceInitFunc) fr_window_init
};
- type = g_type_register_static (GTK_TYPE_WINDOW,
+ type = g_type_register_static (GTK_TYPE_APPLICATION_WINDOW,
"FrWindow",
&type_info,
0);
@@ -6065,7 +6063,7 @@ fr_window_new (void)
{
GtkWidget *window;
- window = g_object_new (FR_TYPE_WINDOW, NULL);
+ window = g_object_new (FR_TYPE_WINDOW, "application", g_application_get_default (), NULL);
fr_window_construct ((FrWindow*) window);
return window;
diff --git a/src/fr-window.h b/src/fr-window.h
index 826dc33..53b769c 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -82,14 +82,14 @@ typedef struct _FrWindowPrivateData FrWindowPrivateData;
struct _FrWindow
{
- GtkWindow __parent;
+ GtkApplicationWindow __parent;
FrArchive *archive;
FrWindowPrivateData *priv;
};
struct _FrWindowClass
{
- GtkWindowClass __parent_class;
+ GtkApplicationWindowClass __parent_class;
/*<signals>*/
diff --git a/src/main.c b/src/main.c
index 5859318..b1058ce 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,8 +44,6 @@ static int extract;
static int extract_here;
static char *default_url = NULL;
-static guint startup_id = 0;
-
/* argv[0] from main(); used as the command to restart the program */
static const char *program_argv0 = NULL;
@@ -141,7 +139,7 @@ prepare_app (void)
/**/
if (remaining_args == NULL) { /* No archive specified. */
- gtk_widget_show (fr_window_new ());
+ fr_window_new ();
return;
}
@@ -216,7 +214,6 @@ prepare_app (void)
char *uri;
window = fr_window_new ();
- gtk_widget_show (window);
file = g_file_new_for_commandline_arg (filename);
uri = g_file_get_uri (file);
@@ -231,16 +228,23 @@ prepare_app (void)
}
-static gboolean
-startup_cb (gpointer data)
+static void
+startup_cb (GApplication *application)
{
- g_source_remove (startup_id);
- startup_id = 0;
-
initialize_data ();
prepare_app ();
+}
+
+
+static void
+activate_cb (GApplication *application)
+{
+ GList *link;
- return FALSE;
+ for (link = WindowList; link; link = link->next) {
+ FrWindow *window = link->data;
+ gtk_widget_show (GTK_WIDGET (window));
+ }
}
@@ -280,12 +284,15 @@ fr_save_state (EggSMClient *client, GKeyFile *state, gpointer user_data)
g_key_file_set_integer (state, "Session", "archives", i);
}
+
int
main (int argc, char **argv)
{
GOptionContext *context = NULL;
GError *error = NULL;
+ GtkApplication *app = NULL;
EggSMClient *client = NULL;
+ int status;
program_argv0 = argv[0];
@@ -318,9 +325,13 @@ main (int argc, char **argv)
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
PKG_DATA_DIR G_DIR_SEPARATOR_S "icons");
- startup_id = g_idle_add (startup_cb, NULL);
- gtk_main ();
+ app = gtk_application_new ("org.mate.engrampa", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect (app, "startup", G_CALLBACK (startup_cb), NULL);
+ g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
+
+ status = g_application_run (G_APPLICATION (app), argc, argv);
+
release_data ();
- return 0;
+ return status;
}