diff options
| -rw-r--r-- | configure.ac | 11 | ||||
| -rw-r--r-- | targets/mutter/Makefile.am | 1 | ||||
| -rw-r--r-- | targets/unity/Makefile.am | 1 | ||||
| -rw-r--r-- | tests/ui/Makefile.am | 2 | ||||
| -rw-r--r-- | tests/unit/Makefile.am | 4 | ||||
| -rw-r--r-- | tests/unit/test-panel-indicator-object-view.vala | 149 | ||||
| -rw-r--r-- | tests/unit/test-place.vala | 168 | ||||
| -rw-r--r-- | tests/unit/test-places.vala | 8 | ||||
| -rw-r--r-- | tests/unit/test-unit.vala | 6 | ||||
| -rw-r--r-- | unity-private/panel/panel-indicator-object-view.vala | 27 | ||||
| -rw-r--r-- | unity/Makefile.am | 58 | ||||
| -rw-r--r-- | unity/unity-place-marshal.list | 28 | ||||
| -rw-r--r-- | unity/unity-place.c | 257 | ||||
| -rw-r--r-- | unity/unity-place.h | 79 | ||||
| -rw-r--r-- | unity/unity-place.vala | 753 | ||||
| -rw-r--r-- | unity/unity-place.xml | 55 | ||||
| -rw-r--r-- | vapi/Makefile.am | 3 | ||||
| -rw-r--r-- | vapi/dee-1.0.vapi | 4 | ||||
| -rw-r--r-- | vapi/unity-places.vapi | 16 |
19 files changed, 1127 insertions, 503 deletions
diff --git a/configure.ac b/configure.ac index 2b2342286..536f82280 100644 --- a/configure.ac +++ b/configure.ac @@ -92,7 +92,12 @@ AC_SUBST(MAINTAINER_VALAFLAGS) dnl Check for module and library dependancies GLIB_REQUIRED=2.22 GTK_REQUIRED=2.18 -PKG_CHECK_MODULES(BASE, +PKG_CHECK_MODULES(BASE, + clutter-1.0 >= 1.0 + clutter-gtk-0.10 >= 0.10 + clutk-0.3 >= 0.3.26 + dbus-glib-1 + dee-1.0 >= 0.2.0 glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gtk+-2.0 >= $GTK_REQUIRED @@ -100,10 +105,6 @@ PKG_CHECK_MODULES(BASE, gio-2.0 >= $GTK_REQUIRED gee-1.0 gconf-2.0 - dee-1.0 >= 0.2.0 - clutter-1.0 >= 1.0 - clutter-gtk-0.10 >= 0.10 - clutk-0.3 >= 0.3.26 indicator libbamf >= 0.2 libwnck-1.0 >= 2.28.0 diff --git a/targets/mutter/Makefile.am b/targets/mutter/Makefile.am index 01e262f91..00206c0e7 100644 --- a/targets/mutter/Makefile.am +++ b/targets/mutter/Makefile.am @@ -39,6 +39,7 @@ libunity_mutter_la_VALAFLAGS = \ --pkg clutter-gtk-0.10 \ --pkg clutk-0.3 \ --pkg dbus-glib-1 \ + --pkg dee-1.0 \ --pkg gtk+-2.0 \ --pkg gee-1.0 \ --pkg indicator \ diff --git a/targets/unity/Makefile.am b/targets/unity/Makefile.am index 04502e8f0..81a463460 100644 --- a/targets/unity/Makefile.am +++ b/targets/unity/Makefile.am @@ -35,6 +35,7 @@ unity_VALAFLAGS = \ --pkg clutter-gtk-0.10 \ --pkg cogl-1.0 \ --pkg config \ + --pkg dee-1.0 \ --pkg dbus-glib-1 \ --pkg gtk+-2.0 \ --pkg gdk-2.0 \ diff --git a/tests/ui/Makefile.am b/tests/ui/Makefile.am index 27218ae1f..7094fe5f7 100644 --- a/tests/ui/Makefile.am +++ b/tests/ui/Makefile.am @@ -28,6 +28,7 @@ test_ui_VALAFLAGS = \ --pkg clutter-1.0 \ --pkg clutter-gtk-0.10 \ --pkg dbus-glib-1 \ + --pkg dee-1.0 \ --pkg gtk+-2.0 \ --pkg gdk-2.0 \ --pkg gee-1.0 \ @@ -42,7 +43,6 @@ test_ui_VALAFLAGS = \ --pkg unique-1.0 \ --pkg unity \ --pkg unity-const \ - --pkg unity-places \ --pkg unity-private \ $(MAINTAINER_VALAFLAGS) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 0a7f17e92..21097bd9e 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -29,6 +29,7 @@ test_unit_VALAFLAGS = \ --pkg clutter-1.0 \ --pkg clutter-gtk-0.10 \ --pkg dbus-glib-1 \ + --pkg dee-1.0 \ --pkg gtk+-2.0 \ --pkg gdk-2.0 \ --pkg gee-1.0 \ @@ -43,14 +44,15 @@ test_unit_VALAFLAGS = \ --pkg unique-1.0 \ --pkg unity \ --pkg unity-const \ - --pkg unity-places \ --pkg unity-private \ $(MAINTAINER_VALAFLAGS) test_unit_SOURCES = \ test-launcher.vala \ test-panel-indicator-object-entry-view.vala \ + test-panel-indicator-object-view.vala \ test-places.vala \ + test-place.vala \ test-unit.vala # GTester stuff diff --git a/tests/unit/test-panel-indicator-object-view.vala b/tests/unit/test-panel-indicator-object-view.vala new file mode 100644 index 000000000..31717e801 --- /dev/null +++ b/tests/unit/test-panel-indicator-object-view.vala @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2009 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 Jay Taoko <jay.taoko.patel@canonical.com> + * + */ +using Unity; +using Unity.Testing; +using Unity.Panel.Indicators; + +namespace Unity.Tests.Unit +{ + public class FakeIndicatorObject: Indicator.Object + { + public Gee.ArrayList<Indicator.ObjectEntry> indicator_entry_array; + public Gtk.Label _label; + public Gtk.Image _image; + public Gtk.Menu _menu; + + public FakeIndicatorObject () + { + Object(); + } + + construct + { + START_FUNCTION (); + indicator_entry_array = new Gee.ArrayList< unowned Indicator.ObjectEntry> (); + + _label = new Gtk.Label ("Test Label"); + _image = new Gtk.Image.from_icon_name ("gtk-apply", Gtk.IconSize.MENU); + _menu = new Gtk.Menu (); + END_FUNCTION (); + } + + public void add_entry(Indicator.ObjectEntry entry) + { + int pos = indicator_entry_array.index_of (entry); + if (pos != -1) + return; + + indicator_entry_array.add (entry); + entry_added (entry); + } + + public void remove_entry(Indicator.ObjectEntry entry) + { + int pos = indicator_entry_array.index_of (entry); + if (pos != -1) + { + indicator_entry_array.remove_at (pos); + entry_removed (entry); + } + } + + public override unowned Gtk.Label get_label () + { + return this._label; + } + + public override unowned Gtk.Image get_image () + { + return this._image; + } + + public override unowned Gtk.Menu get_menu () + { + return this._menu; + } + +/* public override unowned GLib.List get_entries () + { + + }*/ + } + + public class PanelIndicatorObjectViewSuite : Object + { + public const string DOMAIN = "/Unit/Panel/Indicator/ObjectView"; + + private Indicator.ObjectEntry entry; + private Gtk.Menu menu; + private Gtk.Label label; + private Gtk.Image image; + + public PanelIndicatorObjectViewSuite () + { + Logging.init_fatal_handler (); + + entry = new Indicator.ObjectEntry (); + + menu = new Gtk.Menu (); + entry.menu = menu; + + label = new Gtk.Label ("Test Label"); + entry.label = label; + + image = new Gtk.Image.from_icon_name ("gtk-apply", Gtk.IconSize.MENU); + entry.image = image; + + Test.add_data_func (DOMAIN + "/FakeIndicator", test_fake_indicator_object); + Test.add_data_func (DOMAIN + "/FakeIndicatorAddEntry", test_indicator_add_entry); + Test.add_data_func (DOMAIN + "/TestEntryView", test_indicator_enty_view); + } + + private void test_fake_indicator_object () + { + var fakeobject = new FakeIndicatorObject (); + + assert (fakeobject is FakeIndicatorObject); + } + + private void test_indicator_add_entry () + { + var fakeobject = new FakeIndicatorObject (); + var e = new IndicatorObjectView (fakeobject); + + fakeobject.add_entry (entry); + + assert (e.find_entry (entry)); + } + + private void test_indicator_enty_view () + { + var fakeobject = new FakeIndicatorObject (); + var e = new IndicatorObjectView (fakeobject); + + fakeobject.add_entry (entry); + IndicatorObjectEntryView? entry_view = e.get_entry_view (entry); + + assert (entry_view.entry == entry); + assert (entry_view.entry.label == entry.label); + assert (entry_view.entry.image == entry.image); + assert (entry_view.entry.menu == entry.menu); + } + } +} diff --git a/tests/unit/test-place.vala b/tests/unit/test-place.vala new file mode 100644 index 000000000..3e628ec46 --- /dev/null +++ b/tests/unit/test-place.vala @@ -0,0 +1,168 @@ +/* -*- 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 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> + * + */ +using Unity; +using Unity.Place; +using Unity.Testing; + +namespace Unity.Tests.Unit +{ + public class PlaceSuite + { + public PlaceSuite () + { + Test.add_data_func ("/Unit/Place/Empty", + PlaceSuite.test_empty_controller); + Test.add_data_func ("/Unit/Place/OneEntry", + PlaceSuite.test_one_entry); + Test.add_data_func ("/Unit/Place/TwoEntries", + PlaceSuite.test_two_entries); + Test.add_data_func ("/Unit/Place/LocalModels", + PlaceSuite.test_local_models); + } + + internal static void test_empty_controller() + { + var ctl = new Controller("/org/ayatana/unity/testplace"); + assert (ctl is Controller); + assert (!ctl.exported); + assert (ctl.dbus_path == "/org/ayatana/unity/testplace"); + assert (ctl.num_entries() == 0); + assert (ctl.get_entry ("no such entry") == null); + } + + internal static void test_one_entry() + { + var entry_path = "/org/ayatana/unity/testplace/testentry1"; + var entry = new EntryInfo(entry_path); + assert (entry is EntryInfo); + assert (entry.dbus_path == entry_path); + + var ctl = new Controller("/org/ayatana/unity/testplace"); + assert (ctl.num_entries() == 0); + + /* Assert that we can add one entry */ + ctl.add_entry (entry); + assert (ctl.num_entries() == 1); + assert (ctl.get_entry (entry_path) == entry); + + var entry_paths = ctl.get_entry_paths(); + assert (entry_paths.length == 1); + assert (entry_paths[0] == entry_path); + + var entries = ctl.get_entries (); + assert (entries.length == 1); + assert (entries[0] == entry); + + /* Assert that we can remove it again */ + ctl.remove_entry (entry_path); + assert (ctl.num_entries() == 0); + assert (ctl.get_entry (entry_path) == null); + } + + internal static void test_two_entries() + { + var entry_path1 = "/org/ayatana/unity/testplace/testentry1"; + var entry_path2 = "/org/ayatana/unity/testplace/testentry2"; + var entry1 = new EntryInfo(entry_path1); + var entry2 = new EntryInfo(entry_path2); + + var ctl = new Controller("/org/ayatana/unity/testplace"); + assert (ctl.num_entries() == 0); + + ctl.add_entry (entry1); + assert (ctl.num_entries() == 1); + + ctl.add_entry (entry2); + assert (ctl.num_entries() == 2); + + assert (ctl.get_entry (entry_path1) == entry1); + assert (ctl.get_entry (entry_path2) == entry2); + + var entry_paths = ctl.get_entry_paths(); + assert (entry_paths.length == 2); + assert (entry_paths[0] == entry_path1); + assert (entry_paths[1] == entry_path2); + + var entries = ctl.get_entries (); + assert (entries.length == 2); + assert (entries[0] == entry1); + assert (entries[1] == entry2); + + /* Assert we can't add them twice */ + + ctl.add_entry (entry1); + assert (ctl.num_entries() == 2); + + ctl.add_entry (entry2); + assert (ctl.num_entries() == 2); + + /* Assert we can remove them */ + + ctl.remove_entry (entry_path1); + assert (ctl.num_entries() == 1); + assert (ctl.get_entry (entry_path1) == null); + assert (ctl.get_entry (entry_path2) == entry2); + + ctl.remove_entry (entry_path2); + assert (ctl.num_entries() == 0); + assert (ctl.get_entry (entry_path1) == null); + assert (ctl.get_entry (entry_path2) == null); + + entry_paths = ctl.get_entry_paths(); + assert (entry_paths.length == 0); + + entries = ctl.get_entries (); + assert (entries.length == 0); + } + + internal static void test_local_models () + { + var entry = new EntryInfo("/foo/bar"); + Dee.Model sections_model = new Dee.SequenceModel(2, + typeof(string), + typeof(string)); + entry.sections_model = sections_model; + assert (entry.sections_model == sections_model); + assert (sections_model.get_n_rows() == 0); + + var renderer = entry.entry_renderer_info; + assert (renderer is RendererInfo); + Dee.Model groups_model = new Dee.SequenceModel(3, + typeof(string), + typeof(string), + typeof(string)); + renderer.groups_model = groups_model; + assert (renderer.groups_model == groups_model); + assert (groups_model.get_n_rows() == 0); + + Dee.Model results_model = new Dee.SequenceModel(6, + typeof(string), + typeof(string), + typeof(uint), + typeof(string), + typeof(string), + typeof(string)); + renderer.results_model = results_model; + assert (renderer.results_model == results_model); + assert (results_model.get_n_rows() == 0); + } + + } +} diff --git a/tests/unit/test-places.vala b/tests/unit/test-places.vala index 7cedb3592..689ede92a 100644 --- a/tests/unit/test-places.vala +++ b/tests/unit/test-places.vala @@ -26,7 +26,7 @@ namespace Unity.Tests.Unit { public PlacesSuite () { - Test.add_func ("/Unit/Places/TestPlace", () => { + /*Test.add_func ("/Unit/Places/TestPlace", () => { Logging.init_fatal_handler (); @@ -49,10 +49,10 @@ namespace Unity.Tests.Unit { warning ("TestPlace error: %s", e.message); } - }); + });*/ } - public class TestPlace : Unity.Place + /*public class TestPlace : Unity.Place { public TestPlace () { @@ -63,6 +63,6 @@ namespace Unity.Tests.Unit { this.is_active.connect ((a) => {print (@"$a\n");}); } - } + }*/ } } diff --git a/tests/unit/test-unit.vala b/tests/unit/test-unit.vala index f7fb87253..f07ff183f 100644 --- a/tests/unit/test-unit.vala +++ b/tests/unit/test-unit.vala @@ -25,16 +25,22 @@ public class Main public static int main (string[] args) { PanelIndicatorObjectEntryViewSuite panel_object_entry_view_suite; + PanelIndicatorObjectViewSuite panel_object_view_suite; + PlacesSuite places; LauncherSuite launcher; + PlaceSuite place; Gtk.init (ref args); Ctk.init (ref args); Test.init (ref args); panel_object_entry_view_suite = new PanelIndicatorObjectEntryViewSuite (); + panel_object_view_suite = new PanelIndicatorObjectViewSuite (); + launcher = new LauncherSuite (); places = new PlacesSuite (); + place = new PlaceSuite (); Test.run (); diff --git a/unity-private/panel/panel-indicator-object-view.vala b/unity-private/panel/panel-indicator-object-view.vala index 4f18afc72..8f18b65b7 100644 --- a/unity-private/panel/panel-indicator-object-view.vala +++ b/unity-private/panel/panel-indicator-object-view.vala @@ -166,5 +166,32 @@ namespace Unity.Panel.Indicators object_entry_view.show_menu (); } } + + public bool find_entry (Indicator.ObjectEntry entry) + { + for (int i = 0; i < indicator_entry_array.size; i++) + { + IndicatorObjectEntryView object_entry_view = this.indicator_entry_array.get (i) as IndicatorObjectEntryView; + if (object_entry_view.entry == entry) + { + return true; + } + } + return false; + } + + public IndicatorObjectEntryView? get_entry_view (Indicator.ObjectEntry entry) + { + for (int i = 0; i < indicator_entry_array.size; i++) + { + IndicatorObjectEntryView object_entry_view = this.indicator_entry_array.get (i) as IndicatorObjectEntryView; + if (object_entry_view.entry == entry) + { + return object_entry_view; + } + } + return null; + } + } } diff --git a/unity/Makefile.am b/unity/Makefile.am index 3446013f3..267ae1fce 100644 --- a/unity/Makefile.am +++ b/unity/Makefile.am @@ -10,60 +10,11 @@ lib_LTLIBRARIES = \ ## unityincludedir = $(includedir)/unity/unity unityinclude_HEADERS = \ - unity.h \ - unity-place.h \ - unity-place-marshal.h + unity.h unityvapidir = $(datadir)/vala/vapi unityvapi_DATA = unity.vapi -## -# DBus Specs -## - -DBUS_SPECS = \ - unity-place.xml - -%-client.h: %.xml - $(AM_V_GEN)dbus-binding-tool \ - --prefix=_$(subst -,_,$(basename $(notdir $<)))_client \ - --mode=glib-client \ - --output=$@ \ - $< - -%-server.h: %.xml - $(AM_V_GEN)dbus-binding-tool \ - --prefix=_$(subst -,_,$(basename $(notdir $<)))_server \ - --mode=glib-server \ - --output=$@ \ - $< - -BUILT_SOURCES += \ - $(DBUS_SPECS:.xml=-client.h) \ - $(DBUS_SPECS:.xml=-server.h) - -CLEANFILES += $(BUILT_SOURCES) - -EXTRA_DIST += $(DBUS_SPECS) - -## -# Signal Marshallers -## -unity-place-marshal.h: $(srcdir)/unity-place-marshal.list - $(AM_V_GEN)glib-genmarshal --header \ - --prefix=_unity_place_marshal $(srcdir)/unity-place-marshal.list \ - > unity-place-marshal.h - -unity-place-marshal.c: $(srcdir)/unity-place-marshal.list - $(AM_V_GEN)glib-genmarshal --body \ - --prefix=_unity_place_marshal $(srcdir)/unity-place-marshal.list \ - > unity-place-marshal.c - -BUILT_SOURCES += \ - unity-place-marshal.c \ - unity-place-marshal.h - -EXTRA_DIST += unity-place-marshal.list ## # libunity @@ -92,6 +43,8 @@ libunity_la_VALAFLAGS = \ --pkg config \ --pkg clutter-1.0 \ --pkg clutk-0.3 \ + --pkg dbus-glib-1 \ + --pkg dee-1.0 \ --pkg gconf-2.0 \ --pkg gtk+-2.0 \ --pkg gee-1.0 \ @@ -102,10 +55,6 @@ libunity_la_VALAFLAGS = \ $(MAINTAINER_VALAFLAGS) libunity_la_SOURCES = \ - unity-place.c \ - unity-place-client.h \ - unity-place-marshal.c \ - unity-place-server.h \ $(libunity_la_VALASOURCES:.vala=.c) libunity_la_VALASOURCES = \ @@ -119,6 +68,7 @@ libunity_la_VALASOURCES = \ shell.vala \ theme.vala \ unity-favorites.vala \ + unity-place.vala \ webapp-fetcher.vala diff --git a/unity/unity-place-marshal.list b/unity/unity-place-marshal.list deleted file mode 100644 index 0a0c935b7..000000000 --- a/unity/unity-place-marshal.list +++ /dev/null @@ -1,28 +0,0 @@ -# A library to allow applictions to provide simple indications of -# information to be displayed to users of the application through the -# interface shell. -# -# Copyright 2009 Canonical Ltd. -# -# Authors: -# Neil Jagdish Patel <neil.patel@canonical.com> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of either or both of the following licenses: -# -# 1) the GNU Lesser General Public License version 3, as published by the -# Free Software Foundation; and/or -# 2) the GNU Lesser General Public License version 2.1, 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 warranties of -# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the applicable version of the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of both the GNU Lesser General Public -# License version 3 and version 2.1 along with this program. If not, see -# <http://www.gnu.org/licenses/> -# -VOID:STRING,BOXED diff --git a/unity/unity-place.c b/unity/unity-place.c deleted file mode 100644 index 5ae7091e5..000000000 --- a/unity/unity-place.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2009 Canonical, Ltd. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License - * version 3.0 as published by the Free Software Foundation. - * - * This library 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 Lesser General Public License version 3.0 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by Neil Jagdish Patel <neil.patel@canonical.com> - */ -/** - * SECTION:unity-place - * @short_description: Sub-class this to implement a places object in the - * Unity homescreen. - * @include: unity-place.h - * - * #UnityPlace implements the Unity Place dbus protocol. It cannot be intiated - * on it's own, instead it should be subclassed and the vtable functions - * overridden to create your own Unity Place. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "unity-place.h" -#include "unity-place-marshal.h" - -G_DEFINE_TYPE (UnityPlace, unity_place, G_TYPE_OBJECT) - -#define UNITY_PLACE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \ - UNITY_TYPE_PLACE, UnityPlacePrivate)) - -struct _UnityPlacePrivate -{ - gchar *name; - gchar *icon_name; - gchar *tooltip; - - gboolean is_active; -}; - -/* Globals */ -enum -{ - VIEW_CHANGED, - IS_ACTIVE, - - LAST_SIGNAL -}; - -enum -{ - PROP_0, - PROP_NAME, - PROP_ICON_NAME, - PROP_TOOLTIP -}; - -static guint32 _place_signals[LAST_SIGNAL] = { 0 }; -static GQuark unity_place_error_quark = 0; - -/* DBus Forwards (needed above the generated dbus header) */ -static gboolean _unity_place_server_set_active (UnityPlace *place, - gboolean is_active, - GError **error); - -#include "unity-place-server.h" - -/* Forwards */ - -/* GObject Init */ -static void -unity_place_finalize (GObject *place) -{ - UnityPlacePrivate *priv; - - priv = UNITY_PLACE (place)->priv; - - if (priv->name) - { - g_free (priv->name); - priv->name = NULL; - } - if (priv->icon_name) - { - g_free (priv->icon_name); - priv->icon_name = NULL; - } - if (priv->tooltip) - { - g_free (priv->tooltip); - priv->tooltip = NULL; - } - - G_OBJECT_CLASS (unity_place_parent_class)->finalize (place); -} - -static void -unity_place_set_property (GObject *object, - guint id, - const GValue *value, - GParamSpec *pspec) -{ - UnityPlace *place = UNITY_PLACE (object); - UnityPlacePrivate *priv = place->priv; - - switch (id) - { - case PROP_NAME: - if (priv->name) - g_free (priv->name); - priv->name = g_value_dup_string (value); - g_object_notify (object, "name"); - break; - - case PROP_ICON_NAME: - if (priv->icon_name) - g_free (priv->icon_name); - priv->icon_name = g_value_dup_string (value); - g_object_notify (object, "icon-name"); - break; - - case PROP_TOOLTIP: - if (priv->tooltip) - g_free (priv->tooltip); - priv->tooltip = g_value_dup_string (value); - g_object_notify (object, "tooltip"); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, id, pspec); - break; - } -} - -static void -unity_place_get_property (GObject *object, - guint id, - GValue *value, - GParamSpec *pspec) -{ - UnityPlace *place = UNITY_PLACE (object); - UnityPlacePrivate *priv = place->priv; - - switch (id) - { - case PROP_NAME: - g_value_set_string (value, priv->name); - break; - - case PROP_ICON_NAME: - g_value_set_string (value, priv->icon_name); - break; - - case PROP_TOOLTIP: - g_value_set_string (value, priv->tooltip); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, id, pspec); - break; - } -} - -static void -unity_place_class_init (UnityPlaceClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - - obj_class->finalize = unity_place_finalize; - obj_class->set_property = unity_place_set_property; - obj_class->get_property = unity_place_get_property; - - /* Signals */ - _place_signals[VIEW_CHANGED] = - g_signal_new ("view-changed", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - 0, - NULL, NULL, - _unity_place_marshal_VOID__STRING_BOXED, - G_TYPE_NONE, 2, - G_TYPE_STRING, - DBUS_TYPE_G_STRING_STRING_HASHTABLE); - - _place_signals[IS_ACTIVE] = - g_signal_new ("is-active", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__BOOLEAN, - G_TYPE_NONE, 1, - G_TYPE_BOOLEAN); - - /* Properties */ - pspec = g_param_spec_string ("name", "Name", - "Name of place", - "", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (obj_class, PROP_NAME, pspec); - - pspec = g_param_spec_string ("icon-name", "Icon Name", - "Name of icon representing this place", - "", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (obj_class, PROP_ICON_NAME, pspec); - - pspec = g_param_spec_string ("tooltip", "Tooltip", - "The tooltip to show for this place", - "", - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (obj_class, PROP_TOOLTIP, pspec); - - /* Register as a DBus object */ - dbus_g_object_type_install_info (UNITY_TYPE_PLACE, - &dbus_glib__unity_place_server_object_info); - - /* Add Private data */ - g_type_class_add_private (obj_class, sizeof (UnityPlacePrivate)); -} - -static void -unity_place_init (UnityPlace *place) -{ - UnityPlacePrivate *priv; - - priv = place->priv = UNITY_PLACE_GET_PRIVATE (place); - - if (!unity_place_error_quark) - unity_place_error_quark = g_quark_from_string ("unity-place-error"); -} - -/* Private methods */ - -static gboolean -_unity_place_server_set_active (UnityPlace *self, - gboolean is_active, - GError **error) -{ - g_return_val_if_fail (UNITY_IS_PLACE (self), FALSE); - - self->priv->is_active = is_active; - - g_signal_emit (self, _place_signals[IS_ACTIVE], 0, is_active); - - return TRUE; -} diff --git a/unity/unity-place.h b/unity/unity-place.h deleted file mode 100644 index 7ce0e6049..000000000 --- a/unity/unity-place.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Canonical, Ltd. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License - * version 3.0 as published by the Free Software Foundation. - * - * This library 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 Lesser General Public License version 3.0 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by Neil Jagdish Patel <neil.patel@canonical.com> - */ - -#ifndef _HAVE_UNITY_PLACE_H -#define _HAVE_UNITY_PLACE_H - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define UNITY_TYPE_PLACE (unity_place_get_type ()) - -#define UNITY_PLACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - UNITY_TYPE_PLACE, UnityPlace)) - -#define UNITY_PLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ - UNITY_TYPE_PLACE, UnityPlaceClass)) - -#define UNITY_IS_PLACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - UNITY_TYPE_PLACE)) - -#define UNITY_IS_PLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - UNITY_TYPE_PLACE)) - -#define UNITY_PLACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - UNITY_TYPE_PLACE, UnityPlaceClass)) - -typedef struct _UnityPlace UnityPlace; -typedef struct _UnityPlaceClass UnityPlaceClass; -typedef struct _UnityPlacePrivate UnityPlacePrivate; - -struct _UnityPlace -{ - GObject parent; - - /*< private >*/ - UnityPlacePrivate *priv; -}; - -struct _UnityPlaceClass -{ - GObjectClass parent_class; - - /*< public >*/ - - /*< signals >*/ - void (*is_active) (UnityPlace *place, gboolean is_active); - - /*< vtable >*/ - - /*< private >*/ - void (*_unity_place_1) (void); - void (*_unity_place_2) (void); - void (*_unity_place_3) (void); - void (*_unity_place_4) (void); -}; - -GType unity_place_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* _HAVE_UNITY_PLACE_H */ diff --git a/unity/unity-place.vala b/unity/unity-place.vala new file mode 100644 index 000000000..3889426a2 --- /dev/null +++ b/unity/unity-place.vala @@ -0,0 +1,753 @@ +/* + * 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 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> + * + */ + +/* + * IMPLEMENTATION NOTE: + * It may appear this code it is bit more bloated than it needs to be + * (considering the pure number of classes and indirections), but this has + * some good reasons. + * + * Firstly we want to hide away Vala's internal DBus marshalling which would + * expose raw structs in the. These structs are hidden away in _RendererInfo, + * and _EntryInfo. We wrap these in handy GObjects with properties and what not. + * In fact we want to hide all DBusisms, which is also why the DBus interfaces + * are declared private. + * + * Secondly we want the generatedd C API to be nice and not too Vala-ish. We + * must anticipate that place daemons consuming libunity will be written in + * both Vala and C. + * + */ + +using Dee; +using DBus; + +namespace Unity.Place { + + /** + * UnityPlace_RendererInfo: + * + * Private helper struct used for marshalling a RendererInfo object over DBus + */ + private struct _RendererInfo { + public string default_renderer; + public string groups_model; + public string results_model; + public HashTable<string,string> hints; + } + + /** + * SECTION:unity-place-renderer-info + * @short_description: Encapsulates all place entry metadata the Unity shell needs in order to render this model + * @include: unity.h + * + * + */ + public class RendererInfo : GLib.Object { + + private _RendererInfo info; + private Dee.Model _groups_model; + private Dee.Model _results_model; + + /* + * Properties + */ + public string default_renderer { + get { return info.default_renderer; } + set { info.default_renderer = value; } + } + + public Dee.Model groups_model { + get { return _groups_model; } + set { + _groups_model = value; + if (value is Dee.SharedModel) + { + Dee.SharedModel model = value as Dee.SharedModel; + info.groups_model = model.get_swarm_name(); + } + else + info.groups_model = "__local__"; + } + } + + public Dee.Model results_model { + get { return _results_model; } + set { + _results_model = value; + if (value is Dee.SharedModel) + { + Dee.SharedModel model = value as Dee.SharedModel; + info.results_model = model.get_swarm_name(); + } + else + info.results_model = "__local__"; + } + } + + /* + * Constructors + */ + + internal RendererInfo (_RendererInfo info) + { + this.info = info; + info.hints = new HashTable<string,string>(str_hash, str_equal); + } + + /* + * Public API + */ + + public void set_hint (string hint, string val) + { + info.hints.insert (hint, val); + } + + public string? get_hint (string hint) + { + return info.hints.lookup (hint); + } + + public void clear_hint (string hint) + { + info.hints.remove (hint); + } + + public void clear_hints () + { + info.hints.remove_all (); + } + } + + /** + * UnityPlace_EntryInfo: + * + * Private helper struct used for marshalling an EntryInfo object over DBus + */ + private struct _EntryInfo { + public string dbus_path; + public string display_name; + public string icon; + public uint position; + public string[] mimetypes; + public bool sensitive; + public string sections_model; + public HashTable<string,string> hints; + public _RendererInfo entry_renderer_info; + public _RendererInfo global_renderer_info; + } + + public class EntryInfo : GLib.Object { + + /* The _EntryInfo needs to be set before we set properties, so it's + * paramount we do it here */ + private _EntryInfo info = _EntryInfo(); + private RendererInfo _entry_renderer_info; + private RendererInfo _global_renderer_info; + private Dee.Model _sections_model; + + /* + * Properties + */ + public RendererInfo entry_renderer_info { + get { return _entry_renderer_info; } + } + + public RendererInfo global_renderer_info { + get { return _global_renderer_info; } + } + + public string dbus_path { + get { return info.dbus_path; } + construct set { info.dbus_path = value; } + } + + public string display_name { + get { return info.display_name; } + construct set { info.display_name = value; } + } + + public string icon { + get { return info.icon; } + construct set { info.icon = value; } + } + + public uint position { + get { return info.position; } + construct set { info.position = value; } + } + + public string[] mimetypes { + get { return info.mimetypes; } + construct set { info.mimetypes = value; } + } + + public bool sensitive { + get { return info.sensitive; } + construct set { info.sensitive = value; } + } + + public Dee.Model sections_model { + get { return _sections_model; } + construct set { + _sections_model = value; + if (value is Dee.SharedModel) + { + Dee.SharedModel model = value as Dee.SharedModel; + info.sections_model = model.get_swarm_name(); + } + else + info.sections_model = "__local__"; + } + } + + /* + * Constructors + */ + + construct { + if (info.dbus_path == null) + { + critical ("""No DBus path set for EntryInfo. +'dbus-path' property in the UnityPlaceEntryInfo constructor"""); + info.dbus_path = ""; + } + if (info.display_name == null) + info.display_name = ""; + if (info.icon == null) + info.icon = ""; + info.position = 0; + if (info.mimetypes == null) + info.mimetypes = new string[0]; + info.sensitive = true; + if (info.sections_model == null) + info.sections_model = ""; + info.hints = new HashTable<string,string>(str_hash, str_equal); + + info.entry_renderer_info.default_renderer = ""; + info.entry_renderer_info.groups_model = ""; + info.entry_renderer_info.results_model = ""; + info.entry_renderer_info.hints = new HashTable<string, string> (str_hash, str_equal); + + info.global_renderer_info.default_renderer = ""; + info.global_renderer_info.groups_model = ""; + info.global_renderer_info.results_model = ""; + info.global_renderer_info.hints = new HashTable<string, string> (str_hash, str_equal); + + _entry_renderer_info = new RendererInfo (info.entry_renderer_info); + _global_renderer_info = new RendererInfo (info.global_renderer_info); + } + + public EntryInfo (string dbus_path) { + /* We need the _empty hack here to avoid a bug in valac, otherwise + * valac will set it to NULL somehow and cause a g_critical in + * g_strv_length() */ + var _empty = new string[0]; + GLib.Object(dbus_path : dbus_path, + mimetypes : _empty); + } + + /* + * Public API + */ + + public void set_hint (string hint, string val) + { + info.hints.insert (hint, val); + } + + public string? get_hint (string hint) + { + return info.hints.lookup (hint); + } + + public void clear_hint (string hint) + { + info.hints.remove (hint); + } + + public void clear_hints () + { + info.hints.remove_all (); + } + + /* + * Internal API + */ + internal _EntryInfo get_raw () + { + return info; + } + } + + /** + * UnityPlaceService: + * + * DBus interface exported by a place daemon + */ + [DBus (name = "com.canonical.Unity.Place")] + private interface Service : GLib.Object + { + public abstract _EntryInfo[] get_entries () throws DBus.Error; + + public signal void entry_added (_EntryInfo entry); + + public signal void entry_removed (string entry_dbus_path); + } + + /** + * UnityPlaceEntryService: + * + * DBus interface for a given place entry exported by a place daemon + */ + [DBus (name = "com.canonical.Unity.PlaceEntry")] + private interface EntryService : GLib.Object + { + public abstract uint set_global_search (string search, + HashTable<string,string> hints) throws DBus.Error; + + public abstract uint set_search (string search, + HashTable<string,string> hints) throws DBus.Error; + + public abstract void set_active (bool is_active) throws DBus.Error; + + public abstract void set_active_section (uint section_id) throws DBus.Error; + + public signal void renderer_info_changed (_RendererInfo renderer_info); + } + + /** + * UnityPlaceServiceImpl: + * + * Private helper class to shield of DBus details and ugly + * internal structs used for marshalling + */ + private class ServiceImpl : GLib.Object, Service + { + private string _dbus_path; + private HashTable<string,EntryServiceImpl> entries; + private bool _exported; + + /* + * Properties + */ + + [Property(nick = "DBus object path", blurb = "The DBus path this object is exported under")] + public string dbus_path { + get { return _dbus_path; } + construct { _dbus_path = value; } + } + + public bool exported { + get { return _exported; } + } + + /* + * Constructors + */ + + construct { + entries = new HashTable<string,EntryServiceImpl> (str_hash, str_equal); + } + + public ServiceImpl (string dbus_path) + { + GLib.Object (dbus_path : dbus_path); + } + + /* + * DBus API + */ + + public _EntryInfo[] get_entries () + { + _EntryInfo[] result = new _EntryInfo[entries.size ()]; + + int i = 0; + foreach (var entry in entries.get_values ()) + { + result[i] = entry.entry_info.get_raw(); + i++; + } + + return result; + } + + /* + * Internal API + */ + + public void add_entry (EntryInfo entry_info) + { + if (entries.lookup (entry_info.dbus_path) != null) + return; + + var entry = new EntryServiceImpl(entry_info); + entries.insert (entry_info.dbus_path, entry); + if (_exported) + { + try { + entry.export (); + } catch (DBus.Error e) { + critical ("Failed to export place entry '%s': %s", + entry_info.dbus_path, e.message); + } + } + entry_added (entry_info.get_raw ()); + } + + public EntryInfo? get_entry (string dbus_path) + { + var entry = entries.lookup (dbus_path); + if (entry != null) + return entry.entry_info; + else + return null; + } + + public uint num_entries () + { + return entries.size (); + } + + public string[] get_entry_paths () + { + string[] result = new string[entries.size ()]; + + int i = 0; + foreach (var entry in entries.get_values ()) + { + result[i] = entry.entry_info.dbus_path; + i++; + } + + return result; + } + + public void remove_entry (string dbus_path) + { + var entry = entries.lookup (dbus_path); + + if (entry == null) + return; + + entry_removed (dbus_path); + if (_exported) + { + try { + entry.unexport (); + } catch (DBus.Error e) { + critical ("Failed to unexport place entry '%s': %s", + entry.entry_info.dbus_path, e.message); + } + } + + entries.remove (dbus_path); + } + + public void export () throws DBus.Error + { + var conn = DBus.Bus.get (DBus.BusType. SESSION); + conn.register_object (_dbus_path, this); + + foreach (var entry in entries.get_values ()) + { + entry.export (); + } + + _exported = true; + notify_property("exported"); + } + + public void unexport () throws DBus.Error + { + foreach (var entry in entries.get_values ()) + { + entry.unexport (); + } + // FIXME: unregister_object() depends on https://bugzilla.gnome.org/show_bug.cgi?id=620543 + //var conn = DBus.Bus.get (DBus.BusType. SESSION); + //conn.unregister_object (this); + + _exported = false; + notify_property("exported"); + } + } + + /** + * UnityPlaceEntryServiceImpl: + * + * Private helper class to shield of DBus details and ugly + * internal structs used for marshalling + */ + private class EntryServiceImpl : GLib.Object, EntryService + { + private bool _exported = false; + private EntryInfo _entry_info; + + /* + * Properties + */ + + public EntryInfo entry_info { + get { return _entry_info; } + construct { _entry_info = value; } + } + + public bool exported { + get { return _exported; } + } + + /* + * Constructors + */ + + public EntryServiceImpl (EntryInfo entry_info) + { + GLib.Object(entry_info : entry_info); + } + + /* + * DBus API + */ + + public uint set_global_search (string search, + HashTable<string,string> hints) + { + return 0; + } + + public uint set_search (string search, + HashTable<string,string> hints) + { + return 0; + } + + public void set_active (bool is_active) + { + // pass + } + + public void set_active_section (uint section_id) + { + // pass + } + + /* + * Internal API + */ + + public void export () throws DBus.Error + { + var conn = DBus.Bus.get (DBus.BusType. SESSION); + conn.register_object (_entry_info.dbus_path, this); + + _exported = true; + notify_property("exported"); + } + + public void unexport () throws DBus.Error + { + // FIXME: unregister_object() depends on https://bugzilla.gnome.org/show_bug.cgi?id=620543 + //var conn = DBus.Bus.get (DBus.BusType. SESSION); + //conn.unregister_object (this); + + _exported = false; + notify_property("exported"); + } + } + + /** + * UnityPlaceController: + * + * Main handle for controlling the place entries managed by a place daemon + */ + public class Controller : GLib.Object + { + private ServiceImpl service; + private string _dbus_path; + private bool _exported = false; + + /* + * Properties + */ + + [Property(nick = "DBus object path", blurb = "The DBus path this object is exported under")] + public string dbus_path { + get { return _dbus_path; } + construct { _dbus_path = value; } + } + + public bool exported { + get { return _exported; } + } + + /* + * Constructors + */ + + construct { + service = new ServiceImpl (_dbus_path); + } + + public Controller (string dbus_path) + { + GLib.Object (dbus_path : dbus_path); + } + + /* + * Public API + */ + + public void add_entry (EntryInfo entry) + { + service.add_entry (entry); + } + + public EntryInfo? get_entry (string dbus_path) + { + return service.get_entry (dbus_path); + } + + public void remove_entry (string dbus_path) + { + service.remove_entry (dbus_path); + } + + public uint num_entries () + { + return service.num_entries (); + } + + public string[] get_entry_paths () + { + return service.get_entry_paths (); + } + + public EntryInfo[] get_entries () + { + uint len = num_entries(); + var result = new EntryInfo[len]; + var entry_paths = get_entry_paths (); + + int i = 0; + for (i = 0; i < len; i++) + { + result[i] = get_entry (entry_paths[i]); + } + + return result; + } + + public void export () throws DBus.Error + { + service.export (); + _exported = true; + notify_property("exported"); + } + + public void unexport () throws DBus.Error + { + service.unexport (); + _exported = false; + notify_property("exported"); + } + } + + /*public class TestPlaceDaemon : GLib.Object, PlaceService + { + private static string[] supported_mimetypes = {"text/plain", "text/html"}; + + public TestPlaceDaemon() + { + try { + var conn = DBus.Bus.get (DBus.BusType. SESSION); + + dynamic DBus.Object bus = conn.get_object ("org.freedesktop.DBus", + "/org/freedesktop/DBus", + "org.freedesktop.DBus"); + + // try to register service in session bus + uint request_name_result = bus.request_name ("org.ayatana.TestPlace", (uint) 0); + + if (request_name_result == DBus.RequestNameReply.PRIMARY_OWNER) { + conn.register_object ("/org/ayatana/places/test", this); + } else { + stderr.printf ("Unable to grab DBus name. Another test server is probably running\n"); + } + } catch (DBus.Error e) { + stderr.printf ("Oops: %s\n", e.message); + } + } + + public _EntryInfo[] get_entries () throws DBus.Error + { + var entry = _EntryInfo(); + entry.dbus_path = "/org/foo/bar"; + entry.name = "My Entry Name"; + entry.icon = "__icon__"; + entry.position = 0; + entry.mimetypes = supported_mimetypes; + entry.sensitive = true; + entry.sections_model = "org.ayatana.MySectionsModel"; + entry.hints = new HashTable<string, string> (str_hash, str_equal); + entry.entry_renderer_info.default_renderer = "DefaultRenderer"; + entry.entry_renderer_info.groups_model = "org.ayatana.MyGroupsModel"; + entry.entry_renderer_info.results_model = "org.ayatana.MyResultsModel"; + entry.entry_renderer_info.hints = new HashTable<string, string> (str_hash, str_equal); + entry.global_renderer_info.default_renderer = "DefaultRenderer"; + entry.global_renderer_info.groups_model = "org.ayatana.MyGlobalGroupsModel"; + entry.global_renderer_info.results_model = "org.ayatana.MyGlobalResultsModel"; + entry.global_renderer_info.hints = new HashTable<string, string> (str_hash, str_equal); + + _EntryInfo[] entries = new _EntryInfo[1]; + entries[0] = entry; + return entries; + } + + public static int main (string[] args) + { + var loop = new MainLoop (null, false); + var daemon = new TestPlaceDaemon(); + loop.run (); + + return 0; + } + }*/ + /* + public static int main (string[] args) + { + var loop = new MainLoop (null, false); + var ctl = new Controller ("/foo/bar"); + ctl.export(); + + var entry = new EntryInfo(); + entry.dbus_path = "/foo/bar/entries/0"; + entry.display_name = "Display Name"; + entry.set_hint ("hintkey1", "hintvalue1"); + ctl.add_entry (entry); + + loop.run (); + + return 0; + } + */ + +} /* namespace */ diff --git a/unity/unity-place.xml b/unity/unity-place.xml deleted file mode 100644 index 9774d63c6..000000000 --- a/unity/unity-place.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -A library to allow applictions to provide simple indications of -information to be displayed to users of the application through the -interface shell. - -Copyright 2009 Canonical Ltd. - -Authors: - Neil Jagdish Patel <neil.patel@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the -Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, 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 warranties of -MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR -PURPOSE. See the applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see -<http://www.gnu.org/licenses/> ---> -<node name="/com/canonical/Unity/Place"> - <interface name="com.canonical.Unity.Place"> - <annotation name="com.canonical.DBus.GLib.CSymbol" value="unity_place"/> - -<!-- Properties --> - <property name="name" type="s" access="read" /> - <property name="icon_name" type="s" access="read" /> - <property name="tooltip" type="s" access="read" /> - -<!-- Methods --> - <method name="SetActive"> - <arg name="is_active" type="b" direction="in" /> - </method> - -<!-- Signals --> - <signal name="ViewChanged"> - <arg name="properties" type="a{ss}" /> - </signal> - - <signal name="IsActive"> - <arg name="is_active" type="b" /> - </signal> - -<!-- End of interesting stuff --> - </interface> -</node> diff --git a/vapi/Makefile.am b/vapi/Makefile.am index 6e7a01e50..27d75ba92 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -14,5 +14,4 @@ EXTRA_DIST = \ mutter-2.28.vapi \ mutter-2.28.deps \ unity-const.vapi \ - unity-misc.vapi \ - unity-places.vapi + unity-misc.vapi diff --git a/vapi/dee-1.0.vapi b/vapi/dee-1.0.vapi index f2356ec87..f8c9012fd 100644 --- a/vapi/dee-1.0.vapi +++ b/vapi/dee-1.0.vapi @@ -52,13 +52,15 @@ namespace Dee { [CCode (cheader_filename = "dee.h")] public class SequenceModel : Dee.VersionedModel, Dee.Model { [CCode (type = "DeeModel*", has_construct_function = false)] - public SequenceModel (uint n_columns); + public SequenceModel (uint n_columns, ...); } [CCode (cheader_filename = "dee.h")] public class SharedModel : Dee.ProxyModel, Dee.Model { [CCode (type = "DeeModel*", has_construct_function = false)] public SharedModel (string name, uint n_columns, ...); public void connect (); + public unowned string get_swarm_name (); + public Dee.Peer get_peer (); [CCode (type = "DeeModel*", has_construct_function = false)] public SharedModel.with_back_end (string name, Dee.Model back_end); [CCode (type = "DeeModel*", has_construct_function = false)] diff --git a/vapi/unity-places.vapi b/vapi/unity-places.vapi deleted file mode 100644 index 2962546dc..000000000 --- a/vapi/unity-places.vapi +++ /dev/null @@ -1,16 +0,0 @@ -/* unity-places.vapi generated by vapigen, do not modify. */ - -[CCode (cprefix = "Unity", lower_case_cprefix = "unity_")] -namespace Unity { - [CCode (cheader_filename = "unity/unity-place.h")] - public class Place : GLib.Object { - [NoAccessorMethod] - public string icon_name { owned get; set; } - [NoAccessorMethod] - public string name { owned get; set; } - [NoAccessorMethod] - public string tooltip { owned get; set; } - public virtual signal void is_active (bool is_active); - public virtual signal void view_changed (string view_name, GLib.HashTable<string,string> view_properties); - } -} |
