[gnome-builder] app: simplify preferences action



commit 2fc7c4fbad57bab1d45c3abb8369b529f4ae7b23
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 8 00:04:52 2015 -0700

    app: simplify preferences action

 src/app/gb-application-actions.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/src/app/gb-application-actions.c b/src/app/gb-application-actions.c
index 29ca446..476a460 100644
--- a/src/app/gb-application-actions.c
+++ b/src/app/gb-application-actions.c
@@ -36,32 +36,23 @@ gb_application_actions_preferences (GSimpleAction *action,
                                     gpointer       user_data)
 {
   GbApplication *self = user_data;
-  GbPreferencesWindow *window;
-  GbWorkbench *workbench = NULL;
-  GList *list;
 
   IDE_ENTRY;
 
   g_assert (GB_IS_APPLICATION (self));
 
-  if (self->preferences_window)
+  if (self->preferences_window == NULL)
     {
-      gtk_window_present (GTK_WINDOW (self->preferences_window));
-      return;
-    }
-
-  list = gtk_application_get_windows (GTK_APPLICATION (self));
-
-  for (; list; list = list->next)
-    if (GB_IS_WORKBENCH (list->data))
-      workbench = GB_WORKBENCH (list->data);
+      GbPreferencesWindow *window;
 
-  window = g_object_new (GB_TYPE_PREFERENCES_WINDOW,
-                         "transient-for", workbench,
-                         NULL);
-  ide_set_weak_pointer (&self->preferences_window, window);
+      window = g_object_new (GB_TYPE_PREFERENCES_WINDOW,
+                             "type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
+                             "window-position", GTK_WIN_POS_CENTER,
+                             NULL);
+      ide_set_weak_pointer (&self->preferences_window, window);
+    }
 
-  gtk_window_present (GTK_WINDOW (window));
+  gtk_window_present (GTK_WINDOW (self->preferences_window));
 
   IDE_EXIT;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]