diff options
| author | Didier Roche <didier.roche@canonical.com> | 2010-07-12 14:43:10 +0200 |
|---|---|---|
| committer | Didier Roche <didier.roche@canonical.com> | 2010-07-12 14:43:10 +0200 |
| commit | 4ba7a4015c3e2ef2f44a9cca8610426b53de0d52 (patch) | |
| tree | 083423ac057b2decffed88f3da93bb1fe8ad4c20 | |
| parent | 2bdc8e604297fbeaa9283a0f3595db582788f42e (diff) | |
| parent | 0e106150b06de43e63fe4c6a31eaefebb1fff63a (diff) | |
Import upstream version 0.2.16upstream-0.2.16
(bzr r55.4.15)
55 files changed, 1955 insertions, 642 deletions
@@ -1,5 +1,111 @@ # Generated by Makefile. Do not edit. +2010-07-09 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Jasons unmatched applications branch + +2010-07-08 Neil Jagdish Patel <neil.patel@canonical.com> + + merge with trunk + +2010-07-08 Neil Jagdish Patel <neil.patel@canonical.com> + + Add missind method to test + +2010-07-02 Jason Smith <jason@hakimaki> + + ensure we dont overdo things + +2010-07-02 Jason Smith <jason@hakimaki> + + Cause unity to properly display unmatched applications + +2010-07-08 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Collapsing place groups + +2010-07-06 Neil Jagdish Patel <neil.patel@canonical.com> + + - Add support for about to show (really speeds up the showing of results) + - Make the pixbuf cache a little better at loading up files + - Lot's of other cleanups + + modified: + unity-private/places/places-default-renderer-group.vala + unity-private/places/places-default-renderer.vala + unity-private/places/places-place-search-bar.vala + unity-private/places/places-place-search-entry.vala + unity-private/places/places-view.vala + unity/unity-expanding-bin.vala + unity/unity-pixbuf-cache.vala + vapi/clutk-0.3.vapi + +2010-07-05 Neil Jagdish Patel <neil.patel@canonical.com> + + - Darken the background in testing mode when showing places + - Clean up the unexpanded_height setting method + - Take into account the padding of the actor when updating the + unexpanded_height property + + modified: + unity-private/places/places-default-renderer-group.vala + unity-private/places/places-default-renderer.vala + unity-private/testing/test-window.vala + unity/unity-expanding-bin.vala + +2010-07-05 Neil Jagdish Patel <neil.patel@canonical.com> + + = Add expandable bin which can be in three states, closed (hidden), unexpanded (required height) and expanded (full child height). It can animate between the states (mostly :) + - Make the DefaultRendererGroup use this bin + - Make the DefaultRendererGroup set the new property on the icon view + + added: + unity/unity-expanding-bin.vala + modified: + .bzrignore + unity-private/places/places-default-renderer-group.vala + unity/Makefile.am + +2010-07-08 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Bugfixes from QA friday + +2010-07-03 Neil Jagdish Patel <neil.patel@canonical.com> + + Hide Unity when something is activated in places + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Add HACKING file to dist + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Check menu exists before closing it + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + can't focus indicators in places model + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Update ignores + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Correctly unparent our child actor, as we're actually hold two references to it + +2010-07-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Check if the place was successfully brought online before adding to the model + +2010-07-01 Neil Jagdish Patel <neil.patel@canonical.com> + + Bump for next devel version + +2010-07-01 Neil Jagdish Patel <neil.patel@canonical.com> + + [release] 0.2.14 + 2010-07-01 Neil Jagdish Patel <neil.patel@canonical.com> Listen to the icon hint diff --git a/HACKING b/HACKING new file mode 100644 index 000000000..491c1a56f --- /dev/null +++ b/HACKING @@ -0,0 +1,49 @@ +Notes on unity development: + +Quicklist desktop file specification: + Adding a new quicklist entry requires modifiying the desktop file of the + application the quicklist belongs to. You will need to create a new group + named Quicklist Entry UID, with UID being a unique id (in the scope of the + desktop file). + An example follows: + +[Desktop Entry] +... +... +... + +[QuickList Entry 1] +Name=FooBar Action +Exec=foobar --thingone + +[QuickList Entry 2] +Name=FooBar Second Action +Exec=foobar --thingtwo + +[QuickList Entry 3] +Name=FooBar Third Action +Exec=foobar --thingthree + + Name and Exec follow standard Desktop file specifications and can be + translated in the same mannar as standard desktop files. + +Bootperformance Logging: + To enable boot performance logging, set the environment variable + UNITY_BOOTLOG_FILENAME to a path to the log file and make sure unity is built + with --enable-testing. eg: + UNITY_BOOTLOG_FILENAME=/tmp/unity.log unity -p + + you can then produce a bootchart with this by running the tools/makebootchart.py + script: + ./tools/makebootchart.py --input=/tmp/unity.log --output=/tmp/unity.svg + + +Webapp switching: + Unity can use two webapp systems, prism and chromium, you can toggle between + the two by setting the gconf key "/apps/unity/webapp_use_chromium" on or off + +Setting unmovable apps: + To make a launcher unmovable set the desktop_file gconf key of the app to manditory + +setting bottom fixed apps: + To make a launcher appear at the bottom of the launchers and fixed in place, set the key "fixed" (bool) to true in the launchers gconf directory diff --git a/Makefile.am b/Makefile.am index 85a1a72e1..2612713a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,5 +28,7 @@ pkgconfig_DATA = unity.pc EXTRA_DIST = \ autogen.sh \ COPYING \ - unity.pc.in \ - COPYING.LGPL + COPYING.LGPL \ + HACKING \ + unity.pc.in + diff --git a/Makefile.in b/Makefile.in index 87ac15e0e..3ff0376dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -306,8 +306,9 @@ pkgconfig_DATA = unity.pc EXTRA_DIST = \ autogen.sh \ COPYING \ - unity.pc.in \ - COPYING.LGPL + COPYING.LGPL \ + HACKING \ + unity.pc.in all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for unity 0.2.14. +# Generated by GNU Autoconf 2.65 for unity 0.2.16. # # Report bugs to <https://launchpad.net/unity>. # @@ -763,8 +763,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unity' PACKAGE_TARNAME='unity' -PACKAGE_VERSION='0.2.14' -PACKAGE_STRING='unity 0.2.14' +PACKAGE_VERSION='0.2.16' +PACKAGE_STRING='unity 0.2.16' PACKAGE_BUGREPORT='https://launchpad.net/unity' PACKAGE_URL='' @@ -1573,7 +1573,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unity 0.2.14 to adapt to many kinds of systems. +\`configure' configures unity 0.2.16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1643,7 +1643,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unity 0.2.14:";; + short | recursive ) echo "Configuration of unity 0.2.16:";; esac cat <<\_ACEOF @@ -1776,7 +1776,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unity configure 0.2.14 +unity configure 0.2.16 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2056,7 +2056,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unity $as_me 0.2.14, which was +It was created by unity $as_me 0.2.16, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2883,7 +2883,7 @@ fi # Define the identity of the package. PACKAGE=unity - VERSION=0.2.14 + VERSION=0.2.16 cat >>confdefs.h <<_ACEOF @@ -2926,8 +2926,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' DL_MAJOR_VERSION=0 DL_MINOR_VERSION=2 -DL_MICRO_VERSION=14 -DL_VERSION=0.2.14 +DL_MICRO_VERSION=16 +DL_VERSION=0.2.16 @@ -14461,7 +14461,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by unity $as_me 0.2.14, which was +This file was extended by unity $as_me 0.2.16, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14527,7 +14527,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -unity config.status 0.2.14 +unity config.status 0.2.16 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 026362274..f0b3db740 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([unity_major], [0]) m4_define([unity_minor], [2]) -m4_define([unity_micro], [14]) +m4_define([unity_micro], [16]) m4_define([unity_api], [unity_major.unity_minor]) diff --git a/targets/mutter/plugin.c b/targets/mutter/plugin.c index 84d592a91..30d14bc69 100644 --- a/targets/mutter/plugin.c +++ b/targets/mutter/plugin.c @@ -256,6 +256,7 @@ static void _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify (GO static void unity_plugin_on_focus_window_changed (UnityPlugin* self); static void unity_plugin_set_fullscreen_obstruction (UnityPlugin* self, gboolean value); static void unity_plugin_got_screensaver_changed (UnityPlugin* self, DBusGProxy* screensaver, gboolean changed); +static guint32 unity_plugin_real_get_current_time (UnityShell* base); static void unity_plugin_real_add_fullscreen_request (UnityShell* base, GObject* o); static gboolean unity_plugin_real_remove_fullscreen_request (UnityShell* base, GObject* o); static gboolean unity_plugin_get_fullscreen_obstruction (UnityPlugin* self); @@ -277,6 +278,7 @@ static void _lambda8_ (ClutterAnimation* an, UnityPlugin* self); static void __lambda8__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static void _lambda9_ (ClutterAnimation* an, UnityPlugin* self); static void __lambda9__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static void unity_plugin_real_hide_unity (UnityShell* base); static void unity_plugin_real_show_unity (UnityShell* base); static void unity_plugin_real_about_to_show_places (UnityShell* base); static void unity_plugin_real_grab_keyboard (UnityShell* base, gboolean grab, guint32 timestamp); @@ -633,6 +635,15 @@ static void unity_plugin_got_screensaver_changed (UnityPlugin* self, DBusGProxy* } +static guint32 unity_plugin_real_get_current_time (UnityShell* base) { + UnityPlugin * self; + guint32 result = 0U; + self = (UnityPlugin*) base; + result = meta_display_get_current_time (meta_screen_get_display (mutter_plugin_get_screen (unity_plugin_get_plugin (self)))); + return result; +} + + static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self) { MutterWindow* focus; gboolean fullscreen; @@ -1011,31 +1022,47 @@ static void __lambda9__clutter_animation_completed (ClutterAnimation* _sender, g } +static void unity_plugin_real_hide_unity (UnityShell* base) { + UnityPlugin * self; + ClutterAnimation* anim; + ClutterAnimation* _tmp0_; + self = (UnityPlugin*) base; + if (self->priv->places_showing == FALSE) { + return; + } + self->priv->places_showing = FALSE; + anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->dark_box, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 100, "opacity", 0, NULL)); + g_signal_connect_object (anim, "completed", (GCallback) __lambda8__clutter_animation_completed, self, 0); + clutter_actor_animate (mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self)), (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 100, "opacity", 255, NULL); + anim = (_tmp0_ = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->places, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 100, "opacity", 0, NULL)), _g_object_unref0 (anim), _tmp0_); + g_signal_connect_object (anim, "completed", (GCallback) __lambda9__clutter_animation_completed, self, 0); + unity_panel_view_set_indicator_mode (self->priv->panel, FALSE); + unity_shell_ensure_input_region ((UnityShell*) self); + while (TRUE) { + if (!gtk_events_pending ()) { + break; + } + gtk_main_iteration (); + } + _g_object_unref0 (anim); +} + + static void unity_plugin_real_show_unity (UnityShell* base) { UnityPlugin * self; self = (UnityPlugin*) base; if (self->priv->places_showing) { - ClutterAnimation* anim; - ClutterAnimation* _tmp0_; - self->priv->places_showing = FALSE; - anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->dark_box, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 100, "opacity", 0, NULL)); - g_signal_connect_object (anim, "completed", (GCallback) __lambda8__clutter_animation_completed, self, 0); - clutter_actor_animate (mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self)), (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 100, "opacity", 255, NULL); - anim = (_tmp0_ = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->places, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 100, "opacity", 0, NULL)), _g_object_unref0 (anim), _tmp0_); - g_signal_connect_object (anim, "completed", (GCallback) __lambda9__clutter_animation_completed, self, 0); - unity_panel_view_set_indicator_mode (self->priv->panel, FALSE); - unity_shell_ensure_input_region ((UnityShell*) self); - _g_object_unref0 (anim); + unity_shell_hide_unity ((UnityShell*) self); } else { - ClutterRectangle* _tmp3_; - ClutterColor _tmp2_; - ClutterColor _tmp1_ = {0}; - ClutterActor* _tmp4_; + ClutterRectangle* _tmp2_; + ClutterColor _tmp1_; + ClutterColor _tmp0_ = {0}; + ClutterActor* _tmp3_; self->priv->places_showing = TRUE; clutter_actor_show ((ClutterActor*) self->priv->places); clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 0); - self->priv->dark_box = (_tmp3_ = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp2_ = (_tmp1_.red = (guint8) 0, _tmp1_.green = (guint8) 0, _tmp1_.blue = (guint8) 0, _tmp1_.alpha = (guint8) 255, _tmp1_), &_tmp2_))), _g_object_unref0 (self->priv->dark_box), _tmp3_); - clutter_container_add_actor ((_tmp4_ = mutter_plugin_get_window_group (unity_plugin_get_plugin (self)), CLUTTER_IS_CONTAINER (_tmp4_) ? ((ClutterContainer*) _tmp4_) : NULL), (ClutterActor*) self->priv->dark_box); + self->priv->dark_box = (_tmp2_ = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp1_ = (_tmp0_.red = (guint8) 0, _tmp0_.green = (guint8) 0, _tmp0_.blue = (guint8) 0, _tmp0_.alpha = (guint8) 255, _tmp0_), &_tmp1_))), _g_object_unref0 (self->priv->dark_box), _tmp2_); + clutter_container_add_actor ((_tmp3_ = mutter_plugin_get_window_group (unity_plugin_get_plugin (self)), CLUTTER_IS_CONTAINER (_tmp3_) ? ((ClutterContainer*) _tmp3_) : NULL), (ClutterActor*) self->priv->dark_box); clutter_actor_raise ((ClutterActor*) self->priv->dark_box, mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); clutter_actor_set_position ((ClutterActor*) self->priv->dark_box, (float) 0, (float) 0); clutter_actor_set_size ((ClutterActor*) self->priv->dark_box, clutter_actor_get_width ((ClutterActor*) self->priv->stage), clutter_actor_get_height ((ClutterActor*) self->priv->stage)); @@ -1353,6 +1380,7 @@ static void unity_plugin_class_init (UnityPluginClass * klass) { static void unity_plugin_unity_shell_interface_init (UnityShellIface * iface) { unity_plugin_unity_shell_parent_iface = g_type_interface_peek_parent (iface); + iface->get_current_time = unity_plugin_real_get_current_time; iface->add_fullscreen_request = unity_plugin_real_add_fullscreen_request; iface->remove_fullscreen_request = unity_plugin_real_remove_fullscreen_request; iface->ensure_input_region = unity_plugin_real_ensure_input_region; @@ -1363,6 +1391,7 @@ static void unity_plugin_unity_shell_interface_init (UnityShellIface * iface) { iface->show_window = unity_plugin_real_show_window; iface->get_mode = unity_plugin_real_get_mode; iface->get_indicators_width = unity_plugin_real_get_indicators_width; + iface->hide_unity = unity_plugin_real_hide_unity; iface->show_unity = unity_plugin_real_show_unity; iface->about_to_show_places = unity_plugin_real_about_to_show_places; iface->grab_keyboard = unity_plugin_real_grab_keyboard; diff --git a/targets/mutter/plugin.vala b/targets/mutter/plugin.vala index cbc2865f8..a516da09c 100644 --- a/targets/mutter/plugin.vala +++ b/targets/mutter/plugin.vala @@ -196,7 +196,7 @@ namespace Unity this.wm = new WindowManagement (this); this.maximus = new Maximus (); - + END_FUNCTION (); } @@ -239,7 +239,7 @@ namespace Unity this.launcher = new Launcher.Launcher (this); this.launcher.get_view ().opacity = 0; - + this.spaces_manager = new SpacesManager (this); this.spaces_manager.set_padding (50, 50, 125, 50); @@ -330,6 +330,11 @@ namespace Unity fullscreen_obstruction = false; } } + + public uint32 get_current_time () + { + return Mutter.MetaDisplay.get_current_time (Mutter.MetaScreen.get_display (plugin.get_screen ())); + } void check_fullscreen_obstruction () { @@ -584,27 +589,38 @@ namespace Unity expose_manager.end_expose (); } - public void show_unity () + public void hide_unity () { - if (this.places_showing) - { - this.places_showing = false; + if (places_showing == false) + return; - var anim = dark_box.animate (Clutter.AnimationMode.EASE_IN_QUAD, 100, "opacity", 0); - anim.completed.connect ((an) => { - (an.get_object () as Clutter.Actor).destroy (); - }); + places_showing = false; - plugin.get_normal_window_group ().animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, "opacity", 255); + var anim = dark_box.animate (Clutter.AnimationMode.EASE_IN_QUAD, 100, "opacity", 0); + anim.completed.connect ((an) => { + (an.get_object () as Clutter.Actor).destroy (); + }); - anim = places.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, - "opacity", 0); - anim.completed.connect ((an) => { - (an.get_object () as Clutter.Actor).hide (); - }); + plugin.get_normal_window_group ().animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, "opacity", 255); - this.panel.set_indicator_mode (false); - this.ensure_input_region (); + anim = places.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, + "opacity", 0); + anim.completed.connect ((an) => { + (an.get_object () as Clutter.Actor).hide (); + }); + + panel.set_indicator_mode (false); + ensure_input_region (); + + while (Gtk.events_pending ()) + Gtk.main_iteration (); + } + + public void show_unity () + { + if (this.places_showing) + { + hide_unity (); } else { diff --git a/tests/ui/test-home-button.c b/tests/ui/test-home-button.c index 87ee48006..189c72786 100644 --- a/tests/ui/test-home-button.c +++ b/tests/ui/test-home-button.c @@ -79,6 +79,7 @@ UnityTestsUIHomeButtonSuite* unity_tests_ui_home_button_suite_construct (GType o static UnityShellMode unity_tests_ui_home_button_suite_real_get_mode (UnityShell* base); static ClutterStage* unity_tests_ui_home_button_suite_real_get_stage (UnityShell* base); static void unity_tests_ui_home_button_suite_real_show_unity (UnityShell* base); +static void unity_tests_ui_home_button_suite_real_hide_unity (UnityShell* base); static gint unity_tests_ui_home_button_suite_real_get_indicators_width (UnityShell* base); static gint unity_tests_ui_home_button_suite_real_get_launcher_width_foobar (UnityShell* base); static gint unity_tests_ui_home_button_suite_real_get_panel_height_foobar (UnityShell* base); @@ -91,6 +92,7 @@ static void unity_tests_ui_home_button_suite_real_close_xids (UnityShell* base, static void unity_tests_ui_home_button_suite_real_show_window (UnityShell* base, guint32 xid); static void unity_tests_ui_home_button_suite_real_expose_xids (UnityShell* base, GArray* xids); static void unity_tests_ui_home_button_suite_real_stop_expose (UnityShell* base); +static guint32 unity_tests_ui_home_button_suite_real_get_current_time (UnityShell* base); static void unity_tests_ui_home_button_suite_finalize (GObject* obj); static void unity_tests_ui_home_button_suite_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -164,6 +166,12 @@ static void unity_tests_ui_home_button_suite_real_show_unity (UnityShell* base) } +static void unity_tests_ui_home_button_suite_real_hide_unity (UnityShell* base) { + UnityTestsUIHomeButtonSuite * self; + self = (UnityTestsUIHomeButtonSuite*) base; +} + + static gint unity_tests_ui_home_button_suite_real_get_indicators_width (UnityShell* base) { UnityTestsUIHomeButtonSuite * self; gint result = 0; @@ -252,6 +260,15 @@ static void unity_tests_ui_home_button_suite_real_stop_expose (UnityShell* base) } +static guint32 unity_tests_ui_home_button_suite_real_get_current_time (UnityShell* base) { + UnityTestsUIHomeButtonSuite * self; + guint32 result = 0U; + self = (UnityTestsUIHomeButtonSuite*) base; + result = clutter_get_current_event_time (); + return result; +} + + static gboolean unity_tests_ui_home_button_suite_real_get_menus_swallow_events (UnityShell* base) { gboolean result; UnityTestsUIHomeButtonSuite* self; @@ -275,6 +292,7 @@ static void unity_tests_ui_home_button_suite_unity_shell_interface_init (UnitySh iface->get_mode = unity_tests_ui_home_button_suite_real_get_mode; iface->get_stage = unity_tests_ui_home_button_suite_real_get_stage; iface->show_unity = unity_tests_ui_home_button_suite_real_show_unity; + iface->hide_unity = unity_tests_ui_home_button_suite_real_hide_unity; iface->get_indicators_width = unity_tests_ui_home_button_suite_real_get_indicators_width; iface->get_launcher_width_foobar = unity_tests_ui_home_button_suite_real_get_launcher_width_foobar; iface->get_panel_height_foobar = unity_tests_ui_home_button_suite_real_get_panel_height_foobar; @@ -287,6 +305,7 @@ static void unity_tests_ui_home_button_suite_unity_shell_interface_init (UnitySh iface->show_window = unity_tests_ui_home_button_suite_real_show_window; iface->expose_xids = unity_tests_ui_home_button_suite_real_expose_xids; iface->stop_expose = unity_tests_ui_home_button_suite_real_stop_expose; + iface->get_current_time = unity_tests_ui_home_button_suite_real_get_current_time; iface->get_menus_swallow_events = unity_tests_ui_home_button_suite_real_get_menus_swallow_events; } diff --git a/tests/ui/test-home-button.vala b/tests/ui/test-home-button.vala index 27428f384..bb8fa1d4a 100644 --- a/tests/ui/test-home-button.vala +++ b/tests/ui/test-home-button.vala @@ -85,6 +85,12 @@ namespace Unity.Tests.UI g_flag = true; } + public void + hide_unity () + { + + } + public int get_indicators_width () { @@ -160,6 +166,11 @@ namespace Unity.Tests.UI { // stub } + + public uint32 get_current_time () + { + return Clutter.get_current_event_time (); + } } } diff --git a/unity-private/launcher/application-controller.c b/unity-private/launcher/application-controller.c index 8aad7ef5b..c2b659a4b 100644 --- a/unity-private/launcher/application-controller.c +++ b/unity-private/launcher/application-controller.c @@ -31,9 +31,9 @@ #include <gdk/gdk.h> #include <gio/gdesktopappinfo.h> #include <gio/gio.h> +#include <unity.h> #include <libbamf/libbamf.h> #include <glib/gi18n-lib.h> -#include <unity.h> #include <gee.h> #include <float.h> #include <math.h> @@ -308,6 +308,8 @@ enum { UNITY_LAUNCHER_APPLICATION_CONTROLLER_DUMMY_PROPERTY, UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE }; +static void unity_launcher_application_controller_set_desktop_file (UnityLauncherApplicationController* self, const char* value); +static void unity_launcher_application_controller_load_desktop_file_info (UnityLauncherApplicationController* self); GType unity_launcher_scroller_child_get_type (void); UnityLauncherApplicationController* unity_launcher_application_controller_new (const char* desktop_file_, UnityLauncherScrollerChild* child_); UnityLauncherApplicationController* unity_launcher_application_controller_construct (GType object_type, const char* desktop_file_, UnityLauncherScrollerChild* child_); @@ -341,21 +343,19 @@ static void unity_launcher_application_controller_load_icon_from_icon_name (Unit void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application); void unity_launcher_scroller_child_set_needs_attention (UnityLauncherScrollerChild* self, gboolean value); gboolean unity_launcher_application_controller_debug_is_application_attached (UnityLauncherApplicationController* self); -static void unity_launcher_application_controller_load_desktop_file_info (UnityLauncherApplicationController* self); static gboolean unity_launcher_application_controller_try_load_from_file (UnityLauncherApplicationController* self, const char* filepath); void unity_launcher_scroller_child_set_icon (UnityLauncherScrollerChild* self, GdkPixbuf* value); -static void _lambda10_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self); -static void __lambda10__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self); -static void _lambda11_ (UnityLauncherApplicationController* self); -static void __lambda11__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self); -static void unity_launcher_application_controller_set_desktop_file (UnityLauncherApplicationController* self, const char* value); +static void _lambda12_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self); +static void __lambda12__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self); +static void _lambda13_ (UnityLauncherApplicationController* self); +static void __lambda13__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self); static void _unity_launcher_application_controller_on_favorite_added_unity_favorites_favorite_added (UnityFavorites* _sender, const char* uid, gpointer self); static void _unity_launcher_application_controller_on_favorite_removed_unity_favorites_favorite_removed (UnityFavorites* _sender, const char* uid, gpointer self); GType unity_launcher_quicklist_controller_get_type (void); UnityLauncherQuicklistController* unity_launcher_quicklist_controller_get_default (void); CtkActor* unity_launcher_quicklist_controller_get_attached_actor (UnityLauncherQuicklistController* self); -static void _lambda12_ (gboolean open, Block1Data* _data1_); -static void __lambda12__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self); +static void _lambda14_ (gboolean open, Block1Data* _data1_); +static void __lambda14__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self); static Block1Data* block1_data_ref (Block1Data* _data1_); static void block1_data_unref (Block1Data* _data1_); static GObject * unity_launcher_application_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -409,6 +409,7 @@ static void unity_launcher_application_shortcut_real_activated (UnityLauncherSho _g_object_unref0 (appinfo); goto __catch18_g_error; } + unity_shell_hide_unity (unity_global_shell); _g_key_file_free0 (desktop_file); _g_object_unref0 (appinfo); } @@ -419,7 +420,7 @@ static void unity_launcher_application_shortcut_real_activated (UnityLauncherSho e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:55: %s", e->message); + g_warning ("application-controller.vala:57: %s", e->message); _g_error_free0 (e); } } @@ -767,9 +768,12 @@ GQuark unity_launcher_app_type_error_quark (void) { UnityLauncherApplicationController* unity_launcher_application_controller_construct (GType object_type, const char* desktop_file_, UnityLauncherScrollerChild* child_) { UnityLauncherApplicationController * self; - g_return_val_if_fail (desktop_file_ != NULL, NULL); g_return_val_if_fail (child_ != NULL, NULL); - self = (UnityLauncherApplicationController*) g_object_new (object_type, "desktop-file", desktop_file_, "child", child_, NULL); + self = (UnityLauncherApplicationController*) g_object_new (object_type, "child", child_, NULL); + if (desktop_file_ != NULL) { + unity_launcher_application_controller_set_desktop_file (self, desktop_file_); + unity_launcher_application_controller_load_desktop_file_info (self); + } return self; } @@ -784,19 +788,19 @@ void unity_launcher_application_controller_set_sticky (UnityLauncherApplicationC UnityFavorites* favorites; char* uid; g_return_if_fail (self != NULL); - if (_vala_strcmp0 (unity_launcher_application_controller_get_desktop_file (self), "") == 0) { + if (_vala_strcmp0 (self->priv->_desktop_file, "") == 0) { _tmp0_ = TRUE; } else { - _tmp0_ = unity_launcher_application_controller_get_desktop_file (self) == NULL; + _tmp0_ = self->priv->_desktop_file == NULL; } if (_tmp0_) { return; } favorites = unity_favorites_get_default (); - uid = unity_favorites_find_uid_for_desktop_file (favorites, unity_launcher_application_controller_get_desktop_file (self)); + uid = unity_favorites_find_uid_for_desktop_file (favorites, self->priv->_desktop_file); if (is_sticky) { unity_favorites_set_string (favorites, uid, "type", "application"); - unity_favorites_set_string (favorites, uid, "desktop_file", unity_launcher_application_controller_get_desktop_file (self)); + unity_favorites_set_string (favorites, uid, "desktop_file", self->priv->_desktop_file); unity_favorites_add_favorite (favorites, uid); } else { unity_favorites_remove_favorite (favorites, uid); @@ -824,15 +828,15 @@ void unity_launcher_application_controller_set_priority (UnityLauncherApplicatio char* uid; UnityFavorites* favorites; g_return_if_fail (self != NULL); - if (_vala_strcmp0 (unity_launcher_application_controller_get_desktop_file (self), "") == 0) { + if (_vala_strcmp0 (self->priv->_desktop_file, "") == 0) { _tmp0_ = TRUE; } else { - _tmp0_ = unity_launcher_application_controller_get_desktop_file (self) == NULL; + _tmp0_ = self->priv->_desktop_file == NULL; } if (_tmp0_) { return; } - uid = (_tmp2_ = g_strconcat ("app-", _tmp1_ = g_path_get_basename (unity_launcher_application_controller_get_desktop_file (self)), NULL), _g_free0 (_tmp1_), _tmp2_); + uid = (_tmp2_ = g_strconcat ("app-", _tmp1_ = g_path_get_basename (self->priv->_desktop_file), NULL), _g_free0 (_tmp1_), _tmp2_); favorites = unity_favorites_get_default (); unity_favorites_set_float (favorites, uid, "priority", priority); _g_free0 (uid); @@ -852,10 +856,10 @@ float unity_launcher_application_controller_get_priority (UnityLauncherApplicati float _tmp4_; g_return_val_if_fail (self != NULL, 0.0F); _inner_error_ = NULL; - if (_vala_strcmp0 (unity_launcher_application_controller_get_desktop_file (self), "") == 0) { + if (_vala_strcmp0 (self->priv->_desktop_file, "") == 0) { _tmp0_ = TRUE; } else { - _tmp0_ = unity_launcher_application_controller_get_desktop_file (self) == NULL; + _tmp0_ = self->priv->_desktop_file == NULL; } if (_tmp0_) { _inner_error_ = g_error_new_literal (UNITY_LAUNCHER_APP_TYPE_ERROR, UNITY_LAUNCHER_APP_TYPE_ERROR_NO_DESKTOP_FILE, "There is no desktop file for this app, can't get priority"); @@ -870,7 +874,7 @@ float unity_launcher_application_controller_get_priority (UnityLauncherApplicati } } } - uid = (_tmp2_ = g_strconcat ("app-", _tmp1_ = g_path_get_basename (unity_launcher_application_controller_get_desktop_file (self)), NULL), _g_free0 (_tmp1_), _tmp2_); + uid = (_tmp2_ = g_strconcat ("app-", _tmp1_ = g_path_get_basename (self->priv->_desktop_file), NULL), _g_free0 (_tmp1_), _tmp2_); favorites = unity_favorites_get_default (); result = (_tmp4_ = *(_tmp3_ = unity_favorites_get_float (favorites, uid, "priority")), _g_free0 (_tmp3_), _tmp4_); _g_free0 (uid); @@ -888,7 +892,7 @@ static void unity_launcher_application_controller_on_favorite_added (UnityLaunch g_return_if_fail (uid != NULL); favorites = unity_favorites_get_default (); desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file"); - if (_vala_strcmp0 (desktop_filename, unity_launcher_application_controller_get_desktop_file (self)) == 0) { + if (_vala_strcmp0 (desktop_filename, self->priv->_desktop_file) == 0) { self->priv->is_favorite = TRUE; unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED; } @@ -913,7 +917,7 @@ static void unity_launcher_application_controller_on_favorite_removed (UnityLaun g_return_if_fail (uid != NULL); favorites = unity_favorites_get_default (); desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file"); - if (_vala_strcmp0 (desktop_filename, unity_launcher_application_controller_get_desktop_file (self)) == 0) { + if (_vala_strcmp0 (desktop_filename, self->priv->_desktop_file) == 0) { self->priv->is_favorite = FALSE; unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_UNPINNED; g_signal_emit_by_name ((UnityLauncherScrollerChildController*) self, "closed"); @@ -940,13 +944,13 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu self = (UnityLauncherApplicationController*) base; _inner_error_ = NULL; ret_list = gee_array_list_new (UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); - if (unity_launcher_application_controller_get_desktop_file (self) == NULL) { + if (self->priv->_desktop_file == NULL) { result = ret_list; return result; } desktop_keyfile = g_key_file_new (); { - g_key_file_load_from_file (desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), 0, &_inner_error_); + g_key_file_load_from_file (desktop_keyfile, self->priv->_desktop_file, 0, &_inner_error_); if (_inner_error_ != NULL) { goto __catch19_g_error; } @@ -958,7 +962,7 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:316: Unable to load desktop file '%s': %s", unity_launcher_application_controller_get_desktop_file (self), e->message); + g_warning ("application-controller.vala:312: Unable to load desktop file '%s': %s", self->priv->_desktop_file, e->message); result = ret_list; _g_error_free0 (e); _g_key_file_free0 (desktop_keyfile); @@ -1020,7 +1024,7 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:335: %s", e->message); + g_warning ("application-controller.vala:331: %s", e->message); _g_error_free0 (e); _g_free0 (exec); _g_free0 (name); @@ -1041,7 +1045,7 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu shortcut = unity_launcher_application_shortcut_new (); shortcut->exec = (_tmp7_ = g_strdup (exec), _g_free0 (shortcut->exec), _tmp7_); shortcut->name = (_tmp8_ = g_strdup (name), _g_free0 (shortcut->name), _tmp8_); - shortcut->desktop_location = (_tmp9_ = g_strdup (unity_launcher_application_controller_get_desktop_file (self)), _g_free0 (shortcut->desktop_location), _tmp9_); + shortcut->desktop_location = (_tmp9_ = g_strdup (self->priv->_desktop_file), _g_free0 (shortcut->desktop_location), _tmp9_); gee_abstract_collection_add ((GeeAbstractCollection*) ret_list, (UnityLauncherShortcutItem*) shortcut); _g_free0 (exec); _g_free0 (name); @@ -1068,9 +1072,9 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu GeeArrayList* ret_list; self = (UnityLauncherApplicationController*) base; ret_list = gee_array_list_new (UNITY_LAUNCHER_TYPE_SHORTCUT_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); - if (unity_launcher_application_controller_get_desktop_file (self) != NULL) { + if (self->priv->_desktop_file != NULL) { UnityLauncherLauncherPinningShortcut* pin_entry; - pin_entry = unity_launcher_launcher_pinning_shortcut_new (unity_launcher_application_controller_get_desktop_file (self)); + pin_entry = unity_launcher_launcher_pinning_shortcut_new (self->priv->_desktop_file); gee_abstract_collection_add ((GeeAbstractCollection*) ret_list, (UnityLauncherShortcutItem*) pin_entry); _g_object_unref0 (pin_entry); } @@ -1121,6 +1125,7 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc GError * _inner_error_; self = (UnityLauncherApplicationController*) base; _inner_error_ = NULL; + unity_shell_hide_unity (unity_global_shell); if (BAMF_IS_APPLICATION (self->priv->app)) { if (bamf_view_is_running ((BamfView*) self->priv->app)) { GList* windows; @@ -1135,7 +1140,7 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc GKeyFile* desktop_keyfile; GAppInfo* appinfo; desktop_keyfile = g_key_file_new (); - g_key_file_load_from_file (desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), 0, &_inner_error_); + g_key_file_load_from_file (desktop_keyfile, self->priv->_desktop_file, 0, &_inner_error_); if (_inner_error_ != NULL) { _g_key_file_free0 (desktop_keyfile); goto __catch21_g_error; @@ -1161,7 +1166,7 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:413: %s", e->message); + g_warning ("application-controller.vala:411: %s", e->message); _g_error_free0 (e); } } @@ -1217,10 +1222,12 @@ static const char* string_to_string (const char* self) { void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application) { BamfApplication* _tmp0_; char* _tmp1_; - char* potential_icon_name; + gboolean _tmp2_ = FALSE; + char* _tmp4_; g_return_if_fail (self != NULL); g_return_if_fail (application != NULL); self->priv->app = (_tmp0_ = _g_object_ref0 (application), _g_object_unref0 (self->priv->app), _tmp0_); + unity_launcher_application_controller_set_desktop_file (self, bamf_application_get_desktop_file (self->priv->app)); unity_launcher_scroller_child_set_running (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), bamf_view_is_running ((BamfView*) self->priv->app)); unity_launcher_scroller_child_set_active (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), bamf_view_is_active ((BamfView*) self->priv->app)); unity_launcher_scroller_child_set_activating (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), FALSE); @@ -1229,21 +1236,18 @@ void unity_launcher_application_controller_attach_application (UnityLauncherAppl g_signal_connect_object ((BamfView*) self->priv->app, "closed", (GCallback) _unity_launcher_application_controller_detach_application_bamf_view_closed, self, 0); g_signal_connect_object ((BamfView*) self->priv->app, "urgent-changed", (GCallback) _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed, self, 0); ((UnityLauncherScrollerChildController*) self)->name = (_tmp1_ = bamf_view_get_name ((BamfView*) self->priv->app), _g_free0 (((UnityLauncherScrollerChildController*) self)->name), _tmp1_); - if (_vala_strcmp0 (((UnityLauncherScrollerChildController*) self)->name, "") == 0) { - char* _tmp2_; - g_warning ("application-controller.vala:436: %s", _tmp2_ = g_strconcat ("Bamf returned null for app.get_name (): ", string_to_string (unity_launcher_application_controller_get_desktop_file (self)), NULL)); - _g_free0 (_tmp2_); + if (((UnityLauncherScrollerChildController*) self)->name == NULL) { + _tmp2_ = TRUE; + } else { + _tmp2_ = _vala_strcmp0 (((UnityLauncherScrollerChildController*) self)->name, "") == 0; } - potential_icon_name = bamf_view_get_icon ((BamfView*) self->priv->app); - if (_vala_strcmp0 (potential_icon_name, "") == 0) { + if (_tmp2_) { char* _tmp3_; - g_warning ("application-controller.vala:440: %s", _tmp3_ = g_strconcat ("Bamf returned null for app.get_icon (): ", string_to_string (unity_launcher_application_controller_get_desktop_file (self)), NULL)); + g_warning ("application-controller.vala:435: %s", _tmp3_ = g_strconcat ("Bamf returned null for app.get_name (): ", string_to_string (self->priv->_desktop_file), NULL)); _g_free0 (_tmp3_); - } else { - _vala_strcmp0 (self->priv->icon_name, potential_icon_name) == 0; } + self->priv->icon_name = (_tmp4_ = bamf_view_get_icon ((BamfView*) self->priv->app), _g_free0 (self->priv->icon_name), _tmp4_); unity_launcher_application_controller_load_icon_from_icon_name (self); - _g_free0 (potential_icon_name); } @@ -1306,7 +1310,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL { GKeyFile* _tmp0_; self->priv->desktop_keyfile = (_tmp0_ = g_key_file_new (), _g_key_file_free0 (self->priv->desktop_keyfile), _tmp0_); - g_key_file_load_from_file (self->priv->desktop_keyfile, unity_launcher_application_controller_get_desktop_file (self), G_KEY_FILE_NONE, &_inner_error_); + g_key_file_load_from_file (self->priv->desktop_keyfile, self->priv->_desktop_file, G_KEY_FILE_NONE, &_inner_error_); if (_inner_error_ != NULL) { goto __catch22_g_error; } @@ -1318,7 +1322,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:493: could not load desktop file: %s", e->message); + g_warning ("application-controller.vala:487: could not load desktop file: %s", e->message); _g_error_free0 (e); } } @@ -1345,7 +1349,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:503: could not load icon name from desktop" \ + g_warning ("application-controller.vala:497: could not load icon name from desktop" \ " file: %s", e->message); _g_error_free0 (e); } @@ -1372,7 +1376,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:512: could not load name from desktop file" \ + g_warning ("application-controller.vala:506: could not load name from desktop file" \ ": %s", e->message); _g_error_free0 (e); } @@ -1386,7 +1390,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL } -static void _lambda10_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self) { +static void _lambda12_ (UnityThemeFilePath* theme, const char* filepath, UnityLauncherApplicationController* self) { GError * _inner_error_; g_return_if_fail (theme != NULL); g_return_if_fail (filepath != NULL); @@ -1409,7 +1413,7 @@ static void _lambda10_ (UnityThemeFilePath* theme, const char* filepath, UnityLa _inner_error_ = NULL; { char* _tmp2_; - g_warning ("application-controller.vala:551: %s", _tmp2_ = g_strconcat ("Could not load from ", string_to_string (filepath), NULL)); + g_warning ("application-controller.vala:545: %s", _tmp2_ = g_strconcat ("Could not load from ", string_to_string (filepath), NULL)); _g_free0 (_tmp2_); _g_error_free0 (e); } @@ -1423,12 +1427,12 @@ static void _lambda10_ (UnityThemeFilePath* theme, const char* filepath, UnityLa } -static void __lambda10__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self) { - _lambda10_ (_sender, filepath, self); +static void __lambda12__unity_theme_file_path_found_icon_path (UnityThemeFilePath* _sender, const char* filepath, gpointer self) { + _lambda12_ (_sender, filepath, self); } -static void _lambda11_ (UnityLauncherApplicationController* self) { +static void _lambda13_ (UnityLauncherApplicationController* self) { GError * _inner_error_; _inner_error_ = NULL; { @@ -1451,7 +1455,7 @@ static void _lambda11_ (UnityLauncherApplicationController* self) { _inner_error_ = NULL; { char* _tmp1_; - g_warning ("application-controller.vala:563: Could not load any icon for %s", _tmp1_ = bamf_view_get_name ((BamfView*) self->priv->app)); + g_warning ("application-controller.vala:557: Could not load any icon for %s", _tmp1_ = bamf_view_get_name ((BamfView*) self->priv->app)); _g_free0 (_tmp1_); _g_error_free0 (e); } @@ -1465,8 +1469,8 @@ static void _lambda11_ (UnityLauncherApplicationController* self) { } -static void __lambda11__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self) { - _lambda11_ (self); +static void __lambda13__unity_theme_file_path_failed (UnityThemeFilePath* _sender, gpointer self) { + _lambda13_ (self); } @@ -1491,8 +1495,8 @@ static void unity_launcher_application_controller_load_icon_from_icon_name (Unit unity_theme_file_path_add_icon_theme (self->priv->theme_file_path, theme); gtk_icon_theme_set_custom_theme (theme, "Web"); unity_theme_file_path_add_icon_theme (self->priv->theme_file_path, theme); - g_signal_connect_object (self->priv->theme_file_path, "found-icon-path", (GCallback) __lambda10__unity_theme_file_path_found_icon_path, self, 0); - g_signal_connect_object (self->priv->theme_file_path, "failed", (GCallback) __lambda11__unity_theme_file_path_failed, self, 0); + g_signal_connect_object (self->priv->theme_file_path, "found-icon-path", (GCallback) __lambda12__unity_theme_file_path_found_icon_path, self, 0); + g_signal_connect_object (self->priv->theme_file_path, "failed", (GCallback) __lambda13__unity_theme_file_path_failed, self, 0); unity_theme_file_path_get_icon_filepath (self->priv->theme_file_path, self->priv->icon_name, NULL, NULL); _g_object_unref0 (theme); } @@ -1523,7 +1527,7 @@ static gboolean unity_launcher_application_controller_try_load_from_file (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:582: Unable to load image from file '%s': " \ + g_warning ("application-controller.vala:576: Unable to load image from file '%s': " \ "%s", filepath, e->message); _g_error_free0 (e); } @@ -1560,7 +1564,6 @@ static void unity_launcher_application_controller_set_desktop_file (UnityLaunche char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_desktop_file = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_desktop_file), _tmp0_); - unity_launcher_application_controller_load_desktop_file_info (self); g_object_notify ((GObject *) self, "desktop-file"); } @@ -1575,7 +1578,7 @@ static void _unity_launcher_application_controller_on_favorite_removed_unity_fav } -static void _lambda12_ (gboolean open, Block1Data* _data1_) { +static void _lambda14_ (gboolean open, Block1Data* _data1_) { UnityLauncherApplicationController * self; gboolean _tmp0_ = FALSE; CtkActor* _tmp1_; @@ -1598,8 +1601,8 @@ static void _lambda12_ (gboolean open, Block1Data* _data1_) { } -static void __lambda12__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self) { - _lambda12_ (open, self); +static void __lambda14__unity_launcher_quicklist_controller_menu_state_changed (UnityLauncherQuicklistController* _sender, gboolean open, gpointer self) { + _lambda14_ (open, self); } @@ -1651,7 +1654,7 @@ static GObject * unity_launcher_application_controller_constructor (GType type, break; } uid = (char*) gee_iterator_get (_uid_it); - if ((_tmp4_ = _vala_strcmp0 (_tmp3_ = unity_favorites_get_string (favorites, uid, "desktop_file"), unity_launcher_application_controller_get_desktop_file (self)) == 0, _g_free0 (_tmp3_), _tmp4_)) { + if ((_tmp4_ = _vala_strcmp0 (_tmp3_ = unity_favorites_get_string (favorites, uid, "desktop_file"), self->priv->_desktop_file) == 0, _g_free0 (_tmp3_), _tmp4_)) { self->priv->is_favorite = TRUE; unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED; _g_free0 (uid); @@ -1662,7 +1665,7 @@ static GObject * unity_launcher_application_controller_constructor (GType type, _g_object_unref0 (_uid_it); } _data1_->controller = _g_object_ref0 (unity_launcher_quicklist_controller_get_default ()); - g_signal_connect_data (_data1_->controller, "menu-state-changed", (GCallback) __lambda12__unity_launcher_quicklist_controller_menu_state_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); + g_signal_connect_data (_data1_->controller, "menu-state-changed", (GCallback) __lambda14__unity_launcher_quicklist_controller_menu_state_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); _g_object_unref0 (favorites); block1_data_unref (_data1_); } @@ -1680,7 +1683,7 @@ static void unity_launcher_application_controller_class_init (UnityLauncherAppli G_OBJECT_CLASS (klass)->set_property = unity_launcher_application_controller_set_property; G_OBJECT_CLASS (klass)->constructor = unity_launcher_application_controller_constructor; G_OBJECT_CLASS (klass)->finalize = unity_launcher_application_controller_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE, g_param_spec_string ("desktop-file", "desktop-file", "desktop-file", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_APPLICATION_CONTROLLER_DESKTOP_FILE, g_param_spec_string ("desktop-file", "desktop-file", "desktop-file", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } diff --git a/unity-private/launcher/application-controller.vala b/unity-private/launcher/application-controller.vala index a6e06863a..4ed3f1718 100644 --- a/unity-private/launcher/application-controller.vala +++ b/unity-private/launcher/application-controller.vala @@ -49,12 +49,13 @@ namespace Unity.Launcher context.set_timestamp (Gdk.CURRENT_TIME); appinfo.launch (null, context); + + global_shell.hide_unity (); } catch (Error e) { warning (e.message); } - } } @@ -155,18 +156,8 @@ namespace Unity.Launcher public class ApplicationController : ScrollerChildController { - private string _desktop_file; - public string desktop_file { - get - { - return _desktop_file; - } - construct - { - _desktop_file = value; - load_desktop_file_info (); - } - } + public string desktop_file { get; private set; } + private KeyFile desktop_keyfile; private string icon_name; private Unity.ThemeFilePath theme_file_path; @@ -174,10 +165,15 @@ namespace Unity.Launcher private bool is_favorite = false; - public ApplicationController (string desktop_file_, ScrollerChild child_) + public ApplicationController (string? desktop_file_, ScrollerChild child_) { - Object (desktop_file: desktop_file_, - child: child_); + Object (child: child_); + + if (desktop_file_ != null) + { + desktop_file = desktop_file_; + load_desktop_file_info (); + } } ~ApplicationController () @@ -383,6 +379,8 @@ namespace Unity.Launcher public override void activate () { + global_shell.hide_unity (); + if (app is Bamf.Application) { if (app.is_running ()) @@ -423,6 +421,7 @@ namespace Unity.Launcher public void attach_application (Bamf.Application application) { app = application; + desktop_file = app.get_desktop_file (); child.running = app.is_running (); child.active = app.is_active (); child.activating = false; @@ -432,15 +431,10 @@ namespace Unity.Launcher app.closed.connect (detach_application); app.urgent_changed.connect (on_app_urgant_changed); name = app.get_name (); - if (name == "") + if (name == null || name == "") warning (@"Bamf returned null for app.get_name (): $desktop_file"); - string potential_icon_name = app.get_icon (); - if (potential_icon_name == "") - warning (@"Bamf returned null for app.get_icon (): $desktop_file"); - else - icon_name == potential_icon_name; - + icon_name = app.get_icon (); load_icon_from_icon_name (); } diff --git a/unity-private/launcher/quicklist-controller.c b/unity-private/launcher/quicklist-controller.c index 53c9ec825..1f01138ad 100644 --- a/unity-private/launcher/quicklist-controller.c +++ b/unity-private/launcher/quicklist-controller.c @@ -146,10 +146,10 @@ static void unity_launcher_quicklist_controller_on_unity_drag_start (UnityLaunch UnityLauncherQuicklistMenu* unity_launcher_quicklist_menu_new (void); UnityLauncherQuicklistMenu* unity_launcher_quicklist_menu_construct (GType object_type); GType unity_launcher_quicklist_menu_get_type (void); -static void _lambda8_ (UnityLauncherQuicklistController* self); -static void __lambda8__clutter_actor_destroy (ClutterActor* _sender, gpointer self); -static void _lambda9_ (UnityLauncherQuicklistController* self); -static void __lambda9__clutter_actor_destroy (ClutterActor* _sender, gpointer self); +static void _lambda10_ (UnityLauncherQuicklistController* self); +static void __lambda10__clutter_actor_destroy (ClutterActor* _sender, gpointer self); +static void _lambda11_ (UnityLauncherQuicklistController* self); +static void __lambda11__clutter_actor_destroy (ClutterActor* _sender, gpointer self); UnityLauncherQuicklistMenuItem* unity_launcher_quicklist_menu_item_new (const char* label); UnityLauncherQuicklistMenuItem* unity_launcher_quicklist_menu_item_construct (GType object_type, const char* label); GType unity_launcher_quicklist_menu_item_get_type (void); @@ -205,25 +205,25 @@ static void unity_launcher_quicklist_controller_on_unity_drag_start (UnityLaunch } -static void _lambda8_ (UnityLauncherQuicklistController* self) { +static void _lambda10_ (UnityLauncherQuicklistController* self) { if (self->is_in_menu) { g_signal_emit_by_name (self, "menu-state-changed", FALSE); } } -static void __lambda8__clutter_actor_destroy (ClutterActor* _sender, gpointer self) { - _lambda8_ (self); +static void __lambda10__clutter_actor_destroy (ClutterActor* _sender, gpointer self) { + _lambda10_ (self); } -static void _lambda9_ (UnityLauncherQuicklistController* self) { +static void _lambda11_ (UnityLauncherQuicklistController* self) { unity_shell_remove_fullscreen_request (unity_global_shell, (GObject*) self); } -static void __lambda9__clutter_actor_destroy (ClutterActor* _sender, gpointer self) { - _lambda9_ (self); +static void __lambda11__clutter_actor_destroy (ClutterActor* _sender, gpointer self) { + _lambda11_ (self); } @@ -246,9 +246,9 @@ void unity_launcher_quicklist_controller_show_label (UnityLauncherQuicklistContr clutter_actor_destroy ((ClutterActor*) self->menu); } menu = (_tmp0_ = g_object_ref_sink (unity_launcher_quicklist_menu_new ()), CTK_IS_MENU (_tmp0_) ? ((CtkMenu*) _tmp0_) : NULL); - g_signal_connect_object ((ClutterActor*) menu, "destroy", (GCallback) __lambda8__clutter_actor_destroy, self, 0); + g_signal_connect_object ((ClutterActor*) menu, "destroy", (GCallback) __lambda10__clutter_actor_destroy, self, 0); self->menu = menu; - g_signal_connect_object ((ClutterActor*) self->menu, "destroy", (GCallback) __lambda9__clutter_actor_destroy, self, 0); + g_signal_connect_object ((ClutterActor*) self->menu, "destroy", (GCallback) __lambda11__clutter_actor_destroy, self, 0); ctk_menu_set_swallow_clicks (self->menu, unity_shell_get_menus_swallow_events (unity_global_shell)); ctk_menu_set_detect_clicks (self->menu, FALSE); menuitem = g_object_ref_sink (unity_launcher_quicklist_menu_item_new (label)); diff --git a/unity-private/launcher/scroller-controller.c b/unity-private/launcher/scroller-controller.c index 3d2f66cc6..232285884 100644 --- a/unity-private/launcher/scroller-controller.c +++ b/unity-private/launcher/scroller-controller.c @@ -180,8 +180,8 @@ enum { UnityLauncherScrollerController* unity_launcher_scroller_controller_new (UnityLauncherScrollerModel* _model, UnityLauncherScrollerView* _view); UnityLauncherScrollerController* unity_launcher_scroller_controller_construct (GType object_type, UnityLauncherScrollerModel* _model, UnityLauncherScrollerView* _view); static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLauncherScrollerController* self, GObject* object); -static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self); -static void __lambda17__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); +static void _lambda19_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self); +static void __lambda19__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); GType unity_launcher_application_controller_get_type (void); static UnityLauncherApplicationController* unity_launcher_scroller_controller_find_controller_by_desktop_file (UnityLauncherScrollerController* self, const char* desktop_file); void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application); @@ -264,7 +264,7 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self) { +static void _lambda19_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self) { g_return_if_fail (a != NULL); if (changed) { BamfView* _tmp0_; @@ -273,8 +273,8 @@ static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerCont } -static void __lambda17__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { - _lambda17_ (_sender, object, self); +static void __lambda19__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { + _lambda19_ (_sender, object, self); } @@ -291,34 +291,39 @@ static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLau GObject* _tmp0_; BamfApplication* app; app = _g_object_ref0 ((_tmp0_ = object, BAMF_IS_APPLICATION (_tmp0_) ? ((BamfApplication*) _tmp0_) : NULL)); - if (_vala_strcmp0 (bamf_application_get_desktop_file (app), "") == 0) { - g_debug ("scroller-controller.vala:80: no desktop file for this app"); - _g_object_unref0 (app); - return; - } - g_signal_connect_object ((BamfView*) app, "user-visible-changed", (GCallback) __lambda17__bamf_view_user_visible_changed, self, 0); + g_signal_connect_object ((BamfView*) app, "user-visible-changed", (GCallback) __lambda19__bamf_view_user_visible_changed, self, 0); if (bamf_view_user_visible ((BamfView*) app)) { char* desktop_file; + UnityLauncherScrollerChildController* controller; + gboolean _tmp1_ = FALSE; desktop_file = g_strdup (bamf_application_get_desktop_file (app)); + controller = NULL; if (desktop_file != NULL) { - UnityLauncherApplicationController* controller; - controller = unity_launcher_scroller_controller_find_controller_by_desktop_file (self, desktop_file); - if (UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (controller)) { - unity_launcher_application_controller_attach_application (controller, app); - } else { - UnityLauncherLauncherChild* child; - UnityLauncherApplicationController* _tmp1_; - child = g_object_ref_sink (unity_launcher_launcher_child_new ()); - controller = (_tmp1_ = unity_launcher_application_controller_new (desktop_file, (UnityLauncherScrollerChild*) child), _g_object_unref0 (controller), _tmp1_); - unity_launcher_application_controller_attach_application (controller, app); - unity_launcher_scroller_model_add (self->priv->_model, (UnityLauncherScrollerChild*) child); - gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->childcontrollers, (UnityLauncherScrollerChildController*) controller); - g_signal_connect_object ((UnityLauncherScrollerChildController*) controller, "closed", (GCallback) _unity_launcher_scroller_controller_on_scroller_controller_closed_unity_launcher_scroller_child_controller_closed, self, 0); - _g_object_unref0 (child); - } - _g_object_unref0 (controller); + _tmp1_ = _vala_strcmp0 (desktop_file, "") != 0; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + UnityLauncherScrollerChildController* _tmp2_; + controller = (_tmp2_ = (UnityLauncherScrollerChildController*) unity_launcher_scroller_controller_find_controller_by_desktop_file (self, desktop_file), _g_object_unref0 (controller), _tmp2_); + } + if (UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (controller)) { + UnityLauncherScrollerChildController* _tmp3_; + unity_launcher_application_controller_attach_application ((_tmp3_ = controller, UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (_tmp3_) ? ((UnityLauncherApplicationController*) _tmp3_) : NULL), app); + } else { + UnityLauncherLauncherChild* child; + UnityLauncherScrollerChildController* _tmp4_; + UnityLauncherScrollerChildController* _tmp5_; + child = g_object_ref_sink (unity_launcher_launcher_child_new ()); + controller = (_tmp4_ = (UnityLauncherScrollerChildController*) unity_launcher_application_controller_new (NULL, (UnityLauncherScrollerChild*) child), _g_object_unref0 (controller), _tmp4_); + unity_launcher_application_controller_attach_application ((_tmp5_ = controller, UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (_tmp5_) ? ((UnityLauncherApplicationController*) _tmp5_) : NULL), app); + unity_launcher_scroller_model_add (self->priv->_model, (UnityLauncherScrollerChild*) child); + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->childcontrollers, controller); + g_signal_connect_object (controller, "closed", (GCallback) _unity_launcher_scroller_controller_on_scroller_controller_closed_unity_launcher_scroller_child_controller_closed, self, 0); + _g_object_unref0 (child); } _g_free0 (desktop_file); + _g_object_unref0 (controller); } _g_object_unref0 (app); } @@ -699,7 +704,7 @@ static UnityLauncherScrollerChildController* unity_launcher_scroller_controller_ } _g_object_unref0 (_childcontroller_it); } - g_warning ("scroller-controller.vala:350: %s", _tmp1_ = g_strconcat ("Could not find controller for given view: ", _tmp0_ = unity_launcher_scroller_child_to_string (childview), NULL)); + g_warning ("scroller-controller.vala:349: %s", _tmp1_ = g_strconcat ("Could not find controller for given view: ", _tmp0_ = unity_launcher_scroller_child_to_string (childview), NULL)); _g_free0 (_tmp1_); _g_free0 (_tmp0_); result = NULL; diff --git a/unity-private/launcher/scroller-controller.vala b/unity-private/launcher/scroller-controller.vala index 5a7c2598e..cccf4992a 100644 --- a/unity-private/launcher/scroller-controller.vala +++ b/unity-private/launcher/scroller-controller.vala @@ -74,13 +74,9 @@ namespace Unity.Launcher if (object is Bamf.Application) { Bamf.Application app = object as Bamf.Application; - //need to hook up to its visible changed signals - if (app.get_desktop_file () == "") - { - debug ("no desktop file for this app"); - return; - } + // need to hook up to its visible changed signals + // this is wrong as it will never re-hide a window app.user_visible_changed.connect ((a, changed) => { if (changed) { @@ -91,22 +87,25 @@ namespace Unity.Launcher if (app.user_visible ()) { string desktop_file = app.get_desktop_file (); - if (desktop_file != null) + + ScrollerChildController controller = null; + if (desktop_file != null && desktop_file != "") { - var controller = find_controller_by_desktop_file (desktop_file); - if (controller is ApplicationController) - { - controller.attach_application (app); - } - else - { - LauncherChild child = new LauncherChild (); - controller = new ApplicationController (desktop_file, child); - controller.attach_application (app); - model.add (child); - childcontrollers.add (controller); - controller.closed.connect (on_scroller_controller_closed); - } + controller = find_controller_by_desktop_file (desktop_file); + } + + if (controller is ApplicationController) + { + (controller as ApplicationController).attach_application (app); + } + else + { + LauncherChild child = new LauncherChild (); + controller = new ApplicationController (null, child); + (controller as ApplicationController).attach_application (app); + model.add (child); + childcontrollers.add (controller); + controller.closed.connect (on_scroller_controller_closed); } } } diff --git a/unity-private/launcher/scroller-view.c b/unity-private/launcher/scroller-view.c index 7c34b3978..86fc560a8 100644 --- a/unity-private/launcher/scroller-view.c +++ b/unity-private/launcher/scroller-view.c @@ -247,12 +247,12 @@ gboolean unity_launcher_scroller_model_iterator_next (UnityLauncherScrollerModel UnityLauncherScrollerChild* unity_launcher_scroller_model_iterator_get (UnityLauncherScrollerModelIterator* self); static void unity_launcher_scroller_view_disable_animations_on_children (UnityLauncherScrollerView* self, ClutterEvent* event); gint unity_launcher_scroller_model_get_size (UnityLauncherScrollerModel* self); -static void _lambda13_ (UnityLauncherScrollerView* self); -static void __lambda13__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void _lambda15_ (UnityLauncherScrollerView* self); +static void __lambda15__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void unity_launcher_scroller_view_model_child_added (UnityLauncherScrollerView* self, UnityLauncherScrollerChild* child); #define UNITY_LAUNCHER_SHORT_DELAY ((guint) 400) -static void _lambda14_ (Block2Data* _data2_); -static void __lambda14__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static void _lambda16_ (Block2Data* _data2_); +static void __lambda16__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static Block2Data* block2_data_ref (Block2Data* _data2_); static void block2_data_unref (Block2Data* _data2_); static void unity_launcher_scroller_view_model_child_removed (UnityLauncherScrollerView* self, UnityLauncherScrollerChild* child); @@ -306,10 +306,10 @@ static gboolean _unity_launcher_scroller_view_on_button_press_event_clutter_acto static gboolean _unity_launcher_scroller_view_on_enter_event_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static gboolean _unity_launcher_scroller_view_on_leave_event_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); -static void _lambda15_ (UnityLauncherScrollerView* self); -static void __lambda15__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); -static gboolean _lambda16_ (UnityLauncherScrollerView* self); -static gboolean __lambda16__gsource_func (gpointer self); +static void _lambda17_ (UnityLauncherScrollerView* self); +static void __lambda17__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); +static gboolean _lambda18_ (UnityLauncherScrollerView* self); +static gboolean __lambda18__gsource_func (gpointer self); static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_launcher_scroller_view_finalize (GObject* obj); static void unity_launcher_scroller_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -613,13 +613,13 @@ static void unity_launcher_scroller_view_disable_animations_on_children (UnityLa } -static void _lambda13_ (UnityLauncherScrollerView* self) { +static void _lambda15_ (UnityLauncherScrollerView* self) { clutter_actor_queue_relayout ((ClutterActor*) self); } -static void __lambda13__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda13_ (self); +static void __lambda15__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda15_ (self); } @@ -634,11 +634,11 @@ static void unity_launcher_scroller_view_model_child_added (UnityLauncherScrolle unity_launcher_scroller_view_order_children (self, FALSE); } clutter_actor_queue_relayout ((ClutterActor*) self); - g_signal_connect_object ((GObject*) child, "notify::position", (GCallback) __lambda13__g_object_notify, self, 0); + g_signal_connect_object ((GObject*) child, "notify::position", (GCallback) __lambda15__g_object_notify, self, 0); } -static void _lambda14_ (Block2Data* _data2_) { +static void _lambda16_ (Block2Data* _data2_) { UnityLauncherScrollerView * self; self = _data2_->self; clutter_actor_unparent ((ClutterActor*) _data2_->child); @@ -646,8 +646,8 @@ static void _lambda14_ (Block2Data* _data2_) { } -static void __lambda14__clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { - _lambda14_ (self); +static void __lambda16__clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { + _lambda16_ (self); } @@ -677,7 +677,7 @@ static void unity_launcher_scroller_view_model_child_removed (UnityLauncherScrol _data2_->child = _g_object_ref0 (child); gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->child_refs, _data2_->child); anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) _data2_->child, (gulong) CLUTTER_EASE_OUT_QUAD, UNITY_LAUNCHER_SHORT_DELAY, "opacity", 0, NULL)); - g_signal_connect_data (anim, "completed", (GCallback) __lambda14__clutter_animation_completed, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + g_signal_connect_data (anim, "completed", (GCallback) __lambda16__clutter_animation_completed, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); unity_launcher_scroller_view_order_children (self, FALSE); clutter_actor_queue_relayout ((ClutterActor*) self); _g_object_unref0 (anim); @@ -1721,26 +1721,26 @@ static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new } -static void _lambda15_ (UnityLauncherScrollerView* self) { +static void _lambda17_ (UnityLauncherScrollerView* self) { self->priv->is_scrolling = FALSE; self->priv->button_down = FALSE; } -static void __lambda15__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { - _lambda15_ (self); +static void __lambda17__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { + _lambda17_ (self); } -static gboolean _lambda16_ (UnityLauncherScrollerView* self) { +static gboolean _lambda18_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; unity_launcher_scroller_view_order_children (self, TRUE); } -static gboolean __lambda16__gsource_func (gpointer self) { +static gboolean __lambda18__gsource_func (gpointer self) { gboolean result; - result = _lambda16_ (self); + result = _lambda18_ (self); return result; } @@ -1794,12 +1794,12 @@ static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_c clutter_timeline_set_loop (self->priv->fling_timeline, TRUE); g_signal_connect_object (self->priv->fling_timeline, "new-frame", (GCallback) _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame, self, 0); drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); - g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda15__unity_drag_controller_drag_start, self, 0); + g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda17__unity_drag_controller_drag_start, self, 0); clutter_actor_set_reactive ((ClutterActor*) self, TRUE); self->priv->child_refs = (_tmp3_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->child_refs), _tmp3_); unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda16__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda18__gsource_func, g_object_ref (self), g_object_unref); _g_object_unref0 (drag_controller); } return obj; diff --git a/unity-private/panel/panel-indicator-object-entry-view.c b/unity-private/panel/panel-indicator-object-entry-view.c index 05f525cb7..f6f9d9165 100644 --- a/unity-private/panel/panel-indicator-object-entry-view.c +++ b/unity-private/panel/panel-indicator-object-entry-view.c @@ -31,6 +31,7 @@ #include <clutter/clutter.h> #include <float.h> #include <math.h> +#include <unity.h> #include <cairo.h> #include <gdk-pixbuf/gdk-pixdata.h> @@ -86,7 +87,6 @@ struct _UnityPanelIndicatorsIndicatorObjectEntryViewPrivate { ClutterCairoTexture* bg; gboolean menu_is_open; guint32 click_time; - float last_found_entry_x; float last_width; float last_height; }; @@ -116,10 +116,10 @@ static gboolean unity_panel_indicators_indicator_object_entry_view_on_scroll_eve gboolean unity_panel_indicators_indicator_object_entry_view_on_button_press_event (UnityPanelIndicatorsIndicatorObjectEntryView* self, ClutterEvent* e); gboolean menu_manager_menu_is_open (MenuManager* self); gboolean unity_panel_indicators_indicator_object_entry_view_on_motion_event (UnityPanelIndicatorsIndicatorObjectEntryView* self, ClutterEvent* e); -void unity_panel_indicators_indicator_object_entry_view_menu_key_moved (UnityPanelIndicatorsIndicatorObjectEntryView* self, GtkMenuDirectionType type); -static void _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current (GtkMenuShell* _sender, GtkMenuDirectionType direction, gpointer self); void unity_panel_indicators_indicator_object_entry_view_menu_vis_changed (UnityPanelIndicatorsIndicatorObjectEntryView* self); static void _unity_panel_indicators_indicator_object_entry_view_menu_vis_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +void unity_panel_indicators_indicator_object_entry_view_menu_key_moved (UnityPanelIndicatorsIndicatorObjectEntryView* self, GtkMenuDirectionType type); +static void _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current (GtkMenuShell* _sender, GtkMenuDirectionType direction, gpointer self); static gboolean unity_panel_indicators_indicator_object_entry_view_update_bg (UnityPanelIndicatorsIndicatorObjectEntryView* self); static gboolean _unity_panel_indicators_indicator_object_entry_view_update_bg_gsource_func (gpointer self); static void unity_panel_indicators_indicator_object_entry_view_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); @@ -164,10 +164,12 @@ UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_o static void unity_panel_indicators_indicator_object_entry_view_position_menu (UnityPanelIndicatorsIndicatorObjectEntryView* self, GtkMenu* menu, gint* x, gint* y, gboolean* push_in) { + float xx = 0.0F; g_return_if_fail (self != NULL); g_return_if_fail (menu != NULL); *y = (gint) clutter_actor_get_height ((ClutterActor*) self); - *x = (gint) self->priv->last_found_entry_x; + clutter_actor_get_transformed_position ((ClutterActor*) self, &xx, NULL); + *x = (gint) xx; } @@ -180,11 +182,12 @@ void unity_panel_indicators_indicator_object_entry_view_show_menu (UnityPanelInd g_return_if_fail (self != NULL); if (GTK_IS_MENU (self->priv->_entry->menu)) { MenuManager* _tmp0_; - self->priv->last_found_entry_x = (clutter_actor_get_x ((ClutterActor*) self) + clutter_actor_get_x (clutter_actor_get_parent ((ClutterActor*) self))) + clutter_actor_get_x (clutter_actor_get_parent (clutter_actor_get_parent ((ClutterActor*) self))); + unity_shell_hide_unity (unity_global_shell); menu_manager_register_visible_menu (_tmp0_ = menu_manager_get_default (), self->priv->_entry->menu); _g_object_unref0 (_tmp0_); - gtk_menu_popup (self->priv->_entry->menu, NULL, NULL, _unity_panel_indicators_indicator_object_entry_view_position_menu_gtk_menu_position_func, self, (guint) 1, clutter_get_current_event_time ()); - self->priv->click_time = clutter_get_current_event_time (); + gtk_menu_popup (self->priv->_entry->menu, NULL, NULL, _unity_panel_indicators_indicator_object_entry_view_position_menu_gtk_menu_position_func, self, (guint) 1, unity_shell_get_current_time (unity_global_shell)); + self->priv->click_time = unity_shell_get_current_time (unity_global_shell); + self->priv->menu_is_open = TRUE; unity_panel_indicators_indicator_object_entry_view_menu_shown (self); } } @@ -222,13 +225,7 @@ gboolean unity_panel_indicators_indicator_object_entry_view_on_button_press_even result = TRUE; return result; } else { - MenuManager* _tmp0_; - self->priv->last_found_entry_x = (clutter_actor_get_x ((ClutterActor*) self) + clutter_actor_get_x (clutter_actor_get_parent ((ClutterActor*) self))) + clutter_actor_get_x (clutter_actor_get_parent (clutter_actor_get_parent ((ClutterActor*) self))); - menu_manager_register_visible_menu (_tmp0_ = menu_manager_get_default (), self->priv->_entry->menu); - _g_object_unref0 (_tmp0_); - gtk_menu_popup (self->priv->_entry->menu, NULL, NULL, _unity_panel_indicators_indicator_object_entry_view_position_menu_gtk_menu_position_func, self, (guint) (*e).button.button, (*e).button.time); - self->priv->click_time = clutter_get_current_event_time (); - self->priv->menu_is_open = TRUE; + unity_panel_indicators_indicator_object_entry_view_show_menu (self); unity_panel_indicators_indicator_object_entry_view_menu_shown (self); } } @@ -240,11 +237,17 @@ gboolean unity_panel_indicators_indicator_object_entry_view_on_button_press_even gboolean unity_panel_indicators_indicator_object_entry_view_on_motion_event (UnityPanelIndicatorsIndicatorObjectEntryView* self, ClutterEvent* e) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); if (GTK_IS_MENU (self->priv->_entry->menu)) { - MenuManager* _tmp1_; - _tmp0_ = menu_manager_menu_is_open (_tmp1_ = menu_manager_get_default ()); - _g_object_unref0 (_tmp1_); + MenuManager* _tmp2_; + _tmp1_ = menu_manager_menu_is_open (_tmp2_ = menu_manager_get_default ()); + _g_object_unref0 (_tmp2_); + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + _tmp0_ = self->priv->menu_is_open == FALSE; } else { _tmp0_ = FALSE; } @@ -258,11 +261,6 @@ gboolean unity_panel_indicators_indicator_object_entry_view_on_motion_event (Uni } -static void _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current (GtkMenuShell* _sender, GtkMenuDirectionType direction, gpointer self) { - unity_panel_indicators_indicator_object_entry_view_menu_key_moved (self, direction); -} - - static void _unity_panel_indicators_indicator_object_entry_view_menu_vis_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { unity_panel_indicators_indicator_object_entry_view_menu_vis_changed (self); } @@ -271,13 +269,17 @@ static void _unity_panel_indicators_indicator_object_entry_view_menu_vis_changed void unity_panel_indicators_indicator_object_entry_view_menu_shown (UnityPanelIndicatorsIndicatorObjectEntryView* self) { g_return_if_fail (self != NULL); if (GTK_IS_MENU (self->priv->_entry->menu)) { - g_signal_connect_object ((GtkMenuShell*) self->priv->_entry->menu, "move-current", (GCallback) _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current, self, 0); g_signal_connect_object ((GObject*) self->priv->_entry->menu, "notify::visible", (GCallback) _unity_panel_indicators_indicator_object_entry_view_menu_vis_changed_g_object_notify, self, 0); clutter_actor_animate ((ClutterActor*) self->priv->bg, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 200, "opacity", 255, NULL); } } +static void _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current (GtkMenuShell* _sender, GtkMenuDirectionType direction, gpointer self) { + unity_panel_indicators_indicator_object_entry_view_menu_key_moved (self, direction); +} + + void unity_panel_indicators_indicator_object_entry_view_menu_vis_changed (UnityPanelIndicatorsIndicatorObjectEntryView* self) { gboolean vis; g_return_if_fail (self != NULL); @@ -651,7 +653,6 @@ static void unity_panel_indicators_indicator_object_entry_view_class_init (Unity static void unity_panel_indicators_indicator_object_entry_view_instance_init (UnityPanelIndicatorsIndicatorObjectEntryView * self) { self->priv = UNITY_PANEL_INDICATORS_INDICATOR_OBJECT_ENTRY_VIEW_GET_PRIVATE (self); self->priv->menu_is_open = FALSE; - self->priv->last_found_entry_x = 0.0f; self->priv->last_width = (float) 0; self->priv->last_height = (float) 0; } @@ -660,6 +661,9 @@ static void unity_panel_indicators_indicator_object_entry_view_instance_init (Un static void unity_panel_indicators_indicator_object_entry_view_finalize (GObject* obj) { UnityPanelIndicatorsIndicatorObjectEntryView * self; self = UNITY_PANEL_INDICATORS_INDICATOR_OBJECT_ENTRY_VIEW (obj); + { + clutter_actor_unparent ((ClutterActor*) self->priv->bg); + } _g_object_unref0 (self->priv->bg); _g_object_unref0 (self->image); _g_object_unref0 (self->text); diff --git a/unity-private/panel/panel-indicator-object-entry-view.vala b/unity-private/panel/panel-indicator-object-entry-view.vala index e2064bbce..35d2f9fc3 100644 --- a/unity-private/panel/panel-indicator-object-entry-view.vala +++ b/unity-private/panel/panel-indicator-object-entry-view.vala @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2010 Canonical Ltd * * This program is free software: you can redistribute it and/or modify @@ -30,7 +30,6 @@ namespace Unity.Panel.Indicators private bool menu_is_open = false; private uint32 click_time; - private float last_found_entry_x = 0.0f; private float last_width = 0; private float last_height = 0; @@ -44,6 +43,11 @@ namespace Unity.Panel.Indicators reactive:true); } + ~IndicatorObjectEntryView () + { + bg.unparent (); + } + construct { /* Figure out if you need a label, text or both, create the ctk @@ -86,7 +90,7 @@ namespace Unity.Panel.Indicators { image.hide (); } - + entry.image.notify["visible"].connect (() => { if (entry.image != null) @@ -140,7 +144,7 @@ namespace Unity.Panel.Indicators { text.text = entry.label.label; }); - + if ((entry.label.get_flags () & Gtk.WidgetFlags.VISIBLE) != 0) { text.show (); @@ -149,7 +153,7 @@ namespace Unity.Panel.Indicators { text.hide (); } - + entry.label.notify["visible"].connect (() => { if (entry.label != null) @@ -163,7 +167,7 @@ namespace Unity.Panel.Indicators text.hide (); } } - }); + }); } } @@ -173,21 +177,27 @@ namespace Unity.Panel.Indicators out bool push_in) { y = (int)height; - x = (int)last_found_entry_x; + + float xx; + get_transformed_position (out xx, null); + + x = (int)xx; } public void show_menu () { if (entry.menu is Gtk.Menu) { - last_found_entry_x = x + get_parent ().x + get_parent ().get_parent ().x; + global_shell.hide_unity (); + MenuManager.get_default ().register_visible_menu (entry.menu); entry.menu.popup (null, null, position_menu, 1, - Clutter.get_current_event_time ()); - click_time = Clutter.get_current_event_time (); + Unity.global_shell.get_current_time ()); + click_time = Unity.global_shell.get_current_time (); + menu_is_open = true; menu_shown (); } } @@ -216,15 +226,7 @@ namespace Unity.Panel.Indicators } else { - last_found_entry_x = x + get_parent ().x + get_parent ().get_parent ().x; - MenuManager.get_default ().register_visible_menu (entry.menu); - entry.menu.popup (null, - null, - position_menu, - e.button.button, - e.button.time); - click_time = Clutter.get_current_event_time (); - menu_is_open = true; + show_menu (); menu_shown (); } } @@ -233,7 +235,9 @@ namespace Unity.Panel.Indicators public bool on_motion_event (Clutter.Event e) { - if ((entry.menu is Gtk.Menu) && MenuManager.get_default ().menu_is_open ()) + if ((entry.menu is Gtk.Menu) + && MenuManager.get_default ().menu_is_open () + && menu_is_open == false) { show_menu (); return true; @@ -248,7 +252,7 @@ namespace Unity.Panel.Indicators /* Show the menu and connect various signal to update the menu if * necessary. */ - entry.menu.move_current.connect (menu_key_moved); + //entry.menu.move_current.connect (menu_key_moved); entry.menu.notify["visible"].connect (menu_vis_changed); bg.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, "opacity", 255); } @@ -310,7 +314,7 @@ namespace Unity.Panel.Indicators { return (entry.menu.get_flags () & Gtk.WidgetFlags.VISIBLE) != 0; } - + private override void paint () { bg.paint (); diff --git a/unity-private/panel/panel-menu-manager.c b/unity-private/panel/panel-menu-manager.c index 0b8b26bd6..81626e545 100644 --- a/unity-private/panel/panel-menu-manager.c +++ b/unity-private/panel/panel-menu-manager.c @@ -112,7 +112,9 @@ void menu_manager_register_visible_menu (MenuManager* self, GtkMenu* menu) { void menu_manager_popdown_current_menu (MenuManager* self) { g_return_if_fail (self != NULL); - gtk_menu_popdown (self->priv->current_menu); + if (GTK_IS_MENU (self->priv->current_menu)) { + gtk_menu_popdown (self->priv->current_menu); + } } diff --git a/unity-private/panel/panel-menu-manager.vala b/unity-private/panel/panel-menu-manager.vala index 3eebbd4f4..beaf0659b 100644 --- a/unity-private/panel/panel-menu-manager.vala +++ b/unity-private/panel/panel-menu-manager.vala @@ -33,7 +33,9 @@ public class MenuManager : Object public void register_visible_menu (Gtk.Menu menu) { - if (current_menu is Gtk.Menu && (current_menu.visible == true) && (current_menu != menu)) + if (current_menu is Gtk.Menu + && (current_menu.visible == true) + && (current_menu != menu)) current_menu.popdown (); current_menu = menu; @@ -41,7 +43,8 @@ public class MenuManager : Object public void popdown_current_menu () { - current_menu.popdown (); + if (current_menu is Gtk.Menu) + current_menu.popdown (); } public bool menu_is_open () diff --git a/unity-private/places/places-default-renderer-group.c b/unity-private/places/places-default-renderer-group.c index 81629cc04..a112e95cf 100644 --- a/unity-private/places/places-default-renderer-group.c +++ b/unity-private/places/places-default-renderer-group.c @@ -22,15 +22,15 @@ #include <glib.h> #include <glib-object.h> -#include <clutk/clutk.h> +#include <unity.h> #include <stdlib.h> #include <string.h> #include <dee.h> +#include <clutk/clutk.h> #include <float.h> #include <math.h> #include <clutter/clutter.h> #include <gio/gio.h> -#include <unity.h> #include <gtk/gtk.h> #include <gdk/gdk.h> #include <pango/pango.h> @@ -64,12 +64,12 @@ typedef struct _UnityPlacesTilePrivate UnityPlacesTilePrivate; typedef struct _UnityPlacesTileClickedHandlerData UnityPlacesTileClickedHandlerData; struct _UnityPlacesDefaultRendererGroup { - CtkBox parent_instance; + UnityExpandingBin parent_instance; UnityPlacesDefaultRendererGroupPrivate * priv; }; struct _UnityPlacesDefaultRendererGroupClass { - CtkBoxClass parent_class; + UnityExpandingBinClass parent_class; }; struct _UnityPlacesDefaultRendererGroupPrivate { @@ -78,11 +78,14 @@ struct _UnityPlacesDefaultRendererGroupPrivate { char* _display_name; char* _icon_hint; DeeModel* _results; + CtkVBox* vbox; CtkHBox* title_box; CtkImage* icon; CtkText* text; CtkImage* expander; CtkIconView* renderer; + guint n_results; + gboolean dirty; }; struct _UnityPlacesTile { @@ -101,6 +104,7 @@ struct _UnityPlacesTilePrivate { char* _uri; char* _mimetype; char* _comment; + gboolean shown; }; struct _UnityPlacesTileClickedHandlerData { @@ -108,12 +112,11 @@ struct _UnityPlacesTileClickedHandlerData { GAsyncResult* _res_; GSimpleAsyncResult* _async_result; UnityPlacesTile* self; - char* _tmp0_; char* id; GAppInfo* info; UnityAppInfoManager* appinfos; + GAppInfo* _tmp0_; GAppInfo* _tmp1_; - GAppInfo* _tmp2_; GError * ee; GError * e; GError * eee; @@ -134,20 +137,23 @@ enum { UNITY_PLACES_DEFAULT_RENDERER_GROUP_ICON_HINT, UNITY_PLACES_DEFAULT_RENDERER_GROUP_RESULTS }; -#define UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING 0.0f +#define UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING 24.0f #define UNITY_PLACES_DEFAULT_RENDERER_GROUP_SPACING 0 UnityPlacesDefaultRendererGroup* unity_places_default_renderer_group_new (guint group_id, const char* group_renderer, const char* display_name, const char* icon_hint, DeeModel* results); UnityPlacesDefaultRendererGroup* unity_places_default_renderer_group_construct (GType object_type, guint group_id, const char* group_renderer, const char* display_name, const char* icon_hint, DeeModel* results); -static void unity_places_default_renderer_group_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height); +static void unity_places_default_renderer_group_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static gboolean unity_places_default_renderer_group_interesting (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); DeeModel* unity_places_default_renderer_group_get_results (UnityPlacesDefaultRendererGroup* self); UnityPlacesTile* unity_places_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesTile* unity_places_tile_construct (GType object_type, DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); GType unity_places_tile_get_type (void); +static void unity_places_default_renderer_group_add_to_n_results (UnityPlacesDefaultRendererGroup* self, gint i); static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); DeeModelIter* unity_places_tile_get_iter (UnityPlacesTile* self); static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); guint unity_places_default_renderer_group_get_group_id (UnityPlacesDefaultRendererGroup* self); +void unity_places_tile_about_to_show (UnityPlacesTile* self); +static void unity_places_default_renderer_group_on_n_cols_changed (UnityPlacesDefaultRendererGroup* self); static void unity_places_default_renderer_group_set_group_id (UnityPlacesDefaultRendererGroup* self, guint value); const char* unity_places_default_renderer_group_get_group_renderer (UnityPlacesDefaultRendererGroup* self); static void unity_places_default_renderer_group_set_group_renderer (UnityPlacesDefaultRendererGroup* self, const char* value); @@ -156,6 +162,11 @@ static void unity_places_default_renderer_group_set_display_name (UnityPlacesDef const char* unity_places_default_renderer_group_get_icon_hint (UnityPlacesDefaultRendererGroup* self); static void unity_places_default_renderer_group_set_icon_hint (UnityPlacesDefaultRendererGroup* self, const char* value); static void unity_places_default_renderer_group_set_results (UnityPlacesDefaultRendererGroup* self, DeeModel* value); +static gboolean _lambda8_ (UnityPlacesDefaultRendererGroup* self); +static gboolean __lambda8__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _lambda9_ (UnityPlacesDefaultRendererGroup* self); +static gboolean __lambda9__clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static void _unity_places_default_renderer_group_on_n_cols_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void _unity_places_default_renderer_group_on_result_added_dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self); static void _unity_places_default_renderer_group_on_result_removed_dee_model_row_removed (DeeModel* _sender, DeeModelIter* iter, gpointer self); static GObject * unity_places_default_renderer_group_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -174,6 +185,8 @@ enum { }; #define UNITY_PLACES_TILE_ICON_SIZE 48 #define UNITY_PLACES_TILE_DEFAULT_ICON "text-x-preview" +const char* unity_places_tile_get_display_name (UnityPlacesTile* self); +static void unity_places_tile_set_icon (UnityPlacesTile* self); static void unity_places_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth); static void unity_places_tile_clicked_handler (UnityPlacesTile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); static void unity_places_tile_clicked_handler_finish (UnityPlacesTile* self, GAsyncResult* _res_); @@ -184,9 +197,7 @@ const char* unity_places_tile_get_uri (UnityPlacesTile* self); static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHandlerData* data); const char* unity_places_tile_get_icon_hint (UnityPlacesTile* self); const char* unity_places_tile_get_mimetype (UnityPlacesTile* self); -static void unity_places_tile_set_icon (UnityPlacesTile* self); static void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value); -const char* unity_places_tile_get_display_name (UnityPlacesTile* self); static void unity_places_tile_set_display_name (UnityPlacesTile* self, const char* value); static void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value); static void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value); @@ -217,20 +228,31 @@ UnityPlacesDefaultRendererGroup* unity_places_default_renderer_group_new (guint } -static void unity_places_default_renderer_group_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height) { +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void unity_places_default_renderer_group_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags) { UnityPlacesDefaultRendererGroup * self; GList* children; + ClutterActor* _tmp0_; + ClutterActor* child; + gboolean _tmp1_ = FALSE; self = (UnityPlacesDefaultRendererGroup*) base; + CLUTTER_ACTOR_CLASS (unity_places_default_renderer_group_parent_class)->allocate ((ClutterActor*) UNITY_EXPANDING_BIN (self), box, flags); children = clutter_container_get_children ((ClutterContainer*) self->priv->renderer); - if (g_list_length (children) > 0) { - CLUTTER_ACTOR_CLASS (unity_places_default_renderer_group_parent_class)->get_preferred_height ((ClutterActor*) CTK_BOX (self), for_width, min_height, nat_height); - clutter_actor_show ((ClutterActor*) self); + child = _g_object_ref0 ((_tmp0_ = (ClutterActor*) g_list_nth_data (children, (guint) 0), CLUTTER_IS_ACTOR (_tmp0_) ? ((ClutterActor*) _tmp0_) : NULL)); + if (CLUTTER_IS_ACTOR (child)) { + _tmp1_ = clutter_actor_get_height (child) != unity_expanding_bin_get_unexpanded_height ((UnityExpandingBin*) self); } else { - *min_height = (float) 0; - *nat_height = (float) 0; - clutter_actor_hide ((ClutterActor*) self); + _tmp1_ = FALSE; + } + if (_tmp1_) { + unity_expanding_bin_set_unexpanded_height ((UnityExpandingBin*) self, (clutter_actor_get_height ((ClutterActor*) self->priv->title_box) + 1.0f) + clutter_actor_get_height (child)); } _g_list_free0 (children); + _g_object_unref0 (child); } @@ -244,16 +266,16 @@ static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefa button = g_object_ref_sink (unity_places_tile_new (iter, dee_model_get_string (self->priv->_results, iter, (guint) 0), dee_model_get_string (self->priv->_results, iter, (guint) 1), dee_model_get_string (self->priv->_results, iter, (guint) 3), dee_model_get_string (self->priv->_results, iter, (guint) 4), dee_model_get_string (self->priv->_results, iter, (guint) 5))); clutter_container_add_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) button); clutter_actor_show ((ClutterActor*) button); - clutter_actor_show ((ClutterActor*) self); + unity_places_default_renderer_group_add_to_n_results (self, 1); + if (unity_expanding_bin_get_bin_state ((UnityExpandingBin*) self) == UNITY_EXPANDING_BIN_STATE_CLOSED) { + unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_UNEXPANDED); + clutter_actor_show ((ClutterActor*) self); + } + self->priv->dirty = TRUE; _g_object_unref0 (button); } -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter) { GList* children; g_return_if_fail (self != NULL); @@ -275,6 +297,7 @@ static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDe tile = _g_object_ref0 ((_tmp0_ = actor, UNITY_PLACES_IS_TILE (_tmp0_) ? ((UnityPlacesTile*) _tmp0_) : NULL)); if (unity_places_tile_get_iter (tile) == iter) { clutter_actor_destroy (actor); + unity_places_default_renderer_group_add_to_n_results (self, -1); _g_object_unref0 (actor); _g_object_unref0 (tile); break; @@ -284,8 +307,8 @@ static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDe } } } - if (g_list_length (children) <= 1) { - clutter_actor_hide ((ClutterActor*) self); + if (self->priv->n_results < 1) { + unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_CLOSED); } _g_list_free0 (children); } @@ -300,6 +323,56 @@ static gboolean unity_places_default_renderer_group_interesting (UnityPlacesDefa } +static void unity_places_default_renderer_group_add_to_n_results (UnityPlacesDefaultRendererGroup* self, gint i) { + g_return_if_fail (self != NULL); + self->priv->n_results = self->priv->n_results + ((guint) i); + if (self->priv->n_results > ctk_icon_view_get_n_cols (self->priv->renderer)) { + clutter_actor_animate ((ClutterActor*) self->priv->expander, (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "opacity", 255, NULL); + } else { + clutter_actor_animate ((ClutterActor*) self->priv->expander, (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "opacity", 0, NULL); + } +} + + +static void unity_places_default_renderer_group_on_n_cols_changed (UnityPlacesDefaultRendererGroup* self) { + guint n_cols; + g_return_if_fail (self != NULL); + n_cols = ctk_icon_view_get_n_cols (self->priv->renderer); + if (unity_expanding_bin_get_bin_state ((UnityExpandingBin*) self) == UNITY_EXPANDING_BIN_STATE_UNEXPANDED) { + GList* children; + gint i; + children = clutter_container_get_children ((ClutterContainer*) self->priv->renderer); + i = 0; + { + GList* child_collection; + GList* child_it; + child_collection = children; + for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { + ClutterActor* child; + child = _g_object_ref0 ((ClutterActor*) child_it->data); + { + ClutterActor* _tmp0_; + UnityPlacesTile* tile; + tile = _g_object_ref0 ((_tmp0_ = child, UNITY_PLACES_IS_TILE (_tmp0_) ? ((UnityPlacesTile*) _tmp0_) : NULL)); + if (i < n_cols) { + unity_places_tile_about_to_show (tile); + i++; + } else { + _g_object_unref0 (child); + _g_object_unref0 (tile); + break; + } + _g_object_unref0 (child); + _g_object_unref0 (tile); + } + } + } + _g_list_free0 (children); + } + unity_places_default_renderer_group_add_to_n_results (self, 0); +} + + guint unity_places_default_renderer_group_get_group_id (UnityPlacesDefaultRendererGroup* self) { guint result; g_return_val_if_fail (self != NULL, 0U); @@ -379,6 +452,71 @@ static void unity_places_default_renderer_group_set_results (UnityPlacesDefaultR } +static gboolean _lambda8_ (UnityPlacesDefaultRendererGroup* self) { + gboolean result = FALSE; + if (self->priv->n_results <= ctk_icon_view_get_n_cols (self->priv->renderer)) { + result = TRUE; + return result; + } + if (unity_expanding_bin_get_bin_state ((UnityExpandingBin*) self) == UNITY_EXPANDING_BIN_STATE_UNEXPANDED) { + unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_EXPANDED); + ctk_image_set_from_filename (self->priv->expander, PKGDATADIR "/minimize_up.png"); + } else { + unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_UNEXPANDED); + ctk_image_set_from_filename (self->priv->expander, PKGDATADIR "/maximize_up.png"); + } + result = TRUE; + return result; +} + + +static gboolean __lambda8__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = _lambda8_ (self); + return result; +} + + +static gboolean _lambda9_ (UnityPlacesDefaultRendererGroup* self) { + gboolean result = FALSE; + if (self->priv->dirty) { + GList* children; + children = clutter_container_get_children ((ClutterContainer*) self->priv->renderer); + { + GList* child_collection; + GList* child_it; + child_collection = children; + for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { + ClutterActor* child; + child = _g_object_ref0 ((ClutterActor*) child_it->data); + { + ClutterActor* _tmp0_; + UnityPlacesTile* tile; + tile = _g_object_ref0 ((_tmp0_ = child, UNITY_PLACES_IS_TILE (_tmp0_) ? ((UnityPlacesTile*) _tmp0_) : NULL)); + unity_places_tile_about_to_show (tile); + _g_object_unref0 (child); + _g_object_unref0 (tile); + } + } + } + self->priv->dirty = FALSE; + _g_list_free0 (children); + } +} + + +static gboolean __lambda9__clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = _lambda9_ (self); + return result; +} + + +static void _unity_places_default_renderer_group_on_n_cols_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + unity_places_default_renderer_group_on_n_cols_changed (self); +} + + static void _unity_places_default_renderer_group_on_result_added_dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self) { unity_places_default_renderer_group_on_result_added (self, iter); } @@ -399,43 +537,54 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu { CtkPadding _tmp0_ = {0}; CtkPadding _tmp1_; - CtkHBox* _tmp2_; - CtkImage* _tmp3_; - CtkText* _tmp4_; - CtkImage* _tmp5_; - ClutterColor _tmp7_; - ClutterColor _tmp6_ = {0}; - ClutterRectangle* sep; - CtkIconView* _tmp8_; - CtkPadding _tmp9_ = {0}; - CtkPadding _tmp10_; + CtkVBox* _tmp2_; + CtkHBox* _tmp3_; + CtkImage* _tmp4_; + CtkText* _tmp5_; + CtkImage* _tmp6_; + ClutterColor _tmp8_; + ClutterColor _tmp7_ = {0}; + ClutterRectangle* rect; + CtkIconView* _tmp9_; + CtkPadding _tmp10_ = {0}; + CtkPadding _tmp11_; DeeModelIter* iter; - ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING, _tmp0_.right = UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING, _tmp0_.bottom = UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING, _tmp0_.left = UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING, _tmp0_), &_tmp1_)); - ctk_box_set_orientation ((CtkBox*) self, (gint) CTK_ORIENTATION_VERTICAL); - ctk_box_set_spacing ((CtkBox*) self, UNITY_PLACES_DEFAULT_RENDERER_GROUP_SPACING); - ctk_box_set_homogeneous ((CtkBox*) self, FALSE); + ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = 0.0f, _tmp0_.right = 0.0f, _tmp0_.bottom = UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING, _tmp0_.left = 0.0f, _tmp0_), &_tmp1_)); clutter_actor_hide ((ClutterActor*) self); - self->priv->title_box = (_tmp2_ = g_object_ref_sink ((CtkHBox*) ctk_hbox_new ((guint) 8)), _g_object_unref0 (self->priv->title_box), _tmp2_); - ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->priv->title_box, FALSE, FALSE); + self->priv->vbox = (_tmp2_ = g_object_ref_sink ((CtkVBox*) ctk_vbox_new ((guint) UNITY_PLACES_DEFAULT_RENDERER_GROUP_SPACING)), _g_object_unref0 (self->priv->vbox), _tmp2_); + ctk_box_set_spacing ((CtkBox*) self->priv->vbox, UNITY_PLACES_DEFAULT_RENDERER_GROUP_SPACING); + ctk_box_set_homogeneous ((CtkBox*) self->priv->vbox, FALSE); + clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->priv->vbox); + clutter_actor_show ((ClutterActor*) self->priv->vbox); + self->priv->title_box = (_tmp3_ = g_object_ref_sink ((CtkHBox*) ctk_hbox_new ((guint) 5)), _g_object_unref0 (self->priv->title_box), _tmp3_); + ctk_box_pack ((CtkBox*) self->priv->vbox, (ClutterActor*) self->priv->title_box, FALSE, FALSE); clutter_actor_show ((ClutterActor*) self->priv->title_box); - self->priv->icon = (_tmp3_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) 24)), _g_object_unref0 (self->priv->icon), _tmp3_); + clutter_actor_set_reactive ((ClutterActor*) self->priv->title_box, TRUE); + self->priv->icon = (_tmp4_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) 22)), _g_object_unref0 (self->priv->icon), _tmp4_); + ctk_image_set_from_filename (self->priv->icon, PKGDATADIR "/favourites.png"); ctk_box_pack ((CtkBox*) self->priv->title_box, (ClutterActor*) self->priv->icon, FALSE, FALSE); clutter_actor_show ((ClutterActor*) self->priv->icon); - self->priv->text = (_tmp4_ = g_object_ref_sink ((CtkText*) ctk_text_new (self->priv->_display_name)), _g_object_unref0 (self->priv->text), _tmp4_); + self->priv->text = (_tmp5_ = g_object_ref_sink ((CtkText*) ctk_text_new (self->priv->_display_name)), _g_object_unref0 (self->priv->text), _tmp5_); ctk_box_pack ((CtkBox*) self->priv->title_box, (ClutterActor*) self->priv->text, TRUE, TRUE); clutter_actor_show ((ClutterActor*) self->priv->text); - self->priv->expander = (_tmp5_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) 24)), _g_object_unref0 (self->priv->expander), _tmp5_); + self->priv->expander = (_tmp6_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) 22)), _g_object_unref0 (self->priv->expander), _tmp6_); + ctk_image_set_from_filename (self->priv->expander, PKGDATADIR "/maximize_up.png"); + clutter_actor_set_opacity ((ClutterActor*) self->priv->expander, (guint8) 0); ctk_box_pack ((CtkBox*) self->priv->title_box, (ClutterActor*) self->priv->expander, FALSE, TRUE); clutter_actor_show ((ClutterActor*) self->priv->expander); - sep = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp7_ = (_tmp6_.red = (guint8) 255, _tmp6_.green = (guint8) 255, _tmp6_.blue = (guint8) 255, _tmp6_.alpha = (guint8) 255, _tmp6_), &_tmp7_))); - clutter_actor_set_height ((ClutterActor*) sep, (float) 1); - ctk_box_pack ((CtkBox*) self, (ClutterActor*) sep, FALSE, FALSE); - clutter_actor_show ((ClutterActor*) sep); - self->priv->renderer = (_tmp8_ = g_object_ref_sink ((CtkIconView*) ctk_icon_view_new ()), _g_object_unref0 (self->priv->renderer), _tmp8_); - ctk_actor_set_padding ((CtkActor*) self->priv->renderer, (_tmp10_ = (_tmp9_.top = 12.0f, _tmp9_.right = 0.0f, _tmp9_.bottom = 0.0f, _tmp9_.left = 0.0f, _tmp9_), &_tmp10_)); + rect = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp8_ = (_tmp7_.red = (guint8) 255, _tmp7_.green = (guint8) 255, _tmp7_.blue = (guint8) 255, _tmp7_.alpha = (guint8) 255, _tmp7_), &_tmp8_))); + clutter_actor_set_height ((ClutterActor*) rect, (float) 1); + ctk_box_pack ((CtkBox*) self->priv->vbox, (ClutterActor*) rect, FALSE, FALSE); + clutter_actor_show ((ClutterActor*) rect); + g_signal_connect_object ((ClutterActor*) self->priv->title_box, "button-release-event", (GCallback) __lambda8__clutter_actor_button_release_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->title_box, "motion-event", (GCallback) __lambda9__clutter_actor_motion_event, self, 0); + self->priv->renderer = (_tmp9_ = g_object_ref_sink ((CtkIconView*) ctk_icon_view_new ()), _g_object_unref0 (self->priv->renderer), _tmp9_); + ctk_actor_set_padding ((CtkActor*) self->priv->renderer, (_tmp11_ = (_tmp10_.top = 12.0f, _tmp10_.right = 0.0f, _tmp10_.bottom = 0.0f, _tmp10_.left = 0.0f, _tmp10_), &_tmp11_)); ctk_icon_view_set_spacing (self->priv->renderer, 24); - ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->priv->renderer, TRUE, TRUE); + ctk_box_pack ((CtkBox*) self->priv->vbox, (ClutterActor*) self->priv->renderer, TRUE, TRUE); clutter_actor_show ((ClutterActor*) self->priv->renderer); + g_object_set ((GObject*) self->priv->renderer, "auto-fade-children", TRUE, NULL); + g_signal_connect_object ((GObject*) self->priv->renderer, "notify::n-cols", (GCallback) _unity_places_default_renderer_group_on_n_cols_changed_g_object_notify, self, 0); iter = dee_model_get_first_iter (self->priv->_results); while (TRUE) { if (!(!dee_model_is_last (self->priv->_results, iter))) { @@ -448,7 +597,7 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu } g_signal_connect_object (self->priv->_results, "row-added", (GCallback) _unity_places_default_renderer_group_on_result_added_dee_model_row_added, self, 0); g_signal_connect_object (self->priv->_results, "row-removed", (GCallback) _unity_places_default_renderer_group_on_result_removed_dee_model_row_removed, self, 0); - _g_object_unref0 (sep); + _g_object_unref0 (rect); } return obj; } @@ -457,7 +606,7 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu static void unity_places_default_renderer_group_class_init (UnityPlacesDefaultRendererGroupClass * klass) { unity_places_default_renderer_group_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityPlacesDefaultRendererGroupPrivate)); - CLUTTER_ACTOR_CLASS (klass)->get_preferred_height = unity_places_default_renderer_group_real_get_preferred_height; + CLUTTER_ACTOR_CLASS (klass)->allocate = unity_places_default_renderer_group_real_allocate; G_OBJECT_CLASS (klass)->get_property = unity_places_default_renderer_group_get_property; G_OBJECT_CLASS (klass)->set_property = unity_places_default_renderer_group_set_property; G_OBJECT_CLASS (klass)->constructor = unity_places_default_renderer_group_constructor; @@ -472,6 +621,8 @@ static void unity_places_default_renderer_group_class_init (UnityPlacesDefaultRe static void unity_places_default_renderer_group_instance_init (UnityPlacesDefaultRendererGroup * self) { self->priv = UNITY_PLACES_DEFAULT_RENDERER_GROUP_GET_PRIVATE (self); + self->priv->n_results = (guint) 0; + self->priv->dirty = FALSE; } @@ -482,6 +633,7 @@ static void unity_places_default_renderer_group_finalize (GObject* obj) { _g_free0 (self->priv->_display_name); _g_free0 (self->priv->_icon_hint); _g_object_unref0 (self->priv->_results); + _g_object_unref0 (self->priv->vbox); _g_object_unref0 (self->priv->title_box); _g_object_unref0 (self->priv->icon); _g_object_unref0 (self->priv->text); @@ -496,7 +648,7 @@ GType unity_places_default_renderer_group_get_type (void) { if (g_once_init_enter (&unity_places_default_renderer_group_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (UnityPlacesDefaultRendererGroupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_places_default_renderer_group_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityPlacesDefaultRendererGroup), 0, (GInstanceInitFunc) unity_places_default_renderer_group_instance_init, NULL }; GType unity_places_default_renderer_group_type_id; - unity_places_default_renderer_group_type_id = g_type_register_static (CTK_TYPE_BOX, "UnityPlacesDefaultRendererGroup", &g_define_type_info, 0); + unity_places_default_renderer_group_type_id = g_type_register_static (UNITY_TYPE_EXPANDING_BIN, "UnityPlacesDefaultRendererGroup", &g_define_type_info, 0); g_once_init_leave (&unity_places_default_renderer_group_type_id__volatile, unity_places_default_renderer_group_type_id); } return unity_places_default_renderer_group_type_id__volatile; @@ -570,6 +722,17 @@ UnityPlacesTile* unity_places_tile_new (DeeModelIter* iter, const char* uri, con } +void unity_places_tile_about_to_show (UnityPlacesTile* self) { + g_return_if_fail (self != NULL); + if (self->priv->shown) { + return; + } + self->priv->shown = TRUE; + ctk_button_set_label ((CtkButton*) self, self->priv->_display_name); + unity_places_tile_set_icon (self); +} + + static void unity_places_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth) { UnityPlacesTile * self; self = (UnityPlacesTile*) base; @@ -617,14 +780,6 @@ static void unity_places_tile_clicked_handler_ready (GObject* source_object, GAs } -static const char* string_to_string (const char* self) { - const char* result = NULL; - g_return_val_if_fail (self != NULL, NULL); - result = self; - return result; -} - - static glong string_get_length (const char* self) { glong result; g_return_val_if_fail (self != NULL, 0L); @@ -644,8 +799,7 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand } _state_0: { - g_debug ("places-default-renderer-group.vala:219: %s", data->_tmp0_ = g_strconcat ("Launching ", string_to_string (data->self->priv->_uri), NULL)); - _g_free0 (data->_tmp0_); + unity_shell_hide_unity (unity_global_shell); if (g_str_has_prefix (data->self->priv->_uri, "application://")) { data->id = g_strdup (g_utf8_offset_to_pointer (data->self->priv->_uri, string_get_length ("application://"))); { @@ -654,13 +808,12 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand unity_app_info_manager_lookup_async (data->appinfos, data->id, unity_places_tile_clicked_handler_ready, data); return FALSE; _state_1: - data->_tmp1_ = unity_app_info_manager_lookup_finish (data->appinfos, data->_res_, &data->_inner_error_); + data->_tmp0_ = unity_app_info_manager_lookup_finish (data->appinfos, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { _g_object_unref0 (data->appinfos); goto __catch5_g_error; } - data->info = (data->_tmp2_ = data->_tmp1_, _g_object_unref0 (data->info), data->_tmp2_); - g_debug ("places-default-renderer-group.vala:229: Foo: %s", g_app_info_get_name (data->info)); + data->info = (data->_tmp1_ = data->_tmp0_, _g_object_unref0 (data->info), data->_tmp1_); _g_object_unref0 (data->appinfos); } goto __finally5; @@ -669,7 +822,7 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand data->ee = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-default-renderer-group.vala:231: Unable to read .desktop file '" \ + g_warning ("places-default-renderer-group.vala:334: Unable to read .desktop file '" \ "%s': %s", data->self->priv->_uri, data->ee->message); _g_error_free0 (data->ee); _g_free0 (data->id); @@ -700,7 +853,6 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand if (data->_inner_error_ != NULL) { goto __catch6_g_error; } - g_debug ("places-default-renderer-group.vala:239: Launched"); } goto __finally6; __catch6_g_error: @@ -708,7 +860,7 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand data->e = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-default-renderer-group.vala:241: Unable to launch desktop file " \ + g_warning ("places-default-renderer-group.vala:343: Unable to launch desktop file " \ "%s: %s\n", data->id, data->e->message); _g_error_free0 (data->e); } @@ -722,7 +874,7 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand return FALSE; } } else { - g_warning ("places-default-renderer-group.vala:248: %s is an invalid DesktopAppInf" \ + g_warning ("places-default-renderer-group.vala:350: %s is an invalid DesktopAppInf" \ "o id\n", data->id); } _g_free0 (data->id); @@ -751,7 +903,7 @@ static gboolean unity_places_tile_clicked_handler_co (UnityPlacesTileClickedHand data->eee = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-default-renderer-group.vala:258: Unable to launch: %s\n", data->eee->message); + g_warning ("places-default-renderer-group.vala:360: Unable to launch: %s\n", data->eee->message); _g_error_free0 (data->eee); } } @@ -910,10 +1062,8 @@ static GObject * unity_places_tile_constructor (GType type, guint n_construct_pr self = UNITY_PLACES_TILE (obj); { CtkText* text; - ctk_button_set_label ((CtkButton*) self, self->priv->_display_name); text = ctk_button_get_text ((CtkButton*) self); clutter_text_set_ellipsize ((ClutterText*) text, PANGO_ELLIPSIZE_END); - unity_places_tile_set_icon (self); } return obj; } @@ -939,6 +1089,7 @@ static void unity_places_tile_class_init (UnityPlacesTileClass * klass) { static void unity_places_tile_instance_init (UnityPlacesTile * self) { self->priv = UNITY_PLACES_TILE_GET_PRIVATE (self); + self->priv->shown = FALSE; } diff --git a/unity-private/places/places-default-renderer-group.vala b/unity-private/places/places-default-renderer-group.vala index 959cab05c..47a0e6390 100644 --- a/unity-private/places/places-default-renderer-group.vala +++ b/unity-private/places/places-default-renderer-group.vala @@ -19,9 +19,9 @@ namespace Unity.Places { - public class DefaultRendererGroup : Ctk.Box + public class DefaultRendererGroup : ExpandingBin { - static const float PADDING = 0.0f; + static const float PADDING = 24.0f; static const int SPACING = 0; public uint group_id { get; construct; } @@ -30,12 +30,17 @@ namespace Unity.Places public string icon_hint { get; construct; } public Dee.Model results { get; construct; } + private Ctk.VBox vbox; private Ctk.HBox title_box; private Ctk.Image icon; private Ctk.Text text; private Ctk.Image expander; private Ctk.IconView renderer; + /* Some caching to speed up lookups */ + private uint n_results = 0; + private bool dirty = false; + public DefaultRendererGroup (uint group_id, string group_renderer, string display_name, @@ -51,17 +56,22 @@ namespace Unity.Places construct { - padding = { PADDING, PADDING, PADDING , PADDING}; - orientation = Ctk.Orientation.VERTICAL; - spacing = SPACING; - homogeneous = false; + padding = { 0.0f, 0.0f, PADDING , 0.0f}; hide (); - title_box = new Ctk.HBox (8); - pack (title_box, false, false); + vbox = new Ctk.VBox (SPACING); + vbox.spacing = SPACING; + vbox.homogeneous = false; + add_actor (vbox); + vbox.show (); + + title_box = new Ctk.HBox (5); + vbox.pack (title_box, false, false); title_box.show (); + title_box.reactive = true; - icon = new Ctk.Image (24); + icon = new Ctk.Image (22); + icon.set_from_filename (PKGDATADIR + "/favourites.png"); title_box.pack (icon, false, false); icon.show (); @@ -69,20 +79,53 @@ namespace Unity.Places title_box.pack (text, true, true); text.show (); - expander = new Ctk.Image (24); + expander = new Ctk.Image (22); + expander.set_from_filename (PKGDATADIR + "/maximize_up.png"); + expander.opacity = 0; title_box.pack (expander, false, true); expander.show (); - var sep = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 }); - sep.set_height (1); - pack (sep, false, false); - sep.show (); + var rect = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 }); + rect.height = 1; + vbox.pack (rect, false, false); + rect.show (); + + title_box.button_release_event.connect (() => { + if (n_results <= renderer.get_n_cols ()) + return true; + + if (bin_state == ExpandingBinState.UNEXPANDED) + { + bin_state = ExpandingBinState.EXPANDED; + expander.set_from_filename (PKGDATADIR + "/minimize_up.png"); + } + else + { + bin_state = ExpandingBinState.UNEXPANDED; + expander.set_from_filename (PKGDATADIR + "/maximize_up.png"); + } + return true; + }); + title_box.motion_event.connect (() => { + if (dirty) + { + var children = renderer.get_children (); + foreach (Clutter.Actor child in children) + { + Tile tile = child as Tile; + tile.about_to_show (); + } + dirty = false; + } + }); renderer = new Ctk.IconView (); renderer.padding = { 12.0f, 0.0f, 0.0f, 0.0f }; renderer.spacing = 24; - pack (renderer, true, true); + vbox.pack (renderer, true, true); renderer.show (); + renderer.set ("auto-fade-children", true); + renderer.notify["n-cols"].connect (on_n_cols_changed); unowned Dee.ModelIter iter = results.get_first_iter (); while (!results.is_last (iter)) @@ -97,21 +140,22 @@ namespace Unity.Places results.row_removed.connect (on_result_removed); } - private override void get_preferred_height (float for_width, - out float min_height, - out float nat_height) + private override void allocate (Clutter.ActorBox box, + Clutter.AllocationFlags flags) { + base.allocate (box, flags); + + /* Update the unexpanded height if necessary */ + /* FIXME: Can we please add some nice methods to CluTK which allow + * doing something like $clutk_container.get_nth_child (), and so + * bypass the stupid get_children stuff. In any case, cache the result + */ var children = renderer.get_children (); - if (children.length () > 0) - { - base.get_preferred_height (for_width, out min_height, out nat_height); - show (); - } - else + var child = children.nth_data (0) as Clutter.Actor; + if (child is Clutter.Actor && + child.height != unexpanded_height) { - min_height = 0; - nat_height = 0; - hide (); + unexpanded_height = title_box.height + 1.0f + child.height; } } @@ -132,7 +176,15 @@ namespace Unity.Places renderer.add_actor (button); button.show (); - show (); + add_to_n_results (1); + + if (bin_state == ExpandingBinState.CLOSED) + { + bin_state = ExpandingBinState.UNEXPANDED; + show (); + } + + dirty = true; } private void on_result_removed (Dee.ModelIter iter) @@ -148,18 +200,62 @@ namespace Unity.Places if (tile.iter == iter) { actor.destroy (); + add_to_n_results (-1); break; } } - if (children.length () <= 1) - hide (); + if (n_results < 1) + { + bin_state = ExpandingBinState.CLOSED; + } } private bool interesting (Dee.ModelIter iter) { return (results.get_uint (iter, 2) == group_id); } + + private void add_to_n_results (int i) + { + n_results += i; + + if (n_results > renderer.get_n_cols ()) + { + expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, + "opacity", 255); + } + else + { + expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, + "opacity", 0); + } + } + + private void on_n_cols_changed () + { + var n_cols = renderer.get_n_cols (); + + if (bin_state == ExpandingBinState.UNEXPANDED) + { + var children = renderer.get_children (); + int i = 0; + + foreach (Clutter.Actor child in children) + { + Tile tile = child as Tile; + if (i < n_cols) + { + tile.about_to_show (); + i++; + } + else + break; + } + } + + add_to_n_results (0); + } } public class Tile : Ctk.Button @@ -175,6 +271,8 @@ namespace Unity.Places public string? mimetype { get; construct; } public string? comment { get; construct; } + private bool shown = false; + public Tile (Dee.ModelIter iter, string uri, string? icon_hint, @@ -193,11 +291,17 @@ namespace Unity.Places construct { - set_label (display_name); - unowned Ctk.Text text = get_text (); text.ellipsize = Pango.EllipsizeMode.END; + } + public void about_to_show () + { + if (shown) + return; + shown = true; + + set_label (display_name); set_icon (); } @@ -216,7 +320,7 @@ namespace Unity.Places private async void clicked_handler () { - debug (@"Launching $uri"); + global_shell.hide_unity (); if (uri.has_prefix ("application://")) { @@ -226,7 +330,6 @@ namespace Unity.Places try { var appinfos = AppInfoManager.get_instance (); info = yield appinfos.lookup_async (id); - debug ("Foo: %s", info.get_name()); } catch (Error ee) { warning ("Unable to read .desktop file '%s': %s", uri, ee.message); return; @@ -236,7 +339,6 @@ namespace Unity.Places { try { info.launch (null,null); - debug ("Launched"); } catch (Error e) { warning ("Unable to launch desktop file %s: %s\n", id, diff --git a/unity-private/places/places-default-renderer.c b/unity-private/places/places-default-renderer.c index f960fbfa6..7543e628b 100644 --- a/unity-private/places/places-default-renderer.c +++ b/unity-private/places/places-default-renderer.c @@ -81,7 +81,7 @@ enum { UNITY_PLACES_DEFAULT_RENDERER_DUMMY_PROPERTY }; #define UNITY_PLACES_DEFAULT_RENDERER_PADDING 12.0f -#define UNITY_PLACES_DEFAULT_RENDERER_SPACING 12 +#define UNITY_PLACES_DEFAULT_RENDERER_SPACING 0 UnityPlacesDefaultRenderer* unity_places_default_renderer_new (void); UnityPlacesDefaultRenderer* unity_places_default_renderer_construct (GType object_type); static void unity_places_default_renderer_on_group_added (UnityPlacesDefaultRenderer* self, DeeModel* model, DeeModelIter* iter); diff --git a/unity-private/places/places-default-renderer.vala b/unity-private/places/places-default-renderer.vala index 371de7318..3e78fa62e 100644 --- a/unity-private/places/places-default-renderer.vala +++ b/unity-private/places/places-default-renderer.vala @@ -22,7 +22,7 @@ namespace Unity.Places public class DefaultRenderer : Ctk.ScrollView, Unity.Place.Renderer { static const float PADDING = 12.0f; - static const int SPACING = 12; + static const int SPACING = 0; private Ctk.VBox box; private Dee.Model groups_model; diff --git a/unity-private/places/places-place-bar.c b/unity-private/places/places-place-bar.c index 7d9d7acb2..50d64d6da 100644 --- a/unity-private/places/places-place-bar.c +++ b/unity-private/places/places-place-bar.c @@ -628,7 +628,7 @@ static GObject * unity_places_place_bar_background_constructor (GType type, guin e = _inner_error_; _inner_error_ = NULL; { - g_warning ("places-place-bar.vala:153: Unable to load dash background"); + g_warning ("places-place-bar.vala:152: Unable to load dash background"); _g_error_free0 (e); } } diff --git a/unity-private/places/places-place-bar.vala b/unity-private/places/places-place-bar.vala index 9d0ebcf94..83d5729e7 100644 --- a/unity-private/places/places-place-bar.vala +++ b/unity-private/places/places-place-bar.vala @@ -46,7 +46,6 @@ namespace Unity.Places set_background (bg); bg.show (); - /* Enable once clutk bug is fixed */ glow = new Ctk.EffectGlow (); glow.set_color ({ 255, 255, 255, 255 }); glow.set_factor (1.0f); diff --git a/unity-private/places/places-place-model.c b/unity-private/places/places-place-model.c index cbd7907f5..3534a4068 100644 --- a/unity-private/places/places-place-model.c +++ b/unity-private/places/places-place-model.c @@ -136,6 +136,7 @@ const char* unity_places_place_file_model_get_directory (UnityPlacesPlaceFileMod static void _g_list_free_g_object_unref (GList* self); static UnityPlacesPlace* unity_places_place_file_model_load_place (UnityPlacesPlaceFileModel* self, const char* path); void unity_places_place_connect (UnityPlacesPlace* self); +gboolean unity_places_place_get_online (UnityPlacesPlace* self); static void unity_places_place_file_model_load_place_files (UnityPlacesPlaceFileModel* self, GAsyncReadyCallback _callback_, gpointer _user_data_); static void unity_places_place_file_model_load_place_files_finish (UnityPlacesPlaceFileModel* self, GAsyncResult* _res_); static gboolean unity_places_place_file_model_load_place_files_co (UnityPlacesPlaceFileModelLoadPlaceFilesData* data); @@ -305,9 +306,11 @@ static gboolean unity_places_place_file_model_load_place_files_co (UnityPlacesPl data->place = (data->_tmp1_ = unity_places_place_file_model_load_place (data->self, data->_tmp0_ = g_build_filename (data->self->priv->_directory, g_file_info_get_name (data->info), NULL)), _g_free0 (data->_tmp0_), data->_tmp1_); if (UNITY_PLACES_IS_PLACE (data->place)) { unity_places_place_connect (data->place); - g_object_ref ((data->_tmp2_ = data->place, G_IS_OBJECT (data->_tmp2_) ? ((GObject*) data->_tmp2_) : NULL)); - gee_abstract_collection_add ((GeeAbstractCollection*) data->self, data->place); - g_signal_emit_by_name ((UnityPlacesPlaceModel*) data->self, "place-added", data->place); + if (unity_places_place_get_online (data->place) == TRUE) { + g_object_ref ((data->_tmp2_ = data->place, G_IS_OBJECT (data->_tmp2_) ? ((GObject*) data->_tmp2_) : NULL)); + gee_abstract_collection_add ((GeeAbstractCollection*) data->self, data->place); + g_signal_emit_by_name ((UnityPlacesPlaceModel*) data->self, "place-added", data->place); + } } _g_object_unref0 (data->info); _g_object_unref0 (data->place); diff --git a/unity-private/places/places-place-model.vala b/unity-private/places/places-place-model.vala index 411bcd1b8..8bf080fef 100644 --- a/unity-private/places/places-place-model.vala +++ b/unity-private/places/places-place-model.vala @@ -95,9 +95,12 @@ namespace Unity.Places if (place is Place) { place.connect (); - (place as GLib.Object).ref (); - add (place); - place_added (place); + if (place.online == true) + { + (place as GLib.Object).ref (); + add (place); + place_added (place); + } } } } diff --git a/unity-private/places/places-place-search-bar.c b/unity-private/places/places-place-search-bar.c index a63813bc5..e11546d35 100644 --- a/unity-private/places/places-place-search-bar.c +++ b/unity-private/places/places-place-search-bar.c @@ -142,6 +142,8 @@ enum { #define UNITY_PLACES_PLACE_SEARCH_BAR_RANDOM_TEXT_WIDTH 400 UnityPlacesPlaceSearchBar* unity_places_place_search_bar_new (void); UnityPlacesPlaceSearchBar* unity_places_place_search_bar_construct (GType object_type); +void unity_places_place_search_entry_reset (UnityPlacesPlaceSearchEntry* self); +void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); gboolean unity_places_place_search_bar_background_update_background (UnityPlacesPlaceSearchBarBackground* self); static gboolean _unity_places_place_search_bar_background_update_background_gsource_func (gpointer self); static void unity_places_place_search_bar_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); @@ -190,6 +192,12 @@ UnityPlacesPlaceSearchBar* unity_places_place_search_bar_new (void) { } +void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self) { + g_return_if_fail (self != NULL); + unity_places_place_search_entry_reset (self->priv->entry); +} + + static gboolean _unity_places_place_search_bar_background_update_background_gsource_func (gpointer self) { gboolean result; result = unity_places_place_search_bar_background_update_background (self); @@ -230,7 +238,6 @@ static void unity_places_place_search_bar_real_get_preferred_height (ClutterActo static void unity_places_place_search_bar_on_search_text_changed (UnityPlacesPlaceSearchBar* self, const char* text) { g_return_if_fail (self != NULL); - g_return_if_fail (text != NULL); if (UNITY_PLACES_IS_PLACE_ENTRY (self->priv->active_entry)) { GHashTable* hints; hints = g_hash_table_new (g_str_hash, g_str_equal); @@ -508,7 +515,7 @@ static GObject * unity_places_place_search_bar_background_constructor (GType typ e = _inner_error_; _inner_error_ = NULL; { - g_warning ("places-place-search-bar.vala:163: Unable to load dash background"); + g_warning ("places-place-search-bar.vala:168: Unable to load dash background"); _g_error_free0 (e); } } diff --git a/unity-private/places/places-place-search-bar.vala b/unity-private/places/places-place-search-bar.vala index ef9bafb07..d84634505 100644 --- a/unity-private/places/places-place-search-bar.vala +++ b/unity-private/places/places-place-search-bar.vala @@ -62,6 +62,11 @@ namespace Unity.Places bg.show (); } + public void reset () + { + entry.reset (); + } + private override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags) { @@ -94,7 +99,7 @@ namespace Unity.Places nat_height = nheight + SPACING * 3; } - private void on_search_text_changed (string text) + private void on_search_text_changed (string? text) { if (active_entry is PlaceEntry) { diff --git a/unity-private/places/places-place-search-entry.c b/unity-private/places/places-place-search-entry.c index c1b750d8a..de3716ee8 100644 --- a/unity-private/places/places-place-search-entry.c +++ b/unity-private/places/places-place-search-entry.c @@ -26,6 +26,7 @@ #include <unity.h> #include <stdlib.h> #include <string.h> +#include <glib/gi18n-lib.h> #include <float.h> #include <math.h> #include <clutter/clutter.h> @@ -71,7 +72,7 @@ enum { }; #define UNITY_PLACES_PLACE_SEARCH_ENTRY_SEARCH_ICON_FILE PKGDATADIR "/search_icon.png" #define UNITY_PLACES_PLACE_SEARCH_ENTRY_PADDING 1.0f -#define UNITY_PLACES_PLACE_SEARCH_ENTRY_LIVE_SEARCH_TIMEOUT 300 +#define UNITY_PLACES_PLACE_SEARCH_ENTRY_LIVE_SEARCH_TIMEOUT 200 UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_new (void); UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_construct (GType object_type); static void unity_places_place_search_entry_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height); @@ -80,6 +81,7 @@ static gboolean __lambda7__gsource_func (gpointer self); static void unity_places_place_search_entry_on_text_changed (UnityPlacesPlaceSearchEntry* self); static void unity_places_place_search_entry_on_key_focus_in (UnityPlacesPlaceSearchEntry* self); static void unity_places_place_search_entry_on_key_focus_out (UnityPlacesPlaceSearchEntry* self); +void unity_places_place_search_entry_reset (UnityPlacesPlaceSearchEntry* self); static void _unity_places_place_search_entry_on_text_changed_clutter_text_text_changed (ClutterText* _sender, gpointer self); static void _unity_places_place_search_entry_on_key_focus_in_clutter_actor_key_focus_in (ClutterActor* _sender, gpointer self); static void _unity_places_place_search_entry_on_key_focus_out_clutter_actor_key_focus_out (ClutterActor* _sender, gpointer self); @@ -123,7 +125,14 @@ static void unity_places_place_search_entry_real_get_preferred_height (ClutterAc static gboolean _lambda7_ (UnityPlacesPlaceSearchEntry* self) { gboolean result = FALSE; - g_signal_emit_by_name (self, "text-changed", clutter_text_get_text ((ClutterText*) self->text)); + const char* _tmp0_; + _tmp0_ = NULL; + if (_vala_strcmp0 (clutter_text_get_text ((ClutterText*) self->text), self->priv->_static_text) == 0) { + _tmp0_ = ""; + } else { + _tmp0_ = clutter_text_get_text ((ClutterText*) self->text); + } + g_signal_emit_by_name (self, "text-changed", _tmp0_); self->priv->live_search_timeout = (guint) 0; result = FALSE; return result; @@ -147,14 +156,13 @@ static void unity_places_place_search_entry_on_text_changed (UnityPlacesPlaceSea static void unity_places_place_search_entry_on_key_focus_in (UnityPlacesPlaceSearchEntry* self) { + ClutterColor _tmp0_; g_return_if_fail (self != NULL); if (_vala_strcmp0 (clutter_text_get_text ((ClutterText*) self->text), self->priv->_static_text) == 0) { - ClutterColor _tmp0_; clutter_text_set_text ((ClutterText*) self->text, ""); - clutter_text_set_cursor_visible ((ClutterText*) self->text, TRUE); - clutter_text_set_selection ((ClutterText*) self->text, (gssize) 0, (gssize) (-1)); - clutter_text_set_color ((ClutterText*) self->text, (_tmp0_ = UNITY_PLACES_PLACE_SEARCH_ENTRY_focus_color, &_tmp0_)); } + clutter_text_set_cursor_visible ((ClutterText*) self->text, TRUE); + clutter_text_set_color ((ClutterText*) self->text, (_tmp0_ = UNITY_PLACES_PLACE_SEARCH_ENTRY_focus_color, &_tmp0_)); } @@ -162,11 +170,19 @@ static void unity_places_place_search_entry_on_key_focus_out (UnityPlacesPlaceSe ClutterColor _tmp0_; g_return_if_fail (self != NULL); clutter_text_set_cursor_visible ((ClutterText*) self->text, FALSE); - clutter_text_set_text ((ClutterText*) self->text, self->priv->_static_text); clutter_text_set_color ((ClutterText*) self->text, (_tmp0_ = UNITY_PLACES_PLACE_SEARCH_ENTRY_nofocus_color, &_tmp0_)); } +void unity_places_place_search_entry_reset (UnityPlacesPlaceSearchEntry* self) { + ClutterColor _tmp0_; + g_return_if_fail (self != NULL); + clutter_text_set_cursor_visible ((ClutterText*) self->text, FALSE); + clutter_text_set_color ((ClutterText*) self->text, (_tmp0_ = UNITY_PLACES_PLACE_SEARCH_ENTRY_nofocus_color, &_tmp0_)); + clutter_text_set_text ((ClutterText*) self->text, self->priv->_static_text); +} + + static void _unity_places_place_search_entry_on_text_changed_clutter_text_text_changed (ClutterText* _sender, gpointer self) { unity_places_place_search_entry_on_text_changed (self); } @@ -234,7 +250,7 @@ static void unity_places_place_search_entry_class_init (UnityPlacesPlaceSearchEn static void unity_places_place_search_entry_instance_init (UnityPlacesPlaceSearchEntry * self) { self->priv = UNITY_PLACES_PLACE_SEARCH_ENTRY_GET_PRIVATE (self); self->priv->live_search_timeout = (guint) 0; - self->priv->_static_text = g_strdup ("Search"); + self->priv->_static_text = g_strdup (_ ("Search")); } diff --git a/unity-private/places/places-place-search-entry.vala b/unity-private/places/places-place-search-entry.vala index 9b43f61d6..68170936c 100644 --- a/unity-private/places/places-place-search-entry.vala +++ b/unity-private/places/places-place-search-entry.vala @@ -23,7 +23,7 @@ namespace Unity.Places { static const string SEARCH_ICON_FILE = PKGDATADIR + "/search_icon.png"; static const float PADDING = 1.0f; - static const int LIVE_SEARCH_TIMEOUT = 300; /* Milliseconds */ + static const int LIVE_SEARCH_TIMEOUT = 200; /* Milliseconds */ const Clutter.Color nofocus_color = { 0xff, 0xff, 0xff, 0xbb }; const Clutter.Color focus_color = { 0xff, 0xff, 0xff, 0xff }; @@ -32,9 +32,9 @@ namespace Unity.Places public ThemeImage right_icon; private uint live_search_timeout = 0; - private string _static_text = "Search"; + private string _static_text = _("Search"); - public signal void text_changed (string text); + public signal void text_changed (string? text); public PlaceSearchEntry () { @@ -89,7 +89,7 @@ namespace Unity.Places Source.remove (live_search_timeout); live_search_timeout = Timeout.add (LIVE_SEARCH_TIMEOUT, () => { - text_changed (text.text); + text_changed (text.text == _static_text ? "" : text.text); live_search_timeout = 0; return false; @@ -99,21 +99,24 @@ namespace Unity.Places private void on_key_focus_in () { if (text.text == _static_text) - { text.set_text (""); - text.cursor_visible = true; - text.set_selection (0, -1); - text.color = focus_color; - } + + text.cursor_visible = true; + text.color = focus_color; } private void on_key_focus_out () { text.cursor_visible = false; - text.text = _static_text; text.color = nofocus_color; + } + public void reset () + { + text.cursor_visible = false; + text.color = nofocus_color; + text.text = _static_text; } } } diff --git a/unity-private/places/places-view.c b/unity-private/places/places-view.c index 796c64541..7a3de8784 100644 --- a/unity-private/places/places-view.c +++ b/unity-private/places/places-view.c @@ -166,6 +166,7 @@ enum { UnityPlacesView* unity_places_view_new (UnityShell* shell); UnityPlacesView* unity_places_view_construct (GType object_type, UnityShell* shell); GType unity_places_place_file_model_get_type (void); +void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); UnityPlacesPlaceFileModel* unity_places_place_file_model_new (void); UnityPlacesPlaceFileModel* unity_places_place_file_model_construct (GType object_type); UnityShell* unity_places_view_get_shell (UnityPlacesView* self); @@ -224,6 +225,7 @@ void unity_places_view_about_to_show (UnityPlacesView* self) { UnityPlacesPlaceSearchBar* _tmp6_; g_return_if_fail (self != NULL); if (UNITY_PLACES_IS_PLACE_FILE_MODEL (self->priv->_model)) { + unity_places_place_search_bar_reset (self->priv->search_bar); return; } self->priv->_model = (_tmp1_ = (_tmp0_ = unity_places_place_file_model_new (), UNITY_PLACES_IS_PLACE_MODEL (_tmp0_) ? ((UnityPlacesPlaceModel*) _tmp0_) : NULL), _g_object_unref0 (self->priv->_model), _tmp1_); diff --git a/unity-private/places/places-view.vala b/unity-private/places/places-view.vala index 1e883a292..261472447 100644 --- a/unity-private/places/places-view.vala +++ b/unity-private/places/places-view.vala @@ -52,7 +52,10 @@ namespace Unity.Places public void about_to_show () { if (_model is PlaceFileModel) - return; + { + search_bar.reset (); + return; + } _model = new PlaceFileModel () as PlaceModel; diff --git a/unity-private/testing/test-director.c b/unity-private/testing/test-director.c index ba6c822a8..dc3b6aec7 100644 --- a/unity-private/testing/test-director.c +++ b/unity-private/testing/test-director.c @@ -68,8 +68,8 @@ UnityTestingDirector* unity_testing_director_new (ClutterStage* stage); UnityTestingDirector* unity_testing_director_construct (GType object_type, ClutterStage* stage); static void unity_testing_director_do_event (UnityTestingDirector* self, ClutterActor* actor, ClutterEvent* event, gboolean capture_phase); void unity_testing_director_do_wait_for_animation (UnityTestingDirector* self, ClutterActor* actor); -static gboolean _lambda18_ (UnityTestingDirector* self); -static gboolean __lambda18__gsource_func (gpointer self); +static gboolean _lambda20_ (UnityTestingDirector* self); +static gboolean __lambda20__gsource_func (gpointer self); void unity_testing_director_do_wait_for_timeout (UnityTestingDirector* self, guint32 msecs); void unity_testing_director_button_press (UnityTestingDirector* self, ClutterActor* actor, guint32 button, gboolean autorelease, float relative_x, float relative_y, gboolean wait_for_animation); void unity_testing_director_button_release (UnityTestingDirector* self, ClutterActor* actor, guint32 button, float relative_x, float relative_y); @@ -137,7 +137,7 @@ void unity_testing_director_do_wait_for_animation (UnityTestingDirector* self, C } -static gboolean _lambda18_ (UnityTestingDirector* self) { +static gboolean _lambda20_ (UnityTestingDirector* self) { gboolean result = FALSE; self->priv->break_loop = TRUE; result = FALSE; @@ -145,9 +145,9 @@ static gboolean _lambda18_ (UnityTestingDirector* self) { } -static gboolean __lambda18__gsource_func (gpointer self) { +static gboolean __lambda20__gsource_func (gpointer self) { gboolean result; - result = _lambda18_ (self); + result = _lambda20_ (self); return result; } @@ -155,7 +155,7 @@ static gboolean __lambda18__gsource_func (gpointer self) { void unity_testing_director_do_wait_for_timeout (UnityTestingDirector* self, guint32 msecs) { g_return_if_fail (self != NULL); self->priv->break_loop = FALSE; - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda18__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda20__gsource_func, g_object_ref (self), g_object_unref); while (TRUE) { if (!(self->priv->break_loop != TRUE)) { break; diff --git a/unity-private/testing/test-window.c b/unity-private/testing/test-window.c index ec39dc7f9..8fe2bbe94 100644 --- a/unity-private/testing/test-window.c +++ b/unity-private/testing/test-window.c @@ -186,6 +186,7 @@ enum { }; UnityTestingWindow* unity_testing_window_new (gboolean popup, gint width, gint height); UnityTestingWindow* unity_testing_window_construct (GType object_type, gboolean popup, gint width, gint height); +static guint32 unity_testing_window_real_get_current_time (UnityShell* base); void unity_testing_window_init_test_mode (UnityTestingWindow* self); gboolean unity_testing_window_get_is_popup (UnityTestingWindow* self); gint unity_testing_window_get_popup_width (UnityTestingWindow* self); @@ -203,6 +204,7 @@ static ClutterStage* unity_testing_window_real_get_stage (UnityShell* base); static UnityShellMode unity_testing_window_real_get_mode (UnityShell* base); void unity_panel_view_set_indicator_mode (UnityPanelView* self, gboolean mode); static void unity_testing_window_real_show_unity (UnityShell* base); +static void unity_testing_window_real_hide_unity (UnityShell* base); void unity_places_view_about_to_show (UnityPlacesView* self); static void unity_testing_window_real_about_to_show_places (UnityShell* base); gint unity_panel_view_get_indicators_width (UnityPanelView* self); @@ -224,14 +226,14 @@ static void unity_testing_window_set_popup_height (UnityTestingWindow* self, gin UnityTestingWorkarea* unity_testing_workarea_new (void); UnityTestingWorkarea* unity_testing_workarea_construct (GType object_type); void unity_testing_workarea_update_net_workarea (UnityTestingWorkarea* self); -static gboolean _lambda19_ (UnityTestingWindow* self); -static gboolean __lambda19__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static gboolean _lambda20_ (UnityTestingWindow* self); -static gboolean __lambda20__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _lambda21_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda21__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); -static void _lambda22_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda22__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); +static gboolean _lambda21_ (UnityTestingWindow* self); +static gboolean __lambda21__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); +static gboolean _lambda22_ (UnityTestingWindow* self); +static gboolean __lambda22__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); +static void _lambda23_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda23__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static void _lambda24_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda24__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); static gboolean _unity_testing_window_on_stage_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); UnityTestingBackground* unity_testing_background_new (void); UnityTestingBackground* unity_testing_background_construct (GType object_type); @@ -267,6 +269,15 @@ UnityTestingWindow* unity_testing_window_new (gboolean popup, gint width, gint h } +static guint32 unity_testing_window_real_get_current_time (UnityShell* base) { + UnityTestingWindow * self; + guint32 result = 0U; + self = (UnityTestingWindow*) base; + result = clutter_get_current_event_time (); + return result; +} + + void unity_testing_window_init_test_mode (UnityTestingWindow* self) { ClutterColor _tmp0_ = {0}; ClutterColor _tmp1_; @@ -421,16 +432,30 @@ static void unity_testing_window_real_show_unity (UnityShell* base) { if (self->priv->showing_places) { self->priv->showing_places = FALSE; unity_panel_view_set_indicator_mode (self->priv->panel, TRUE); + clutter_actor_set_opacity ((ClutterActor*) self->priv->background, (guint8) 160); clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 255); } else { self->priv->showing_places = TRUE; unity_panel_view_set_indicator_mode (self->priv->panel, FALSE); + clutter_actor_set_opacity ((ClutterActor*) self->priv->background, (guint8) 255); clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 0); } clutter_actor_queue_redraw ((ClutterActor*) self->priv->places); } +static void unity_testing_window_real_hide_unity (UnityShell* base) { + UnityTestingWindow * self; + self = (UnityTestingWindow*) base; + if (self->priv->showing_places == FALSE) { + self->priv->showing_places = TRUE; + unity_panel_view_set_indicator_mode (self->priv->panel, FALSE); + clutter_actor_set_opacity ((ClutterActor*) self->priv->background, (guint8) 255); + clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 0); + } +} + + static void unity_testing_window_real_about_to_show_places (UnityShell* base) { UnityTestingWindow * self; self = (UnityTestingWindow*) base; @@ -601,7 +626,7 @@ static void unity_testing_window_set_popup_height (UnityTestingWindow* self, gin } -static gboolean _lambda19_ (UnityTestingWindow* self) { +static gboolean _lambda21_ (UnityTestingWindow* self) { gboolean result = FALSE; gtk_main_quit (); result = FALSE; @@ -609,46 +634,46 @@ static gboolean _lambda19_ (UnityTestingWindow* self) { } -static gboolean __lambda19__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda21__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda19_ (self); + result = _lambda21_ (self); return result; } -static gboolean _lambda20_ (UnityTestingWindow* self) { +static gboolean _lambda22_ (UnityTestingWindow* self) { gboolean result = FALSE; result = TRUE; return result; } -static gboolean __lambda20__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda22__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda20_ (self); + result = _lambda22_ (self); return result; } -static void _lambda21_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda23_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda21__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { - _lambda21_ (_sender, self); +static void __lambda23__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { + _lambda23_ (_sender, self); } -static void _lambda22_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda24_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda22__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { - _lambda22_ (_sender, self); +static void __lambda24__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { + _lambda24_ (_sender, self); } @@ -706,7 +731,7 @@ static GObject * unity_testing_window_constructor (GType type, guint n_construct gtk_window_set_decorated ((GtkWindow*) self, TRUE); gtk_window_set_skip_taskbar_hint ((GtkWindow*) self, FALSE); gtk_window_set_skip_pager_hint ((GtkWindow*) self, FALSE); - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda19__gtk_widget_delete_event, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda21__gtk_widget_delete_event, self, 0); } else { gtk_window_set_type_hint ((GtkWindow*) self, GDK_WINDOW_TYPE_HINT_DESKTOP); gtk_window_set_keep_below ((GtkWindow*) self, TRUE); @@ -715,9 +740,9 @@ static GObject * unity_testing_window_constructor (GType type, guint n_construct gtk_window_set_skip_pager_hint ((GtkWindow*) self, TRUE); gtk_window_set_accept_focus ((GtkWindow*) self, FALSE); g_object_set ((GtkWidget*) self, "can-focus", FALSE, NULL); - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda20__gtk_widget_delete_event, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda21__gdk_screen_size_changed, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda22__gdk_screen_monitors_changed, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda22__gtk_widget_delete_event, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda23__gdk_screen_size_changed, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda24__gdk_screen_monitors_changed, self, 0); } gtk_window_set_title ((GtkWindow*) self, "Unity"); gtk_window_set_icon_name ((GtkWindow*) self, "distributor-logo"); @@ -784,10 +809,12 @@ static void unity_testing_window_class_init (UnityTestingWindowClass * klass) { static void unity_testing_window_unity_shell_interface_init (UnityShellIface * iface) { unity_testing_window_unity_shell_parent_iface = g_type_interface_peek_parent (iface); + iface->get_current_time = unity_testing_window_real_get_current_time; iface->grab_keyboard = unity_testing_window_real_grab_keyboard; iface->get_stage = unity_testing_window_real_get_stage; iface->get_mode = unity_testing_window_real_get_mode; iface->show_unity = unity_testing_window_real_show_unity; + iface->hide_unity = unity_testing_window_real_hide_unity; iface->about_to_show_places = unity_testing_window_real_about_to_show_places; iface->get_indicators_width = unity_testing_window_real_get_indicators_width; iface->get_launcher_width_foobar = unity_testing_window_real_get_launcher_width_foobar; diff --git a/unity-private/testing/test-window.vala b/unity-private/testing/test-window.vala index ce8ab87ff..23b1eca84 100644 --- a/unity-private/testing/test-window.vala +++ b/unity-private/testing/test-window.vala @@ -156,6 +156,11 @@ namespace Unity.Testing END_FUNCTION (); } + + public uint32 get_current_time () + { + return Clutter.get_current_event_time (); + } public void init_test_mode () { @@ -300,18 +305,31 @@ namespace Unity.Testing { this.showing_places = false; this.panel.set_indicator_mode (true); + this.background.opacity = 160; this.places.opacity = 255; } else { this.showing_places = true; this.panel.set_indicator_mode (false); + this.background.opacity = 255; this.places.opacity = 0; } this.places.do_queue_redraw (); } + public void hide_unity () + { + if (showing_places == false) + { + showing_places = true; + panel.set_indicator_mode (false); + background.opacity = 255; + places.opacity = 0; + } + } + public void about_to_show_places () { places.about_to_show (); diff --git a/unity-private/unity-private.h b/unity-private/unity-private.h index b67f56d46..00d7365d3 100644 --- a/unity-private/unity-private.h +++ b/unity-private/unity-private.h @@ -764,12 +764,12 @@ struct _UnityPlacesControllerClass { }; struct _UnityPlacesDefaultRendererGroup { - CtkBox parent_instance; + UnityExpandingBin parent_instance; UnityPlacesDefaultRendererGroupPrivate * priv; }; struct _UnityPlacesDefaultRendererGroupClass { - CtkBoxClass parent_class; + UnityExpandingBinClass parent_class; }; struct _UnityPlacesTile { @@ -1292,6 +1292,7 @@ DeeModel* unity_places_default_renderer_group_get_results (UnityPlacesDefaultRen GType unity_places_tile_get_type (void); UnityPlacesTile* unity_places_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesTile* unity_places_tile_construct (GType object_type, DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); +void unity_places_tile_about_to_show (UnityPlacesTile* self); DeeModelIter* unity_places_tile_get_iter (UnityPlacesTile* self); const char* unity_places_tile_get_display_name (UnityPlacesTile* self); const char* unity_places_tile_get_icon_hint (UnityPlacesTile* self); @@ -1397,6 +1398,7 @@ void unity_places_place_set_online (UnityPlacesPlace* self, gboolean value); GType unity_places_place_search_bar_get_type (void); UnityPlacesPlaceSearchBar* unity_places_place_search_bar_new (void); UnityPlacesPlaceSearchBar* unity_places_place_search_bar_construct (GType object_type); +void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x); GType unity_places_place_search_bar_background_get_type (void); #define UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_BG "/usr/share/unity/dash_background.png" @@ -1409,6 +1411,7 @@ void unity_places_place_search_bar_background_set_entry_position (UnityPlacesPla UnityPlacesPlaceSearchEntry* unity_places_place_search_bar_background_get_search_entry (UnityPlacesPlaceSearchBarBackground* self); UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_new (void); UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_construct (GType object_type); +void unity_places_place_search_entry_reset (UnityPlacesPlaceSearchEntry* self); GType unity_places_place_search_sections_bar_get_type (void); UnityPlacesPlaceSearchSectionsBar* unity_places_place_search_sections_bar_new (void); UnityPlacesPlaceSearchSectionsBar* unity_places_place_search_sections_bar_construct (GType object_type); diff --git a/unity-private/unity-private.vapi b/unity-private/unity-private.vapi index d888e939c..915ab5b23 100644 --- a/unity-private/unity-private.vapi +++ b/unity-private/unity-private.vapi @@ -6,7 +6,7 @@ namespace Unity { namespace Launcher { [CCode (cheader_filename = "unity-private.h")] public class ApplicationController : Unity.Launcher.ScrollerChildController { - public ApplicationController (string desktop_file_, Unity.Launcher.ScrollerChild child_); + public ApplicationController (string? desktop_file_, Unity.Launcher.ScrollerChild child_); public override void activate (); public void attach_application (Bamf.Application application); public void close_windows (); @@ -17,7 +17,7 @@ namespace Unity { public float get_priority () throws Unity.Launcher.AppTypeError; public void set_priority (float priority); public void set_sticky (bool is_sticky = true); - public string desktop_file { get; construct; } + public string desktop_file { get; set; } } [CCode (cheader_filename = "unity-private.h")] public class ApplicationShortcut : GLib.Object, Unity.Launcher.ShortcutItem { @@ -266,7 +266,7 @@ namespace Unity { public DefaultRenderer (); } [CCode (cheader_filename = "unity-private.h")] - public class DefaultRendererGroup : Ctk.Box { + public class DefaultRendererGroup : Unity.ExpandingBin { public DefaultRendererGroup (uint group_id, string group_renderer, string display_name, string icon_hint, Dee.Model results); public string display_name { get; construct; } public uint group_id { get; construct; } @@ -368,6 +368,7 @@ namespace Unity { [CCode (cheader_filename = "unity-private.h")] public class PlaceSearchBar : Ctk.Box { public PlaceSearchBar (); + public void reset (); public void set_active_entry_view (Unity.Places.PlaceEntry entry, int x); } [CCode (cheader_filename = "unity-private.h")] @@ -384,7 +385,8 @@ namespace Unity { public Unity.ThemeImage right_icon; public Ctk.Text text; public PlaceSearchEntry (); - public signal void text_changed (string text); + public void reset (); + public signal void text_changed (string? text); } [CCode (cheader_filename = "unity-private.h")] public class PlaceSearchSectionsBar : Ctk.Box { @@ -400,6 +402,7 @@ namespace Unity { [CCode (cheader_filename = "unity-private.h")] public class Tile : Ctk.Button { public Tile (Dee.ModelIter iter, string uri, string? icon_hint, string? mimetype, string display_name, string? comment); + public void about_to_show (); public string? comment { get; construct; } public string display_name { get; construct; } public string? icon_hint { get; construct; } diff --git a/unity-private/utils.vala b/unity-private/utils.vala index a349b68d3..b9c770d35 100644 --- a/unity-private/utils.vala +++ b/unity-private/utils.vala @@ -21,12 +21,12 @@ namespace Utils { [CCode (lower_case_prefix = "utils_")] public extern void set_strut (Gtk.Window *window, - uint32 strut_size, - uint32 strut_start, - uint32 strut_end, - uint32 top_size, - uint32 top_start, - uint32 top_end); + uint32 strut_size, + uint32 strut_start, + uint32 strut_end, + uint32 top_size, + uint32 top_start, + uint32 top_end); [CCode (lower_case_prefix = "utils_")] public extern void register_object_on_dbus (DBus.Connection conn, diff --git a/unity/Makefile.am b/unity/Makefile.am index 8bca92fe3..a9fd5810b 100644 --- a/unity/Makefile.am +++ b/unity/Makefile.am @@ -70,6 +70,7 @@ libunity_la_VALASOURCES = \ theme.vala \ unity-appinfo-manager.vala \ unity-cairo-canvas.vala \ + unity-expanding-bin.vala \ unity-favorites.vala \ unity-io.vala \ unity-pixbuf-cache.vala \ diff --git a/unity/Makefile.in b/unity/Makefile.in index 760ea25b5..8d0d90966 100644 --- a/unity/Makefile.in +++ b/unity/Makefile.in @@ -88,6 +88,7 @@ am__objects_1 = libunity_la-chrome-handler.lo \ libunity_la-quicklist-rendering.lo libunity_la-shell.lo \ libunity_la-theme.lo libunity_la-unity-appinfo-manager.lo \ libunity_la-unity-cairo-canvas.lo \ + libunity_la-unity-expanding-bin.lo \ libunity_la-unity-favorites.lo libunity_la-unity-io.lo \ libunity_la-unity-pixbuf-cache.lo \ libunity_la-unity-place-renderer.lo libunity_la-unity-place.lo \ @@ -354,6 +355,7 @@ libunity_la_VALASOURCES = \ theme.vala \ unity-appinfo-manager.vala \ unity-cairo-canvas.vala \ + unity-expanding-bin.vala \ unity-favorites.vala \ unity-io.vala \ unity-pixbuf-cache.vala \ @@ -451,6 +453,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-theme.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-appinfo-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-cairo-canvas.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-expanding-bin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-favorites.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libunity_la-unity-pixbuf-cache.Plo@am__quote@ @@ -570,6 +573,14 @@ libunity_la-unity-cairo-canvas.lo: unity-cairo-canvas.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libunity_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libunity_la-unity-cairo-canvas.lo `test -f 'unity-cairo-canvas.c' || echo '$(srcdir)/'`unity-cairo-canvas.c +libunity_la-unity-expanding-bin.lo: unity-expanding-bin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libunity_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libunity_la-unity-expanding-bin.lo -MD -MP -MF $(DEPDIR)/libunity_la-unity-expanding-bin.Tpo -c -o libunity_la-unity-expanding-bin.lo `test -f 'unity-expanding-bin.c' || echo '$(srcdir)/'`unity-expanding-bin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libunity_la-unity-expanding-bin.Tpo $(DEPDIR)/libunity_la-unity-expanding-bin.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unity-expanding-bin.c' object='libunity_la-unity-expanding-bin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libunity_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libunity_la-unity-expanding-bin.lo `test -f 'unity-expanding-bin.c' || echo '$(srcdir)/'`unity-expanding-bin.c + libunity_la-unity-favorites.lo: unity-favorites.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libunity_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libunity_la-unity-favorites.lo -MD -MP -MF $(DEPDIR)/libunity_la-unity-favorites.Tpo -c -o libunity_la-unity-favorites.lo `test -f 'unity-favorites.c' || echo '$(srcdir)/'`unity-favorites.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libunity_la-unity-favorites.Tpo $(DEPDIR)/libunity_la-unity-favorites.Plo diff --git a/unity/drag-controller.c b/unity/drag-controller.c index 3de484bc0..ca20decb4 100644 --- a/unity/drag-controller.c +++ b/unity/drag-controller.c @@ -97,9 +97,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); diff --git a/unity/entry.c b/unity/entry.c index f4d7b7dd3..b0eda92d2 100644 --- a/unity/entry.c +++ b/unity/entry.c @@ -72,9 +72,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); diff --git a/unity/shell.c b/unity/shell.c index 115d42160..1c066f4db 100644 --- a/unity/shell.c +++ b/unity/shell.c @@ -52,9 +52,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); @@ -77,9 +79,11 @@ UnityShell* unity_global_shell = NULL; GType unity_shell_mode_get_type (void); GType unity_dnd_targets_get_type (void); GType unity_shell_get_type (void); +guint32 unity_shell_get_current_time (UnityShell* self); UnityShellMode unity_shell_get_mode (UnityShell* self); ClutterStage* unity_shell_get_stage (UnityShell* self); void unity_shell_show_unity (UnityShell* self); +void unity_shell_hide_unity (UnityShell* self); gint unity_shell_get_indicators_width (UnityShell* self); gint unity_shell_get_launcher_width_foobar (UnityShell* self); gint unity_shell_get_panel_height_foobar (UnityShell* self); @@ -120,6 +124,11 @@ GType unity_dnd_targets_get_type (void) { } +guint32 unity_shell_get_current_time (UnityShell* self) { + return UNITY_SHELL_GET_INTERFACE (self)->get_current_time (self); +} + + UnityShellMode unity_shell_get_mode (UnityShell* self) { return UNITY_SHELL_GET_INTERFACE (self)->get_mode (self); } @@ -135,6 +144,11 @@ void unity_shell_show_unity (UnityShell* self) { } +void unity_shell_hide_unity (UnityShell* self) { + UNITY_SHELL_GET_INTERFACE (self)->hide_unity (self); +} + + gint unity_shell_get_indicators_width (UnityShell* self) { return UNITY_SHELL_GET_INTERFACE (self)->get_indicators_width (self); } diff --git a/unity/shell.vala b/unity/shell.vala index f8f94aa1f..17e55d370 100644 --- a/unity/shell.vala +++ b/unity/shell.vala @@ -35,9 +35,11 @@ namespace Unity { public abstract bool menus_swallow_events {get;} + public abstract uint32 get_current_time (); public abstract ShellMode get_mode (); public abstract Clutter.Stage get_stage (); public abstract void show_unity (); + public abstract void hide_unity (); public abstract int get_indicators_width (); public abstract int get_launcher_width_foobar (); // _foobar is used to avoid a symbol-clash public abstract int get_panel_height_foobar (); // with unity/targets/mutter/main.c diff --git a/unity/unity-expanding-bin.c b/unity/unity-expanding-bin.c new file mode 100644 index 000000000..57e41d632 --- /dev/null +++ b/unity/unity-expanding-bin.c @@ -0,0 +1,393 @@ +/* unity-expanding-bin.c generated by valac, the Vala compiler + * generated from unity-expanding-bin.vala, do not modify */ + +/* + * Copyright (C) 2010 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> + */ + +#include <glib.h> +#include <glib-object.h> +#include <clutk/clutk.h> +#include <float.h> +#include <math.h> +#include <string.h> +#include <clutter/clutter.h> + + +#define UNITY_TYPE_EXPANDING_BIN_STATE (unity_expanding_bin_state_get_type ()) + +#define UNITY_TYPE_EXPANDING_BIN (unity_expanding_bin_get_type ()) +#define UNITY_EXPANDING_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBin)) +#define UNITY_EXPANDING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBinClass)) +#define UNITY_IS_EXPANDING_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_EXPANDING_BIN)) +#define UNITY_IS_EXPANDING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_EXPANDING_BIN)) +#define UNITY_EXPANDING_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBinClass)) + +typedef struct _UnityExpandingBin UnityExpandingBin; +typedef struct _UnityExpandingBinClass UnityExpandingBinClass; +typedef struct _UnityExpandingBinPrivate UnityExpandingBinPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +typedef enum { + UNITY_EXPANDING_BIN_STATE_CLOSED, + UNITY_EXPANDING_BIN_STATE_UNEXPANDED, + UNITY_EXPANDING_BIN_STATE_EXPANDED +} UnityExpandingBinState; + +struct _UnityExpandingBin { + CtkBin parent_instance; + UnityExpandingBinPrivate * priv; +}; + +struct _UnityExpandingBinClass { + CtkBinClass parent_class; +}; + +struct _UnityExpandingBinPrivate { + float _size_factor; + UnityExpandingBinState _state; + UnityExpandingBinState _old_state; + float _unexpanded_height; + float _expanded_height; + float _target_height; + float last_height; + float last_width; +}; + + +static gpointer unity_expanding_bin_parent_class = NULL; + +GType unity_expanding_bin_state_get_type (void); +GType unity_expanding_bin_get_type (void); +#define UNITY_EXPANDING_BIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBinPrivate)) +enum { + UNITY_EXPANDING_BIN_DUMMY_PROPERTY, + UNITY_EXPANDING_BIN_SIZE_FACTOR, + UNITY_EXPANDING_BIN_BIN_STATE, + UNITY_EXPANDING_BIN_UNEXPANDED_HEIGHT +}; +#define UNITY_EXPANDING_BIN_ANIMATION_TIME 200 +UnityExpandingBin* unity_expanding_bin_new (void); +UnityExpandingBin* unity_expanding_bin_construct (GType object_type); +static void unity_expanding_bin_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); +static void unity_expanding_bin_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height); +static void _lambda1_ (UnityExpandingBin* self); +static void __lambda1__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static void _unity_expanding_bin_change_state (UnityExpandingBin* self, UnityExpandingBinState new_state); +float unity_expanding_bin_get_size_factor (UnityExpandingBin* self); +void unity_expanding_bin_set_size_factor (UnityExpandingBin* self, float value); +UnityExpandingBinState unity_expanding_bin_get_bin_state (UnityExpandingBin* self); +void unity_expanding_bin_set_bin_state (UnityExpandingBin* self, UnityExpandingBinState value); +float unity_expanding_bin_get_unexpanded_height (UnityExpandingBin* self); +void unity_expanding_bin_set_unexpanded_height (UnityExpandingBin* self, float value); +static GObject * unity_expanding_bin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +static void unity_expanding_bin_finalize (GObject* obj); +static void unity_expanding_bin_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void unity_expanding_bin_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + + +GType unity_expanding_bin_state_get_type (void) { + static volatile gsize unity_expanding_bin_state_type_id__volatile = 0; + if (g_once_init_enter (&unity_expanding_bin_state_type_id__volatile)) { + static const GEnumValue values[] = {{UNITY_EXPANDING_BIN_STATE_CLOSED, "UNITY_EXPANDING_BIN_STATE_CLOSED", "closed"}, {UNITY_EXPANDING_BIN_STATE_UNEXPANDED, "UNITY_EXPANDING_BIN_STATE_UNEXPANDED", "unexpanded"}, {UNITY_EXPANDING_BIN_STATE_EXPANDED, "UNITY_EXPANDING_BIN_STATE_EXPANDED", "expanded"}, {0, NULL, NULL}}; + GType unity_expanding_bin_state_type_id; + unity_expanding_bin_state_type_id = g_enum_register_static ("UnityExpandingBinState", values); + g_once_init_leave (&unity_expanding_bin_state_type_id__volatile, unity_expanding_bin_state_type_id); + } + return unity_expanding_bin_state_type_id__volatile; +} + + +UnityExpandingBin* unity_expanding_bin_construct (GType object_type) { + UnityExpandingBin * self; + self = (UnityExpandingBin*) g_object_new (object_type, NULL); + return self; +} + + +UnityExpandingBin* unity_expanding_bin_new (void) { + return unity_expanding_bin_construct (UNITY_TYPE_EXPANDING_BIN); +} + + +static void unity_expanding_bin_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags) { + UnityExpandingBin * self; + CtkPadding _tmp0_ = {0}; + float x; + CtkPadding _tmp1_ = {0}; + float y; + CtkPadding _tmp2_ = {0}; + CtkPadding _tmp3_ = {0}; + float width; + ClutterActorBox child_box = {0}; + self = (UnityExpandingBin*) base; + x = (ctk_actor_get_padding ((CtkActor*) self, &_tmp0_), _tmp0_.left); + y = (ctk_actor_get_padding ((CtkActor*) self, &_tmp1_), _tmp1_.top); + width = (floorf ((*box).x2 - (*box).x1) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp2_), _tmp2_.left)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp3_), _tmp3_.right); + memset (&child_box, 0, sizeof (ClutterActorBox)); + child_box.x1 = x; + child_box.x2 = x + width; + child_box.y1 = y; + child_box.y2 = (y + self->priv->last_height) + ((self->priv->_target_height - self->priv->last_height) * self->priv->_size_factor); + CLUTTER_ACTOR_CLASS (unity_expanding_bin_parent_class)->allocate ((ClutterActor*) CTK_BIN (self), box, flags); + clutter_actor_allocate (ctk_bin_get_child ((CtkBin*) self), &child_box, flags); + self->priv->last_height = child_box.y2 - child_box.y1; + self->priv->last_width = child_box.x2 - child_box.x1; +} + + +static void unity_expanding_bin_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height) { + UnityExpandingBin * self; + CtkPadding _tmp0_ = {0}; + CtkPadding _tmp1_ = {0}; + float vpadding; + self = (UnityExpandingBin*) base; + vpadding = (ctk_actor_get_padding ((CtkActor*) self, &_tmp0_), _tmp0_.top) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp1_), _tmp1_.bottom); + clutter_actor_get_preferred_height (ctk_bin_get_child ((CtkBin*) self), self->priv->last_width, NULL, &self->priv->_expanded_height); + if (self->priv->_state == UNITY_EXPANDING_BIN_STATE_CLOSED) { + self->priv->_target_height = 0.0f; + } else { + if (self->priv->_state == UNITY_EXPANDING_BIN_STATE_UNEXPANDED) { + self->priv->_target_height = self->priv->_unexpanded_height + vpadding; + } else { + self->priv->_target_height = self->priv->_expanded_height + vpadding; + } + } + *min_height = self->priv->last_height + ((self->priv->_target_height - self->priv->last_height) * self->priv->_size_factor); + *nat_height = self->priv->last_height + ((self->priv->_target_height - self->priv->last_height) * self->priv->_size_factor); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void _lambda1_ (UnityExpandingBin* self) { + if (self->priv->_state == UNITY_EXPANDING_BIN_STATE_CLOSED) { + clutter_actor_hide ((ClutterActor*) self); + } +} + + +static void __lambda1__clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { + _lambda1_ (self); +} + + +static void _unity_expanding_bin_change_state (UnityExpandingBin* self, UnityExpandingBinState new_state) { + g_return_if_fail (self != NULL); + if (self->priv->_state == new_state) { + return; + } + self->priv->_old_state = self->priv->_state; + self->priv->_state = new_state; + self->priv->_size_factor = 0.0f; + switch (self->priv->_state) { + case UNITY_EXPANDING_BIN_STATE_CLOSED: + { + ClutterAnimation* anim; + anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_EASE_OUT_SINE, (guint) UNITY_EXPANDING_BIN_ANIMATION_TIME, "size_factor", 1.0f, "opacity", 0, NULL)); + self->priv->_target_height = 0.0f; + g_signal_connect_object (anim, "completed", (GCallback) __lambda1__clutter_animation_completed, self, 0); + _g_object_unref0 (anim); + break; + } + case UNITY_EXPANDING_BIN_STATE_UNEXPANDED: + { + ClutterAnimationMode _tmp0_ = 0; + if (self->priv->_old_state == UNITY_EXPANDING_BIN_STATE_CLOSED) { + _tmp0_ = CLUTTER_EASE_IN_SINE; + } else { + _tmp0_ = CLUTTER_EASE_OUT_SINE; + } + clutter_actor_animate ((ClutterActor*) self, (gulong) _tmp0_, (guint) UNITY_EXPANDING_BIN_ANIMATION_TIME, "size_factor", 1.0f, "opacity", 255, NULL); + self->priv->_target_height = self->priv->_unexpanded_height; + clutter_actor_show ((ClutterActor*) self); + break; + } + case UNITY_EXPANDING_BIN_STATE_EXPANDED: + { + clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_EASE_IN_SINE, (guint) UNITY_EXPANDING_BIN_ANIMATION_TIME, "size_factor", 1.0f, "opacity", 255, NULL); + clutter_actor_get_preferred_height (ctk_bin_get_child ((CtkBin*) self), clutter_actor_get_width ((ClutterActor*) self), NULL, &self->priv->_expanded_height); + self->priv->_target_height = self->priv->_expanded_height; + clutter_actor_show ((ClutterActor*) self); + break; + } + default: + { + g_warning ("unity-expanding-bin.vala:174: ExpandingBinState %d not supported", (gint) self->priv->_state); + break; + } + } +} + + +float unity_expanding_bin_get_size_factor (UnityExpandingBin* self) { + float result; + g_return_val_if_fail (self != NULL, 0.0F); + result = self->priv->_size_factor; + return result; +} + + +void unity_expanding_bin_set_size_factor (UnityExpandingBin* self, float value) { + g_return_if_fail (self != NULL); + self->priv->_size_factor = value; + clutter_actor_queue_relayout ((ClutterActor*) self); + g_object_notify ((GObject *) self, "size-factor"); +} + + +UnityExpandingBinState unity_expanding_bin_get_bin_state (UnityExpandingBin* self) { + UnityExpandingBinState result; + g_return_val_if_fail (self != NULL, 0); + result = self->priv->_state; + return result; +} + + +void unity_expanding_bin_set_bin_state (UnityExpandingBin* self, UnityExpandingBinState value) { + g_return_if_fail (self != NULL); + _unity_expanding_bin_change_state (self, value); + g_object_notify ((GObject *) self, "bin-state"); +} + + +float unity_expanding_bin_get_unexpanded_height (UnityExpandingBin* self) { + float result; + g_return_val_if_fail (self != NULL, 0.0F); + result = self->priv->_unexpanded_height; + return result; +} + + +void unity_expanding_bin_set_unexpanded_height (UnityExpandingBin* self, float value) { + g_return_if_fail (self != NULL); + if (self->priv->_unexpanded_height != value) { + self->priv->_unexpanded_height = value; + if (self->priv->_state == UNITY_EXPANDING_BIN_STATE_UNEXPANDED) { + self->priv->_state = UNITY_EXPANDING_BIN_STATE_CLOSED; + _unity_expanding_bin_change_state (self, UNITY_EXPANDING_BIN_STATE_UNEXPANDED); + } + } + g_object_notify ((GObject *) self, "unexpanded-height"); +} + + +static GObject * unity_expanding_bin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + UnityExpandingBin * self; + parent_class = G_OBJECT_CLASS (unity_expanding_bin_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = UNITY_EXPANDING_BIN (obj); + { + } + return obj; +} + + +static void unity_expanding_bin_class_init (UnityExpandingBinClass * klass) { + unity_expanding_bin_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (UnityExpandingBinPrivate)); + CLUTTER_ACTOR_CLASS (klass)->allocate = unity_expanding_bin_real_allocate; + CLUTTER_ACTOR_CLASS (klass)->get_preferred_height = unity_expanding_bin_real_get_preferred_height; + G_OBJECT_CLASS (klass)->get_property = unity_expanding_bin_get_property; + G_OBJECT_CLASS (klass)->set_property = unity_expanding_bin_set_property; + G_OBJECT_CLASS (klass)->constructor = unity_expanding_bin_constructor; + G_OBJECT_CLASS (klass)->finalize = unity_expanding_bin_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_EXPANDING_BIN_SIZE_FACTOR, g_param_spec_float ("size-factor", "size-factor", "size-factor", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_EXPANDING_BIN_BIN_STATE, g_param_spec_enum ("bin-state", "bin-state", "bin-state", UNITY_TYPE_EXPANDING_BIN_STATE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_EXPANDING_BIN_UNEXPANDED_HEIGHT, g_param_spec_float ("unexpanded-height", "unexpanded-height", "unexpanded-height", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void unity_expanding_bin_instance_init (UnityExpandingBin * self) { + self->priv = UNITY_EXPANDING_BIN_GET_PRIVATE (self); + self->priv->_size_factor = 0.0f; + self->priv->_state = UNITY_EXPANDING_BIN_STATE_CLOSED; + self->priv->_old_state = UNITY_EXPANDING_BIN_STATE_CLOSED; + self->priv->_unexpanded_height = 100.0f; + self->priv->_expanded_height = 0.0f; + self->priv->_target_height = 0.0f; +} + + +static void unity_expanding_bin_finalize (GObject* obj) { + UnityExpandingBin * self; + self = UNITY_EXPANDING_BIN (obj); + G_OBJECT_CLASS (unity_expanding_bin_parent_class)->finalize (obj); +} + + +GType unity_expanding_bin_get_type (void) { + static volatile gsize unity_expanding_bin_type_id__volatile = 0; + if (g_once_init_enter (&unity_expanding_bin_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (UnityExpandingBinClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_expanding_bin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityExpandingBin), 0, (GInstanceInitFunc) unity_expanding_bin_instance_init, NULL }; + GType unity_expanding_bin_type_id; + unity_expanding_bin_type_id = g_type_register_static (CTK_TYPE_BIN, "UnityExpandingBin", &g_define_type_info, 0); + g_once_init_leave (&unity_expanding_bin_type_id__volatile, unity_expanding_bin_type_id); + } + return unity_expanding_bin_type_id__volatile; +} + + +static void unity_expanding_bin_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + UnityExpandingBin * self; + self = UNITY_EXPANDING_BIN (object); + switch (property_id) { + case UNITY_EXPANDING_BIN_SIZE_FACTOR: + g_value_set_float (value, unity_expanding_bin_get_size_factor (self)); + break; + case UNITY_EXPANDING_BIN_BIN_STATE: + g_value_set_enum (value, unity_expanding_bin_get_bin_state (self)); + break; + case UNITY_EXPANDING_BIN_UNEXPANDED_HEIGHT: + g_value_set_float (value, unity_expanding_bin_get_unexpanded_height (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void unity_expanding_bin_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + UnityExpandingBin * self; + self = UNITY_EXPANDING_BIN (object); + switch (property_id) { + case UNITY_EXPANDING_BIN_SIZE_FACTOR: + unity_expanding_bin_set_size_factor (self, g_value_get_float (value)); + break; + case UNITY_EXPANDING_BIN_BIN_STATE: + unity_expanding_bin_set_bin_state (self, g_value_get_enum (value)); + break; + case UNITY_EXPANDING_BIN_UNEXPANDED_HEIGHT: + unity_expanding_bin_set_unexpanded_height (self, g_value_get_float (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + + diff --git a/unity/unity-expanding-bin.vala b/unity/unity-expanding-bin.vala new file mode 100644 index 000000000..652ad58fd --- /dev/null +++ b/unity/unity-expanding-bin.vala @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2010 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> + */ + +using GLib; + +namespace Unity +{ + public enum ExpandingBinState + { + CLOSED, + UNEXPANDED, + EXPANDED + } + + public class ExpandingBin : Ctk.Bin + { + public static const int ANIMATION_TIME = 200; + /* + * Properties + */ + public float size_factor { + get { return _size_factor; } + set { _size_factor = value; queue_relayout (); } + } + + public ExpandingBinState bin_state { + get { return _state; } + set { _change_state (value); } + } + + public float unexpanded_height { + get { return _unexpanded_height; } + set { + if (_unexpanded_height != value) + { + _unexpanded_height = value; + + if (_state == ExpandingBinState.UNEXPANDED) + { + _state = ExpandingBinState.CLOSED; + _change_state (ExpandingBinState.UNEXPANDED); + } + } + } + } + + private float _size_factor = 0.0f; + private ExpandingBinState _state = ExpandingBinState.CLOSED; + private ExpandingBinState _old_state = ExpandingBinState.CLOSED; + private float _unexpanded_height = 100.0f; + private float _expanded_height = 0.0f; + private float _target_height = 0.0f; + + private float last_height; + private float last_width; + + /* + * Construction + */ + public ExpandingBin () + { + Object (); + } + + construct + { + } + + /* + * Private Methods + */ + private override void allocate (Clutter.ActorBox box, + Clutter.AllocationFlags flags) + { + float x = padding.left; + float y = padding.top; + float width = Math.floorf (box.x2 - box.x1) - padding.left - padding.right; + Clutter.ActorBox child_box = Clutter.ActorBox (); + child_box.x1 = x; + child_box.x2 = x + width; + child_box.y1 = y; + child_box.y2 = y + last_height + ((_target_height - last_height) * _size_factor); + + base.allocate (box, flags); + get_child ().allocate (child_box, flags); + + last_height = child_box.y2 - child_box.y1; + last_width = child_box.x2 - child_box.x1; + } + + private override void get_preferred_height (float for_width, + out float min_height, + out float nat_height) + { + var vpadding = padding.top + padding.bottom; + + get_child ().get_preferred_height (last_width, null, out _expanded_height); + if (_state == ExpandingBinState.CLOSED) + { + _target_height = 0.0f; + } + else if (_state == ExpandingBinState.UNEXPANDED) + { + _target_height = _unexpanded_height + vpadding; + } + else + { + _target_height = _expanded_height + vpadding; + } + + min_height = last_height + ((_target_height - last_height) *_size_factor); + nat_height = last_height + ((_target_height - last_height) *_size_factor); + } + + private void _change_state (ExpandingBinState new_state) + { + if (_state == new_state) + return; + + _old_state = _state; + _state = new_state; + + _size_factor = 0.0f; + switch (_state) + { + case ExpandingBinState.CLOSED: + var anim = animate (Clutter.AnimationMode.EASE_OUT_SINE, ANIMATION_TIME, + "size_factor", 1.0f, + "opacity", 0); + _target_height = 0.0f; + + anim.completed.connect (() => { + if (_state == ExpandingBinState.CLOSED) + hide (); + }); + break; + + case ExpandingBinState.UNEXPANDED: + animate (_old_state == ExpandingBinState.CLOSED ? Clutter.AnimationMode.EASE_IN_SINE + : Clutter.AnimationMode.EASE_OUT_SINE, + ANIMATION_TIME, + "size_factor", 1.0f, + "opacity", 255); + _target_height = _unexpanded_height; + show (); + break; + + case ExpandingBinState.EXPANDED: + animate (Clutter.AnimationMode.EASE_IN_SINE, ANIMATION_TIME, + "size_factor", 1.0f, + "opacity", 255); + get_child ().get_preferred_height (width, null, out _expanded_height); + _target_height = _expanded_height; + show (); + break; + + default: + warning ("ExpandingBinState %d not supported", _state); + break; + } + } + } +} diff --git a/unity/unity-pixbuf-cache.c b/unity/unity-pixbuf-cache.c index 1e9a3d32b..3f2e905b1 100644 --- a/unity/unity-pixbuf-cache.c +++ b/unity/unity-pixbuf-cache.c @@ -82,9 +82,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); @@ -126,17 +128,21 @@ struct _UnityPixbufCacheSetImageFromGiconStringData { gint size; char* key; GdkPixbuf* ret; - GIcon* icon; - GtkIconInfo* info; GdkPixbuf* _tmp0_; GdkPixbuf* _tmp1_; - gboolean _tmp2_; - gboolean _tmp3_; - gboolean _tmp4_; + char* _tmp2_; + GError * err; + GIcon* icon; + GtkIconInfo* info; + GdkPixbuf* _tmp3_; + GdkPixbuf* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; char* real_name; - GdkPixbuf* _tmp5_; - GdkPixbuf* _tmp6_; - char* _tmp7_; + GdkPixbuf* _tmp8_; + GdkPixbuf* _tmp9_; + char* _tmp10_; GError * e; GError * _inner_error_; }; @@ -443,6 +449,14 @@ static gboolean _unity_pixbuf_cache_set_image_from_gicon_string_co_gsource_func } +static const char* string_to_string (const char* self) { + const char* result = NULL; + g_return_val_if_fail (self != NULL, NULL); + result = self; + return result; +} + + static char* string_slice (const char* self, glong start, glong end) { char* result = NULL; glong string_length; @@ -484,14 +498,6 @@ static glong string_get_length (const char* self) { } -static const char* string_to_string (const char* self) { - const char* result = NULL; - g_return_val_if_fail (self != NULL, NULL); - result = self; - return result; -} - - static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCacheSetImageFromGiconStringData* data) { switch (data->_state_) { case 0: @@ -525,71 +531,101 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCa _state_10: ; if (data->ret == NULL) { - { - data->icon = g_icon_new_for_string (data->gicon_as_string, &data->_inner_error_); - if (data->_inner_error_ != NULL) { - goto __catch28_g_error; - } - data->info = gtk_icon_theme_lookup_by_gicon (data->self->priv->theme, data->icon, data->size, 0); - if (data->info != NULL) { - data->_tmp0_ = gtk_icon_info_load_icon (data->info, &data->_inner_error_); + if (g_utf8_get_char (g_utf8_offset_to_pointer (data->gicon_as_string, 0)) == '/') { + { + data->_tmp0_ = gdk_pixbuf_new_from_file (data->gicon_as_string, &data->_inner_error_); if (data->_inner_error_ != NULL) { - _gtk_icon_info_free0 (data->info); goto __catch28_g_error; } data->ret = (data->_tmp1_ = data->_tmp0_, _g_object_unref0 (data->ret), data->_tmp1_); } - if (data->ret == NULL) { - if (g_str_has_suffix (data->gicon_as_string, ".png")) { - data->_tmp4_ = TRUE; - } else { - data->_tmp4_ = g_str_has_suffix (data->gicon_as_string, ".xpm"); - } - if (data->_tmp4_) { - data->_tmp3_ = TRUE; - } else { - data->_tmp3_ = g_str_has_suffix (data->gicon_as_string, ".gir"); + goto __finally28; + __catch28_g_error: + { + data->err = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_message (data->_tmp2_ = g_strconcat ("Unable to load ", string_to_string (data->gicon_as_string), " as file: %s", NULL), data->err->message); + _g_free0 (data->_tmp2_); + _g_error_free0 (data->err); } - if (data->_tmp3_) { - data->_tmp2_ = TRUE; - } else { - data->_tmp2_ = g_str_has_suffix (data->gicon_as_string, ".jpg"); + } + __finally28: + if (data->_inner_error_ != NULL) { + _g_free0 (data->key); + _g_object_unref0 (data->ret); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); + g_clear_error (&data->_inner_error_); + return FALSE; + } + } + if (data->ret == NULL) { + { + data->icon = g_icon_new_for_string (data->gicon_as_string, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + goto __catch29_g_error; } - if (data->_tmp2_) { - data->real_name = string_slice (data->gicon_as_string, (glong) 0, string_get_length (data->gicon_as_string) - 4); - data->_tmp5_ = gtk_icon_theme_load_icon (data->self->priv->theme, data->real_name, data->size, 0, &data->_inner_error_); + data->info = gtk_icon_theme_lookup_by_gicon (data->self->priv->theme, data->icon, data->size, 0); + if (data->info != NULL) { + data->_tmp3_ = gtk_icon_info_load_icon (data->info, &data->_inner_error_); if (data->_inner_error_ != NULL) { - _g_free0 (data->real_name); _gtk_icon_info_free0 (data->info); - goto __catch28_g_error; + goto __catch29_g_error; } - data->ret = (data->_tmp6_ = _g_object_ref0 (data->_tmp5_), _g_object_unref0 (data->ret), data->_tmp6_); - _g_free0 (data->real_name); + data->ret = (data->_tmp4_ = data->_tmp3_, _g_object_unref0 (data->ret), data->_tmp4_); } + if (data->ret == NULL) { + if (g_str_has_suffix (data->gicon_as_string, ".png")) { + data->_tmp7_ = TRUE; + } else { + data->_tmp7_ = g_str_has_suffix (data->gicon_as_string, ".xpm"); + } + if (data->_tmp7_) { + data->_tmp6_ = TRUE; + } else { + data->_tmp6_ = g_str_has_suffix (data->gicon_as_string, ".gir"); + } + if (data->_tmp6_) { + data->_tmp5_ = TRUE; + } else { + data->_tmp5_ = g_str_has_suffix (data->gicon_as_string, ".jpg"); + } + if (data->_tmp5_) { + data->real_name = string_slice (data->gicon_as_string, (glong) 0, string_get_length (data->gicon_as_string) - 4); + data->_tmp8_ = gtk_icon_theme_load_icon (data->self->priv->theme, data->real_name, data->size, 0, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + _g_free0 (data->real_name); + _gtk_icon_info_free0 (data->info); + goto __catch29_g_error; + } + data->ret = (data->_tmp9_ = _g_object_ref0 (data->_tmp8_), _g_object_unref0 (data->ret), data->_tmp9_); + _g_free0 (data->real_name); + } + } + _gtk_icon_info_free0 (data->info); } - if (GDK_IS_PIXBUF (data->ret)) { - gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->cache, data->key, data->ret); - } - _gtk_icon_info_free0 (data->info); - } - goto __finally28; - __catch28_g_error: - { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; + goto __finally29; + __catch29_g_error: { - g_warning (data->_tmp7_ = g_strconcat ("Unable to load icon ", string_to_string (data->gicon_as_string), ": '%s'", NULL), data->e->message); - _g_free0 (data->_tmp7_); - _g_error_free0 (data->e); + data->e = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_warning (data->_tmp10_ = g_strconcat ("Unable to load icon ", string_to_string (data->gicon_as_string), ": '%s'", NULL), data->e->message); + _g_free0 (data->_tmp10_); + _g_error_free0 (data->e); + } + } + __finally29: + if (data->_inner_error_ != NULL) { + _g_free0 (data->key); + _g_object_unref0 (data->ret); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); + g_clear_error (&data->_inner_error_); + return FALSE; } } - __finally28: - if (data->_inner_error_ != NULL) { - _g_free0 (data->key); - _g_object_unref0 (data->ret); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); - return FALSE; + if (GDK_IS_PIXBUF (data->ret)) { + gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->cache, data->key, data->ret); } } if (GDK_IS_PIXBUF (data->ret)) { diff --git a/unity/unity-pixbuf-cache.vala b/unity/unity-pixbuf-cache.vala index f1366e3da..26b082171 100644 --- a/unity/unity-pixbuf-cache.vala +++ b/unity/unity-pixbuf-cache.vala @@ -157,36 +157,50 @@ namespace Unity if (ret == null) { - try { - unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string); - var info = theme.lookup_by_gicon (icon, size, 0); - if (info != null) - ret = info.load_icon (); + if (gicon_as_string[0] == '/') + { + try { + ret = new Gdk.Pixbuf.from_file (gicon_as_string); + } catch (Error err) { + message (@"Unable to load $gicon_as_string as file: %s", + err.message); + } + } - if (ret == null) - { - /* There is some funkiness in some programs where they install - * their icon to /usr/share/icons/hicolor/apps/, but they - * name the Icon= key as `foo.$extension` which breaks loading - * So we can try and work around that here. - */ - if (gicon_as_string.has_suffix (".png") - || gicon_as_string.has_suffix (".xpm") - || gicon_as_string.has_suffix (".gir") - || gicon_as_string.has_suffix (".jpg")) + if (ret == null) + { + try { + unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string); + var info = theme.lookup_by_gicon (icon, size, 0); + if (info != null) + ret = info.load_icon (); + + if (ret == null) { - string real_name = gicon_as_string[0:gicon_as_string.length-4]; - ret = theme.load_icon (real_name, size, 0); + /* There is some funkiness in some programs where they install + * their icon to /usr/share/icons/hicolor/apps/, but they + * name the Icon= key as `foo.$extension` which breaks loading + * So we can try and work around that here. + */ + if (gicon_as_string.has_suffix (".png") + || gicon_as_string.has_suffix (".xpm") + || gicon_as_string.has_suffix (".gir") + || gicon_as_string.has_suffix (".jpg")) + { + string real_name = gicon_as_string[0:gicon_as_string.length-4]; + ret = theme.load_icon (real_name, size, 0); + } } - } - if (ret is Pixbuf) - { - cache[key] = ret; + } catch (Error e) { + warning (@"Unable to load icon $gicon_as_string: '%s'", e.message); } - } catch (Error e) { - warning (@"Unable to load icon $gicon_as_string: '%s'", e.message); - } + } + + if (ret is Pixbuf) + { + cache[key] = ret; + } } if (ret is Pixbuf) diff --git a/unity/unity-place.c b/unity/unity-place.c index efcdb9901..2f9e8d757 100644 --- a/unity/unity-place.c +++ b/unity/unity-place.c @@ -568,10 +568,10 @@ UnityPlaceController* unity_place_controller_new (const char* dbus_path); UnityPlaceController* unity_place_controller_construct (GType object_type, const char* dbus_path); static void unity_place_controller_on_entry_changed (UnityPlaceController* self, GObject* obj, GParamSpec* psec); static void _unity_place_controller_on_entry_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); -static void _lambda1_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_); -static void __lambda1__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void _lambda2_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_); static void __lambda2__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void _lambda3_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_); +static void __lambda3__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static Block1Data* block1_data_ref (Block1Data* _data1_); static void block1_data_unref (Block1Data* _data1_); void unity_place_controller_add_entry (UnityPlaceController* self, UnityPlaceEntryInfo* entry); @@ -4355,7 +4355,7 @@ void unity_place_service_impl_add_entry (UnityPlaceServiceImpl* self, UnityPlace unity_place_entry_service_impl_export (entry, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch29_dbus_gerror; + goto __catch30_dbus_gerror; } _g_object_unref0 (entry); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -4363,8 +4363,8 @@ void unity_place_service_impl_add_entry (UnityPlaceServiceImpl* self, UnityPlace return; } } - goto __finally29; - __catch29_dbus_gerror: + goto __finally30; + __catch30_dbus_gerror: { GError * e; e = _inner_error_; @@ -4374,7 +4374,7 @@ void unity_place_service_impl_add_entry (UnityPlaceServiceImpl* self, UnityPlace _g_error_free0 (e); } } - __finally29: + __finally30: if (_inner_error_ != NULL) { _g_object_unref0 (entry); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -4483,7 +4483,7 @@ void unity_place_service_impl_remove_entry (UnityPlaceServiceImpl* self, const c unity_place_entry_service_impl_unexport (entry, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch30_dbus_gerror; + goto __catch31_dbus_gerror; } _g_object_unref0 (entry); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -4491,8 +4491,8 @@ void unity_place_service_impl_remove_entry (UnityPlaceServiceImpl* self, const c return; } } - goto __finally30; - __catch30_dbus_gerror: + goto __finally31; + __catch31_dbus_gerror: { GError * e; e = _inner_error_; @@ -4502,7 +4502,7 @@ void unity_place_service_impl_remove_entry (UnityPlaceServiceImpl* self, const c _g_error_free0 (e); } } - __finally30: + __finally31: if (_inner_error_ != NULL) { _g_object_unref0 (entry); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -5057,7 +5057,7 @@ static void _unity_place_controller_on_entry_changed_g_object_notify (GObject* _ } -static void _lambda1_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { +static void _lambda2_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { UnityPlaceController * self; GObject* _tmp0_; UnityPlaceRendererInfo* renderer_info; @@ -5082,12 +5082,12 @@ static void _lambda1_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { } -static void __lambda1__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda1_ (_sender, pspec, self); +static void __lambda2__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda2_ (_sender, pspec, self); } -static void _lambda2_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { +static void _lambda3_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { UnityPlaceController * self; GObject* _tmp0_; UnityPlaceRendererInfo* renderer_info; @@ -5112,8 +5112,8 @@ static void _lambda2_ (GObject* obj, GParamSpec* pspec, Block1Data* _data1_) { } -static void __lambda2__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda2_ (_sender, pspec, self); +static void __lambda3__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda3_ (_sender, pspec, self); } @@ -5149,8 +5149,8 @@ void unity_place_controller_add_entry (UnityPlaceController* self, UnityPlaceEnt unity_place_service_impl_add_entry (self->priv->service, _data1_->entry); memset (&signals, 0, sizeof (UnityPlace_EntrySignals)); signals.place_entry_info_changed_id = g_signal_connect_object ((GObject*) _data1_->entry, "notify", (GCallback) _unity_place_controller_on_entry_changed_g_object_notify, self, 0); - signals.entry_renderer_info_changed_id = g_signal_connect_data ((GObject*) unity_place_entry_info_get_entry_renderer_info (_data1_->entry), "notify", (GCallback) __lambda1__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); - signals.global_renderer_info_changed_id = g_signal_connect_data ((GObject*) unity_place_entry_info_get_global_renderer_info (_data1_->entry), "notify", (GCallback) __lambda2__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); + signals.entry_renderer_info_changed_id = g_signal_connect_data ((GObject*) unity_place_entry_info_get_entry_renderer_info (_data1_->entry), "notify", (GCallback) __lambda2__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); + signals.global_renderer_info_changed_id = g_signal_connect_data ((GObject*) unity_place_entry_info_get_global_renderer_info (_data1_->entry), "notify", (GCallback) __lambda3__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); g_hash_table_insert (self->priv->entry_signals, g_strdup (unity_place_entry_info_get_dbus_path (_data1_->entry)), _unity_place__entrysignals_dup0 (&signals)); block1_data_unref (_data1_); } diff --git a/unity/unity.h b/unity/unity.h index 357da6f1e..f05f16d23 100644 --- a/unity/unity.h +++ b/unity/unity.h @@ -176,6 +176,19 @@ typedef struct _UnityCairoCanvas UnityCairoCanvas; typedef struct _UnityCairoCanvasClass UnityCairoCanvasClass; typedef struct _UnityCairoCanvasPrivate UnityCairoCanvasPrivate; +#define UNITY_TYPE_EXPANDING_BIN_STATE (unity_expanding_bin_state_get_type ()) + +#define UNITY_TYPE_EXPANDING_BIN (unity_expanding_bin_get_type ()) +#define UNITY_EXPANDING_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBin)) +#define UNITY_EXPANDING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBinClass)) +#define UNITY_IS_EXPANDING_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_EXPANDING_BIN)) +#define UNITY_IS_EXPANDING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_EXPANDING_BIN)) +#define UNITY_EXPANDING_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_EXPANDING_BIN, UnityExpandingBinClass)) + +typedef struct _UnityExpandingBin UnityExpandingBin; +typedef struct _UnityExpandingBinClass UnityExpandingBinClass; +typedef struct _UnityExpandingBinPrivate UnityExpandingBinPrivate; + #define UNITY_TYPE_FAVORITES (unity_favorites_get_type ()) #define UNITY_FAVORITES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_FAVORITES, UnityFavorites)) #define UNITY_FAVORITES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_FAVORITES, UnityFavoritesClass)) @@ -380,9 +393,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); @@ -437,6 +452,21 @@ struct _UnityCairoCanvasClass { }; typedef void (*UnityCairoCanvasCairoCanvasPaint) (cairo_t* cr, gint width, gint height, void* user_data); +typedef enum { + UNITY_EXPANDING_BIN_STATE_CLOSED, + UNITY_EXPANDING_BIN_STATE_UNEXPANDED, + UNITY_EXPANDING_BIN_STATE_EXPANDED +} UnityExpandingBinState; + +struct _UnityExpandingBin { + CtkBin parent_instance; + UnityExpandingBinPrivate * priv; +}; + +struct _UnityExpandingBinClass { + CtkBinClass parent_class; +}; + struct _UnityFavorites { GObject parent_instance; UnityFavoritesPrivate * priv; @@ -606,9 +636,11 @@ UnityQuicklistRenderingMenu* unity_quicklist_rendering_menu_construct (GType obj GType unity_shell_mode_get_type (void); GType unity_dnd_targets_get_type (void); GType unity_shell_get_type (void); +guint32 unity_shell_get_current_time (UnityShell* self); UnityShellMode unity_shell_get_mode (UnityShell* self); ClutterStage* unity_shell_get_stage (UnityShell* self); void unity_shell_show_unity (UnityShell* self); +void unity_shell_hide_unity (UnityShell* self); gint unity_shell_get_indicators_width (UnityShell* self); gint unity_shell_get_launcher_width_foobar (UnityShell* self); gint unity_shell_get_panel_height_foobar (UnityShell* self); @@ -645,6 +677,17 @@ GType unity_cairo_canvas_get_type (void); UnityCairoCanvas* unity_cairo_canvas_new (UnityCairoCanvasCairoCanvasPaint _func, void* _func_target); UnityCairoCanvas* unity_cairo_canvas_construct (GType object_type, UnityCairoCanvasCairoCanvasPaint _func, void* _func_target); void unity_cairo_canvas_update (UnityCairoCanvas* self); +GType unity_expanding_bin_state_get_type (void); +GType unity_expanding_bin_get_type (void); +#define UNITY_EXPANDING_BIN_ANIMATION_TIME 200 +UnityExpandingBin* unity_expanding_bin_new (void); +UnityExpandingBin* unity_expanding_bin_construct (GType object_type); +float unity_expanding_bin_get_size_factor (UnityExpandingBin* self); +void unity_expanding_bin_set_size_factor (UnityExpandingBin* self, float value); +UnityExpandingBinState unity_expanding_bin_get_bin_state (UnityExpandingBin* self); +void unity_expanding_bin_set_bin_state (UnityExpandingBin* self, UnityExpandingBinState value); +float unity_expanding_bin_get_unexpanded_height (UnityExpandingBin* self); +void unity_expanding_bin_set_unexpanded_height (UnityExpandingBin* self, float value); GType unity_favorites_get_type (void); extern UnityFavorites* unity_favorites_singleton; UnityFavorites* unity_favorites_get_default (void); diff --git a/unity/unity.vapi b/unity/unity.vapi index ca5bcf4fa..b5201cd52 100644 --- a/unity/unity.vapi +++ b/unity/unity.vapi @@ -196,6 +196,14 @@ namespace Unity { public string static_text { get; set construct; } } [CCode (cheader_filename = "unity.h")] + public class ExpandingBin : Ctk.Bin { + public const int ANIMATION_TIME; + public ExpandingBin (); + public Unity.ExpandingBinState bin_state { get; set; } + public float size_factor { get; set; } + public float unexpanded_height { get; set; } + } + [CCode (cheader_filename = "unity.h")] public abstract class Favorites : GLib.Object { public Favorites (); public abstract void add_favorite (string uid); @@ -281,12 +289,14 @@ namespace Unity { public abstract void close_xids (GLib.Array<uint32> xids); public abstract void ensure_input_region (); public abstract void expose_xids (GLib.Array<uint32> xids); + public abstract uint32 get_current_time (); public abstract int get_indicators_width (); public abstract int get_launcher_width_foobar (); public abstract Unity.ShellMode get_mode (); public abstract int get_panel_height_foobar (); public abstract Clutter.Stage get_stage (); public abstract void grab_keyboard (bool grab, uint32 timestamp); + public abstract void hide_unity (); public abstract bool remove_fullscreen_request (GLib.Object o); public abstract void show_unity (); public abstract void show_window (uint32 xid); @@ -295,6 +305,12 @@ namespace Unity { public signal void indicators_changed (int width); public signal void need_new_icon_cache (); } + [CCode (cprefix = "UNITY_EXPANDING_BIN_STATE_", cheader_filename = "unity.h")] + public enum ExpandingBinState { + CLOSED, + UNEXPANDED, + EXPANDED + } [CCode (cprefix = "UNITY_SHELL_MODE_", cheader_filename = "unity.h")] public enum ShellMode { UNDERLAY, diff --git a/unity/webapp-fetcher.c b/unity/webapp-fetcher.c index 6b7904f3d..1165b625f 100644 --- a/unity/webapp-fetcher.c +++ b/unity/webapp-fetcher.c @@ -146,9 +146,11 @@ typedef enum { struct _UnityShellIface { GTypeInterface parent_iface; + guint32 (*get_current_time) (UnityShell* self); UnityShellMode (*get_mode) (UnityShell* self); ClutterStage* (*get_stage) (UnityShell* self); void (*show_unity) (UnityShell* self); + void (*hide_unity) (UnityShell* self); gint (*get_indicators_width) (UnityShell* self); gint (*get_launcher_width_foobar) (UnityShell* self); gint (*get_panel_height_foobar) (UnityShell* self); @@ -224,8 +226,8 @@ UnityWebappWebiconFetcher* unity_webapp_webicon_fetcher_construct (GType object_ const char* unity_webapp_webicon_fetcher_get_desktop_location (UnityWebappWebiconFetcher* self); static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebiconFetcher* self, const char* iconname); const char* unity_webapp_webicon_fetcher_get_uri (UnityWebappWebiconFetcher* self); -static void _lambda3_ (UnityWebappWebiconFetcher* self); -static void __lambda3__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self); +static void _lambda4_ (UnityWebappWebiconFetcher* self); +static void __lambda4__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self); static void unity_webapp_webicon_fetcher_on_fetcher_completed (UnityWebappWebiconFetcher* self, GByteArray* data); static void _unity_webapp_webicon_fetcher_on_fetcher_completed_unity_webapp_fetch_file_completed (UnityWebappFetchFile* _sender, GByteArray* data, gpointer self); void unity_webapp_webicon_fetcher_fetch_webapp_data (UnityWebappWebiconFetcher* self); @@ -234,11 +236,11 @@ static void unity_webapp_webicon_fetcher_attempt_fetch_icon (UnityWebappWebiconF const char* unity_webapp_webicon_fetcher_get_destination (UnityWebappWebiconFetcher* self); GType unity_shell_mode_get_type (void); GType unity_shell_get_type (void); -static gboolean _lambda5_ (UnityWebappWebiconFetcher* self); -static gboolean __lambda5__gsource_func (gpointer self); +static gboolean _lambda6_ (UnityWebappWebiconFetcher* self); +static gboolean __lambda6__gsource_func (gpointer self); static void unity_webapp_webicon_fetcher_on_fetcher_failed (UnityWebappWebiconFetcher* self); -static void _lambda4_ (UnityWebappWebiconFetcher* self); -static void __lambda4__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self); +static void _lambda5_ (UnityWebappWebiconFetcher* self); +static void __lambda5__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self); static void unity_webapp_webicon_fetcher_set_uri (UnityWebappWebiconFetcher* self, const char* value); static void unity_webapp_webicon_fetcher_set_destination (UnityWebappWebiconFetcher* self, const char* value); static void unity_webapp_webicon_fetcher_set_desktop_location (UnityWebappWebiconFetcher* self, const char* value); @@ -266,7 +268,7 @@ char* unity_webapp_urlify (const char* uri) { regex = g_regex_new ("^[ \\\\]+|[ \\\\]+$", 0, 0, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch31_g_regex_error; + goto __catch32_g_regex_error; } _g_free0 (return_string); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -277,7 +279,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch31_g_regex_error; + goto __catch32_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -288,8 +290,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp1_ = _tmp0_, _g_free0 (return_string), _tmp1_); _g_regex_unref0 (regex); } - goto __finally31; - __catch31_g_regex_error: + goto __finally32; + __catch32_g_regex_error: { GError * e; e = _inner_error_; @@ -299,7 +301,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally31: + __finally32: if (_inner_error_ != NULL) { _g_free0 (return_string); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -313,7 +315,7 @@ char* unity_webapp_urlify (const char* uri) { regex = g_regex_new ("^.*?://", 0, 0, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch32_g_regex_error; + goto __catch33_g_regex_error; } _g_free0 (return_string); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -324,7 +326,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch32_g_regex_error; + goto __catch33_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -335,8 +337,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp3_ = _tmp2_, _g_free0 (return_string), _tmp3_); _g_regex_unref0 (regex); } - goto __finally32; - __catch32_g_regex_error: + goto __finally33; + __catch33_g_regex_error: { GError * e; e = _inner_error_; @@ -346,7 +348,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally32: + __finally33: if (_inner_error_ != NULL) { _g_free0 (return_string); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -360,7 +362,7 @@ char* unity_webapp_urlify (const char* uri) { regex = g_regex_new ("(\\s|/)", 0, 0, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch33_g_regex_error; + goto __catch34_g_regex_error; } _g_free0 (return_string); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -371,7 +373,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch33_g_regex_error; + goto __catch34_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -382,8 +384,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp5_ = _tmp4_, _g_free0 (return_string), _tmp5_); _g_regex_unref0 (regex); } - goto __finally33; - __catch33_g_regex_error: + goto __finally34; + __catch34_g_regex_error: { GError * e; e = _inner_error_; @@ -393,7 +395,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally33: + __finally34: if (_inner_error_ != NULL) { _g_free0 (return_string); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -407,7 +409,7 @@ char* unity_webapp_urlify (const char* uri) { regex = g_regex_new ("[^([:alnum:]|\\.|_)]+", 0, 0, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch34_g_regex_error; + goto __catch35_g_regex_error; } _g_free0 (return_string); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -418,7 +420,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch34_g_regex_error; + goto __catch35_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -429,8 +431,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp7_ = _tmp6_, _g_free0 (return_string), _tmp7_); _g_regex_unref0 (regex); } - goto __finally34; - __catch34_g_regex_error: + goto __finally35; + __catch35_g_regex_error: { GError * e; e = _inner_error_; @@ -440,7 +442,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally34: + __finally35: if (_inner_error_ != NULL) { _g_free0 (return_string); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -509,14 +511,14 @@ static gboolean unity_webapp_fetch_file_fetch_data_co (UnityWebappFetchFileFetch { data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_); if (data->_inner_error_ != NULL) { - goto __catch35_g_error; + goto __catch36_g_error; } data->self->priv->stream = (data->_tmp2_ = g_data_input_stream_new ((GInputStream*) (data->_tmp1_ = data->_tmp0_)), _g_object_unref0 (data->self->priv->stream), data->_tmp2_); _g_object_unref0 (data->_tmp1_); g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); } - goto __finally35; - __catch35_g_error: + goto __finally36; + __catch36_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -525,7 +527,7 @@ static gboolean unity_webapp_fetch_file_fetch_data_co (UnityWebappFetchFileFetch _g_error_free0 (data->e); } } - __finally35: + __finally36: if (data->_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); g_clear_error (&data->_inner_error_); @@ -607,7 +609,7 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc _state_12: data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { - goto __catch36_g_error; + goto __catch37_g_error; } data->bufsize = data->_tmp2_; if (data->bufsize < 1) { @@ -622,8 +624,8 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1); } } - goto __finally36; - __catch36_g_error: + goto __finally37; + __catch37_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -632,7 +634,7 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc _g_error_free0 (data->e); } } - __finally36: + __finally37: if (data->_inner_error_ != NULL) { data->buffer = (g_free (data->buffer), NULL); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); @@ -775,12 +777,12 @@ char* unity_webapp_get_hostname (const char* uri) { GRegex* _tmp1_; _tmp0_ = g_regex_new (hostname_string, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch37_g_error; + goto __catch38_g_error; } unity_webapp_hostname_match = (_tmp1_ = _tmp0_, _g_regex_unref0 (unity_webapp_hostname_match), _tmp1_); } - goto __finally37; - __catch37_g_error: + goto __finally38; + __catch38_g_error: { GError * e; e = _inner_error_; @@ -790,7 +792,7 @@ char* unity_webapp_get_hostname (const char* uri) { _g_error_free0 (e); } } - __finally37: + __finally38: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -840,7 +842,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic file_stream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (file); - goto __catch38_g_error; + goto __catch39_g_error; } desktop_file = g_key_file_new (); g_key_file_load_from_file (desktop_file, self->priv->_desktop_location, 0, &_inner_error_); @@ -848,7 +850,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_object_unref0 (file); _g_object_unref0 (file_stream); _g_key_file_free0 (desktop_file); - goto __catch38_g_error; + goto __catch39_g_error; } g_key_file_set_string (desktop_file, "Desktop Entry", "Icon", iconname); desktop_data = g_key_file_to_data (desktop_file, NULL, NULL); @@ -860,7 +862,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_key_file_free0 (desktop_file); _g_free0 (desktop_data); _g_object_unref0 (data_stream); - goto __catch38_g_error; + goto __catch39_g_error; } g_output_stream_close ((GOutputStream*) data_stream, NULL, &_inner_error_); if (_inner_error_ != NULL) { @@ -869,7 +871,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_key_file_free0 (desktop_file); _g_free0 (desktop_data); _g_object_unref0 (data_stream); - goto __catch38_g_error; + goto __catch39_g_error; } _g_object_unref0 (file); _g_object_unref0 (file_stream); @@ -877,8 +879,8 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_free0 (desktop_data); _g_object_unref0 (data_stream); } - goto __finally38; - __catch38_g_error: + goto __finally39; + __catch39_g_error: { GError * e; e = _inner_error_; @@ -888,7 +890,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_error_free0 (e); } } - __finally38: + __finally39: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -897,13 +899,13 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic } -static void _lambda3_ (UnityWebappWebiconFetcher* self) { +static void _lambda4_ (UnityWebappWebiconFetcher* self) { g_signal_emit_by_name (self, "failed"); } -static void __lambda3__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self) { - _lambda3_ (self); +static void __lambda4__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self) { + _lambda4_ (self); } @@ -916,7 +918,7 @@ void unity_webapp_webicon_fetcher_fetch_webapp_data (UnityWebappWebiconFetcher* UnityWebappFetchFile* _tmp0_; g_return_if_fail (self != NULL); self->priv->fetcher = (_tmp0_ = unity_webapp_fetch_file_new (self->priv->_uri), _g_object_unref0 (self->priv->fetcher), _tmp0_); - g_signal_connect_object (self->priv->fetcher, "failed", (GCallback) __lambda3__unity_webapp_fetch_file_failed, self, 0); + g_signal_connect_object (self->priv->fetcher, "failed", (GCallback) __lambda4__unity_webapp_fetch_file_failed, self, 0); g_signal_connect_object (self->priv->fetcher, "completed", (GCallback) _unity_webapp_webicon_fetcher_on_fetcher_completed_unity_webapp_fetch_file_completed, self, 0); self->priv->html_phase = TRUE; unity_webapp_fetch_file_fetch_data (self->priv->fetcher, NULL, NULL); @@ -928,7 +930,7 @@ static gpointer _g_object_ref0 (gpointer self) { } -static gboolean _lambda5_ (UnityWebappWebiconFetcher* self) { +static gboolean _lambda6_ (UnityWebappWebiconFetcher* self) { gboolean result = FALSE; g_signal_emit_by_name (unity_global_shell, "need-new-icon-cache"); result = FALSE; @@ -936,9 +938,9 @@ static gboolean _lambda5_ (UnityWebappWebiconFetcher* self) { } -static gboolean __lambda5__gsource_func (gpointer self) { +static gboolean __lambda6__gsource_func (gpointer self) { gboolean result; - result = _lambda5_ (self); + result = _lambda6_ (self); return result; } @@ -1023,25 +1025,25 @@ static void unity_webapp_webicon_fetcher_on_fetcher_completed (UnityWebappWebico gdk_pixbuf_loader_write (loader, data->data, (gsize) data->len, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (loader); - goto __catch39_g_error; + goto __catch40_g_error; } gdk_pixbuf_loader_close (loader, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (loader); - goto __catch39_g_error; + goto __catch40_g_error; } icon = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (loader)); gdk_pixbuf_save (icon, self->priv->_destination, "png", &_inner_error_, NULL); if (_inner_error_ != NULL) { _g_object_unref0 (loader); _g_object_unref0 (icon); - goto __catch39_g_error; + goto __catch40_g_error; } _g_object_unref0 (loader); _g_object_unref0 (icon); } - goto __finally39; - __catch39_g_error: + goto __finally40; + __catch40_g_error: { GError * e; e = _inner_error_; @@ -1052,7 +1054,7 @@ static void unity_webapp_webicon_fetcher_on_fetcher_completed (UnityWebappWebico return; } } - __finally39: + __finally40: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -1060,7 +1062,7 @@ static void unity_webapp_webicon_fetcher_on_fetcher_completed (UnityWebappWebico } unity_webapp_webicon_fetcher_set_desktop_file_icon (self, _tmp8_ = unity_webapp_get_hostname (self->priv->_uri)); _g_free0 (_tmp8_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda5__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda6__gsource_func, g_object_ref (self), g_object_unref); } } } @@ -1087,13 +1089,13 @@ static gboolean string_contains (const char* self, const char* needle) { } -static void _lambda4_ (UnityWebappWebiconFetcher* self) { +static void _lambda5_ (UnityWebappWebiconFetcher* self) { unity_webapp_webicon_fetcher_on_fetcher_failed (self); } -static void __lambda4__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self) { - _lambda4_ (self); +static void __lambda5__unity_webapp_fetch_file_failed (UnityWebappFetchFile* _sender, gpointer self) { + _lambda5_ (self); } @@ -1115,7 +1117,7 @@ static void unity_webapp_webicon_fetcher_attempt_fetch_icon (UnityWebappWebiconF uri = (_tmp1_ = g_strconcat (self->priv->_uri, uri, NULL), _g_free0 (uri), _tmp1_); } self->priv->fetcher = (_tmp2_ = unity_webapp_fetch_file_new (uri), _g_object_unref0 (self->priv->fetcher), _tmp2_); - g_signal_connect_object (self->priv->fetcher, "failed", (GCallback) __lambda4__unity_webapp_fetch_file_failed, self, 0); + g_signal_connect_object (self->priv->fetcher, "failed", (GCallback) __lambda5__unity_webapp_fetch_file_failed, self, 0); g_signal_connect_object (self->priv->fetcher, "completed", (GCallback) _unity_webapp_webicon_fetcher_on_fetcher_completed_unity_webapp_fetch_file_completed, self, 0); unity_webapp_fetch_file_fetch_data (self->priv->fetcher, NULL, NULL); _g_free0 (uri); @@ -1268,32 +1270,32 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c GRegex* _tmp11_; _tmp2_ = g_regex_new (primary_match_prefix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch40_g_error; + goto __catch41_g_error; } unity_webapp_primary_match_prefix = (_tmp3_ = _tmp2_, _g_regex_unref0 (unity_webapp_primary_match_prefix), _tmp3_); _tmp4_ = g_regex_new (primary_match_suffix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch40_g_error; + goto __catch41_g_error; } unity_webapp_primary_match_suffix = (_tmp5_ = _tmp4_, _g_regex_unref0 (unity_webapp_primary_match_suffix), _tmp5_); _tmp6_ = g_regex_new (secondary_match_prefix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch40_g_error; + goto __catch41_g_error; } unity_webapp_secondary_match_prefix = (_tmp7_ = _tmp6_, _g_regex_unref0 (unity_webapp_secondary_match_prefix), _tmp7_); _tmp8_ = g_regex_new (secondary_match_suffix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch40_g_error; + goto __catch41_g_error; } unity_webapp_secondary_match_suffix = (_tmp9_ = _tmp8_, _g_regex_unref0 (unity_webapp_secondary_match_suffix), _tmp9_); _tmp10_ = g_regex_new (hostname_string, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch40_g_error; + goto __catch41_g_error; } unity_webapp_hostname_match = (_tmp11_ = _tmp10_, _g_regex_unref0 (unity_webapp_hostname_match), _tmp11_); } - goto __finally40; - __catch40_g_error: + goto __finally41; + __catch41_g_error: { GError * e; e = _inner_error_; @@ -1303,7 +1305,7 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_error_free0 (e); } } - __finally40: + __finally41: if (_inner_error_ != NULL) { _g_free0 (primary_match_prefix); _g_free0 (primary_match_suffix); @@ -1326,12 +1328,12 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_object_unref0 (_tmp13_); if (_inner_error_ != NULL) { _g_object_unref0 (make_file); - goto __catch41_g_error; + goto __catch42_g_error; } _g_object_unref0 (make_file); } - goto __finally41; - __catch41_g_error: + goto __finally42; + __catch42_g_error: { GError * e; e = _inner_error_; @@ -1340,7 +1342,7 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_error_free0 (e); } } - __finally41: + __finally42: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); diff --git a/vapi/clutk-0.3.vapi b/vapi/clutk-0.3.vapi index d74f24711..3084a43ef 100644 --- a/vapi/clutk-0.3.vapi +++ b/vapi/clutk-0.3.vapi @@ -162,8 +162,14 @@ namespace Ctk { public class IconView : Ctk.Actor, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { [CCode (type = "ClutterActor*", has_construct_function = false)] public IconView (); + public uint get_n_cols (); + public uint get_n_rows (); public int get_spacing (); public void set_spacing (int spacing); + [NoAccessorMethod] + public bool auto_fade_children { get; set construct; } + public uint n_cols { get; } + public uint n_rows { get; } public int spacing { get; set construct; } } [CCode (cheader_filename = "clutk/clutk.h")] |
