[gnome-control-center] display: convert display capplet to a settings panel



commit 8836316161e4bbdc3b353183a439bda074aa8eeb
Author: Thomas Wood <thomas wood intel com>
Date:   Mon Jun 7 16:51:11 2010 +0100

    display: convert display capplet to a settings panel
    
    Add CcPanel and module implmenetation for the display settings.

 capplets/Makefile.am                               |    5 +-
 capplets/display/build.sh                          |    1 -
 configure.ac                                       |    4 +-
 panels/Makefile.am                                 |    8 +-
 {capplets => panels}/display/Makefile.am           |   31 ++--
 {capplets => panels}/display/TODO                  |    0
 panels/display/cc-display-panel.c                  |  114 ++++++++++++++
 panels/display/cc-display-panel.h                  |   74 +++++++++
 {capplets => panels}/display/display-capplet.ui    |  108 ++++---------
 panels/display/display-module.c                    |   41 +++++
 {capplets => panels}/display/foo-marshal.c         |    0
 {capplets => panels}/display/foo-marshal.h         |    0
 .../display/gnome-display-panel.desktop.in.in      |    3 +-
 .../gnome-display-properties-install-systemwide.c  |    0
 .../icons/16x16/preferences-desktop-display.png    |  Bin 613 -> 613 bytes
 .../icons/22x22/preferences-desktop-display.png    |  Bin 866 -> 866 bytes
 .../icons/24x24/preferences-desktop-display.png    |  Bin 909 -> 909 bytes
 .../icons/32x32/preferences-desktop-display.png    |  Bin 1602 -> 1602 bytes
 .../icons/scalable/preferences-desktop-display.svg |    0
 .../display/org.gnome.randr.policy.in              |    0
 {capplets => panels}/display/scrollarea.c          |    0
 {capplets => panels}/display/scrollarea.h          |    0
 {capplets => panels}/display/xrandr-capplet.c      |  158 ++++++++------------
 panels/display/xrandr-capplet.h                    |    3 +
 po/POTFILES.in                                     |   10 +-
 po/POTFILES.skip                                   |    2 +-
 26 files changed, 363 insertions(+), 199 deletions(-)
---
diff --git a/capplets/Makefile.am b/capplets/Makefile.am
index 58cb7db..1e6bc02 100644
--- a/capplets/Makefile.am
+++ b/capplets/Makefile.am
@@ -1,12 +1,11 @@
 SUBDIRS = \
 	common			\
-	appearance		\
-	display
+	appearance
+
 
 DIST_SUBDIRS = \
 	common			\
 	appearance		\
-	display 		\
 	about-me
 
 
diff --git a/configure.ac b/configure.ac
index d75b4ef..f31edf4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,8 +382,8 @@ panels/default-applications/gnome-default-applications-panel.desktop.in
 panels/default-applications/gnome-at-commandline.in
 panels/default-applications/gnome-at-session.desktop.in
 panels/default-applications/gnome-default-applications.pc
-capplets/display/Makefile
-capplets/display/display-properties.desktop.in
+panels/display/Makefile
+panels/display/gnome-display-panel.desktop.in
 panels/keybindings/Makefile
 panels/keybindings/gnome-keybindings.pc
 panels/keybindings/gnome-keybindings-panel.desktop.in
diff --git a/panels/Makefile.am b/panels/Makefile.am
index 653f3e1..22aa0d9 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -1 +1,7 @@
-SUBDIRS=mouse keyboard network default-applications keybindings universal-access
+SUBDIRS=display \
+	mouse \
+	keyboard \
+	network \
+	default-applications \
+	keybindings \
+	universal-access
diff --git a/capplets/display/Makefile.am b/panels/display/Makefile.am
similarity index 84%
rename from capplets/display/Makefile.am
rename to panels/display/Makefile.am
index f994480..8c565b2 100644
--- a/capplets/display/Makefile.am
+++ b/panels/display/Makefile.am
@@ -4,21 +4,24 @@ cappletname = display
 uidir = $(pkgdatadir)/ui
 dist_ui_DATA = display-capplet.ui
 
-bin_PROGRAMS = gnome-display-properties
-
-sbin_PROGRAMS = gnome-display-properties-install-systemwide
-
-gnome_display_properties_SOURCES =	\
-	xrandr-capplet.c		\
-	scrollarea.c			\
-	foo-marshal.c			\
-	scrollarea.h			\
+ccpanelsdir = $(PANELS_DIR)
+ccpanels_LTLIBRARIES = libdisplay.la
+
+libdisplay_la_SOURCES = 	\
+	display-module.c	\
+	cc-display-panel.c	\
+	cc-display-panel.h	\
+	xrandr-capplet.c	\
+	xrandr-capplet.h	\
+	scrollarea.c		\
+	foo-marshal.c		\
+	scrollarea.h		\
 	foo-marshal.h
 
-gnome_display_properties_LDFLAGS = -export-dynamic
-gnome_display_properties_LDADD = \
-	$(top_builddir)/capplets/common/libcommon.la \
-	$(DISPLAY_CAPPLET_LIBS)
+libdisplay_la_LIBADD = $(PANEL_LIBS)
+libdisplay_la_LDFLAGS = $(PANEL_LDFLAGS) $(DISPLAY_CAPPLET_LIBS)
+
+sbin_PROGRAMS = gnome-display-properties-install-systemwide
 
 gnome_display_properties_install_systemwide_SOURCES =	\
 	gnome-display-properties-install-systemwide.c
@@ -48,7 +51,7 @@ iconssvgdir = $(datadir)/icons/hicolor/scalable/apps
 dist_iconssvg_DATA = icons/scalable/preferences-desktop-display.svg
 
 desktopdir = $(datadir)/applications
-Desktop_in_files = display-properties.desktop.in
+Desktop_in_files = gnome-display-panel.desktop.in
 desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
 
 INCLUDES   = $(DISPLAY_CAPPLET_CFLAGS) \
diff --git a/capplets/display/TODO b/panels/display/TODO
similarity index 100%
rename from capplets/display/TODO
rename to panels/display/TODO
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
new file mode 100644
index 0000000..342a780
--- /dev/null
+++ b/panels/display/cc-display-panel.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include "cc-display-panel.h"
+
+#include "xrandr-capplet.h"
+
+G_DEFINE_DYNAMIC_TYPE (CcDisplayPanel, cc_display_panel, CC_TYPE_PANEL)
+
+#define DISPLAY_PANEL_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DISPLAY_PANEL, CcDisplayPanelPrivate))
+
+struct _CcDisplayPanelPrivate
+{
+  gpointer dummy;
+};
+
+
+static void
+cc_display_panel_get_property (GObject    *object,
+                               guint       property_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_display_panel_set_property (GObject      *object,
+                               guint         property_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_display_panel_dispose (GObject *object)
+{
+  G_OBJECT_CLASS (cc_display_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_display_panel_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (cc_display_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_display_panel_class_init (CcDisplayPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcDisplayPanelPrivate));
+
+  object_class->get_property = cc_display_panel_get_property;
+  object_class->set_property = cc_display_panel_set_property;
+  object_class->dispose = cc_display_panel_dispose;
+  object_class->finalize = cc_display_panel_finalize;
+}
+
+static void
+cc_display_panel_class_finalize (CcDisplayPanelClass *klass)
+{
+}
+
+static void
+cc_display_panel_init (CcDisplayPanel *self)
+{
+  GtkWidget *widget;
+
+  self->priv = DISPLAY_PANEL_PRIVATE (self);
+
+  widget = run_application ();
+
+  gtk_widget_show (widget);
+  gtk_container_add (GTK_CONTAINER (self), widget);
+}
+
+void
+cc_display_panel_register (GIOModule *module)
+{
+  cc_display_panel_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+                                  CC_TYPE_DISPLAY_PANEL,
+                                  "display", 0);
+}
+
diff --git a/panels/display/cc-display-panel.h b/panels/display/cc-display-panel.h
new file mode 100644
index 0000000..92e93bd
--- /dev/null
+++ b/panels/display/cc-display-panel.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+
+#ifndef _CC_DISPLAY_PANEL_H
+#define _CC_DISPLAY_PANEL_H
+
+#include <libgnome-control-center/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_DISPLAY_PANEL cc_display_panel_get_type()
+
+#define CC_DISPLAY_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_DISPLAY_PANEL, CcDisplayPanel))
+
+#define CC_DISPLAY_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_DISPLAY_PANEL, CcDisplayPanelClass))
+
+#define CC_IS_DISPLAY_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_DISPLAY_PANEL))
+
+#define CC_IS_DISPLAY_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_DISPLAY_PANEL))
+
+#define CC_DISPLAY_PANEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_DISPLAY_PANEL, CcDisplayPanelClass))
+
+typedef struct _CcDisplayPanel CcDisplayPanel;
+typedef struct _CcDisplayPanelClass CcDisplayPanelClass;
+typedef struct _CcDisplayPanelPrivate CcDisplayPanelPrivate;
+
+struct _CcDisplayPanel
+{
+  CcPanel parent;
+
+  CcDisplayPanelPrivate *priv;
+};
+
+struct _CcDisplayPanelClass
+{
+  CcPanelClass parent_class;
+};
+
+GType cc_display_panel_get_type (void) G_GNUC_CONST;
+
+void  cc_display_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_DISPLAY_PANEL_H */
diff --git a/capplets/display/display-capplet.ui b/panels/display/display-capplet.ui
similarity index 88%
rename from capplets/display/display-capplet.ui
rename to panels/display/display-capplet.ui
index 82ed92b..981aabd 100644
--- a/capplets/display/display-capplet.ui
+++ b/panels/display/display-capplet.ui
@@ -2,16 +2,32 @@
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkDialog" id="dialog">
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Monitor Preferences</property>
-    <property name="type_hint">dialog</property>
-    <property name="has_separator">False</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox1">
+  <object class="GtkListStore" id="rotation-liststore">
+    <columns>
+      <!-- column-name item -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Normal</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Left</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Right</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Upside-down</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkWindow" id="window1">
+    <child>
+      <object class="GtkVBox" id="display-panel">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">6</property>
         <child>
           <object class="GtkTable" id="table2">
             <property name="visible">True</property>
@@ -123,6 +139,7 @@
                 <property name="right_attach">2</property>
                 <property name="top_attach">1</property>
                 <property name="bottom_attach">2</property>
+                <property name="y_options">GTK_FILL</property>
               </packing>
             </child>
             <child>
@@ -272,7 +289,7 @@
                     <child>
                       <object class="GtkComboBox" id="rotation_combo">
                         <property name="visible">True</property>
-                        <property name="model">liststore1</property>
+                        <property name="model">rotation-liststore</property>
                         <child>
                           <object class="GtkCellRendererText" id="cellrenderertext1"/>
                           <attributes>
@@ -331,30 +348,15 @@
             </child>
           </object>
           <packing>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
+        <child>
+          <object class="GtkHButtonBox" id="hbuttonbox1">
             <property name="visible">True</property>
+            <property name="spacing">6</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="helpbutton1">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkButton" id="make_default_button">
                 <property name="label" translatable="yes">Make Default</property>
                 <property name="visible">True</property>
@@ -365,7 +367,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
@@ -374,64 +376,22 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button2">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
+                <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-11">helpbutton1</action-widget>
-      <action-widget response="1">make_default_button</action-widget>
-      <action-widget response="-10">apply_button</action-widget>
-      <action-widget response="-7">button2</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkListStore" id="liststore1">
-    <columns>
-      <!-- column-name item -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Normal</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Left</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Right</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Upside-down</col>
-      </row>
-    </data>
   </object>
 </interface>
diff --git a/panels/display/display-module.c b/panels/display/display-module.c
new file mode 100644
index 0000000..e8127c9
--- /dev/null
+++ b/panels/display/display-module.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-display-panel.h"
+
+#include <glib/gi18n.h>
+
+void
+g_io_module_load (GIOModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+  /* register the panel */
+  cc_display_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/capplets/display/foo-marshal.c b/panels/display/foo-marshal.c
similarity index 100%
rename from capplets/display/foo-marshal.c
rename to panels/display/foo-marshal.c
diff --git a/capplets/display/foo-marshal.h b/panels/display/foo-marshal.h
similarity index 100%
rename from capplets/display/foo-marshal.h
rename to panels/display/foo-marshal.h
diff --git a/capplets/display/display-properties.desktop.in.in b/panels/display/gnome-display-panel.desktop.in.in
similarity index 85%
rename from capplets/display/display-properties.desktop.in.in
rename to panels/display/gnome-display-panel.desktop.in.in
index 8351c76..5073f88 100644
--- a/capplets/display/display-properties.desktop.in.in
+++ b/panels/display/gnome-display-panel.desktop.in.in
@@ -1,7 +1,7 @@
 [Desktop Entry]
 _Name=Monitors
 _Comment=Change resolution and position of monitors
-Exec=gnome-display-properties
+Exec=gnome-control-center display
 Icon=preferences-desktop-display
 Terminal=false
 Type=Application
@@ -12,3 +12,4 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
 X-GNOME-Bugzilla-Product=gnome-control-center
 X-GNOME-Bugzilla-Component=Screen resolution
 X-GNOME-Bugzilla-Version= VERSION@
+X-GNOME-Settings-Panel=display
diff --git a/capplets/display/gnome-display-properties-install-systemwide.c b/panels/display/gnome-display-properties-install-systemwide.c
similarity index 100%
rename from capplets/display/gnome-display-properties-install-systemwide.c
rename to panels/display/gnome-display-properties-install-systemwide.c
diff --git a/capplets/display/icons/16x16/preferences-desktop-display.png b/panels/display/icons/16x16/preferences-desktop-display.png
similarity index 100%
rename from capplets/display/icons/16x16/preferences-desktop-display.png
rename to panels/display/icons/16x16/preferences-desktop-display.png
diff --git a/capplets/display/icons/22x22/preferences-desktop-display.png b/panels/display/icons/22x22/preferences-desktop-display.png
similarity index 100%
rename from capplets/display/icons/22x22/preferences-desktop-display.png
rename to panels/display/icons/22x22/preferences-desktop-display.png
diff --git a/capplets/display/icons/24x24/preferences-desktop-display.png b/panels/display/icons/24x24/preferences-desktop-display.png
similarity index 100%
rename from capplets/display/icons/24x24/preferences-desktop-display.png
rename to panels/display/icons/24x24/preferences-desktop-display.png
diff --git a/capplets/display/icons/32x32/preferences-desktop-display.png b/panels/display/icons/32x32/preferences-desktop-display.png
similarity index 100%
rename from capplets/display/icons/32x32/preferences-desktop-display.png
rename to panels/display/icons/32x32/preferences-desktop-display.png
diff --git a/capplets/display/icons/scalable/preferences-desktop-display.svg b/panels/display/icons/scalable/preferences-desktop-display.svg
similarity index 100%
rename from capplets/display/icons/scalable/preferences-desktop-display.svg
rename to panels/display/icons/scalable/preferences-desktop-display.svg
diff --git a/capplets/display/org.gnome.randr.policy.in b/panels/display/org.gnome.randr.policy.in
similarity index 100%
rename from capplets/display/org.gnome.randr.policy.in
rename to panels/display/org.gnome.randr.policy.in
diff --git a/capplets/display/scrollarea.c b/panels/display/scrollarea.c
similarity index 100%
rename from capplets/display/scrollarea.c
rename to panels/display/scrollarea.c
diff --git a/capplets/display/scrollarea.h b/panels/display/scrollarea.h
similarity index 100%
rename from capplets/display/scrollarea.h
rename to panels/display/scrollarea.h
diff --git a/capplets/display/xrandr-capplet.c b/panels/display/xrandr-capplet.c
similarity index 96%
rename from capplets/display/xrandr-capplet.c
rename to panels/display/xrandr-capplet.c
index c4aedd8..9ba1f1a 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/panels/display/xrandr-capplet.c
@@ -35,6 +35,8 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
 
+#include "xrandr-capplet.h"
+
 typedef struct App App;
 typedef struct GrabInfo GrabInfo;
 
@@ -45,7 +47,9 @@ struct App
     GnomeRRLabeler *labeler;
     GnomeOutputInfo         *current_output;
 
-    GtkWidget	   *dialog;
+    GtkBuilder     *builder;
+
+    GtkWidget	   *panel;
     GtkWidget      *current_monitor_event_box;
     GtkWidget      *current_monitor_label;
     GtkWidget      *monitor_on_radio;
@@ -96,9 +100,15 @@ static gboolean output_info_supports_mode (App *app, GnomeOutputInfo *info, int
 static void
 error_message (App *app, const char *primary_text, const char *secondary_text)
 {
+    GtkWidget *toplevel;
     GtkWidget *dialog;
 
-    dialog = gtk_message_dialog_new ((app && app->dialog) ? GTK_WINDOW (app->dialog) : NULL,
+    if (app && app->panel)
+        toplevel = gtk_widget_get_toplevel (app->panel);
+    else
+        toplevel = NULL;
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
 				     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 				     GTK_MESSAGE_ERROR,
 				     GTK_BUTTONS_CLOSE,
@@ -2047,7 +2057,7 @@ apply_configuration_returned_cb (DBusGProxy       *proxy,
     app->connection = NULL;
     app->proxy_call = NULL;
 
-    gtk_widget_set_sensitive (app->dialog, TRUE);
+    gtk_widget_set_sensitive (app->panel, TRUE);
 }
 
 static gboolean
@@ -2078,6 +2088,7 @@ static void
 apply (App *app)
 {
     GError *error = NULL;
+    GdkWindow *window;
 
     if (!sanitize_and_save_configuration (app))
 	return;
@@ -2093,9 +2104,12 @@ apply (App *app)
 	return;
     }
 
-    gtk_widget_set_sensitive (app->dialog, FALSE);
+    gtk_widget_set_sensitive (app->panel, FALSE);
 
-    begin_version2_apply_configuration (app, gtk_widget_get_window (app->dialog), app->apply_button_clicked_timestamp);
+    window = gtk_widget_get_window (gtk_widget_get_toplevel (app->panel));
+
+    begin_version2_apply_configuration (app, window,
+                                        app->apply_button_clicked_timestamp);
 }
 
 #if 0
@@ -2253,8 +2267,13 @@ get_output_for_window (GnomeRRConfig *configuration, GdkWindow *window)
 static void
 select_current_output_from_dialog_position (App *app)
 {
-    if (gtk_widget_get_realized (app->dialog))
-	app->current_output = get_output_for_window (app->current_configuration, gtk_widget_get_window (app->dialog));
+    GtkWidget *toplevel;
+
+    toplevel = gtk_widget_get_toplevel (app->panel);
+
+    if (gtk_widget_get_realized (toplevel))
+	app->current_output = get_output_for_window (app->current_configuration,
+                                                     gtk_widget_get_window (toplevel));
     else
 	app->current_output = NULL;
 
@@ -2274,31 +2293,6 @@ dialog_map_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer data)
     return FALSE;
 }
 
-static void
-hide_help_button (App *app)
-{
-    GtkWidget *action_area;
-    GList *children;
-    GList *l;
-
-    action_area = gtk_dialog_get_action_area (GTK_DIALOG (app->dialog));
-    children = gtk_container_get_children (GTK_CONTAINER (action_area));
-
-    for (l = children; l; l = l->next)
-    {
-	GtkWidget *child;
-	int response;
-
-	child = GTK_WIDGET (l->data);
-
-	response = gtk_dialog_get_response_for_widget (GTK_DIALOG (app->dialog), child);
-	if (response == GTK_RESPONSE_HELP)
-	{
-	    gtk_widget_hide (child);
-	    return;
-	}
-    }
-}
 
 static void
 apply_button_clicked_cb (GtkButton *button, gpointer data)
@@ -2317,8 +2311,11 @@ static void
 success_dialog_for_make_default (App *app)
 {
     GtkWidget *dialog;
+    GtkWidget *toplevel;
+
+    toplevel = gtk_widget_get_toplevel (app->panel);
 
-    dialog = gtk_message_dialog_new (GTK_WINDOW (app->dialog),
+    dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
 				     GTK_DIALOG_MODAL,
 				     GTK_MESSAGE_INFO,
 				     GTK_BUTTONS_OK,
@@ -2375,7 +2372,17 @@ _gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
 }
 
 static void
-run_application (App *app)
+destroy_app (App *app)
+{
+    gnome_rr_screen_destroy (app->screen);
+    g_object_unref (app->client);
+    g_object_unref (app->builder);
+
+    g_free (app);
+}
+
+GtkWidget*
+run_application ()
 {
 #ifndef UIDIR
 #define UIDIR "."
@@ -2384,16 +2391,20 @@ run_application (App *app)
     GtkBuilder *builder;
     GtkWidget *align;
     GError *error;
+    gchar *objects[] = {"display-panel", "rotation-liststore", NULL};
+    App *app;
+
+    app = g_new0 (App, 1);
 
     error = NULL;
-    builder = gtk_builder_new ();
+    app->builder = builder = gtk_builder_new ();
 
-    if (gtk_builder_add_from_file (builder, UI_FILE, &error) == 0)
+    if (!gtk_builder_add_objects_from_file (builder, UI_FILE, objects, &error))
     {
 	g_warning ("Could not parse UI definition: %s", error->message);
 	g_error_free (error);
 	g_object_unref (builder);
-	return;
+	return NULL;
     }
 
     app->screen = gnome_rr_screen_new (gdk_screen_get_default (),
@@ -2403,18 +2414,17 @@ run_application (App *app)
 	error_message (NULL, _("Could not get screen information"), error->message);
 	g_error_free (error);
 	g_object_unref (builder);
-	return;
+	return NULL;
     }
 
     app->client = gconf_client_get_default ();
 
-    app->dialog = _gtk_builder_get_widget (builder, "dialog");
-    g_signal_connect_after (app->dialog, "map-event",
-			    G_CALLBACK (dialog_map_event_cb), app);
+    app->panel = _gtk_builder_get_widget (builder, "display-panel");
 
-    gtk_window_set_default_icon_name ("preferences-desktop-display");
-    gtk_window_set_icon_name (GTK_WINDOW (app->dialog),
-			      "preferences-desktop-display");
+    if (!app->panel)
+      g_warning ("Missing display-panel object");
+    g_signal_connect_after (app->panel, "map-event",
+			    G_CALLBACK (dialog_map_event_cb), app);
 
     app->current_monitor_event_box = _gtk_builder_get_widget (builder,
     						   "current_monitor_event_box");
@@ -2485,68 +2495,22 @@ run_application (App *app)
 
     gtk_container_add (GTK_CONTAINER (align), app->area);
 
-    /* Until we have help to show, we'll just hide the Help button */
-    hide_help_button (app);
-
     app->apply_button = _gtk_builder_get_widget (builder, "apply_button");
     g_signal_connect (app->apply_button, "clicked",
 		      G_CALLBACK (apply_button_clicked_cb), app);
 
     on_screen_changed (app->screen, app);
 
-    g_object_unref (builder);
+    g_signal_connect_swapped (_gtk_builder_get_widget (builder, "apply_button"),
+                              "clicked", G_CALLBACK (apply), app);
+    g_signal_connect_swapped (_gtk_builder_get_widget (builder,
+                                                       "make_default_button"),
+                              "clicked", G_CALLBACK (make_default), app);
 
-restart:
-    switch (gtk_dialog_run (GTK_DIALOG (app->dialog)))
-    {
-    default:
-	/* Fall Through */
-    case GTK_RESPONSE_DELETE_EVENT:
-    case GTK_RESPONSE_CLOSE:
-#if 0
-	g_debug ("Close");
-#endif
-	break;
+    g_object_weak_ref (G_OBJECT (app->panel), (GWeakNotify) destroy_app, app);
 
-    case GTK_RESPONSE_HELP:
-#if 0
-	g_debug ("Help");
-#endif
-	goto restart;
-	break;
-
-    case GTK_RESPONSE_APPLY:
-	apply (app);
-	goto restart;
-	break;
-
-    case RESPONSE_MAKE_DEFAULT:
-	make_default (app);
-	goto restart;
-	break;
-    }
 
-    gtk_widget_destroy (app->dialog);
-    gnome_rr_screen_destroy (app->screen);
-    g_object_unref (app->client);
+    return app->panel;
 }
 
-int
-main (int argc, char **argv)
-{
-    App *app;
-
-    bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
-    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-    textdomain (GETTEXT_PACKAGE);
-
-    gtk_init (&argc, &argv);
 
-    app = g_new0 (App, 1);
-
-    run_application (app);
-
-    g_free (app);
-
-    return 0;
-}
diff --git a/panels/display/xrandr-capplet.h b/panels/display/xrandr-capplet.h
new file mode 100644
index 0000000..72251f3
--- /dev/null
+++ b/panels/display/xrandr-capplet.h
@@ -0,0 +1,3 @@
+
+GtkWidget* run_application ();
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b4c4cbd..72176fb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -38,11 +38,11 @@ panels/default-applications/gnome-at-session.desktop.in.in
 panels/default-applications/gnome-da-capplet.c
 [type: gettext/glade]panels/default-applications/gnome-default-applications-properties.ui
 panels/default-applications/gnome-default-applications.xml.in
-[type: gettext/glade]capplets/display/display-capplet.ui
-capplets/display/display-properties.desktop.in.in
-capplets/display/gnome-display-properties-install-systemwide.c
-capplets/display/org.gnome.randr.policy.in
-capplets/display/xrandr-capplet.c
+[type: gettext/glade]panels/display/display-capplet.ui
+panels/display/gnome-display-panel.desktop.in.in
+panels/display/gnome-display-properties-install-systemwide.c
+panels/display/org.gnome.randr.policy.in
+panels/display/xrandr-capplet.c
 panels/keybindings/00-multimedia-key.xml.in
 panels/keybindings/01-desktop-key.xml.in
 panels/keybindings/eggcellrendererkeys.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 1f1fadf..1e3fafe 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -4,7 +4,7 @@ capplets/appearance/data/gnome-theme-installer.desktop.in
 capplets/appearance/data/gnome-theme-package.xml
 panels/default-applications/gnome-default-applications-panel.desktop.in
 panels/default-applications/gnome-at-session.desktop.in
-capplets/display/display-properties.desktop.in
+panels/display/gnome-display-panel.desktop.in
 panels/keybindings/gnome-keybindings-panel.desktop.in
 panels/keyboard/gnome-keyboard-panel.desktop.in
 capplets/localization/localization.desktop.in



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