summaryrefslogtreecommitdiff
path: root/src
diff options
authorNeil Jagdish Patel <neil.patel@canonical.com>2010-01-25 17:55:11 +0000
committerNeil Jagdish Patel <neil.patel@canonical.com>2010-01-25 17:55:11 +0000
commit1ab3dad14c2d5578c337d7dcc3412405df76ce21 (patch)
treee828852d1508856e06c30905697cb35ef53eb166 /src
parentab30856f9522a2a25cb452ff7f53a26156e2619e (diff)
parent5eb93ad6c905d3a27132e7ea2a7cf13a743990d5 (diff)
[merge] Panel work
added: data/bfb.png mutter.patch src/panel/ src/panel/panel-home.vala src/panel/panel-indicators.vala src/panel/panel-tray.vala src/panel/panel-view.vala vapi/indicator.deps vapi/indicator.vapi vapi/unity-misc.vapi vapi/x11.vapi modified: .bzrignore configure.ac data/Makefile.am libunity/shell.vala mutter-plugin/Makefile.am mutter-plugin/main.c mutter-plugin/plugin.vala src/Makefile.am src/main.vala src/places/bar-view.vala src/places/cairo-drawing.vala src/places/places-controller.vala src/places/places-view.vala src/unity-utils.c src/unity-utils.h src/utils.vala src/window.vala tests/Makefile.am vapi/mutter-2.28.vapi vapi/unity-const.vapi pending merges: Neil Jagdish Patel 2010-01-25 [panel] Set the panel strut Neil Jagdish Patel 2010-01-25 [panel/tray] Fix sorting of icons crash Neil Jagdish Patel 2010-01-25 [panel/indicators] Ordering + fix changing... Neil Jagdish Patel 2010-01-25 [panel] Fix indicator display, return corr... Neil Jagdish Patel 2010-01-25 [panel/indicators] Some more icon work Neil Jagdish Patel 2010-01-25 [panel/indicators] Load and show something! Neil Jagdish Patel 2010-01-24 [panel/indicators] Actually load something... Neil Jagdish Patel 2010-01-24 [panel/indicators] List the indicators (on... Neil Jagdish Patel 2010-01-24 [panel/indicators/ Beginings of indicator ... Neil Jagdish Patel 2010-01-24 [vapi] Add initial Indicator vala files Neil Jagdish Patel 2010-01-24 [panel-tray] Fix the ordering of the first... Neil Jagdish Patel 2010-01-24 [places/bar] Fix spacing of trash Neil Jagdish Patel 2010-01-24 [panel-tray] Order icons by creation time Neil Jagdish Patel 2010-01-24 [mutter,panel-bar] Remove animations for s... Neil Jagdish Patel 2010-01-24 [mutter] Temp commit Neil Jagdish Patel 2010-01-24 [panel,shell,mutter,places-bar] Communicat... Neil Jagdish Patel 2010-01-24 [panel] Added home button Neil Jagdish Patel 2010-01-24 [merge] [merge] Merge in Jason's branch th... Jason Smith 2010-01-21 Make work with patched mutter for DND window sexi... Neil Jagdish Patel 2010-01-24 [merge] [merge, mutter] Merge from upstrea... Neil Jagdish Patel 2010-01-14 [panel] Use libunity-misc Neil Jagdish Patel 2010-01-10 [panel] Some more tray manager work Neil Jagdish Patel 2010-01-10 [panel] Some basic tray manager stuff Neil Jagdish Patel 2010-01-10 [panel] Initial bits and pieces Neil Jagdish Patel 2010-01-10 [mutter] Fix --disable-mutter (bzr r73)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am16
-rw-r--r--src/main.vala26
-rw-r--r--src/panel/panel-home.vala47
-rw-r--r--src/panel/panel-indicators.vala247
-rw-r--r--src/panel/panel-tray.vala89
-rw-r--r--src/panel/panel-view.vala165
-rw-r--r--src/places/bar-view.vala29
-rw-r--r--src/places/cairo-drawing.vala21
-rw-r--r--src/places/places-controller.vala2
-rw-r--r--src/places/places-view.vala7
-rw-r--r--src/unity-utils.c22
-rw-r--r--src/unity-utils.h5
-rw-r--r--src/utils.vala5
-rw-r--r--src/window.vala38
14 files changed, 672 insertions, 47 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9740079d3..9051cc418 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,11 +22,13 @@ bin_PROGRAMS = \
libunity_static_la_CPPFLAGS = \
-DDATADIR=\"$(DATADIR)\" \
-DPKGDATADIR=\"$(PKGDATADIR)\" \
+ -DINDICATORDIR=\""$(INDICATORDIR)"\" \
+ -DINDICATORICONSDIR=\""$(INDICATORICONSDIR)"\" \
$(BASE_CFLAGS) \
$(MAINTAINER_CFLAGS) \
-I$(top_srcdir)/libunity/ \
-I$(top_srcdir)/src/ \
- -I$(top_srcdir)/places/ \
+ -I$(top_srcdir)/places/ \
-I$(top_srcdir)/quicklauncher/
libunity_static_la_VALAFLAGS = \
@@ -42,13 +44,16 @@ libunity_static_la_VALAFLAGS = \
--pkg cogl-1.0 \
--pkg gconf-2.0 \
--pkg gdk-2.0 \
+ --pkg gdk-x11-2.0 \
--pkg gee-1.0 \
--pkg gio-unix-2.0 \
--pkg gtk+-2.0 \
+ --pkg indicator \
--pkg launcher-0.3 \
--pkg libwnck-1.0 \
--pkg unity \
--pkg unity-const \
+ --pkg unity-misc \
--pkg unique-1.0 \
--pkg x11 \
$(MAINTAINER_VALAFLAGS)
@@ -64,6 +69,12 @@ src_sources = \
utils.vala \
window.vala
+panel_sources = \
+ panel/panel-home.vala \
+ panel/panel-indicators.vala \
+ panel/panel-tray.vala \
+ panel/panel-view.vala
+
places_sources = \
places/application-place.vala \
places/bar-model.vala \
@@ -91,11 +102,13 @@ quicklauncher_sources = \
libunity_static_la_VALASOURCES = \
$(src_sources) \
+ $(panel_sources) \
$(places_sources) \
$(quicklauncher_sources)
libunity_static_la_SOURCES = \
unity-utils.c \
+ unity-utils.h \
$(libunity_static_la_VALASOURCES:.vala=.c)
libunity_static_la_APIFILES = unity-static.vapi unity-static.h unity-utils.h
@@ -129,6 +142,7 @@ unity_VALAFLAGS = \
--pkg gtk+-2.0 \
--pkg gdk-2.0 \
--pkg gee-1.0 \
+ --pkg indicator \
--pkg x11 \
--pkg gtk+-2.0 \
--pkg gee-1.0 \
diff --git a/src/main.vala b/src/main.vala
index 30f86bf13..dec370816 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -23,7 +23,7 @@ static bool popup_mode = false;
static int popup_width = 1024;
static int popup_height = 600;
static bool show_version = false;
-static string? boot_logging_filename = null;
+static string? boot_logging_filename = null;
const OptionEntry[] options = {
{
@@ -109,13 +109,13 @@ public class Main
if (boot_logging_filename != null)
{
Unity.is_logging = true;
- }
- else
- {
+ }
+ else
+ {
Unity.is_logging = false;
}
START_FUNCTION ();
-
+
/* Parse options */
LOGGER_START_PROCESS ("gtk_init");
Gtk.init (ref args);
@@ -128,10 +128,12 @@ public class Main
LOGGER_START_PROCESS ("unity_application_constructor");
app = new Unity.Application ();
LOGGER_END_PROCESS ("unity_application_constructor");
- if (app.is_running)
+
+ string? disable_unique = Environment.get_variable ("UNITY_NO_UNIQUE");
+ if (app.is_running && disable_unique == null)
{
Unique.Response response = Unique.Response.OK;
-
+
if (show_unity)
{
print ("Showing Unity window\n");
@@ -141,7 +143,7 @@ public class Main
{
print ("There already another instance of Unity running\n");
}
-
+
return response == Unique.Response.OK ? 0 : 1;
}
@@ -151,9 +153,9 @@ public class Main
LOGGER_START_PROCESS ("unity_underlay_window_show");
window.show ();
LOGGER_END_PROCESS ("unity_underlay_window_show");
-
+
END_FUNCTION ();
-
+
if (boot_logging_filename != null)
{
Timeout.add_seconds (1, () => {
@@ -163,8 +165,8 @@ public class Main
}
Gtk.main ();
-
-
+
+
return 0;
}
diff --git a/src/panel/panel-home.vala b/src/panel/panel-home.vala
new file mode 100644
index 000000000..8d3654e4b
--- /dev/null
+++ b/src/panel/panel-home.vala
@@ -0,0 +1,47 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+namespace Unity.Panel
+{
+ public class HomeButton : Ctk.Image
+ {
+ public Shell shell { get; construct; }
+
+ public HomeButton (Shell shell)
+ {
+ Object (size:22,
+ filename:PKGDATADIR + "/bfb.png",
+ reactive:true,
+ shell:shell);
+ }
+
+ construct
+ {
+ this.button_release_event.connect (this.on_button_release);
+ }
+
+ private bool on_button_release (Clutter.Event event)
+ {
+ shell.show_unity ();
+
+ return false;
+ }
+ }
+}
diff --git a/src/panel/panel-indicators.vala b/src/panel/panel-indicators.vala
new file mode 100644
index 000000000..d6a303fc4
--- /dev/null
+++ b/src/panel/panel-indicators.vala
@@ -0,0 +1,247 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+using Gee;
+
+namespace Unity.Panel.Indicators
+{
+ public class View : Ctk.Box
+ {
+ private HashMap<string, int> indicator_order;
+
+ public View ()
+ {
+ Object (orientation:Ctk.Orientation.HORIZONTAL,
+ spacing:12,
+ homogeneous:false);
+ }
+
+ construct
+ {
+ this.indicator_order = new HashMap<string, int> ();
+
+ Idle.add (this.load_indicators);
+ }
+
+ private bool load_indicators ()
+ {
+ /* Create the order */
+ this.indicator_order.set ("libapplication.so", 1);
+ this.indicator_order.set ("libmessaging.so", 2);
+ this.indicator_order.set ("libdatetime.so", 3);
+ this.indicator_order.set ("libme.so", 4);
+ this.indicator_order.set ("libsession.so", 5);
+
+ /* We need to look for icons in an specific location */
+ Gtk.IconTheme.get_default ().append_search_path (INDICATORICONSDIR);
+
+ /* Start loading 'em in */
+ debug ("Reading indicators from: %s\n", INDICATORDIR);
+
+ var dir = File.new_for_path (INDICATORDIR);
+ try
+ {
+ var e = dir.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME,
+ 0,
+ null);
+
+ FileInfo file_info;
+ while ((file_info = e.next_file (null)) != null)
+ {
+ string leaf = file_info.get_name ();
+
+ if (leaf[leaf.len()-2:leaf.len()] == "so")
+ this.load_indicator (INDICATORDIR + file_info.get_name (),
+ file_info.get_name ());
+ }
+ }
+ catch (Error error)
+ {
+ print ("Unable to read indicators: %s\n", error.message); }
+
+ this.sort_children ((CompareFunc)reorder_icons);
+
+ return false;
+ }
+
+ public static int reorder_icons (IndicatorItem a, IndicatorItem b)
+ {
+ return a.position - b.position;
+ }
+
+ private void load_indicator (string filename, string leaf)
+ {
+ Indicator.Object o;
+
+ o = new Indicator.Object.from_file (filename);
+
+ if (o is Indicator.Object)
+ {
+ print ("Successfully loaded: %s\n", filename);
+
+ var i = new IndicatorItem ();
+ i.set_object (o);
+ this.add_actor (i);
+ i.show ();
+
+ i.position = (int)this.indicator_order[leaf];
+ print ("%s: %d\n", leaf, i.position);
+ }
+ else
+ {
+ warning ("Unable to load %s\n", filename);
+ }
+ }
+ }
+
+ public class IndicatorItem : Ctk.Box
+ {
+ /**
+ * Represents one Indicator.Object
+ **/
+ private Indicator.Object object;
+ public int position;
+
+ public IndicatorItem ()
+ {
+ Object (orientation: Ctk.Orientation.HORIZONTAL,
+ spacing:12,
+ homogeneous:false);
+ }
+
+ construct
+ {
+ }
+
+ private void remove_entry (Indicator.ObjectEntry entry)
+ {
+ unowned GLib.List list = this.get_children ();
+
+ for (int i = 0; i < list.length (); i++)
+ {
+ IndicatorEntry e;
+
+ e = (IndicatorEntry) list.nth_data (i);
+
+ if (e.entry == entry)
+ {
+ this.remove_actor (e);
+ }
+ }
+ }
+
+ private void create_entry (Indicator.ObjectEntry entry)
+ {
+ IndicatorEntry e = new IndicatorEntry (entry);
+ this.add_actor (e);
+ this.show ();
+ }
+
+ public void set_object (Indicator.Object object)
+ {
+ this.object = object;
+
+ object.entry_added.connect (this.create_entry);
+ object.entry_removed.connect (this.remove_entry);
+
+ unowned GLib.List list = object.get_entries ();
+
+ for (int i = 0; i < list.length (); i++)
+ {
+ unowned Indicator.ObjectEntry entry;
+
+ entry = (Indicator.ObjectEntry) list.nth_data (i);
+
+ this.create_entry (entry);
+ }
+ }
+
+ public Indicator.Object get_object ()
+ {
+ return this.object;
+ }
+ }
+
+ public class IndicatorEntry : Ctk.Box
+ {
+ public unowned Indicator.ObjectEntry entry { get; construct; }
+
+ private Ctk.Image image;
+ private Ctk.Text text;
+
+ public IndicatorEntry (Indicator.ObjectEntry entry)
+ {
+ Object (entry:entry,
+ orientation:Ctk.Orientation.HORIZONTAL,
+ spacing:2,
+ reactive:true);
+ }
+
+ construct
+ {
+ if (this.entry.image is Gtk.Image)
+ {
+ this.image = new Ctk.Image (22);
+ this.add_actor (this.image);
+ this.image.show ();
+
+ this.image.stock_id = this.entry.image.icon_name;
+
+ this.entry.image.notify["icon-name"].connect (() =>
+ {
+ this.image.stock_id = this.entry.image.icon_name;
+ });
+ }
+
+ if (this.entry.label is Gtk.Label)
+ {
+ this.text = new Ctk.Text ("");
+ this.add_actor (this.text);
+ this.text.show ();
+
+ this.text.text = this.entry.label.label;
+
+ this.entry.label.notify["label"].connect (() =>
+ {
+ this.text.text = this.entry.label.label;
+ });
+ }
+
+ this.button_release_event.connect ((e) =>
+ {
+ this.entry.menu.popup (null,
+ null,
+ this.position_menu,
+ e.button.button,
+ e.button.time);
+
+ return true;
+ });
+ }
+
+ private void position_menu (Gtk.Menu menu,
+ out int x,
+ out int y,
+ out bool push_in)
+ {
+ y = (int)this.height;
+ }
+ }
+}
diff --git a/src/panel/panel-tray.vala b/src/panel/panel-tray.vala
new file mode 100644
index 000000000..31efbd7ab
--- /dev/null
+++ b/src/panel/panel-tray.vala
@@ -0,0 +1,89 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+using Gee;
+
+namespace Unity.Panel.Tray
+{
+ public class View : Ctk.Box
+ {
+ private TrayManager manager;
+ private Clutter.Stage stage;
+
+ private int n_icons = 1;
+
+ public View ()
+ {
+ Object (orientation:Ctk.Orientation.HORIZONTAL,
+ spacing:12);
+ }
+
+ construct
+ {
+ this.manager = new TrayManager ();
+ this.manager.tray_icon_added.connect (this.on_tray_icon_added);
+ this.manager.tray_icon_removed.connect (this.on_tray_icon_removed);
+ }
+
+ public void manage_stage (Clutter.Stage stage)
+ {
+ this.stage = stage;
+
+ Idle.add (this.manage_tray_idle);
+ }
+
+ private bool manage_tray_idle ()
+ {
+ string? disable_tray = Environment.get_variable ("UNITY_DISABLE_TRAY");
+
+ if (disable_tray == null)
+ this.manager.manage_stage (this.stage);
+
+ return false;
+ }
+
+ private static int order_icons (Clutter.Actor a, Clutter.Actor b)
+ {
+ weak string stra = (string)a.get_data ("n_icon");
+ weak string strb = (string)b.get_data ("n_icon");
+
+ return strcmp ((stra != null) ? stra : "",
+ (strb != null) ? strb : "");
+ }
+
+ private void on_tray_icon_added (Clutter.Actor icon)
+ {
+ this.add_actor (icon);
+ icon.set_size (22, 22);
+ icon.show ();
+
+ icon.set_data ("n_icon", (void*)"%d".printf (this.n_icons));
+
+ this.sort_children ((CompareFunc)order_icons);
+
+ this.n_icons++;
+ }
+
+ private void on_tray_icon_removed (Clutter.Actor icon)
+ {
+ this.remove_actor (icon);
+ }
+ }
+}
diff --git a/src/panel/panel-view.vala b/src/panel/panel-view.vala
new file mode 100644
index 000000000..07fd62e63
--- /dev/null
+++ b/src/panel/panel-view.vala
@@ -0,0 +1,165 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+namespace Unity.Panel
+{
+ static const int PANEL_HEIGHT = 24;
+
+ public class View : Ctk.Actor
+ {
+ public Shell shell { get; construct;}
+
+ private Clutter.Rectangle rect;
+ private Tray.View tray;
+ private HomeButton home;
+ private Indicators.View indicators;
+
+ private int indicators_width = 0;
+
+ public View (Shell shell)
+ {
+ Object (shell:shell);
+ this.tray.manage_stage (this.shell.get_stage ());
+ }
+
+ construct
+ {
+ START_FUNCTION ();
+
+ Clutter.Color color = { 25, 25, 25, 255 };
+
+ this.rect = new Clutter.Rectangle.with_color (color);
+ this.rect.set_parent (this);
+ this.rect.show ();
+
+ this.indicators = new Indicators.View ();
+ this.indicators.set_parent (this);
+ this.indicators.show ();
+
+ this.tray = new Tray.View ();
+ this.tray.set_parent (this);
+ this.tray.show ();
+
+ this.home = new HomeButton (this.shell);
+ this.home.set_parent (this);
+ this.home.show ();
+
+ END_FUNCTION ();
+ }
+
+ private override void allocate (Clutter.ActorBox box,
+ Clutter.AllocationFlags flags)
+ {
+ Clutter.ActorBox child_box = { 0, 0, box.x2 - box.x1, box.y2 - box.y1 };
+ float width;
+ float child_width;
+ float i_width;
+
+ width = box.x2 - box.x1;
+
+ /* First the background */
+ this.rect.allocate (child_box, flags);
+
+ /* Home button */
+ child_box.x1 = 17; /* (QL_width - logo_width)/2.0 */
+ child_box.x2 = child_box.x1 + PANEL_HEIGHT;
+ child_box.y1 = 0;
+ child_box.y2 = PANEL_HEIGHT;
+ this.home.allocate (child_box, flags);
+
+ /* Indicators */
+ this.indicators.get_preferred_width (PANEL_HEIGHT,
+ out child_width,
+ out child_width);
+ child_box.x1 = width - child_width;
+ child_box.x2 = width;
+ this.indicators.allocate (child_box, flags);
+
+ width -= child_width + 12; /* 12 = space between icons */
+
+ /* Systray */
+ this.tray.get_preferred_width (PANEL_HEIGHT,
+ out child_width,
+ out child_width);
+ child_box.x1 = width - child_width;
+ child_box.x2 = width;
+ this.tray.allocate (child_box, flags);
+
+ width -= child_box.x2 - child_box.x1;
+ i_width = box.x2 - box.x1 - width;
+ if (this.indicators_width != (int)i_width)
+ {
+ this.indicators_width = (int)i_width;
+ this.shell.indicators_changed (this.indicators_width);
+ }
+ }
+
+ private override void paint ()
+ {
+ base.paint ();
+ this.rect.paint ();
+ this.tray.paint ();
+ this.home.paint ();
+ this.indicators.paint ();
+ }
+
+ private override void pick (Clutter.Color color)
+ {
+ this.tray.paint ();
+ this.home.paint ();
+ this.indicators.paint ();
+ }
+
+ private override void map ()
+ {
+ base.map ();
+ this.rect.map ();
+ this.tray.map ();
+ this.home.map ();
+ this.indicators.map ();
+ }
+
+ private override void unmap ()
+ {
+ base.unmap ();
+ this.rect.unmap ();
+ this.tray.unmap ();
+ this.home.unmap ();
+ this.indicators.unmap ();
+ }
+
+ public int get_indicators_width ()
+ {
+ return (int)this.indicators_width;
+ }
+
+ public void set_indicator_mode (bool mode)
+ {
+ float x;
+
+ x = mode ? this.width - this.get_indicators_width () : 0;
+
+ this.rect.set_clip (x,
+ 0,
+ mode ? this.get_indicators_width () : this.width,
+ mode ? PANEL_HEIGHT -1 : PANEL_HEIGHT);
+ }
+ }
+}
diff --git a/src/places/bar-view.vala b/src/places/bar-view.vala
index f443c308a..71141eb0f 100644
--- a/src/places/bar-view.vala
+++ b/src/places/bar-view.vala
@@ -31,6 +31,7 @@ namespace Unity.Places.Bar
public class View : Ctk.Box
{
public Places.Model model { get; construct; }
+ public Shell shell { get; construct; }
private Gee.ArrayList<PlaceIcon> places_icons;
private PlaceIcon trash_icon;
@@ -38,12 +39,12 @@ namespace Unity.Places.Bar
private Unity.Places.CairoDrawing.PlacesVSeparator separator;
private Unity.Places.CairoDrawing.PlacesBackground bg;
- public View (Places.Model model)
+ public View (Places.Model model, Shell shell)
{
Ctk.EffectGlow glow;
Clutter.Color white = {255, 255, 255, 255};
- Object (model:model);
+ Object (model:model, shell:shell);
/* We do our own allocation, but this doesn't hurt */
this.homogeneous = false;
@@ -53,6 +54,8 @@ namespace Unity.Places.Bar
this.bg = new Unity.Places.CairoDrawing.PlacesBackground ();
this.bg.set_parent (this);
this.bg.show ();
+ /* Make sure the bg is updated when the indicators change */
+ this.shell.indicators_changed.connect (this.on_indicators_changed);
/* This'll be populated in an idle by the model */
this.places_icons = new Gee.ArrayList<PlaceIcon> ();
@@ -101,12 +104,24 @@ namespace Unity.Places.Bar
this.bg.create_places_background ((int)stage.width,
(int)stage.height,
(int)(this.padding.left + QL_PAD),
- (int)ICON_VIEW_WIDTH);
+ (int)ICON_VIEW_WIDTH,
+ this.shell.get_indicators_width());
icon.place.active = true;
}
}
+ private void on_indicators_changed (int width)
+ {
+ Clutter.Actor stage = this.get_stage ();
+ this.bg.create_places_background ((int)stage.width,
+ (int)stage.height,
+ (int)(this.padding.left + QL_PAD),
+ (int)ICON_VIEW_WIDTH,
+ width);
+ this.queue_relayout ();
+ }
+
public override void map ()
{
base.map ();
@@ -153,8 +168,9 @@ namespace Unity.Places.Bar
n_places++;
}
- /* Allocate the Trash */
- child_box.x1 = box.x2 - box.x1 - 266 - ICON_VIEW_WIDTH;
+ /* Allocate the Trash (24 = Padding) */
+ var i_width = this.shell.get_indicators_width () + 8;
+ child_box.x1 = box.x2 - box.x1 - i_width - ICON_VIEW_WIDTH;
child_box.x2 = child_box.x1 + ICON_VIEW_WIDTH;
this.trash_icon.allocate (child_box, flags);
@@ -195,7 +211,8 @@ namespace Unity.Places.Bar
this.bg.create_places_background ((int)stage.width,
(int)stage.height,
(int)actor.x,
- 80);
+ 80,
+ this.shell.get_indicators_width());
/* Set the place as active, unset the others */
foreach (PlaceIcon picon in this.places_icons)
diff --git a/src/places/cairo-drawing.vala b/src/places/cairo-drawing.vala
index 8c460274c..2b8df2867 100644
--- a/src/places/cairo-drawing.vala
+++ b/src/places/cairo-drawing.vala
@@ -20,7 +20,7 @@
namespace Unity.Places.CairoDrawing
{
/* Margin outside of the cairo texture. We draw outside to complete the line loop
- * and we don't want the line loop to be visible in some parts of the screen.
+ * and we don't want the line loop to be visible in some parts of the screen.
* */
private int Margin = 5;
@@ -31,7 +31,7 @@ namespace Unity.Places.CairoDrawing
private Ctk.EffectGlow effect_glow;
/* (X, Y) origine of Places Bar: The top-left corner of the screen */
- private int PlaceX = 0;
+ private int PlaceX = 0;
private int PlaceY = 0;
/* Places Bar width and height. The width is set the the width of the window. */
@@ -42,7 +42,7 @@ namespace Unity.Places.CairoDrawing
/* Menu area width and height */
private int MenuH = 22;
- private int MenuW = 216;
+ private int MenuW = 100;
private int Rounding = 16;
private int RoundingSmall = 8;
@@ -61,18 +61,18 @@ namespace Unity.Places.CairoDrawing
int top;
int bottom;
}
-
+
public int PlaceWidth;
void DrawAroundMenu (Cairo.Context cairoctx)
{
cairoctx.line_to (PlaceX + PlaceW + Margin, PlaceY + MenuH);
cairoctx.line_to (PlaceX + PlaceW - MenuW + Rounding, PlaceY + MenuH);
- cairoctx.curve_to (
+ cairoctx.curve_to (
PlaceX + PlaceW - MenuW, PlaceY + MenuH,
PlaceX + PlaceW - MenuW, PlaceY + MenuH,
PlaceX + PlaceW - MenuW, PlaceY + MenuH + Rounding);
- cairoctx.line_to (PlaceX + PlaceW - MenuW, PlaceY + PlaceH - Rounding);
+ cairoctx.line_to (PlaceX + PlaceW - MenuW, PlaceY + PlaceH - Rounding);
cairoctx.curve_to (
PlaceX + PlaceW - MenuW, PlaceY + PlaceH,
PlaceX + PlaceW - MenuW, PlaceY + PlaceH,
@@ -82,7 +82,7 @@ namespace Unity.Places.CairoDrawing
void DrawTab(Cairo.Context cairoctx, TabRect tab)
{
cairoctx.line_to (tab.right + RoundingSmall, PlaceBottom );
- cairoctx.curve_to (
+ cairoctx.curve_to (
tab.right, PlaceBottom,
tab.right, PlaceBottom,
tab.right, PlaceBottom - RoundingSmall);
@@ -126,13 +126,16 @@ namespace Unity.Places.CairoDrawing
public void create_places_background (int WindowWidth,
int WindowHeight,
int TabPositionX,
- int TabWidth)
+ int TabWidth,
+ int menu_width)
{
PlaceWidth = WindowWidth;
PlaceW = WindowWidth;
PlaceBottom = PlaceY + PlaceH;
MenuBottom = PlaceY + MenuH;
+ MenuW = menu_width;
+
if (this.get_child () is Clutter.Actor)
{
this.remove_actor (this.get_child ());
@@ -199,7 +202,7 @@ namespace Unity.Places.CairoDrawing
effect_glow.set_color (c);
effect_glow.set_factor (1.0f);
effect_glow.set_margin (5);
- this.add_effect (effect_glow);
+ //this.add_effect (effect_glow);
}
construct
diff --git a/src/places/places-controller.vala b/src/places/places-controller.vala
index 56fcaba62..cb51e0c0e 100644
--- a/src/places/places-controller.vala
+++ b/src/places/places-controller.vala
@@ -39,7 +39,7 @@ namespace Unity.Places
construct
{
this.model = new Model ();
- this.view = new View (this.model);
+ this.view = new View (this.model, this.shell);
Idle.add (this.load_places);
}
diff --git a/src/places/places-view.vala b/src/places/places-view.vala
index e26c11ffb..89c904ccd 100644
--- a/src/places/places-view.vala
+++ b/src/places/places-view.vala
@@ -23,19 +23,20 @@ namespace Unity.Places
public class View : Ctk.Box
{
public Model model { get; construct; }
+ public Shell shell { get; construct; }
private Bar.View bar_view;
private Clutter.Actor? content_view;
- public View (Model model)
+ public View (Model model, Shell shell)
{
Ctk.Padding padding = { 0.0f, 0.0f, 0.0f, 68.0f };
- Object (model:model);
+ Object (model:model, shell:shell);
this.orientation = Ctk.Orientation.VERTICAL;
- this.bar_view = new Bar.View (this.model);
+ this.bar_view = new Bar.View (this.model, this.shell);
this.bar_view.padding = padding;
this.add_actor (this.bar_view);
}
diff --git a/src/unity-utils.c b/src/unity-utils.c
index 035738a02..2f1fc5365 100644
--- a/src/unity-utils.c
+++ b/src/unity-utils.c
@@ -51,9 +51,12 @@ static Atom net_wm_strut_partial = 0;
void
utils_set_strut (GtkWindow *gtk_window,
- guint32 strut_size,
- guint32 strut_start,
- guint32 strut_end)
+ guint32 left_size,
+ guint32 left_start,
+ guint32 left_end,
+ guint32 top_size,
+ guint32 top_start,
+ guint32 top_end)
{
Display *display;
Window window;
@@ -62,7 +65,7 @@ utils_set_strut (GtkWindow *gtk_window,
g_return_if_fail (GTK_IS_WINDOW (gtk_window));
- if (!strut_size)
+ if (!left_size)
return;
gdk_window = gtk_widget_get_window (GTK_WIDGET (gtk_window));
@@ -74,9 +77,13 @@ utils_set_strut (GtkWindow *gtk_window,
if (net_wm_strut_partial == None)
net_wm_strut_partial = XInternAtom (display, "_NET_WM_STRUT_PARTIAL",False);
- struts [STRUT_LEFT] = strut_size;
- struts [STRUT_LEFT_START] = strut_start;
- struts [STRUT_LEFT_END] = strut_end;
+ struts [STRUT_LEFT] = left_size;
+ struts [STRUT_LEFT_START] = left_start;
+ struts [STRUT_LEFT_END] = left_end;
+
+ struts [STRUT_TOP] = top_size;
+ struts [STRUT_TOP_START] = top_start;
+ struts [STRUT_TOP_END] = top_end;
gdk_error_trap_push ();
XChangeProperty (display, window, net_wm_strut,
@@ -87,4 +94,3 @@ utils_set_strut (GtkWindow *gtk_window,
(guchar *) &struts, 12);
gdk_error_trap_pop ();
}
-
diff --git a/src/unity-utils.h b/src/unity-utils.h
index b98a847fb..1d660247d 100644
--- a/src/unity-utils.h
+++ b/src/unity-utils.h
@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by Gordon Allott <gord.allott@canonical.com>
- *
+ *
*/
#include <unity.h>
@@ -38,5 +38,4 @@
#define LOGGER_END_PROCESS(process) { }
#endif
-
-
+#define INDICATOR_TYPE_OBJECT INDICATOR_OBJECT_TYPE
diff --git a/src/utils.vala b/src/utils.vala
index e0de19f1e..de58e57f7 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -23,5 +23,8 @@ namespace Utils
public extern void set_strut (Gtk.Window *window,
uint32 strut_size,
uint32 strut_start,
- uint32 strut_end);
+ uint32 strut_end,
+ uint32 top_size,
+ uint32 top_start,
+ uint32 top_end);
}
diff --git a/src/window.vala b/src/window.vala
index 79ead140f..9330734d0 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -36,10 +36,12 @@ namespace Unity
private Background background;
private Quicklauncher.View quicklauncher;
-
+ private Panel.View panel;
private Places.Controller controller;
private Unity.Places.View places;
+ private bool showing_places;
+
public UnderlayWindow (bool popup, int width, int height)
{
Object(is_popup: popup, popup_width: width, popup_height: height);
@@ -129,6 +131,12 @@ namespace Unity
this.places = this.controller.get_view ();
this.stage.add_actor (this.quicklauncher);
this.stage.add_actor (this.places);
+ this.places.opacity = 0;
+ this.showing_places = false;
+
+ this.panel = new Panel.View (this);
+ this.stage.add_actor (this.panel);
+ this.panel.show ();
/* Layout everything */
this.move (0, 0);
@@ -167,12 +175,15 @@ namespace Unity
width = size.width;
height = size.height;
}
+
ql_width = this.quicklauncher.get_width ();
this.resize (width, height);
this.stage.set_size (width, height);
if (!this.is_popup)
- Utils.set_strut ((Gtk.Window)this, (uint)(ql_width), 0, height);
+ Utils.set_strut ((Gtk.Window)this,
+ (uint)(ql_width), 0, height,
+ 24, 0, width);
/* Update component layouts */
this.background.set_position (0, 0);
@@ -186,6 +197,9 @@ namespace Unity
this.places.set_size (width,
height);
this.places.set_position (0, 0);
+
+ this.panel.set_size (width, 23);
+ this.panel.set_position (0, 0);
}
public override void show ()
@@ -253,7 +267,25 @@ namespace Unity
public void show_unity ()
{
- this.wnck_screen.toggle_showing_desktop (true);
+ if (this.showing_places)
+ {
+ this.showing_places = false;
+ this.panel.set_indicator_mode (true);
+ this.places.opacity = 255;
+ }
+ else
+ {
+ this.showing_places = true;
+ this.panel.set_indicator_mode (false);
+ this.places.opacity = 0;
+ }
+
+ this.places.do_queue_redraw ();
+ }
+
+ public int get_indicators_width ()
+ {
+ return this.panel.get_indicators_width ();
}
}