[gnome-boxes] Adapt to Gtk+ 3.2



commit ea48c29e2731c30b7f76b01e12d6aa2558201b35
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jan 4 02:03:52 2013 +0200

    Adapt to Gtk+ 3.2
    
    Drop usage of API deprecated in Gtk+ 3.2
    
    * HScale -> Scale
    * VBox -> Box
    * HBox -> Box
    * Widget.modify_fg replaced by theme.
    * Button.pressed -> Button.clicked
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691078

 data/gtk-style.css             |   24 ++++++++++++++++++++++++
 src/i-properties-provider.vala |    2 +-
 src/installer-media.vala       |    2 +-
 src/machine.vala               |    6 +++---
 src/notificationbar.vala       |    2 +-
 src/properties.vala            |    8 ++++----
 src/sidebar.vala               |    6 +++---
 src/topbar.vala                |    8 ++++----
 src/unattended-installer.vala  |    6 +++---
 src/util-app.vala              |    6 +++---
 src/wizard-source.vala         |    3 ++-
 src/wizard.vala                |   32 ++++++++++++++++----------------
 12 files changed, 65 insertions(+), 40 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 01fa58d..576ac66 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -48,6 +48,14 @@ BoxesMiniGraph {
     background-image: none;
 }
 
+.boxes-property-name-label {
+    color: #bebebe;
+}
+
+.boxes-machine-name-label {
+    color: white;
+}
+
 .boxes-step-label {
     color: #989898;
     font-size: 11;
@@ -58,11 +66,27 @@ BoxesMiniGraph {
     color: #d8d8d8;
 }
 
+.boxes-wizard-summary-prop-name-label {
+    color: #bebebe;
+}
+
+.boxes-wizard-summary-prop-value-label {
+    color: white;
+}
+
+.boxes-wizard-summary-customize-button {
+    color: white;
+}
+
 .boxes-wizard-media-os-label {
     color: #d8d8d8;
     font-weight: bold;
 }
 
+.boxes-wizard-current-page-label {
+    color: white;
+}
+
 .boxes-logo-notice-label {
     color: #989898;
     font-style: italic;
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index 6ff0b0d..067c7c6 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -102,7 +102,7 @@ private interface Boxes.IPropertiesProvider: GLib.Object {
         var label = new Gtk.Label (format_size (((uint64) size) * Osinfo.KIBIBYTES, FormatSizeFlags.IEC_UNITS));
         label.halign = Gtk.Align.CENTER;
 
-        var scale = new Gtk.HScale.with_range (min, max, step);
+        var scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, min, max, step);
 
         scale.add_mark (min, Gtk.PositionType.BOTTOM,
                         format_size (min * Osinfo.KIBIBYTES, FormatSizeFlags.IEC_UNITS));
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 05a43d1..7351505 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -83,7 +83,7 @@ private class Boxes.InstallerMedia : GLib.Object {
         eject_cdrom_media (domain);
     }
 
-    public virtual void populate_setup_vbox (Gtk.VBox setup_vbox) {}
+    public virtual void populate_setup_vbox (Gtk.Box setup_vbox) {}
 
     public virtual GLib.List<Pair<string,string>> get_vm_properties () {
         var properties = new GLib.List<Pair<string,string>> ();
diff --git a/src/machine.vala b/src/machine.vala
index 45986dd..95748e7 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -504,7 +504,7 @@ private class Boxes.MachineActor: Boxes.UI {
     private Clutter.Actor? thumbnail;
     private GtkClutter.Texture? thumbnail_screenshot;
     private Gtk.Label label;
-    private Gtk.VBox vbox; // and the vbox under it
+    private Gtk.Box vbox; // and the vbox under it
     private Gtk.Entry password_entry;
     private Machine machine;
     ulong track_screenshot_id = 0;
@@ -531,7 +531,7 @@ private class Boxes.MachineActor: Boxes.UI {
         screenshot.keep_aspect_ratio = true;
         _actor.add (screenshot);
 
-        vbox = new Gtk.VBox (false, 0);
+        vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
         gtk_vbox = new GtkClutter.Actor.with_contents (vbox);
         // Ensure we have enough space to fit everything without changing
         // size, as that causes weird re-animations
@@ -540,7 +540,7 @@ private class Boxes.MachineActor: Boxes.UI {
         gtk_vbox.get_widget ().get_style_context ().add_class ("boxes-bg");
 
         label = new Gtk.Label (machine.name);
-        label.modify_fg (Gtk.StateType.NORMAL, get_color ("white"));
+        label.get_style_context ().add_class ("boxes-machine-name-label");
         machine.bind_property ("name", label, "label", BindingFlags.DEFAULT);
         vbox.add (label);
         vbox.set_valign (Gtk.Align.START);
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 5914254..5fad775 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -97,7 +97,7 @@ private class Boxes.Notificationbar: GLib.Object {
             ok_button.halign = Gtk.Align.END;
             grid.add (ok_button);
 
-            ok_button.pressed.connect ( () => {
+            ok_button.clicked.connect ( () => {
                 ok_pressed = true;
                 if (ok_func != null)
                     ok_func ();
diff --git a/src/properties.vala b/src/properties.vala
index 2af479e..31da4b6 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -98,7 +98,7 @@ private class Boxes.Properties: Boxes.UI {
                 foreach (var property in properties) {
                     if (property.description != null) {
                         var label_name = new Gtk.Label (property.description);
-                        label_name.modify_fg (Gtk.StateType.NORMAL, get_color ("grey"));
+                        label_name.get_style_context ().add_class ("boxes-property-name-label");
                         label_name.margin_left = 25;
                         label_name.halign = Gtk.Align.START;
                         label_name.hexpand = false;
@@ -204,9 +204,9 @@ private class Boxes.Properties: Boxes.UI {
         gtk_actor.opacity = 0;
 
         /* topbar */
-        var hbox = App.app.topbar.notebook.get_nth_page (Boxes.TopbarPage.PROPERTIES) as Gtk.HBox;
+        var hbox = App.app.topbar.notebook.get_nth_page (Boxes.TopbarPage.PROPERTIES) as Gtk.Box;
 
-        var box = new Gtk.HBox (false, 5);
+        var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
         box.add (new Gtk.Image.from_icon_name ("go-previous-symbolic", Gtk.IconSize.MENU));
         toolbar_label = new Gtk.Label ("label");
         box.add (toolbar_label);
@@ -222,7 +222,7 @@ private class Boxes.Properties: Boxes.UI {
         hbox.show_all ();
 
         /* sidebar */
-        var vbox = App.app.sidebar.notebook.get_nth_page (Boxes.SidebarPage.PROPERTIES) as Gtk.VBox;
+        var vbox = App.app.sidebar.notebook.get_nth_page (Boxes.SidebarPage.PROPERTIES) as Gtk.Box;
 
         tree_view = new Gtk.TreeView ();
         tree_view.get_style_context ().add_class ("boxes-bg");
diff --git a/src/sidebar.vala b/src/sidebar.vala
index cffa590..ade14f3 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -89,16 +89,16 @@ private class Boxes.Sidebar: Boxes.UI {
         notebook.show_tabs = false;
 
         /* SidebarPage.COLLECTION */
-        var vbox = new Gtk.VBox (false, 0);
+        var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
         notebook.append_page (vbox, null);
 
         /* SidebarPage.WIZARD */
-        vbox = new Gtk.VBox (false, 0);
+        vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
         vbox.margin_top = 20;
         notebook.append_page (vbox, null);
 
         /* SidebarPage.PROPERTIES */
-        vbox = new Gtk.VBox (false, 10);
+        vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
         notebook.append_page (vbox, null);
 
         notebook.show_all ();
diff --git a/src/topbar.vala b/src/topbar.vala
index 9710344..cd4ec04 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -45,7 +45,7 @@ private class Boxes.Topbar: Boxes.UI {
         gtk_actor.name = "topbar";
 
         /* TopbarPage.COLLECTION */
-        var hbox = new Gtk.HBox (false, 0);
+        var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         notebook.append_page (hbox, null);
 
         var toolbar = new Gd.MainToolbar ();
@@ -82,7 +82,7 @@ private class Boxes.Topbar: Boxes.UI {
         App.app.collection.item_removed.connect (update_select_btn);
 
         /* TopbarPage.SELECTION */
-        hbox = new Gtk.HBox (false, 0);
+        hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         notebook.append_page (hbox, null);
         selection_toolbar = new Gd.MainToolbar ();
         selection_toolbar.get_style_context ().add_class ("selection-mode");
@@ -109,11 +109,11 @@ private class Boxes.Topbar: Boxes.UI {
         });
 
         /* TopbarPage.WIZARD */
-        hbox = new Gtk.HBox (false, 0);
+        hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         notebook.append_page (hbox, null);
 
         /* TopbarPage.PROPERTIES */
-        hbox = new Gtk.HBox (false, 0);
+        hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         notebook.append_page (hbox, null);
 
 
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 5b42143..6557464 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -71,7 +71,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
     private int setup_grid_n_rows;
 
     private Gtk.Label setup_label;
-    private Gtk.HBox setup_hbox;
+    private Gtk.Box setup_hbox;
     private Gtk.Switch express_toggle;
     private Gtk.Entry username_entry;
     private Gtk.Entry password_entry;
@@ -233,7 +233,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         remove_disk_from_domain_config (domain, path);
     }
 
-    public override void populate_setup_vbox (Gtk.VBox setup_vbox) {
+    public override void populate_setup_vbox (Gtk.Box setup_vbox) {
         foreach (var child in setup_vbox.get_children ())
             setup_vbox.remove (child);
 
@@ -302,7 +302,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         setup_label.wrap = true;
         setup_label.width_chars = 30;
         setup_label.halign = Gtk.Align.START;
-        setup_hbox = new Gtk.HBox (false, 0);
+        setup_hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         setup_hbox.valign = Gtk.Align.START;
         setup_hbox.margin = 24;
 
diff --git a/src/util-app.vala b/src/util-app.vala
index 7067e0b..3b69efc 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -24,9 +24,9 @@ namespace Boxes {
         return style.get_background_color (0);
     }
 
-    public Gdk.Color get_color (string desc) {
-        Gdk.Color color;
-        Gdk.Color.parse (desc, out color);
+    public Gdk.RGBA get_color (string desc) {
+        Gdk.RGBA color =  Gdk.RGBA ();
+        color.parse (desc);
         return color;
     }
 
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index ba1300e..0f450c1 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -235,7 +235,8 @@ private class Boxes.WizardSource: GLib.Object {
         if (media.os != null)
             Downloader.fetch_os_logo.begin (image, media.os, 64);
 
-        var vbox = new Gtk.VBox (true, 5);
+        var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 5);
+        vbox.homogeneous = true;
         hbox.pack_start (vbox, true, true);
 
         var media_label = media.label;
diff --git a/src/wizard.vala b/src/wizard.vala
index 9f45b65..fbe9de5 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -28,7 +28,7 @@ private class Boxes.Wizard: Boxes.UI {
     private Gtk.ProgressBar prep_progress;
     private Gtk.Label prep_media_label;
     private Gtk.Label prep_status_label;
-    private Gtk.VBox setup_vbox;
+    private Gtk.Box setup_vbox;
     private Gtk.Label review_label;
     private Gtk.Label nokvm_label;
     private Gtk.Image installer_image;
@@ -120,11 +120,10 @@ private class Boxes.Wizard: Boxes.UI {
 
             for (var i = 0; i < steps.length; i++) {
                 var label = steps.get (i);
-                label.modify_fg (Gtk.StateType.NORMAL, null);
+                label.get_style_context ().remove_class ("boxes-wizard-current-page-label");
             }
 
-            /* highlight in white current page label */
-            steps.get (page).modify_fg (Gtk.StateType.NORMAL, get_color ("white"));
+            steps.get (page).get_style_context ().add_class ("boxes-wizard-current-page-label");
         }
     }
 
@@ -464,7 +463,7 @@ private class Boxes.Wizard: Boxes.UI {
         notebook.append_page (widget, null);
 
         /* sidebar */
-        var vbox = App.app.sidebar.notebook.get_nth_page (Boxes.SidebarPage.WIZARD) as Gtk.VBox;
+        var vbox = App.app.sidebar.notebook.get_nth_page (Boxes.SidebarPage.WIZARD) as Gtk.Box;
 
         var label = new Gtk.Label (title);
         label.margin_left = 25;
@@ -525,7 +524,7 @@ private class Boxes.Wizard: Boxes.UI {
         gtk_actor.opacity = 0;
 
         /* Introduction */
-        var hbox = new Gtk.HBox (false, 10);
+        var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
         hbox.halign = Gtk.Align.CENTER;
         add_step (hbox, _("Introduction"), WizardPage.INTRODUCTION);
         hbox.add (new Gtk.Image.from_file (get_pixmap ("boxes-create.png")));
@@ -540,7 +539,7 @@ private class Boxes.Wizard: Boxes.UI {
         hbox.show_all ();
 
         /* Source */
-        var vbox = new Gtk.VBox (false, 30);
+        var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 30);
         vbox.valign = Gtk.Align.CENTER;
         vbox.halign = Gtk.Align.CENTER;
         add_step (vbox, _("Source Selection"), WizardPage.SOURCE);
@@ -564,7 +563,7 @@ private class Boxes.Wizard: Boxes.UI {
         vbox.show_all ();
 
         /* Preparation */
-        vbox = new Gtk.VBox (false, 30);
+        vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 30);
         vbox.valign = Gtk.Align.CENTER;
         vbox.halign = Gtk.Align.CENTER;
         add_step (vbox, _("Preparation"), WizardPage.PREPARATION);
@@ -576,7 +575,7 @@ private class Boxes.Wizard: Boxes.UI {
         label.xalign = 0.0f;
         vbox.pack_start (label, false, false);
 
-        hbox = new Gtk.HBox (false, 10);
+        hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
         hbox.valign = Gtk.Align.CENTER;
         hbox.halign = Gtk.Align.CENTER;
         vbox.pack_start (hbox, true, true);
@@ -584,7 +583,8 @@ private class Boxes.Wizard: Boxes.UI {
         installer_image = new Gtk.Image.from_icon_name ("media-optical", 0);
         installer_image.pixel_size = 128;
         hbox.pack_start (installer_image, false, false);
-        var prep_vbox = new Gtk.VBox (true, 10);
+        var prep_vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
+        prep_vbox.homogeneous = true;
         prep_vbox.valign = Gtk.Align.CENTER;
         hbox.pack_start (prep_vbox, true, true);
         prep_media_label = new Gtk.Label (null);
@@ -600,14 +600,14 @@ private class Boxes.Wizard: Boxes.UI {
         vbox.show_all ();
 
         /* Setup */
-        setup_vbox = new Gtk.VBox (false, 30);
+        setup_vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 30);
         setup_vbox.valign = Gtk.Align.CENTER;
         setup_vbox.halign = Gtk.Align.CENTER;
         add_step (setup_vbox, _("Setup"), WizardPage.SETUP);
         setup_vbox.show_all ();
 
         /* Review */
-        vbox = new Gtk.VBox (false, 30);
+        vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 30);
         vbox.valign = Gtk.Align.CENTER;
         vbox.halign = Gtk.Align.CENTER;
         add_step (vbox, _("Review"), WizardPage.REVIEW);
@@ -629,7 +629,7 @@ private class Boxes.Wizard: Boxes.UI {
         vbox.show_all ();
 
         /* topbar */
-        hbox = App.app.topbar.notebook.get_nth_page (Boxes.TopbarPage.WIZARD) as Gtk.HBox;
+        hbox = App.app.topbar.notebook.get_nth_page (Boxes.TopbarPage.WIZARD) as Gtk.Box;
         label = new Gtk.Label (_("Create a Box"));
         label.name = "TopbarLabel";
         label.halign = Gtk.Align.START;
@@ -732,12 +732,12 @@ private class Boxes.Wizard: Boxes.UI {
                 return;
 
             var label_name = new Gtk.Label (name);
-            label_name.modify_fg (Gtk.StateType.NORMAL, get_color ("grey"));
+            label_name.get_style_context ().add_class ("boxes-wizard-summary-prop-name-label");
             label_name.xalign = 1.0f;
             grid.attach (label_name, 0, current_row, 1, 1);
 
             var label_value = new Gtk.Label (value);
-            label_value.modify_fg (Gtk.StateType.NORMAL, get_color ("white"));
+            label_value.get_style_context ().add_class ("boxes-wizard-summary-prop-value-label");
             label_value.xalign = 0.0f;
             grid.attach (label_value, 1, current_row, 1, 1);
 
@@ -751,7 +751,7 @@ private class Boxes.Wizard: Boxes.UI {
                 return;
 
             var button = new Gtk.Button.with_mnemonic (_("C_ustomize..."));
-            button.modify_fg (Gtk.StateType.NORMAL, get_color ("white"));
+            button.get_style_context ().add_class ("boxes-wizard-summary-customize-button");
             grid.attach (button, 2, current_row - 1, 1, 1);
             button.show ();
 



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