Remove some debug output.
[gmpc.git] / src / vala / gmpc-paned-size-group.vala
blob66a08116aa29ba6f026077d9555a9a22d916f34c
1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2011 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 using GLib;
21 using MPD;
24 namespace Gmpc{
25 public class PanedSizeGroup : GLib.Object {
26 private List<unowned Gtk.Paned> list = null;
27 private int position = config.get_int_with_default("paned-size-group", "position", 150);
29 public
30 PanedSizeGroup () {
33 ~PanedSizeGroup () {
34 config.set_int("paned-size-group", "position", position);
37 private bool
38 child_destroy_event(Gtk.Widget paned, Gdk.Event event)
40 list.remove((Gtk.Paned)paned);
42 return false;
44 private bool block_changed_callback = false;
45 private
46 void
47 child_position_changed(GLib.Object paned, ParamSpec spec)
49 if(block_changed_callback) return;
50 block_changed_callback = true;
52 var pane = (Gtk.Paned) paned;
53 position = pane.get_position();
54 foreach(unowned Gtk.Paned p in list)
56 if(p != paned)
58 p.set_position(position);
62 block_changed_callback = false;
64 public
65 void
66 add_paned(Gtk.Paned paned)
68 paned.notify["position"].connect(child_position_changed);
69 paned.destroy_event.connect(child_destroy_event);
71 block_changed_callback = true;
72 paned.set_position(position);
73 block_changed_callback = false;
75 list.append(paned);