[gnome-boxes/wip/csd: 4/4] tmp



commit d2f23b2dbadf498a3473ce4273946cafcdceba0e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Aug 30 02:02:48 2013 +0300

    tmp

 src/display-page.vala |   83 ++++--------------------------------------------
 1 files changed, 7 insertions(+), 76 deletions(-)
---
diff --git a/src/display-page.vala b/src/display-page.vala
index 416f746..5decd29 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -2,12 +2,8 @@
 using Gtk;
 using Gdk;
 
-private class Boxes.DisplayToolbar: Gd.MainToolbar {
+private class Boxes.DisplayToolbar: Gtk.HeaderBar {
     private bool overlay;
-    /* The left/right containers of Gd.MainToolbar are GtkGrids, which don't support first/last theming,
-       which the osd css uses, so we need to add our own GtkBoxes instead. */
-    private Gtk.Box leftbox;
-    private Gtk.Box rightbox;
 
     public DisplayToolbar (bool overlay) {
         add_events (Gdk.EventMask.POINTER_MOTION_MASK);
@@ -17,13 +13,6 @@ private class Boxes.DisplayToolbar: Gd.MainToolbar {
         else
             get_style_context ().add_class (Gtk.STYLE_CLASS_MENUBAR);
 
-        int spacing = overlay ? 0 : 12;
-        leftbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, spacing);
-        add_widget (leftbox, true);
-
-        rightbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, spacing);
-        add_widget (rightbox, false);
-
         var back_icon = (get_direction () == Gtk.TextDirection.RTL)? "go-previous-rtl-symbolic" :
                                                                      "go-previous-symbolic";
         var back = add_image_button (back_icon, true);
@@ -49,75 +38,15 @@ private class Boxes.DisplayToolbar: Gd.MainToolbar {
         img.show ();
         button.image = img;
         if (pack_start)
-            leftbox.add (button);
+            this.pack_start (button);
         else
-            rightbox.add (button);
+            this.pack_end (button);
 
         if (!overlay)
             button.get_style_context ().add_class ("raised");
         button.get_style_context ().add_class ("image-button");
         return button;
     }
-
-    private bool button_down;
-    private int button_down_x;
-    private int button_down_y;
-    private uint button_down_button;
-
-    public override bool button_press_event (Gdk.EventButton event) {
-        var res = base.button_press_event (event);
-
-        // With the current GdkEvent bindings this is the only way to
-        // upcast a GdkEventButton to a GdkEvent (which we need for
-        // the triggerts_context_menu() method call.
-        // TODO: Fix this when vala bindings are corrected
-        Gdk.Event *base_event = (Gdk.Event *)(&event);
-
-        if (!res && !base_event->triggers_context_menu ()) {
-            button_down = true;
-            button_down_button = event.button;
-            button_down_x = (int) event.x;
-            button_down_y = (int) event.y;
-        }
-        return res;
-    }
-
-    public override bool button_release_event (Gdk.EventButton event) {
-        button_down = false;
-        return base.button_press_event (event);
-    }
-
-    public override bool motion_notify_event (Gdk.EventMotion event) {
-        if (button_down) {
-            double dx = event.x - button_down_x;
-            double dy = event.y - button_down_y;
-
-            // Break out when the dragged distance is 40 pixels
-            if (dx * dx + dy * dy > 40 * 40) {
-                button_down = false;
-                App.app.fullscreen = false;
-
-                var window = get_toplevel () as Gtk.Window;
-                int old_width;
-                window.get_size (out old_width, null);
-
-                ulong id = 0;
-                id = App.app.notify["fullscreen"].connect ( () => {
-                    int root_x, root_y, width;
-                    window.get_position (out root_x, out root_y);
-                    window.get_window ().get_geometry (null, null, out width, null);
-                    window.begin_move_drag ((int) button_down_button,
-                                            root_x + (int) ((button_down_x / (double) old_width) * width),
-                                            root_y + button_down_y,
-                                            event.time);
-                    App.app.disconnect (id);
-                } );
-            }
-        }
-        if (base.motion_notify_event != null)
-            return base.motion_notify_event (event);
-        return false;
-    }
 }
 
 private class Boxes.DisplayPage: GLib.Object {
@@ -286,8 +215,10 @@ private class Boxes.DisplayPage: GLib.Object {
         if (grabbed)
             hint = _("(press Ctrl+Alt keys to ungrab)");
 
-        overlay_toolbar.set_labels (title, hint);
-        toolbar.set_labels (title, hint);
+        overlay_toolbar.set_title (title);
+        overlay_toolbar.set_subtitle (hint);
+        toolbar.set_title (title);
+        toolbar.set_subtitle (hint);
     }
 
     public void show_display (Boxes.Display display, Widget widget) {


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