[gnome-control-center] universal-access: Parent zoom options to panel



commit f60e2fa4aefb0ea4ab8fc53cfd42cd2422a98aaf
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jan 21 14:25:45 2012 +0000

    universal-access: Parent zoom options to panel

 panels/universal-access/cc-ua-panel.c   |    7 ++++---
 panels/universal-access/zoom-options.c  |   22 ++++++++++++++--------
 panels/universal-access/zoom-options.h  |    4 +++-
 panels/universal-access/zoom-options.ui |    2 --
 4 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 9582e84..81c9f8d 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -49,7 +49,7 @@ struct _CcUaPanelPrivate
   GSettings *application_settings;
   GSettings *mediakeys_settings;
 
-  GObject *zoom_options;
+  ZoomOptions *zoom_options;
 };
 
 
@@ -205,10 +205,11 @@ static void
 zoom_options_launch_cb (GtkWidget *options_button, CcUaPanel *self)
 {
   if (self->priv->zoom_options == NULL)
-    self->priv->zoom_options = g_object_new (ZOOM_TYPE_OPTIONS, NULL);
+    self->priv->zoom_options = zoom_options_new ();
 
   if (self->priv->zoom_options != NULL)
-    zoom_options_present_dialog (ZOOM_OPTIONS (self->priv->zoom_options));
+    zoom_options_set_parent (self->priv->zoom_options,
+			     GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
 }
 
 static void
diff --git a/panels/universal-access/zoom-options.c b/panels/universal-access/zoom-options.c
index fe1bcd1..89b4bea 100644
--- a/panels/universal-access/zoom-options.c
+++ b/panels/universal-access/zoom-options.c
@@ -475,8 +475,7 @@ zoom_options_init (ZoomOptions *self)
 
   /* ... Window itself ... */
   priv->dialog = WID ("magPrefsDialog");
-  gtk_window_set_position (GTK_WINDOW (priv->dialog),
-                           GTK_WIN_POS_CENTER);
+
   w = WID ("closeButton");
   g_signal_connect (G_OBJECT (w), "clicked",
                     G_CALLBACK (zoom_option_close_dialog_cb),
@@ -486,21 +485,28 @@ zoom_options_init (ZoomOptions *self)
                     NULL);
 
   pango_attr_list_unref (pango_attrs);
-
-  zoom_options_present_dialog (self);
 }
 
 /**
- * zoom_options_present_dialog:
+ * zoom_options_set_parent:
  * @self: the #ZoomOptions object
+ * @parent: the parent #GtkWindow
  *
  * Activate the dialog associated with this ZoomOptions.
  */
 void
-zoom_options_present_dialog (ZoomOptions *self)
+zoom_options_set_parent (ZoomOptions *self,
+			 GtkWindow   *parent)
 {
   g_return_if_fail (ZOOM_IS_OPTIONS (self));
 
-  if (self->priv->dialog != NULL)
-    gtk_window_present (GTK_WINDOW (self->priv->dialog));
+  gtk_window_set_transient_for (GTK_WINDOW (self->priv->dialog), parent);
+  gtk_window_set_modal (GTK_WINDOW (self->priv->dialog), TRUE);
+  gtk_widget_show (self->priv->dialog);
+}
+
+ZoomOptions *
+zoom_options_new (void)
+{
+  return g_object_new (ZOOM_TYPE_OPTIONS, NULL);
 }
diff --git a/panels/universal-access/zoom-options.h b/panels/universal-access/zoom-options.h
index 89941aa..0dd5485 100644
--- a/panels/universal-access/zoom-options.h
+++ b/panels/universal-access/zoom-options.h
@@ -66,7 +66,9 @@ struct _ZoomOptions
 
 GType zoom_options_get_type (void) G_GNUC_CONST;
 
-void zoom_options_present_dialog (ZoomOptions *self);
+ZoomOptions *zoom_options_new    (void);
+void zoom_options_set_parent (ZoomOptions *self,
+			      GtkWindow   *parent);
 
 G_END_DECLS
 
diff --git a/panels/universal-access/zoom-options.ui b/panels/universal-access/zoom-options.ui
index b9bc89b..ef3dac7 100644
--- a/panels/universal-access/zoom-options.ui
+++ b/panels/universal-access/zoom-options.ui
@@ -21,8 +21,6 @@
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Zoom Options</property>
     <property name="resizable">False</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="type_hint">normal</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>



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