[gnome-weather] Use GTK types in place of libgd ones



commit 7e3ff35deb19b0f8ee59aa876d94fd7676d540ef
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat May 4 14:55:37 2013 +0200

    Use GTK types in place of libgd ones
    
    Now that Stack, Revealer and HeaderBar are in Gtk, we can use those
    instead of the Gd version, which allows us to put them in the .ui file
    without glade complaining.
    It still fails because it cannot handle <menu>, and because it doesn't
    yet know about those types...

 data/city.ui   |    4 ++--
 data/window.ui |   35 +++++++++++++++++++++++++++++++++--
 src/city.js    |    2 +-
 src/main.js    |    1 +
 src/window.js  |   14 +++-----------
 5 files changed, 40 insertions(+), 16 deletions(-)
---
diff --git a/data/city.ui b/data/city.ui
index 20698a0..d1442ca 100644
--- a/data/city.ui
+++ b/data/city.ui
@@ -120,10 +120,10 @@
       </packing>
     </child>
     <child>
-      <object class="GdRevealer" id="revealer">
+      <object class="GtkRevealer" id="revealer">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="reveal-child">false</property>
+        <property name="transition-type">slide-left</property>
       </object>
       <packing>
         <property name="expand">False</property>
diff --git a/data/window.ui b/data/window.ui
index d068db4..930c7a2 100644
--- a/data/window.ui
+++ b/data/window.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires gtk+ 3.8 -->
   <menu id="selection-menu">
     <section>
       <item>
@@ -14,12 +14,19 @@
       </item>
     </section>
   </menu>
+  <object class="GdHeaderMenuButton" id="selection-menu-button">
+    <property name="label" translatable="yes">Click on items to select them</property>
+    <property name="menu-model">selection-menu</property>
+    <style>
+      <class name="selection-menu"/>
+    </style>
+  </object>
   <object class="GtkGrid" id="main-panel">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="orientation">vertical</property>
     <child>
-      <object class="GdHeaderBar" id="header-bar">
+      <object class="GtkHeaderBar" id="header-bar">
         <property name="visible">True</property>
         <property name="vexpand">False</property>
         <child>
@@ -84,5 +91,29 @@
         <property name="height">1</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkOverlay" id="main-overlay">
+        <child>
+          <object class="GtkStack" id="main-stack">
+            <property name="transition-type">crossfade</property>
+            <child>
+              <placeholder/> <!-- world view -->
+            </child>
+            <child>
+              <placeholder/> <!-- city view -->
+            </child>
+          </object>
+        </child>
+        <child>
+          <placeholder/> <!-- selection toolbar -->
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">1</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/src/city.js b/src/city.js
index 5a2d442..2a310f1 100644
--- a/src/city.js
+++ b/src/city.js
@@ -104,7 +104,7 @@ const WeatherWidget = new Lang.Class({
 
 const WeatherView = new Lang.Class({
     Name: 'WeatherView',
-    Extends: Gd.Stack,
+    Extends: Gtk.Stack,
 
     _init: function(params) {
         this.parent(params);
diff --git a/src/main.js b/src/main.js
index 97525b9..216ef3c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -59,6 +59,7 @@ const Application = new Lang.Class({
 
     vfunc_startup: function() {
         this.parent();
+        Gd.ensure_types();
 
         let resource = Gio.Resource.load(pkg.pkgdatadir + '/gnome-weather.gresource');
         resource._register();
diff --git a/src/window.js b/src/window.js
index 25529d1..8375aa6 100644
--- a/src/window.js
+++ b/src/window.js
@@ -140,13 +140,9 @@ const MainWindow = new Lang.Class({
 
         let selectionMenu = builder.get_object("selection-menu");
 
-        this._selectionMenuButton = new Gd.HeaderMenuButton(
-            { label: _("Click on items to select them"),
-              menu_model: selectionMenu,
-            });
-        this._selectionMenuButton.get_style_context().add_class("selection-menu");
-
-        this._stack = new Gd.Stack({ transition_type: Gd.StackTransitionType.CROSSFADE });
+        this._selectionMenuButton = builder.get_object('selection-menu-button');
+        this._stack = builder.get_object('main-stack');
+        this._overlay = builder.get_object('main-overlay');
 
         this._cityView = new City.WeatherView({ hexpand: true,
                                                 vexpand: true });
@@ -186,10 +182,6 @@ const MainWindow = new Lang.Class({
 
         this._stack.set_visible_child(this._worldView);
 
-        this._overlay = new Gtk.Overlay();
-        this._overlay.add(this._stack);
-        grid.add(this._overlay);
-
         this._selectionToolbar = new SelectionToolbar(this._worldView);
         this._overlay.add_overlay(this._selectionToolbar);
 


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