[nautilus] application: simplify code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] application: simplify code
- Date: Mon, 23 Apr 2012 14:19:10 +0000 (UTC)
commit d311ddd4a68f349c797a59e19868e4bb939d69a1
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Apr 22 16:32:16 2012 -0400
application: simplify code
Move handling of delete-event inside NautilusWindow
src/nautilus-application.c | 48 +++++--------------------------------------
src/nautilus-window.c | 3 ++
2 files changed, 9 insertions(+), 42 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 8dbad83..d85d14b 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -459,47 +459,6 @@ nautilus_application_close_all_windows (NautilusApplication *self)
}
static gboolean
-nautilus_window_delete_event_callback (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (widget);
- nautilus_window_close (window);
-
- return TRUE;
-}
-
-
-static NautilusWindow *
-create_window (NautilusApplication *application,
- GdkScreen *screen)
-{
- NautilusWindow *window;
-
- g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
-
- window = g_object_new (NAUTILUS_TYPE_WINDOW,
- "screen", screen,
- NULL);
-
- g_signal_connect_data (window, "delete_event",
- G_CALLBACK (nautilus_window_delete_event_callback), NULL, NULL,
- G_CONNECT_AFTER);
-
- gtk_application_add_window (GTK_APPLICATION (application),
- GTK_WINDOW (window));
-
- /* Do not yet show the window. It will be shown later on if it can
- * successfully display its initial URI. Otherwise it will be destroyed
- * without ever having seen the light of day.
- */
-
- return window;
-}
-
-static gboolean
another_navigation_window_already_showing (NautilusApplication *application,
NautilusWindow *the_window)
{
@@ -525,7 +484,12 @@ nautilus_application_create_window (NautilusApplication *application,
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
- window = create_window (application, screen);
+ window = g_object_new (NAUTILUS_TYPE_WINDOW,
+ "screen", screen,
+ NULL);
+
+ gtk_application_add_window (GTK_APPLICATION (application),
+ GTK_WINDOW (window));
maximized = g_settings_get_boolean
(nautilus_window_state, NAUTILUS_WINDOW_STATE_MAXIMIZED);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index fb7e9c3..b742684 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -544,6 +544,9 @@ nautilus_window_constructed (GObject *self)
G_OBJECT_CLASS (nautilus_window_parent_class)->constructed (self);
+ g_signal_connect_after (window, "delete-event",
+ G_CALLBACK (nautilus_window_close), NULL);
+
grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
gtk_widget_show (grid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]