diff options
| author | Didier Roche <didier.roche@canonical.com> | 2010-09-03 16:29:12 +0200 |
|---|---|---|
| committer | Didier Roche <didier.roche@canonical.com> | 2010-09-03 16:29:12 +0200 |
| commit | d4298c211eee1c5d95b1807a3ef88fed378c9c8f (patch) | |
| tree | 189320e57a0aade584eebffcf63257549b987749 | |
| parent | 1c0188c03130d533619d631b514810618ec4fef6 (diff) | |
| parent | bc904d504e3fefa5610543a4a213044739559dbd (diff) | |
Import upstream version 0.2.34upstream-0.2.34
(bzr r55.4.24)
62 files changed, 2828 insertions, 971 deletions
@@ -1,5 +1,151 @@ # Generated by Makefile. Do not edit. +2010-09-03 Neil Jagdish Patel <neil.patel@canonical.com> + + Add devices.png to tarball + +2010-09-03 Neil Jagdish Patel <neil.patel@canonical.com> + + Bumped to next dev version + +2010-09-03 Neil Jagdish Patel <neil.patel@canonical.com> + + [release] 0.2.34 + +2010-09-03 Gord Allott <gord.allott@canonical.com> + + This branch queues requests to remove results from the views long enough to update the existing tiles if add_result comes in. This allows the views not to flash as much during searches. + +2010-09-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Make seaching in places a little nicer + +2010-09-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Add a batch processing for icon setting + +2010-09-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Some batchprocessing for pixbuf loading + +2010-09-03 Mirco Müller <mirco.mueller@ubuntu.com> + + Forgot to remove the debug()-calls + +2010-09-03 Mirco Müller <mirco.mueller@ubuntu.com> + + Merged Neil's fix-places-memleaks branch after review and approval. Fixes + numerous mem-leaks in Places and Quicklists. + + modified: + unity-private/launcher/quicklist-check-menu-item.vala + unity-private/launcher/quicklist-image-menu-item.vala + unity-private/launcher/quicklist-menu-item.vala + unity-private/launcher/quicklist-radio-menu-item.vala + unity-private/places/places-default-renderer-group.vala + unity-private/places/places-default-renderer-tiles.vala + unity-private/places/places-default-renderer.vala + unity-private/places/places-place-home-renderer.vala + unity-private/places/places-place-search-entry.vala + unity-private/places/places-view.vala + unity/unity-layered-bin.vala + +2010-09-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Correctly free child actors + +2010-09-02 Neil Jagdish Patel <neil.patel@canonical.com> + + Clean up memory usage inside places + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + fixes lp:623953 - applications that are favourited and then closed are now not removed + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + removed a debug + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + merged in latest unity and fixed lp:614329 + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + debugging + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + fixes a gettext translation to support non plural translations + +2010-09-02 Gord Allott <gord.allott@canonical.com> + + fix for lp:623953 - icons loaded after unity starts are reactive again + +2010-09-01 Gord Allott <gord.allott@canonical.com> + + small speed improvement to previous fix + +2010-09-01 Gord Allott <gord.allott@canonical.com> + + fix for lp:623953 + +2010-08-31 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Add support for latest unity-asset-pool + +2010-08-31 Neil Jagdish Patel <neil.patel@canonical.com> + + Add support for latest asset pool + +2010-08-31 Gord Allott <gord.allott@canonical.com> + + fix neil mode in the launcher and re-enable quicklists + +2010-08-31 Gord Allott <gord.allott@canonical.com> + + fixed double menu open issue + +2010-08-27 Gord Allott <gord.allott@canonical.com> + + re-enabled quicklists + +2010-08-27 Gord Allott <gord.allott@canonical.com> + + don't auto-scroll when already scrolling + +2010-08-27 Gord Allott <gord.allott@canonical.com> + + fixes the scroller so that its scrolls correctly for the use case of having not enough icons to fill the launcher + +2010-08-30 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/places/places-default-renderer.vala + + Merged (with small suggested fixes) after review and approval from Mikkel + into trunk. This brings the scrollbar closer to the mockups from Design. + +2010-08-28 Mirco Müller <mirco.mueller@ubuntu.com> + + add glow to slider + +2010-08-28 Mirco Müller <mirco.mueller@ubuntu.com> + + support drawing the three different styles for the slider depending on its 'state': normal, prelight, active... 'state'-handling should be done properly in Ctk.ScrollView + +2010-08-27 Mirco Müller <mirco.mueller@ubuntu.com> + + forgot to use update() instead of do_queue_redraw() for Unity.CairoCanvas + +2010-08-27 Mirco Müller <mirco.mueller@ubuntu.com> + + added missing background-pattern to trough, added striped pattern to prelight slider, work-around state-handling for slider still not working + +2010-08-26 Neil Jagdish Patel <neil.patel@canonical.com> + + Post release version bump + 2010-08-26 Neil Jagdish Patel <neil.patel@canonical.com> [release] 0.3.32 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for unity 0.2.32. +# Generated by GNU Autoconf 2.67 for unity 0.2.34. # # 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.32' -PACKAGE_STRING='unity 0.2.32' +PACKAGE_VERSION='0.2.34' +PACKAGE_STRING='unity 0.2.34' PACKAGE_BUGREPORT='https://launchpad.net/unity' PACKAGE_URL='' @@ -1574,7 +1574,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.32 to adapt to many kinds of systems. +\`configure' configures unity 0.2.34 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1644,7 +1644,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unity 0.2.32:";; + short | recursive ) echo "Configuration of unity 0.2.34:";; esac cat <<\_ACEOF @@ -1777,7 +1777,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unity configure 0.2.32 +unity configure 0.2.34 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2057,7 +2057,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.32, which was +It was created by unity $as_me 0.2.34, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2891,7 +2891,7 @@ fi # Define the identity of the package. PACKAGE=unity - VERSION=0.2.32 + VERSION=0.2.34 cat >>confdefs.h <<_ACEOF @@ -2934,8 +2934,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' DL_MAJOR_VERSION=0 DL_MINOR_VERSION=2 -DL_MICRO_VERSION=32 -DL_VERSION=0.2.32 +DL_MICRO_VERSION=34 +DL_VERSION=0.2.34 @@ -14546,7 +14546,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.32, which was +This file was extended by unity $as_me 0.2.34, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14612,7 +14612,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.32 +unity config.status 0.2.34 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 8bdd4f76c..22a9baa2c 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], [32]) +m4_define([unity_micro], [34]) m4_define([unity_api], [unity_major.unity_minor]) diff --git a/data/Makefile.am b/data/Makefile.am index cc7c38d35..a05f9388a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -4,6 +4,7 @@ dist_default_DATA = \ applications.png \ bfb.png \ dash_background.png \ + devices.png \ favourites.png \ files.png \ gradient.png \ diff --git a/data/Makefile.in b/data/Makefile.in index 25cae06a3..cbb6fc99e 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -250,6 +250,7 @@ dist_default_DATA = \ applications.png \ bfb.png \ dash_background.png \ + devices.png \ favourites.png \ files.png \ gradient.png \ diff --git a/data/applications.png b/data/applications.png Binary files differindex f3121db5e..51899194b 100644 --- a/data/applications.png +++ b/data/applications.png diff --git a/data/devices.png b/data/devices.png Binary files differnew file mode 100644 index 000000000..5847209cf --- /dev/null +++ b/data/devices.png diff --git a/data/files.png b/data/files.png Binary files differindex bde64565e..ebae21032 100644 --- a/data/files.png +++ b/data/files.png diff --git a/data/trash.png b/data/trash.png Binary files differindex acd2c8a8c..dff2d675e 100644 --- a/data/trash.png +++ b/data/trash.png diff --git a/unity-private/launcher/application-controller.c b/unity-private/launcher/application-controller.c index dbcbd42c5..785db80c0 100644 --- a/unity-private/launcher/application-controller.c +++ b/unity-private/launcher/application-controller.c @@ -152,6 +152,7 @@ struct _UnityLauncherScrollerChildControllerClass { struct _UnityLauncherApplicationController { UnityLauncherScrollerChildController parent_instance; UnityLauncherApplicationControllerPrivate * priv; + gboolean is_favorite; }; struct _UnityLauncherApplicationControllerClass { @@ -166,7 +167,6 @@ struct _UnityLauncherApplicationControllerPrivate { DbusmenuClient* menu_client; DbusmenuMenuitem* cached_menu; gint menu_items_realized_counter; - gboolean is_favorite; }; typedef enum { @@ -250,26 +250,26 @@ UnityLauncherScrollerChild* unity_launcher_scroller_child_controller_get_child ( GType unity_launcher_pin_type_get_type (void) G_GNUC_CONST; static void unity_launcher_application_controller_on_favorite_removed (UnityLauncherApplicationController* self, const char* uid); static void unity_launcher_application_controller_real_get_menu_actions (UnityLauncherScrollerChildController* base, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); -static void _lambda72_ (Block6Data* _data6_); -static void _lambda73_ (Block8Data* _data8_); -static void __lambda73__dbusmenu_menuitem_realized (DbusmenuMenuitem* _sender, gpointer self); +static void _lambda73_ (Block6Data* _data6_); +static void _lambda74_ (Block8Data* _data8_); +static void __lambda74__dbusmenu_menuitem_realized (DbusmenuMenuitem* _sender, gpointer self); static Block8Data* block8_data_ref (Block8Data* _data8_); static void block8_data_unref (Block8Data* _data8_); -static void __lambda72__dbusmenu_client_layout_updated (DbusmenuClient* _sender, gpointer self); +static void __lambda73__dbusmenu_client_layout_updated (DbusmenuClient* _sender, gpointer self); static Block6Data* block6_data_ref (Block6Data* _data6_); static void block6_data_unref (Block6Data* _data6_); static void _g_list_free_g_object_unref (GList* self); -static void _lambda74_ (guint timestamp, Block9Data* _data9_); -static void __lambda74__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); +static void _lambda75_ (guint timestamp, Block9Data* _data9_); +static void __lambda75__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static Block9Data* block9_data_ref (Block9Data* _data9_); static void block9_data_unref (Block9Data* _data9_); static Block7Data* block7_data_ref (Block7Data* _data7_); static void block7_data_unref (Block7Data* _data7_); static void unity_launcher_application_controller_real_get_menu_navigation (UnityLauncherScrollerChildController* base, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); -static void _lambda75_ (guint timestamp, UnityLauncherApplicationController* self); -static void __lambda75__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static void _lambda76_ (guint timestamp, UnityLauncherApplicationController* self); static void __lambda76__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); +static void _lambda77_ (guint timestamp, UnityLauncherApplicationController* self); +static void __lambda77__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static gint unity_launcher_application_controller_order_app_windows (void* a, void* b); static void unity_launcher_application_controller_real_activate (UnityLauncherScrollerChildController* base); void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value); @@ -286,9 +286,9 @@ void unity_launcher_application_controller_detach_application (UnityLauncherAppl static void _unity_launcher_application_controller_detach_application_bamf_view_closed (BamfView* _sender, gpointer self); static void unity_launcher_application_controller_on_app_urgant_changed (UnityLauncherApplicationController* self, gboolean urgancy); static void _unity_launcher_application_controller_on_app_urgant_changed_bamf_view_urgent_changed (BamfView* _sender, gboolean object, gpointer self); -static void _lambda77_ (gboolean value, UnityLauncherApplicationController* self); +static void _lambda78_ (gboolean value, UnityLauncherApplicationController* self); void unity_launcher_scroller_child_controller_set_hide (UnityLauncherScrollerChildController* self, gboolean value); -static void __lambda77__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); +static void __lambda78__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); void unity_launcher_scroller_child_controller_set_name (UnityLauncherScrollerChildController* self, const char* value); const char* unity_launcher_scroller_child_controller_get_name (UnityLauncherScrollerChildController* self); void unity_launcher_scroller_child_controller_load_icon_from_icon_name (UnityLauncherScrollerChildController* self, const char* icon_name); @@ -519,7 +519,7 @@ static void unity_launcher_application_controller_on_favorite_added (UnityLaunch favorites = unity_favorites_get_default (); desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file"); if (_vala_strcmp0 (desktop_filename, self->priv->_desktop_file) == 0) { - self->priv->is_favorite = TRUE; + self->is_favorite = TRUE; unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED; } _g_free0 (desktop_filename); @@ -544,7 +544,7 @@ static void unity_launcher_application_controller_on_favorite_removed (UnityLaun favorites = unity_favorites_get_default (); desktop_filename = unity_favorites_get_string (favorites, uid, "desktop_file"); if (_vala_strcmp0 (desktop_filename, self->priv->_desktop_file) == 0) { - self->priv->is_favorite = FALSE; + self->is_favorite = FALSE; unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_UNPINNED; unity_launcher_application_controller_closed (self); if (string_contains (desktop_filename, ".local")) { @@ -569,7 +569,7 @@ static const char* string_to_string (const char* self) { } -static void _lambda73_ (Block8Data* _data8_) { +static void _lambda74_ (Block8Data* _data8_) { Block6Data* _data6_; Block7Data* _data7_; UnityLauncherApplicationController * self; @@ -583,8 +583,8 @@ static void _lambda73_ (Block8Data* _data8_) { } -static void __lambda73__dbusmenu_menuitem_realized (DbusmenuMenuitem* _sender, gpointer self) { - _lambda73_ (self); +static void __lambda74__dbusmenu_menuitem_realized (DbusmenuMenuitem* _sender, gpointer self) { + _lambda74_ (self); } @@ -603,7 +603,7 @@ static void block8_data_unref (Block8Data* _data8_) { } -static void _lambda72_ (Block6Data* _data6_) { +static void _lambda73_ (Block6Data* _data6_) { Block7Data* _data7_; UnityLauncherApplicationController * self; Block8Data* _data8_; @@ -631,7 +631,7 @@ static void _lambda72_ (Block6Data* _data6_) { DbusmenuMenuitem* menuitem; menuitem = _g_object_ref0 ((DbusmenuMenuitem*) menuitem_it->data); { - g_signal_connect_data (menuitem, "realized", (GCallback) __lambda73__dbusmenu_menuitem_realized, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0); + g_signal_connect_data (menuitem, "realized", (GCallback) __lambda74__dbusmenu_menuitem_realized, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0); _g_object_unref0 (menuitem); } } @@ -640,8 +640,8 @@ static void _lambda72_ (Block6Data* _data6_) { } -static void __lambda72__dbusmenu_client_layout_updated (DbusmenuClient* _sender, gpointer self) { - _lambda72_ (self); +static void __lambda73__dbusmenu_client_layout_updated (DbusmenuClient* _sender, gpointer self) { + _lambda73_ (self); } @@ -667,7 +667,7 @@ static void _g_list_free_g_object_unref (GList* self) { } -static void _lambda74_ (guint timestamp, Block9Data* _data9_) { +static void _lambda75_ (guint timestamp, Block9Data* _data9_) { Block7Data* _data7_; UnityLauncherApplicationController * self; _data7_ = _data9_->_data7_; @@ -676,8 +676,8 @@ static void _lambda74_ (guint timestamp, Block9Data* _data9_) { } -static void __lambda74__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda74_ (object, self); +static void __lambda75__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda75_ (object, self); } @@ -749,7 +749,7 @@ static void unity_launcher_application_controller_real_get_menu_actions (UnityLa _data6_->path = g_strdup (bamf_indicator_get_dbus_menu_path ((_tmp0_ = view, BAMF_IS_INDICATOR (_tmp0_) ? ((BamfIndicator*) _tmp0_) : NULL))); _data6_->remote_address = g_strdup (bamf_indicator_get_remote_address ((_tmp1_ = view, BAMF_IS_INDICATOR (_tmp1_) ? ((BamfIndicator*) _tmp1_) : NULL))); self->priv->menu_client = (_tmp2_ = dbusmenu_client_new (_data6_->remote_address, _data6_->path), _g_object_unref0 (self->priv->menu_client), _tmp2_); - g_signal_connect_data (self->priv->menu_client, "layout-updated", (GCallback) __lambda72__dbusmenu_client_layout_updated, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0); + g_signal_connect_data (self->priv->menu_client, "layout-updated", (GCallback) __lambda73__dbusmenu_client_layout_updated, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0); block6_data_unref (_data6_); } _g_object_unref0 (view); @@ -797,7 +797,7 @@ static void unity_launcher_application_controller_real_get_menu_actions (UnityLa dbusmenu_menuitem_property_set (shortcut_item, DBUSMENU_MENUITEM_PROP_LABEL, local_name); dbusmenu_menuitem_property_set_bool (shortcut_item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (shortcut_item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_signal_connect_data (shortcut_item, "item-activated", (GCallback) __lambda74__dbusmenu_menuitem_item_activated, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0); + g_signal_connect_data (shortcut_item, "item-activated", (GCallback) __lambda75__dbusmenu_menuitem_item_activated, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0); dbusmenu_menuitem_child_append (root, shortcut_item); _g_object_unref0 (shortcut_item); _g_free0 (local_name); @@ -812,17 +812,17 @@ static void unity_launcher_application_controller_real_get_menu_actions (UnityLa } -static void _lambda75_ (guint timestamp, UnityLauncherApplicationController* self) { +static void _lambda76_ (guint timestamp, UnityLauncherApplicationController* self) { unity_launcher_application_controller_set_sticky (self, !unity_launcher_application_controller_is_sticky (self)); } -static void __lambda75__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda75_ (object, self); +static void __lambda76__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda76_ (object, self); } -static void _lambda76_ (guint timestamp, UnityLauncherApplicationController* self) { +static void _lambda77_ (guint timestamp, UnityLauncherApplicationController* self) { if (BAMF_IS_APPLICATION (self->priv->app)) { GArray* xids; xids = bamf_application_get_xids (self->priv->app); @@ -832,8 +832,8 @@ static void _lambda76_ (guint timestamp, UnityLauncherApplicationController* sel } -static void __lambda76__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda76_ (object, self); +static void __lambda77__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda77_ (object, self); } @@ -865,7 +865,7 @@ static void unity_launcher_application_controller_real_get_menu_navigation (Unit } dbusmenu_menuitem_property_set_bool (pinning_item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (pinning_item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_signal_connect_object (pinning_item, "item-activated", (GCallback) __lambda75__dbusmenu_menuitem_item_activated, self, 0); + g_signal_connect_object (pinning_item, "item-activated", (GCallback) __lambda76__dbusmenu_menuitem_item_activated, self, 0); dbusmenu_menuitem_child_append (root, pinning_item); _g_object_unref0 (pinning_item); } @@ -875,7 +875,7 @@ static void unity_launcher_application_controller_real_get_menu_navigation (Unit dbusmenu_menuitem_property_set (app_item, DBUSMENU_MENUITEM_PROP_LABEL, _ ("Quit")); dbusmenu_menuitem_property_set_bool (app_item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (app_item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_signal_connect_object (app_item, "item-activated", (GCallback) __lambda76__dbusmenu_menuitem_item_activated, self, 0); + g_signal_connect_object (app_item, "item-activated", (GCallback) __lambda77__dbusmenu_menuitem_item_activated, self, 0); dbusmenu_menuitem_child_append (root, app_item); _g_object_unref0 (app_item); } @@ -1030,13 +1030,13 @@ static void _unity_launcher_application_controller_on_app_urgant_changed_bamf_vi } -static void _lambda77_ (gboolean value, UnityLauncherApplicationController* self) { +static void _lambda78_ (gboolean value, UnityLauncherApplicationController* self) { unity_launcher_scroller_child_controller_set_hide ((UnityLauncherScrollerChildController*) self, !value); } -static void __lambda77__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { - _lambda77_ (object, self); +static void __lambda78__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { + _lambda78_ (object, self); } @@ -1058,7 +1058,7 @@ void unity_launcher_application_controller_attach_application (UnityLauncherAppl g_signal_connect_object ((BamfView*) self->priv->app, "active-changed", (GCallback) _unity_launcher_application_controller_on_app_active_changed_bamf_view_active_changed, self, 0); 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); - g_signal_connect_object ((BamfView*) self->priv->app, "user-visible-changed", (GCallback) __lambda77__bamf_view_user_visible_changed, self, 0); + g_signal_connect_object ((BamfView*) self->priv->app, "user-visible-changed", (GCallback) __lambda78__bamf_view_user_visible_changed, self, 0); unity_launcher_scroller_child_controller_set_name ((UnityLauncherScrollerChildController*) self, _tmp2_ = bamf_view_get_name ((BamfView*) self->priv->app)); _g_free0 (_tmp2_); if (unity_launcher_scroller_child_controller_get_name ((UnityLauncherScrollerChildController*) self) == NULL) { @@ -1279,7 +1279,7 @@ static GObject * unity_launcher_application_controller_constructor (GType type, favorites = unity_favorites_get_default (); g_signal_connect_object (favorites, "favorite-added", (GCallback) _unity_launcher_application_controller_on_favorite_added_unity_favorites_favorite_added, self, 0); g_signal_connect_object (favorites, "favorite-removed", (GCallback) _unity_launcher_application_controller_on_favorite_removed_unity_favorites_favorite_removed, self, 0); - self->priv->is_favorite = unity_launcher_application_controller_is_sticky (self); + self->is_favorite = unity_launcher_application_controller_is_sticky (self); unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_UNPINNED; if (unity_launcher_application_controller_is_sticky (self)) { unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self)->pin_type = UNITY_LAUNCHER_PIN_TYPE_PINNED; @@ -1308,7 +1308,7 @@ static void unity_launcher_application_controller_class_init (UnityLauncherAppli static void unity_launcher_application_controller_instance_init (UnityLauncherApplicationController * self) { self->priv = UNITY_LAUNCHER_APPLICATION_CONTROLLER_GET_PRIVATE (self); self->priv->app = NULL; - self->priv->is_favorite = FALSE; + self->is_favorite = FALSE; } diff --git a/unity-private/launcher/application-controller.vala b/unity-private/launcher/application-controller.vala index 052968189..6ab692561 100644 --- a/unity-private/launcher/application-controller.vala +++ b/unity-private/launcher/application-controller.vala @@ -38,7 +38,7 @@ namespace Unity.Launcher private Dbusmenu.Menuitem cached_menu; private int menu_items_realized_counter; - private bool is_favorite = false; + public bool is_favorite = false; public ApplicationController (string? desktop_file_, ScrollerChild child_) { diff --git a/unity-private/launcher/launcher.c b/unity-private/launcher/launcher.c index c8b5c5fc7..7488dac95 100644 --- a/unity-private/launcher/launcher.c +++ b/unity-private/launcher/launcher.c @@ -184,8 +184,8 @@ UnityLauncherScrollerView* unity_launcher_scroller_view_new (UnityLauncherScroll UnityLauncherScrollerView* unity_launcher_scroller_view_construct (GType object_type, UnityLauncherScrollerModel* _model, CtkEffectCache* _cache); 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 _lambda92_ (UnityLauncherLauncher* self); -static void __lambda92__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self); +static void _lambda93_ (UnityLauncherLauncher* self); +static void __lambda93__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self); static GObject * unity_launcher_launcher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_launcher_launcher_finalize (GObject* obj); static void unity_launcher_launcher_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -368,15 +368,15 @@ static void unity_launcher_launcher_set_model (UnityLauncherLauncher* self, Unit } -static void _lambda92_ (UnityLauncherLauncher* self) { +static void _lambda93_ (UnityLauncherLauncher* self) { if (clutter_timeline_is_playing (self->priv->view->fling_timeline) == FALSE) { ctk_effect_cache_update_texture_cache (self->priv->launcher_container->cache); } } -static void __lambda92__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self) { - _lambda92_ (self); +static void __lambda93__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self) { + _lambda93_ (self); } @@ -397,7 +397,7 @@ static GObject * unity_launcher_launcher_constructor (GType type, guint n_constr self->priv->launcher_container = (_tmp1_ = g_object_ref_sink (unity_launcher_launcher_container_new ()), _g_object_unref0 (self->priv->launcher_container), _tmp1_); self->priv->view = (_tmp2_ = g_object_ref_sink (unity_launcher_scroller_view_new (self->priv->_model, self->priv->launcher_container->cache)), _g_object_unref0 (self->priv->view), _tmp2_); self->priv->controller = (_tmp3_ = unity_launcher_scroller_controller_new (self->priv->_model, self->priv->view), _g_object_unref0 (self->priv->controller), _tmp3_); - g_signal_connect_object ((ClutterActor*) self->priv->view, "queue-redraw", (GCallback) __lambda92__clutter_actor_queue_redraw, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->view, "queue-redraw", (GCallback) __lambda93__clutter_actor_queue_redraw, self, 0); } return obj; } diff --git a/unity-private/launcher/quicklist-check-menu-item.c b/unity-private/launcher/quicklist-check-menu-item.c index be0900d61..1959c336f 100644 --- a/unity-private/launcher/quicklist-check-menu-item.c +++ b/unity-private/launcher/quicklist-check-menu-item.c @@ -404,6 +404,9 @@ static void unity_launcher_quicklist_check_menu_item_finalize (GObject* obj) { g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) __unity_launcher_quicklist_check_menu_item_on_leave_clutter_actor_leave_event, self); g_signal_parse_name ("button-press-event", CLUTTER_TYPE_ACTOR, &_tmp6_, NULL, FALSE); g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) __unity_launcher_quicklist_check_menu_item_on_mouse_down_clutter_actor_button_press_event, self); + if (CLUTTER_IS_ACTOR (self->priv->item_background)) { + clutter_actor_unparent ((ClutterActor*) self->priv->item_background); + } } _g_object_unref0 (self->priv->item_background); _g_free0 (self->priv->old_label); diff --git a/unity-private/launcher/quicklist-check-menu-item.vala b/unity-private/launcher/quicklist-check-menu-item.vala index e503cad05..9a001de84 100644 --- a/unity-private/launcher/quicklist-check-menu-item.vala +++ b/unity-private/launcher/quicklist-check-menu-item.vala @@ -209,6 +209,9 @@ namespace Unity.Launcher this.enter_event.disconnect (this._on_enter); this.leave_event.disconnect (this._on_leave); this.button_press_event.disconnect (this._on_mouse_down); + + if (this.item_background is Clutter.Actor) + this.item_background.unparent (); } construct diff --git a/unity-private/launcher/quicklist-image-menu-item.c b/unity-private/launcher/quicklist-image-menu-item.c index 0b658313d..a0716fbbe 100644 --- a/unity-private/launcher/quicklist-image-menu-item.c +++ b/unity-private/launcher/quicklist-image-menu-item.c @@ -404,6 +404,9 @@ static void unity_launcher_quicklist_image_menu_item_finalize (GObject* obj) { g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) __unity_launcher_quicklist_image_menu_item_on_leave_clutter_actor_leave_event, self); g_signal_parse_name ("button-press-event", CLUTTER_TYPE_ACTOR, &_tmp6_, NULL, FALSE); g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) __unity_launcher_quicklist_image_menu_item_on_mouse_down_clutter_actor_button_press_event, self); + if (CLUTTER_IS_ACTOR (self->priv->item_background)) { + clutter_actor_unparent ((ClutterActor*) self->priv->item_background); + } } _g_object_unref0 (self->priv->item_background); _g_free0 (self->priv->old_label); diff --git a/unity-private/launcher/quicklist-image-menu-item.vala b/unity-private/launcher/quicklist-image-menu-item.vala index 806f071b0..566b9b63b 100644 --- a/unity-private/launcher/quicklist-image-menu-item.vala +++ b/unity-private/launcher/quicklist-image-menu-item.vala @@ -206,6 +206,9 @@ namespace Unity.Launcher this.enter_event.disconnect (this._on_enter); this.leave_event.disconnect (this._on_leave); this.button_press_event.disconnect (this._on_mouse_down); + + if (this.item_background is Clutter.Actor) + this.item_background.unparent (); } construct diff --git a/unity-private/launcher/quicklist-menu-item.c b/unity-private/launcher/quicklist-menu-item.c index 9996c07bf..ae539f5ea 100644 --- a/unity-private/launcher/quicklist-menu-item.c +++ b/unity-private/launcher/quicklist-menu-item.c @@ -407,6 +407,9 @@ static void unity_launcher_quicklist_menu_item_finalize (GObject* obj) { g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) __unity_launcher_quicklist_menu_item_on_leave_clutter_actor_leave_event, self); g_signal_parse_name ("button-press-event", CLUTTER_TYPE_ACTOR, &_tmp6_, NULL, FALSE); g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) __unity_launcher_quicklist_menu_item_on_mouse_down_clutter_actor_button_press_event, self); + if (CLUTTER_IS_ACTOR (self->priv->item_background)) { + clutter_actor_unparent ((ClutterActor*) self->priv->item_background); + } } _g_object_unref0 (self->priv->item_background); _g_free0 (self->priv->old_label); diff --git a/unity-private/launcher/quicklist-menu-item.vala b/unity-private/launcher/quicklist-menu-item.vala index 0a6b62ee6..5f8cb6ffa 100644 --- a/unity-private/launcher/quicklist-menu-item.vala +++ b/unity-private/launcher/quicklist-menu-item.vala @@ -218,6 +218,9 @@ namespace Unity.Launcher this.enter_event.disconnect (this._on_enter); this.leave_event.disconnect (this._on_leave); this.button_press_event.disconnect (this._on_mouse_down); + + if (this.item_background is Clutter.Actor) + this.item_background.unparent (); } construct diff --git a/unity-private/launcher/quicklist-radio-menu-item.c b/unity-private/launcher/quicklist-radio-menu-item.c index 8a135d082..93649afa5 100644 --- a/unity-private/launcher/quicklist-radio-menu-item.c +++ b/unity-private/launcher/quicklist-radio-menu-item.c @@ -404,6 +404,9 @@ static void unity_launcher_quicklist_radio_menu_item_finalize (GObject* obj) { g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) __unity_launcher_quicklist_radio_menu_item_on_leave_clutter_actor_leave_event, self); g_signal_parse_name ("button-press-event", CLUTTER_TYPE_ACTOR, &_tmp6_, NULL, FALSE); g_signal_handlers_disconnect_matched ((ClutterActor*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) __unity_launcher_quicklist_radio_menu_item_on_mouse_down_clutter_actor_button_press_event, self); + if (CLUTTER_IS_ACTOR (self->priv->item_background)) { + clutter_actor_unparent ((ClutterActor*) self->priv->item_background); + } } _g_object_unref0 (self->priv->item_background); _g_free0 (self->priv->old_label); diff --git a/unity-private/launcher/quicklist-radio-menu-item.vala b/unity-private/launcher/quicklist-radio-menu-item.vala index e9b826c31..dac90fcc6 100644 --- a/unity-private/launcher/quicklist-radio-menu-item.vala +++ b/unity-private/launcher/quicklist-radio-menu-item.vala @@ -207,6 +207,9 @@ namespace Unity.Launcher this.enter_event.disconnect (this._on_enter); this.leave_event.disconnect (this._on_leave); this.button_press_event.disconnect (this._on_mouse_down); + + if (this.item_background is Clutter.Actor) + this.item_background.unparent (); } construct diff --git a/unity-private/launcher/scroller-controller.c b/unity-private/launcher/scroller-controller.c index 44b8fc2e3..c4da553ad 100644 --- a/unity-private/launcher/scroller-controller.c +++ b/unity-private/launcher/scroller-controller.c @@ -31,6 +31,10 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> #include <glib/gstdio.h> #include <clutter/clutter.h> @@ -96,6 +100,22 @@ typedef struct _UnityLauncherScrollerChildClass UnityLauncherScrollerChildClass; typedef struct _UnityLauncherApplicationController UnityLauncherApplicationController; typedef struct _UnityLauncherApplicationControllerClass UnityLauncherApplicationControllerClass; + +#define UNITY_LAUNCHER_SCROLLER_CHILD_TYPE_GROUP_TYPE (unity_launcher_scroller_child_group_type_get_type ()) +typedef struct _UnityLauncherScrollerChildControllerPrivate UnityLauncherScrollerChildControllerPrivate; + +#define UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER (unity_launcher_quicklist_controller_get_type ()) +#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistController)) +#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistControllerClass)) +#define UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER)) +#define UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER)) +#define UNITY_LAUNCHER_QUICKLIST_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_QUICKLIST_CONTROLLER, UnityLauncherQuicklistControllerClass)) + +typedef struct _UnityLauncherQuicklistController UnityLauncherQuicklistController; +typedef struct _UnityLauncherQuicklistControllerClass UnityLauncherQuicklistControllerClass; + +#define UNITY_LAUNCHER_TYPE_SCROLLER_CHILD_CONTROLLER_MENU_STATE (unity_launcher_scroller_child_controller_menu_state_get_type ()) +typedef struct _UnityLauncherApplicationControllerPrivate UnityLauncherApplicationControllerPrivate; typedef struct _Block12Data Block12Data; #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _UnityLauncherScrollerChildPrivate UnityLauncherScrollerChildPrivate; @@ -103,8 +123,6 @@ typedef struct _UnityLauncherScrollerChildPrivate UnityLauncherScrollerChildPriv #define UNITY_LAUNCHER_TYPE_PIN_TYPE (unity_launcher_pin_type_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define UNITY_LAUNCHER_SCROLLER_CHILD_TYPE_GROUP_TYPE (unity_launcher_scroller_child_group_type_get_type ()) - #define UNITY_LAUNCHER_SCROLLER_MODEL_TYPE_ITERATOR (unity_launcher_scroller_model_iterator_get_type ()) #define UNITY_LAUNCHER_SCROLLER_MODEL_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_SCROLLER_MODEL_TYPE_ITERATOR, UnityLauncherScrollerModelIterator)) #define UNITY_LAUNCHER_SCROLLER_MODEL_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_SCROLLER_MODEL_TYPE_ITERATOR, UnityLauncherScrollerModelIteratorClass)) @@ -137,6 +155,51 @@ struct _UnityLauncherScrollerControllerPrivate { float last_drag_y; }; +typedef enum { + UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_APPLICATION, + UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_PLACE, + UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_DEVICE, + UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_SYSTEM +} UnityLauncherScrollerChildGroupType; + +typedef void (*UnityLauncherScrollerChildControllermenu_cb) (DbusmenuMenuitem* menu, void* user_data); +typedef enum { + UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_NO_MENU, + UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_LABEL, + UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_MENU, + UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_MENU_CLOSE_WHEN_LEAVE +} UnityLauncherScrollerChildControllerMenuState; + +struct _UnityLauncherScrollerChildController { + GObject parent_instance; + UnityLauncherScrollerChildControllerPrivate * priv; + UnityLauncherScrollerChildControllerMenuState menu_state; + guint32 last_press_time; + gboolean button_down; + float click_start_pos_x; + float click_start_pos_y; + gint drag_sensitivity; +}; + +struct _UnityLauncherScrollerChildControllerClass { + GObjectClass parent_class; + void (*get_menu_actions) (UnityLauncherScrollerChildController* self, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); + void (*get_menu_navigation) (UnityLauncherScrollerChildController* self, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); + void (*activate) (UnityLauncherScrollerChildController* self); + UnityLauncherQuicklistController* (*get_menu_controller) (UnityLauncherScrollerChildController* self); + gboolean (*can_drag) (UnityLauncherScrollerChildController* self); +}; + +struct _UnityLauncherApplicationController { + UnityLauncherScrollerChildController parent_instance; + UnityLauncherApplicationControllerPrivate * priv; + gboolean is_favorite; +}; + +struct _UnityLauncherApplicationControllerClass { + UnityLauncherScrollerChildControllerClass parent_class; +}; + struct _Block12Data { int _ref_count_; UnityLauncherScrollerController * self; @@ -167,13 +230,6 @@ typedef enum { UNITY_LAUNCHER_APP_TYPE_ERROR_NO_DESKTOP_FILE } UnityLauncherAppTypeError; #define UNITY_LAUNCHER_APP_TYPE_ERROR unity_launcher_app_type_error_quark () -typedef enum { - UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_APPLICATION, - UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_PLACE, - UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_DEVICE, - UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_SYSTEM -} UnityLauncherScrollerChildGroupType; - static gpointer unity_launcher_scroller_controller_parent_class = NULL; @@ -198,27 +254,31 @@ static UnityLauncherScrollerChildController* unity_launcher_scroller_controller_ UnityLauncherScrollerChild* unity_launcher_scroller_model_get (UnityLauncherScrollerModel* self, gint i); void unity_launcher_scroller_child_controller_activate (UnityLauncherScrollerChildController* self); static void unity_launcher_scroller_controller_on_super_key_active (UnityLauncherScrollerController* self); -static gboolean _lambda90_ (UnityLauncherScrollerController* self); +static gboolean _lambda91_ (UnityLauncherScrollerController* self); UnityLauncherScrollerView* unity_launcher_scroller_controller_get_view (UnityLauncherScrollerController* self); void unity_launcher_scroller_view_enable_keyboard_selection_mode (UnityLauncherScrollerView* self, gboolean choice); -static gboolean __lambda90__gsource_func (gpointer self); +static gboolean __lambda91__gsource_func (gpointer self); static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLauncherScrollerController* self, GObject* object); GType unity_launcher_application_controller_get_type (void) G_GNUC_CONST; 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); UnityLauncherScrollerChild* unity_launcher_scroller_child_new (void); UnityLauncherScrollerChild* unity_launcher_scroller_child_construct (GType object_type); +GType unity_launcher_scroller_child_group_type_get_type (void) G_GNUC_CONST; +void unity_launcher_scroller_child_set_group_type (UnityLauncherScrollerChild* self, UnityLauncherScrollerChildGroupType value); 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_); void unity_launcher_scroller_model_add (UnityLauncherScrollerModel* self, UnityLauncherScrollerChild* child); static void unity_launcher_scroller_controller_on_scroller_controller_closed (UnityLauncherScrollerController* self, UnityLauncherScrollerChildController* controller); static void _unity_launcher_scroller_controller_on_scroller_controller_closed_unity_launcher_scroller_child_controller_request_removal (UnityLauncherScrollerChildController* _sender, gpointer self); -static void _lambda91_ (Block12Data* _data12_); +static void _lambda92_ (Block12Data* _data12_); gboolean unity_launcher_scroller_child_controller_get_hide (UnityLauncherScrollerChildController* self); gboolean unity_launcher_scroller_model_contains (UnityLauncherScrollerModel* self, UnityLauncherScrollerChild* child); UnityLauncherScrollerChild* unity_launcher_scroller_child_controller_get_child (UnityLauncherScrollerChildController* self); +GType unity_launcher_quicklist_controller_get_type (void) G_GNUC_CONST; +GType unity_launcher_scroller_child_controller_menu_state_get_type (void) G_GNUC_CONST; void unity_launcher_scroller_model_remove (UnityLauncherScrollerModel* self, UnityLauncherScrollerChild* child); -static void __lambda91__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void __lambda92__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static Block12Data* block12_data_ref (Block12Data* _data12_); static void block12_data_unref (Block12Data* _data12_); gboolean unity_launcher_application_controller_is_sticky (UnityLauncherApplicationController* self); @@ -239,7 +299,6 @@ static void unity_launcher_scroller_controller_on_unity_drag_drop (UnityLauncher static void _unity_launcher_scroller_controller_on_unity_drag_drop_unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); void unity_launcher_scroller_view_set_drag_indicator_active (UnityLauncherScrollerView* self, gboolean value); void unity_launcher_scroller_view_set_drag_indicator_space (UnityLauncherScrollerView* self, gboolean value); -GType unity_launcher_scroller_child_group_type_get_type (void) G_GNUC_CONST; UnityLauncherScrollerChildGroupType unity_launcher_scroller_child_get_group_type (UnityLauncherScrollerChild* self); gboolean unity_launcher_scroller_child_get_enable_close_state (UnityLauncherScrollerChild* self); void unity_launcher_scroller_child_set_enable_close_state (UnityLauncherScrollerChild* self, gboolean value); @@ -321,7 +380,7 @@ static void unity_launcher_scroller_controller_on_super_key_modifier_release (Un } -static gboolean _lambda90_ (UnityLauncherScrollerController* self) { +static gboolean _lambda91_ (UnityLauncherScrollerController* self) { gboolean result = FALSE; unity_launcher_scroller_view_enable_keyboard_selection_mode (self->priv->_view, unity_shell_get_super_key_active (unity_global_shell)); result = FALSE; @@ -329,9 +388,9 @@ static gboolean _lambda90_ (UnityLauncherScrollerController* self) { } -static gboolean __lambda90__gsource_func (gpointer self) { +static gboolean __lambda91__gsource_func (gpointer self) { gboolean result; - result = _lambda90_ (self); + result = _lambda91_ (self); return result; } @@ -345,7 +404,7 @@ static void unity_launcher_scroller_controller_on_super_key_active (UnityLaunche _tmp0_ = FALSE; } if (_tmp0_) { - self->priv->super_key_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda90__gsource_func, g_object_ref (self), g_object_unref); + self->priv->super_key_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda91__gsource_func, g_object_ref (self), g_object_unref); } else { if (self->priv->super_key_source != 0) { g_source_remove (self->priv->super_key_source); @@ -366,10 +425,9 @@ static void _unity_launcher_scroller_controller_on_scroller_controller_closed_un } -static void _lambda91_ (Block12Data* _data12_) { +static void _lambda92_ (Block12Data* _data12_) { UnityLauncherScrollerController * self; gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; self = _data12_->self; if (unity_launcher_scroller_child_controller_get_hide (_data12_->controller)) { _tmp0_ = unity_launcher_scroller_model_contains (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); @@ -377,21 +435,30 @@ static void _lambda91_ (Block12Data* _data12_) { _tmp0_ = FALSE; } if (_tmp0_) { - unity_launcher_scroller_model_remove (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); - } - if (!unity_launcher_scroller_child_controller_get_hide (_data12_->controller)) { - _tmp1_ = unity_launcher_scroller_model_contains (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)) == FALSE; + if (UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (_data12_->controller)) { + UnityLauncherScrollerChildController* _tmp1_; + if ((_tmp1_ = _data12_->controller, UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (_tmp1_) ? ((UnityLauncherApplicationController*) _tmp1_) : NULL)->is_favorite == FALSE) { + unity_launcher_scroller_model_remove (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); + } + } else { + unity_launcher_scroller_model_remove (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); + } } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - unity_launcher_scroller_model_add (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); + gboolean _tmp2_ = FALSE; + if (!unity_launcher_scroller_child_controller_get_hide (_data12_->controller)) { + _tmp2_ = unity_launcher_scroller_model_contains (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)) == FALSE; + } else { + _tmp2_ = FALSE; + } + if (_tmp2_) { + unity_launcher_scroller_model_add (self->priv->_model, unity_launcher_scroller_child_controller_get_child (_data12_->controller)); + } } } -static void __lambda91__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda91_ (self); +static void __lambda92__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda92_ (self); } @@ -443,6 +510,7 @@ static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLau UnityLauncherScrollerChildController* _tmp4_; UnityLauncherScrollerChildController* _tmp5_; child = g_object_ref_sink (unity_launcher_scroller_child_new ()); + unity_launcher_scroller_child_set_group_type (child, UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_APPLICATION); _data12_->controller = (_tmp4_ = (UnityLauncherScrollerChildController*) unity_launcher_application_controller_new (NULL, child), _g_object_unref0 (_data12_->controller), _tmp4_); unity_launcher_application_controller_attach_application ((_tmp5_ = _data12_->controller, UNITY_LAUNCHER_IS_APPLICATION_CONTROLLER (_tmp5_) ? ((UnityLauncherApplicationController*) _tmp5_) : NULL), app); if (bamf_view_user_visible ((BamfView*) app)) { @@ -450,7 +518,7 @@ static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLau } gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->childcontrollers, _data12_->controller); g_signal_connect_object (_data12_->controller, "request-removal", (GCallback) _unity_launcher_scroller_controller_on_scroller_controller_closed_unity_launcher_scroller_child_controller_request_removal, self, 0); - g_signal_connect_data ((GObject*) _data12_->controller, "notify::hide", (GCallback) __lambda91__g_object_notify, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0); + g_signal_connect_data ((GObject*) _data12_->controller, "notify::hide", (GCallback) __lambda92__g_object_notify, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0); _g_object_unref0 (child); } _g_free0 (desktop_file); diff --git a/unity-private/launcher/scroller-controller.vala b/unity-private/launcher/scroller-controller.vala index c338d7ba3..493c5482a 100644 --- a/unity-private/launcher/scroller-controller.vala +++ b/unity-private/launcher/scroller-controller.vala @@ -126,6 +126,7 @@ namespace Unity.Launcher else { ScrollerChild child = new ScrollerChild (); + child.group_type = ScrollerChild.GroupType.APPLICATION; controller = new ApplicationController (null, child); (controller as ApplicationController).attach_application (app); if (app.user_visible ()) @@ -134,9 +135,23 @@ namespace Unity.Launcher childcontrollers.add (controller); controller.request_removal.connect (on_scroller_controller_closed); controller.notify["hide"].connect (() => { + + // weird logic here i know, basically more if's than needed because + // i don't want to access the controller as a subclass until + // i know it is of that subclass type. if (controller.hide && controller.child in model) - model.remove (controller.child); - if (!controller.hide && (controller.child in model) == false) + { + if (controller is ApplicationController) + { + if ((controller as ApplicationController).is_favorite == false) + model.remove (controller.child); + } + else + { + model.remove (controller.child); + } + } + else if (!controller.hide && (controller.child in model) == false) model.add (controller.child); }); } diff --git a/unity-private/launcher/scroller-view.c b/unity-private/launcher/scroller-view.c index 6b52ec1a6..8b543dcd8 100644 --- a/unity-private/launcher/scroller-view.c +++ b/unity-private/launcher/scroller-view.c @@ -199,6 +199,7 @@ struct _UnityLauncherScrollerViewPrivate { UnityLauncherScrollerViewType view_type; gboolean do_logic_pick; float last_known_pointer_x; + gboolean can_scroll; gboolean is_scrolling; float scroll_position; float settle_position; @@ -341,22 +342,23 @@ static float unity_launcher_scroller_view_get_available_height (UnityLauncherScr static void unity_launcher_scroller_view_disable_animations_on_children (UnityLauncherScrollerView* self, ClutterEvent* event); void unity_launcher_scroller_view_set_is_autoscrolling (UnityLauncherScrollerView* self, gboolean value); static void unity_launcher_scroller_view_model_child_added (UnityLauncherScrollerView* self, UnityLauncherScrollerChild* child); -static void _lambda78_ (UnityLauncherScrollerView* self); -static void __lambda78__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void _lambda79_ (UnityLauncherScrollerView* self); +static void __lambda79__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void unity_launcher_scroller_view_model_child_removed (UnityLauncherScrollerView* self, UnityLauncherScrollerChild* child); #define UNITY_LAUNCHER_SHORT_DELAY ((guint) 400) -static void _lambda79_ (Block13Data* _data13_); -static void __lambda79__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static void _lambda80_ (Block13Data* _data13_); +static void __lambda80__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static Block13Data* block13_data_ref (Block13Data* _data13_); static void block13_data_unref (Block13Data* _data13_); static void unity_launcher_scroller_view_model_order_changed (UnityLauncherScrollerView* self); static void unity_launcher_scroller_view_on_auto_scrolling_state_change (UnityLauncherScrollerView* self); gboolean unity_launcher_scroller_view_get_is_autoscrolling (UnityLauncherScrollerView* self); -static gboolean _lambda80_ (UnityLauncherScrollerView* self); -static gboolean __lambda80__gsource_func (gpointer self); +static gboolean _lambda81_ (UnityLauncherScrollerView* self); +static gboolean __lambda81__gsource_func (gpointer self); static gboolean unity_launcher_scroller_view_on_button_press_event (UnityLauncherScrollerView* self, ClutterEvent* event); static gboolean unity_launcher_scroller_view_on_button_release_event (UnityLauncherScrollerView* self, ClutterEvent* event); static gboolean _unity_launcher_scroller_view_on_button_release_event_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static float unity_launcher_scroller_view_get_aligned_settle_position (UnityLauncherScrollerView* self); GType menu_manager_get_type (void) G_GNUC_CONST; MenuManager* menu_manager_get_default (void); void menu_manager_popdown_current_menu (MenuManager* self); @@ -371,9 +373,8 @@ static void unity_launcher_scroller_view_do_anim_settle (UnityLauncherScrollerVi static void unity_launcher_scroller_view_do_anim_fling (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); static void unity_launcher_scroller_view_do_anim_bounce (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); CtkEffectCache* unity_launcher_scroller_view_get_cache (UnityLauncherScrollerView* self); -static gboolean _lambda81_ (UnityLauncherScrollerView* self); -static gboolean __lambda81__gsource_func (gpointer self); -static float unity_launcher_scroller_view_get_aligned_settle_position (UnityLauncherScrollerView* self); +static gboolean _lambda82_ (UnityLauncherScrollerView* self); +static gboolean __lambda82__gsource_func (gpointer self); static void unity_launcher_scroller_view_real_get_preferred_width (ClutterActor* base, float for_height, float* minimum_width, float* natural_width); static void unity_launcher_scroller_view_real_get_preferred_height (ClutterActor* base, float for_width, float* minimum_height, float* natural_height); static void unity_launcher_scroller_view_order_children_expanded (UnityLauncherScrollerView* self, gboolean immediate); @@ -414,22 +415,22 @@ static gboolean _unity_launcher_scroller_view_on_scroll_event_clutter_actor_scro static void _unity_launcher_scroller_view_on_auto_scrolling_state_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void _unity_launcher_scroller_view_on_drag_motion_event_unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); -static void _lambda82_ (UnityLauncherScrollerView* self); -static void __lambda82__clutter_timeline_started (ClutterTimeline* _sender, gpointer self); static void _lambda83_ (UnityLauncherScrollerView* self); -static gboolean _lambda84_ (UnityLauncherScrollerView* self); -static gboolean __lambda84__gsource_func (gpointer self); -static void __lambda83__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self); -static void _lambda85_ (UnityLauncherScrollerView* self); -static void __lambda85__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); -static void _lambda86_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self); -static gboolean _lambda87_ (UnityLauncherScrollerView* self); -static gboolean __lambda87__gsource_func (gpointer self); -static void __lambda86__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); -static void _lambda88_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self); -static void __lambda88__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); -static gboolean _lambda89_ (UnityLauncherScrollerView* self); -static gboolean __lambda89__gsource_func (gpointer self); +static void __lambda83__clutter_timeline_started (ClutterTimeline* _sender, gpointer self); +static void _lambda84_ (UnityLauncherScrollerView* self); +static gboolean _lambda85_ (UnityLauncherScrollerView* self); +static gboolean __lambda85__gsource_func (gpointer self); +static void __lambda84__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self); +static void _lambda86_ (UnityLauncherScrollerView* self); +static void __lambda86__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); +static void _lambda87_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self); +static gboolean _lambda88_ (UnityLauncherScrollerView* self); +static gboolean __lambda88__gsource_func (gpointer self); +static void __lambda87__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); +static void _lambda89_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self); +static void __lambda89__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); +static gboolean _lambda90_ (UnityLauncherScrollerView* self); +static gboolean __lambda90__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); @@ -1342,13 +1343,32 @@ static void unity_launcher_scroller_view_move_scroll_position (UnityLauncherScro new_scroll_position = limit * (1 - powf ((limit - 1) / limit, new_scroll_position)); self->priv->scroll_position = new_scroll_position; } else { - if (self->priv->scroll_position < (-(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)))) { - float diff; + gboolean _tmp0_ = FALSE; + if (unity_launcher_scroller_view_get_total_children_height (self) < unity_launcher_scroller_view_get_available_height (self)) { + _tmp0_ = self->priv->scroll_position < 0; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { float new_scroll_position; - diff = self->priv->scroll_position + (unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)); - new_scroll_position = limit * (1 - powf ((limit - 1) / limit, fabsf (diff))); - new_scroll_position = (-(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self))) - new_scroll_position; - self->priv->scroll_position = new_scroll_position; + new_scroll_position = -self->priv->scroll_position; + new_scroll_position = limit * (1 - powf ((limit - 1) / limit, new_scroll_position)); + self->priv->scroll_position = -new_scroll_position; + } else { + gboolean _tmp1_ = FALSE; + if (unity_launcher_scroller_view_get_total_children_height (self) >= unity_launcher_scroller_view_get_available_height (self)) { + _tmp1_ = self->priv->scroll_position < (-(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self))); + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + float diff; + float new_scroll_position; + diff = self->priv->scroll_position + (unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)); + new_scroll_position = limit * (1 - powf ((limit - 1) / limit, fabsf (diff))); + new_scroll_position = (-(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self))) - new_scroll_position; + self->priv->scroll_position = new_scroll_position; + } } } } @@ -1452,13 +1472,13 @@ static void unity_launcher_scroller_view_contract_launcher (UnityLauncherScrolle } -static void _lambda78_ (UnityLauncherScrollerView* self) { +static void _lambda79_ (UnityLauncherScrollerView* self) { clutter_actor_queue_relayout ((ClutterActor*) self); } -static void __lambda78__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda78_ (self); +static void __lambda79__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda79_ (self); } @@ -1473,12 +1493,12 @@ 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) __lambda78__g_object_notify, self, 0); + g_signal_connect_object ((GObject*) child, "notify::position", (GCallback) __lambda79__g_object_notify, self, 0); clutter_actor_set_reactive ((ClutterActor*) child, FALSE); } -static void _lambda79_ (Block13Data* _data13_) { +static void _lambda80_ (Block13Data* _data13_) { UnityLauncherScrollerView * self; self = _data13_->self; clutter_actor_unparent ((ClutterActor*) _data13_->child); @@ -1486,8 +1506,8 @@ static void _lambda79_ (Block13Data* _data13_) { } -static void __lambda79__clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { - _lambda79_ (self); +static void __lambda80__clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { + _lambda80_ (self); } @@ -1517,7 +1537,7 @@ static void unity_launcher_scroller_view_model_child_removed (UnityLauncherScrol _data13_->child = _g_object_ref0 (child); gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->child_refs, _data13_->child); anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) _data13_->child, (gulong) CLUTTER_EASE_OUT_QUAD, UNITY_LAUNCHER_SHORT_DELAY, "opacity", 0, NULL)); - g_signal_connect_data (anim, "completed", (GCallback) __lambda79__clutter_animation_completed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0); + g_signal_connect_data (anim, "completed", (GCallback) __lambda80__clutter_animation_completed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0); unity_launcher_scroller_view_order_children (self, FALSE); clutter_actor_queue_relayout ((ClutterActor*) self); _g_object_unref0 (anim); @@ -1532,7 +1552,7 @@ static void unity_launcher_scroller_view_model_order_changed (UnityLauncherScrol } -static gboolean _lambda80_ (UnityLauncherScrollerView* self) { +static gboolean _lambda81_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; float speed; speed = 12.0f - self->priv->autoscroll_mouse_pos_cache; @@ -1545,9 +1565,9 @@ static gboolean _lambda80_ (UnityLauncherScrollerView* self) { } -static gboolean __lambda80__gsource_func (gpointer self) { +static gboolean __lambda81__gsource_func (gpointer self) { gboolean result; - result = _lambda80_ (self); + result = _lambda81_ (self); return result; } @@ -1561,7 +1581,7 @@ static void unity_launcher_scroller_view_on_auto_scrolling_state_change (UnityLa _tmp0_ = FALSE; } if (_tmp0_) { - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 33, __lambda80__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 33, __lambda81__gsource_func, g_object_ref (self), g_object_unref); } } @@ -1584,6 +1604,11 @@ static gboolean unity_launcher_scroller_view_on_button_press_event (UnityLaunche unity_launcher_scroller_view_passthrough_button_press_event (self, event); } self->priv->button_down = TRUE; + if (unity_launcher_scroller_view_get_model_index_at_y_pos (self, (*event).button.y, TRUE) < 0) { + self->priv->can_scroll = FALSE; + } else { + self->priv->can_scroll = TRUE; + } self->priv->previous_y_position = (*event).button.y; self->priv->previous_y_time = (guint) (*event).button.time; g_signal_connect_object (clutter_actor_get_stage ((ClutterActor*) self), "button-release-event", (GCallback) _unity_launcher_scroller_view_on_button_release_event_clutter_actor_button_release_event, self, 0); @@ -1605,6 +1630,7 @@ static gboolean unity_launcher_scroller_view_on_button_release_event (UnityLaunc g_signal_parse_name ("button-release-event", CLUTTER_TYPE_ACTOR, &_tmp0_, NULL, FALSE); g_signal_handlers_disconnect_matched (clutter_actor_get_stage ((ClutterActor*) self), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _unity_launcher_scroller_view_on_button_release_event_clutter_actor_button_release_event, self); unity_shell_remove_fullscreen_request (unity_global_shell, (GObject*) self); + clutter_ungrab_pointer (); if (self->priv->is_scrolling) { guint _tmp1_; gboolean _tmp2_ = FALSE; @@ -1634,11 +1660,7 @@ static gboolean unity_launcher_scroller_view_on_button_release_event (UnityLaunc } if (_tmp2_) { self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_SETTLING; - if (self->priv->scroll_position > 0) { - self->priv->settle_position = (float) 0; - } else { - self->priv->settle_position = -(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)); - } + self->priv->settle_position = unity_launcher_scroller_view_get_aligned_settle_position (self); } else { self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_FLUNG; } @@ -1731,14 +1753,20 @@ static gboolean unity_launcher_scroller_view_on_leave_event (UnityLauncherScroll static gboolean unity_launcher_scroller_view_on_autoscroll_motion_check (UnityLauncherScrollerView* self, float y) { gboolean result = FALSE; + gboolean _tmp0_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); if (unity_launcher_scroller_view_get_total_children_height (self) < unity_launcher_scroller_view_get_available_height (self)) { + _tmp0_ = TRUE; + } else { + _tmp0_ = self->priv->is_scrolling; + } + if (_tmp0_) { unity_launcher_scroller_view_set_is_autoscrolling (self, FALSE); } else { float pos_x = 0.0F; float pos_y = 0.0F; float transformed_y; - gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; clutter_actor_get_transformed_position ((ClutterActor*) self, &pos_x, &pos_y); transformed_y = y - pos_y; self->priv->autoscroll_mouse_pos_cache = transformed_y; @@ -1749,11 +1777,11 @@ static gboolean unity_launcher_scroller_view_on_autoscroll_motion_check (UnityLa self->priv->autoscroll_direction = 1; } if (transformed_y < 12) { - _tmp0_ = TRUE; + _tmp1_ = TRUE; } else { - _tmp0_ = transformed_y > (clutter_actor_get_height ((ClutterActor*) self) - 12); + _tmp1_ = transformed_y > (clutter_actor_get_height ((ClutterActor*) self) - 12); } - if (_tmp0_) { + if (_tmp1_) { unity_launcher_scroller_view_set_is_autoscrolling (self, TRUE); } else { unity_launcher_scroller_view_set_is_autoscrolling (self, FALSE); @@ -1776,6 +1804,7 @@ static gboolean unity_launcher_scroller_view_on_motion_event (UnityLauncherScrol UnityDragController* drag_controller; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; + gboolean _tmp2_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); unity_launcher_scroller_view_on_autoscroll_motion_check (self, (*event).motion.y); drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); @@ -1786,12 +1815,17 @@ static gboolean unity_launcher_scroller_view_on_motion_event (UnityLauncherScrol } self->priv->last_motion_event_time = (guint) (*event).motion.time; if (self->priv->button_down) { - _tmp1_ = self->priv->is_scrolling == FALSE; + _tmp2_ = self->priv->is_scrolling == FALSE; + } else { + _tmp2_ = FALSE; + } + if (_tmp2_) { + _tmp1_ = self->priv->view_type != UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; } else { _tmp1_ = FALSE; } if (_tmp1_) { - _tmp0_ = self->priv->view_type != UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; + _tmp0_ = self->priv->can_scroll; } else { _tmp0_ = FALSE; } @@ -1924,23 +1958,19 @@ static void unity_launcher_scroller_view_do_anim_settle (UnityLauncherScrollerVi } -static gboolean _lambda81_ (UnityLauncherScrollerView* self) { +static gboolean _lambda82_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_SETTLING; - if (self->priv->scroll_position > 0) { - self->priv->settle_position = (float) 0; - } else { - self->priv->settle_position = -(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)); - } + self->priv->settle_position = unity_launcher_scroller_view_get_aligned_settle_position (self); clutter_timeline_start (self->fling_timeline); result = FALSE; return result; } -static gboolean __lambda81__gsource_func (gpointer self) { +static gboolean __lambda82__gsource_func (gpointer self) { gboolean result; - result = _lambda81_ (self); + result = _lambda82_ (self); return result; } @@ -1954,7 +1984,7 @@ static void unity_launcher_scroller_view_do_anim_fling (UnityLauncherScrollerVie unity_launcher_scroller_view_move_scroll_position (self, scroll_move_amount, FALSE, 60.0f); if (fabsf (scroll_move_amount) < 1.0) { self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_NONE; - self->priv->fling_timeout_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda81__gsource_func, g_object_ref (self), g_object_unref); + self->priv->fling_timeout_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda82__gsource_func, g_object_ref (self), g_object_unref); } } @@ -1982,11 +2012,14 @@ static float unity_launcher_scroller_view_get_aligned_settle_position (UnityLaun if (self->priv->scroll_position > 0) { final_position = (float) 0; } else { - CtkPadding _tmp2_ = {0}; - CtkPadding _tmp3_ = {0}; - if ((-self->priv->scroll_position) > (((self->priv->total_child_height - clutter_actor_get_height ((ClutterActor*) self)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp2_), _tmp2_.top)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp3_), _tmp3_.bottom))) { - CtkPadding _tmp4_ = {0}; - final_position = (self->priv->total_child_height - clutter_actor_get_height ((ClutterActor*) self)) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp4_), _tmp4_.bottom); + if (unity_launcher_scroller_view_get_total_children_height (self) < unity_launcher_scroller_view_get_available_height (self)) { + final_position = (float) 0; + } else { + CtkPadding _tmp2_ = {0}; + CtkPadding _tmp3_ = {0}; + if ((-self->priv->scroll_position) > (((self->priv->total_child_height - clutter_actor_get_height ((ClutterActor*) self)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp2_), _tmp2_.top)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp3_), _tmp3_.bottom))) { + final_position = -(unity_launcher_scroller_view_get_total_children_height (self) - unity_launcher_scroller_view_get_available_height (self)); + } } } } @@ -2487,69 +2520,33 @@ static void unity_launcher_scroller_view_real_pick (ClutterActor* base, const Cl self = (UnityLauncherScrollerView*) base; CLUTTER_ACTOR_CLASS (unity_launcher_scroller_view_parent_class)->pick ((ClutterActor*) CTK_ACTOR (self), color); { - gint index; - index = gee_collection_get_size ((GeeCollection*) self->priv->draw_btf) - 1; - { - gboolean _tmp0_; - _tmp0_ = TRUE; - while (TRUE) { - UnityLauncherScrollerChild* child; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; - if (!_tmp0_) { - index--; - } - _tmp0_ = FALSE; - if (!(index >= 0)) { - break; - } - child = (UnityLauncherScrollerChild*) gee_abstract_list_get ((GeeAbstractList*) self->priv->draw_btf, index); - if (UNITY_LAUNCHER_IS_SCROLLER_CHILD (child)) { - _tmp2_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - _tmp1_ = !child->do_not_render; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - UnityLauncherScrollerChild* _tmp3_; - clutter_actor_paint ((ClutterActor*) (_tmp3_ = child, UNITY_LAUNCHER_IS_SCROLLER_CHILD (_tmp3_) ? ((UnityLauncherScrollerChild*) _tmp3_) : NULL)); - } - _g_object_unref0 (child); - } - } - } - { - GeeIterator* _child_it; - _child_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->priv->draw_ftb); + UnityLauncherScrollerModelIterator* _child_it; + _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); while (TRUE) { UnityLauncherScrollerChild* child; - gboolean _tmp4_ = FALSE; - gboolean _tmp5_ = FALSE; - if (!gee_iterator_next (_child_it)) { + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + if (!unity_launcher_scroller_model_iterator_next (_child_it)) { break; } - child = (UnityLauncherScrollerChild*) gee_iterator_get (_child_it); + child = unity_launcher_scroller_model_iterator_get (_child_it); if (UNITY_LAUNCHER_IS_SCROLLER_CHILD (child)) { - _tmp5_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; + _tmp1_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; } else { - _tmp5_ = FALSE; + _tmp1_ = FALSE; } - if (_tmp5_) { - _tmp4_ = !child->do_not_render; + if (_tmp1_) { + _tmp0_ = !child->do_not_render; } else { - _tmp4_ = FALSE; + _tmp0_ = FALSE; } - if (_tmp4_) { - UnityLauncherScrollerChild* _tmp6_; - clutter_actor_paint ((ClutterActor*) (_tmp6_ = child, UNITY_LAUNCHER_IS_SCROLLER_CHILD (_tmp6_) ? ((UnityLauncherScrollerChild*) _tmp6_) : NULL)); + if (_tmp0_) { + UnityLauncherScrollerChild* _tmp2_; + clutter_actor_paint ((ClutterActor*) (_tmp2_ = child, UNITY_LAUNCHER_IS_SCROLLER_CHILD (_tmp2_) ? ((UnityLauncherScrollerChild*) _tmp2_) : NULL)); } _g_object_unref0 (child); } - _g_object_unref0 (_child_it); + _unity_launcher_scroller_model_iterator_unref0 (_child_it); } { GeeIterator* _child_it; @@ -2954,17 +2951,17 @@ static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new } -static void _lambda82_ (UnityLauncherScrollerView* self) { +static void _lambda83_ (UnityLauncherScrollerView* self) { ctk_effect_cache_invalidate_texture_cache (self->priv->_cache); } -static void __lambda82__clutter_timeline_started (ClutterTimeline* _sender, gpointer self) { - _lambda82_ (self); +static void __lambda83__clutter_timeline_started (ClutterTimeline* _sender, gpointer self) { + _lambda83_ (self); } -static gboolean _lambda84_ (UnityLauncherScrollerView* self) { +static gboolean _lambda85_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; ctk_effect_cache_update_texture_cache (self->priv->_cache); result = FALSE; @@ -2972,24 +2969,24 @@ static gboolean _lambda84_ (UnityLauncherScrollerView* self) { } -static gboolean __lambda84__gsource_func (gpointer self) { +static gboolean __lambda85__gsource_func (gpointer self) { gboolean result; - result = _lambda84_ (self); + result = _lambda85_ (self); return result; } -static void _lambda83_ (UnityLauncherScrollerView* self) { - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda84__gsource_func, g_object_ref (self), g_object_unref); +static void _lambda84_ (UnityLauncherScrollerView* self) { + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda85__gsource_func, g_object_ref (self), g_object_unref); } -static void __lambda83__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) { - _lambda83_ (self); +static void __lambda84__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) { + _lambda84_ (self); } -static void _lambda85_ (UnityLauncherScrollerView* self) { +static void _lambda86_ (UnityLauncherScrollerView* self) { guint _tmp0_; self->priv->is_scrolling = FALSE; self->priv->button_down = FALSE; @@ -3003,25 +3000,25 @@ static void _lambda85_ (UnityLauncherScrollerView* self) { } -static void __lambda85__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { - _lambda85_ (self); +static void __lambda86__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { + _lambda86_ (self); } -static gboolean _lambda87_ (UnityLauncherScrollerView* self) { +static gboolean _lambda88_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; unity_launcher_scroller_view_order_children (self, FALSE); } -static gboolean __lambda87__gsource_func (gpointer self) { +static gboolean __lambda88__gsource_func (gpointer self) { gboolean result; - result = _lambda87_ (self); + result = _lambda88_ (self); return result; } -static void _lambda86_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self) { +static void _lambda87_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self) { g_return_if_fail (drag_model != NULL); unity_launcher_disable_quicklists = FALSE; { @@ -3041,18 +3038,18 @@ static void _lambda86_ (UnityDragModel* drag_model, float x, float y, UnityLaunc if (x > clutter_actor_get_width ((ClutterActor*) self)) { unity_launcher_scroller_view_contract_launcher (self); } else { - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda87__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda88__gsource_func, g_object_ref (self), g_object_unref); } clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_EASE_OUT_SINE, (guint) 150, "drag-indicator-opacity", 0.0f, NULL); } -static void __lambda86__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { - _lambda86_ (model, x, y, self); +static void __lambda87__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { + _lambda87_ (model, x, y, self); } -static void _lambda88_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self) { +static void _lambda89_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self) { g_return_if_fail (model != NULL); self->priv->last_known_pointer_x = x; if (x > (200 + clutter_actor_get_width ((ClutterActor*) self))) { @@ -3063,21 +3060,21 @@ static void _lambda88_ (UnityDragModel* model, float x, float y, UnityLauncherSc } -static void __lambda88__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { - _lambda88_ (model, x, y, self); +static void __lambda89__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { + _lambda89_ (model, x, y, self); } -static gboolean _lambda89_ (UnityLauncherScrollerView* self) { +static gboolean _lambda90_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); } -static gboolean __lambda89__gsource_func (gpointer self) { +static gboolean __lambda90__gsource_func (gpointer self) { gboolean result; - result = _lambda89_ (self); + result = _lambda90_ (self); return result; } @@ -3144,17 +3141,17 @@ static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_c self->fling_timeline = (_tmp4_ = clutter_timeline_new ((guint) 1000), _g_object_unref0 (self->fling_timeline), _tmp4_); clutter_timeline_set_loop (self->fling_timeline, TRUE); g_signal_connect_object (self->fling_timeline, "new-frame", (GCallback) _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame, self, 0); - g_signal_connect_object (self->fling_timeline, "started", (GCallback) __lambda82__clutter_timeline_started, self, 0); - g_signal_connect_object (self->fling_timeline, "completed", (GCallback) __lambda83__clutter_timeline_completed, self, 0); + g_signal_connect_object (self->fling_timeline, "started", (GCallback) __lambda83__clutter_timeline_started, self, 0); + g_signal_connect_object (self->fling_timeline, "completed", (GCallback) __lambda84__clutter_timeline_completed, self, 0); drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); - g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda85__unity_drag_controller_drag_start, self, 0); - g_signal_connect_object (drag_controller, "drag-drop", (GCallback) __lambda86__unity_drag_controller_drag_drop, self, 0); - g_signal_connect_object (drag_controller, "drag-motion", (GCallback) __lambda88__unity_drag_controller_drag_motion, self, 0); + g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda86__unity_drag_controller_drag_start, self, 0); + g_signal_connect_object (drag_controller, "drag-drop", (GCallback) __lambda87__unity_drag_controller_drag_drop, self, 0); + g_signal_connect_object (drag_controller, "drag-motion", (GCallback) __lambda89__unity_drag_controller_drag_motion, self, 0); clutter_actor_set_reactive ((ClutterActor*) self, TRUE); self->priv->child_refs = (_tmp5_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->child_refs), _tmp5_); unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda89__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda90__gsource_func, g_object_ref (self), g_object_unref); unity_launcher_scroller_view_set_drag_indicator_space (self, FALSE); _g_object_unref0 (drag_controller); } @@ -3201,6 +3198,7 @@ static void unity_launcher_scroller_view_instance_init (UnityLauncherScrollerVie self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; self->priv->do_logic_pick = TRUE; self->priv->last_known_pointer_x = 0.0f; + self->priv->can_scroll = FALSE; self->priv->scroll_position = 0.0f; self->priv->settle_position = 0.0f; self->priv->autoscroll_anim_active = FALSE; diff --git a/unity-private/launcher/scroller-view.vala b/unity-private/launcher/scroller-view.vala index df5d95331..4c83f07db 100644 --- a/unity-private/launcher/scroller-view.vala +++ b/unity-private/launcher/scroller-view.vala @@ -82,6 +82,7 @@ namespace Unity.Launcher private ScrollerViewType view_type = ScrollerViewType.CONTRACTED; private bool do_logic_pick = true; private float last_known_pointer_x = 0.0f; + private bool can_scroll = false; /* * scrolling variables @@ -409,7 +410,6 @@ namespace Unity.Launcher private void on_drag_indicator_index_change () { - //debug (@"index changed $drag_indicator_index"); order_children (false); queue_relayout (); } @@ -678,7 +678,15 @@ namespace Unity.Launcher new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, new_scroll_position)); scroll_position = new_scroll_position; } - else if (scroll_position < -(get_total_children_height () - get_available_height ())) + else if (get_total_children_height () < get_available_height () && + scroll_position < 0) + { + float new_scroll_position = -scroll_position; + new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, new_scroll_position)); + scroll_position = -new_scroll_position; + } + else if (get_total_children_height () >= get_available_height () && + scroll_position < -(get_total_children_height () - get_available_height ())) { float diff = scroll_position + (get_total_children_height () - get_available_height ()); float new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, Math.fabsf (diff))); @@ -845,6 +853,11 @@ namespace Unity.Launcher passthrough_button_press_event (event); } button_down = true; + if (get_model_index_at_y_pos (event.button.y, true) < 0) + can_scroll = false; + else + can_scroll = true; + previous_y_position = event.button.y; previous_y_time = event.button.time; @@ -864,6 +877,7 @@ namespace Unity.Launcher button_down = false; this.get_stage ().button_release_event.disconnect (this.on_button_release_event); Unity.global_shell.remove_fullscreen_request (this); + Clutter.ungrab_pointer (); if (is_scrolling) { @@ -879,10 +893,7 @@ namespace Unity.Launcher if (scroll_position > 0 || scroll_position < -(get_total_children_height () - get_available_height ())) { current_phase = ScrollerPhase.SETTLING; - if (scroll_position > 0) - settle_position = 0; - else - settle_position = -(get_total_children_height () - get_available_height ()); + settle_position = get_aligned_settle_position (); } else { @@ -950,7 +961,7 @@ namespace Unity.Launcher float autoscroll_mouse_pos_cache = 0.0f; private bool on_autoscroll_motion_check (float y) { - if (get_total_children_height () < get_available_height ()) + if (get_total_children_height () < get_available_height () || is_scrolling) { is_autoscrolling = false; } @@ -996,7 +1007,9 @@ namespace Unity.Launcher } last_motion_event_time = event.motion.time; - if (button_down && is_scrolling == false && view_type != ScrollerViewType.CONTRACTED) + if (button_down && is_scrolling == false && + view_type != ScrollerViewType.CONTRACTED && + can_scroll) { /* we have a left button down, but we aren't dragging yet, we need to * monitor how far away we have dragged from the original click, once @@ -1143,10 +1156,7 @@ namespace Unity.Launcher fling_timeout_source = GLib.Timeout.add (300, () => { current_phase = ScrollerPhase.SETTLING; - if (scroll_position > 0) - settle_position = 0; - else - settle_position = -(get_total_children_height () - get_available_height ()); + settle_position = get_aligned_settle_position (); fling_timeline.start (); return false; }); @@ -1175,10 +1185,14 @@ namespace Unity.Launcher // we always position on the first child final_position = 0; } + else if (get_total_children_height () < get_available_height ()) + { + final_position = 0; + } else if (-scroll_position > total_child_height - height - padding.top - padding.bottom) { // position on the final child - final_position = total_child_height - height + padding.bottom; + final_position = -(get_total_children_height () - get_available_height ()); } return final_position; @@ -1571,16 +1585,7 @@ namespace Unity.Launcher public override void pick (Clutter.Color color) { base.pick (color); - for (int index = draw_btf.size-1; index >= 0; index--) - { - ScrollerChild child = draw_btf[index]; - if (child is ScrollerChild && child.opacity > 0 && !child.do_not_render) - { - (child as ScrollerChild).paint (); - } - } - - foreach (ScrollerChild child in draw_ftb) + foreach (ScrollerChild child in model) { if (child is ScrollerChild && child.opacity > 0 && !child.do_not_render) { @@ -1602,7 +1607,6 @@ namespace Unity.Launcher if (drag_indicator_active) { - //debug (@"drawing at $drag_indicator_position with $drag_indicator_opacity opacity"); Cogl.set_source_color4f (1.0f, 1.0f, 1.0f, drag_indicator_opacity); diff --git a/unity-private/launcher/scrollerchild-controller.c b/unity-private/launcher/scrollerchild-controller.c index c5a2ba5be..63c6c60c1 100644 --- a/unity-private/launcher/scrollerchild-controller.c +++ b/unity-private/launcher/scrollerchild-controller.c @@ -363,42 +363,38 @@ static gboolean unity_launcher_scroller_child_controller_on_press_event (UnityLa static gboolean unity_launcher_scroller_child_controller_on_release_event (UnityLauncherScrollerChildController* self, ClutterEvent* event) { gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); self->priv->_child->grabbed_push = (float) 0; if ((*event).button.button == 1) { - _tmp2_ = self->button_down == TRUE; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - _tmp1_ = ((*event).button.time - self->last_press_time) < 500; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - _tmp0_ = self->priv->no_activate == FALSE; - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - if (UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER (self->priv->_menu)) { - gboolean _tmp3_ = FALSE; - if (unity_launcher_quicklist_controller_get_state (self->priv->_menu) == UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_LABEL) { - _tmp3_ = TRUE; - } else { - _tmp3_ = unity_launcher_quicklist_controller_get_state (self->priv->_menu) == UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_MENU; - } - if (_tmp3_) { - unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_CLOSED); + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + if (self->button_down == TRUE) { + _tmp1_ = ((*event).button.time - self->last_press_time) < 500; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + _tmp0_ = self->priv->no_activate == FALSE; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { + if (UNITY_LAUNCHER_IS_QUICKLIST_CONTROLLER (self->priv->_menu)) { + gboolean _tmp2_ = FALSE; + if (unity_launcher_quicklist_controller_get_state (self->priv->_menu) == UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_LABEL) { + _tmp2_ = TRUE; + } else { + _tmp2_ = unity_launcher_quicklist_controller_get_state (self->priv->_menu) == UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_MENU; + } + if (_tmp2_) { + unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_CLOSED); + } } + unity_launcher_scroller_child_controller_activate (self); + } else { + unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_LABEL); + unity_launcher_scroller_child_controller_ensure_menu_state (self); } - unity_launcher_scroller_child_controller_activate (self); - } else { - unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_LABEL); - unity_launcher_scroller_child_controller_ensure_menu_state (self); } self->button_down = FALSE; result = FALSE; @@ -423,8 +419,9 @@ static void _unity_launcher_scroller_child_controller_ensure_menu_state_clutter_ static gboolean _lambda18_ (UnityLauncherScrollerChildController* self) { gboolean result = FALSE; - unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_MENU); - self->menu_state = UNITY_LAUNCHER_SCROLLER_CHILD_CONTROLLER_MENU_STATE_NO_MENU; + if (unity_launcher_quicklist_controller_get_state (self->priv->_menu) != UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_MENU) { + unity_launcher_quicklist_controller_set_state (self->priv->_menu, UNITY_LAUNCHER_QUICKLIST_CONTROLLER_STATE_MENU); + } result = FALSE; return result; } @@ -592,7 +589,7 @@ static void _lambda19_ (UnityThemeFilePath* theme, const char* filepath, UnityLa _inner_error_ = NULL; { char* _tmp2_; - g_warning ("scrollerchild-controller.vala:311: %s", _tmp2_ = g_strconcat ("Could not load from ", string_to_string (filepath), NULL)); + g_warning ("scrollerchild-controller.vala:316: %s", _tmp2_ = g_strconcat ("Could not load from ", string_to_string (filepath), NULL)); _g_free0 (_tmp2_); _g_error_free0 (e); } @@ -634,7 +631,7 @@ static void _lambda20_ (Block11Data* _data11_) { e = _inner_error_; _inner_error_ = NULL; { - g_warning ("scrollerchild-controller.vala:323: Could not load any icon for %s", _data11_->icon_name); + g_warning ("scrollerchild-controller.vala:328: Could not load any icon for %s", _data11_->icon_name); _g_error_free0 (e); } } @@ -728,7 +725,7 @@ static gboolean unity_launcher_scroller_child_controller_try_load_from_file (Uni e = _inner_error_; _inner_error_ = NULL; { - g_warning ("scrollerchild-controller.vala:341: Unable to load image from file '%s'" \ + g_warning ("scrollerchild-controller.vala:346: Unable to load image from file '%s'" \ ": %s", filepath, e->message); _g_error_free0 (e); } diff --git a/unity-private/launcher/scrollerchild-controller.vala b/unity-private/launcher/scrollerchild-controller.vala index 786980e5d..a3c961732 100644 --- a/unity-private/launcher/scrollerchild-controller.vala +++ b/unity-private/launcher/scrollerchild-controller.vala @@ -140,26 +140,28 @@ namespace Unity.Launcher private bool on_release_event (Clutter.Event event) { child.grabbed_push = 0; - if (event.button.button == 1 && - button_down == true && - event.button.time - last_press_time < 500 && - no_activate == false) + if (event.button.button == 1) { - if (menu is QuicklistController) + if (button_down == true && + event.button.time - last_press_time < 500 && + no_activate == false) { - if (menu.state == QuicklistControllerState.LABEL || - menu.state == QuicklistControllerState.MENU) - { - menu.state = QuicklistControllerState.CLOSED; - } + if (menu is QuicklistController) + { + if (menu.state == QuicklistControllerState.LABEL || + menu.state == QuicklistControllerState.MENU) + { + menu.state = QuicklistControllerState.CLOSED; + } + } + + activate (); + } + else + { + menu.state = QuicklistControllerState.LABEL; + ensure_menu_state (); } - - activate (); - } - else - { - menu.state = QuicklistControllerState.LABEL; - ensure_menu_state (); } button_down = false; @@ -215,8 +217,11 @@ namespace Unity.Launcher { Idle.add (() => { - menu.state = QuicklistControllerState.MENU; - menu_state = ScrollerChildControllerMenuState.NO_MENU; + if (menu.state != QuicklistControllerState.MENU) + { + menu.state = QuicklistControllerState.MENU; + } + //menu_state = ScrollerChildControllerMenuState.NO_MENU; return false; }); } diff --git a/unity-private/places/places-button.c b/unity-private/places/places-button.c index 785b8db88..183047fe8 100644 --- a/unity-private/places/places-button.c +++ b/unity-private/places/places-button.c @@ -176,6 +176,7 @@ static void unity_places_button_paint_bg (UnityPlacesButton* self, cairo_t* cr, gint x; g_return_if_fail (self != NULL); g_return_if_fail (cr != NULL); + g_return_if_fail (UNITY_PLACES_IS_BUTTON (self)); x = 1; cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); diff --git a/unity-private/places/places-button.vala b/unity-private/places/places-button.vala index 631f096eb..e58050b5f 100644 --- a/unity-private/places/places-button.vala +++ b/unity-private/places/places-button.vala @@ -128,6 +128,7 @@ namespace Unity.Places cr.close_path (); } private void paint_bg (Cairo.Context cr, int width, int height) + requires (this is Button) { var x = 1; diff --git a/unity-private/places/places-controller.c b/unity-private/places/places-controller.c index 6b5cc91b5..568fe4e88 100644 --- a/unity-private/places/places-controller.c +++ b/unity-private/places/places-controller.c @@ -291,8 +291,8 @@ void unity_places_controller_set_volumes (UnityPlacesController* self, UnityPlac UnityPlacesPlaceFileModel* unity_places_place_file_model_new (void); UnityPlacesPlaceFileModel* unity_places_place_file_model_construct (GType object_type); GType unity_places_place_file_model_get_type (void) G_GNUC_CONST; -static void _lambda68_ (UnityPlacesPlace* place, UnityPlacesController* self); -static void __lambda68__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self); +static void _lambda69_ (UnityPlacesPlace* place, UnityPlacesController* self); +static void __lambda69__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self); UnityPlacesVolumeController* unity_places_volume_controller_new (void); UnityPlacesVolumeController* unity_places_volume_controller_construct (GType object_type); UnityPlacesTrashController* unity_places_trash_controller_new (void); @@ -497,7 +497,7 @@ void unity_places_controller_set_volumes (UnityPlacesController* self, UnityPlac } -static void _lambda68_ (UnityPlacesPlace* place, UnityPlacesController* self) { +static void _lambda69_ (UnityPlacesPlace* place, UnityPlacesController* self) { g_return_if_fail (place != NULL); { GeeIterator* _e_it; @@ -516,8 +516,8 @@ static void _lambda68_ (UnityPlacesPlace* place, UnityPlacesController* self) { } -static void __lambda68__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self) { - _lambda68_ (place, self); +static void __lambda69__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self) { + _lambda69_ (place, self); } @@ -541,7 +541,7 @@ static GObject * unity_places_controller_constructor (GType type, guint n_constr UnityPlacesView* _tmp7_; unity_places_controller_set_model (self, _tmp1_ = (_tmp0_ = unity_places_place_file_model_new (), UNITY_PLACES_IS_PLACE_MODEL (_tmp0_) ? ((UnityPlacesPlaceModel*) _tmp0_) : NULL)); _g_object_unref0 (_tmp1_); - g_signal_connect_object (self->priv->_model, "place-added", (GCallback) __lambda68__unity_places_place_model_place_added, self, 0); + g_signal_connect_object (self->priv->_model, "place-added", (GCallback) __lambda69__unity_places_place_model_place_added, self, 0); unity_places_controller_set_volumes (self, _tmp2_ = unity_places_volume_controller_new ()); _g_object_unref0 (_tmp2_); s = (_tmp6_ = (_tmp5_ = (GObject*) gee_abstract_list_get ((GeeAbstractList*) (_tmp4_ = unity_testing_object_registry_lookup (_tmp3_ = unity_testing_object_registry_get_default (), "UnityScrollerModel")), 0), UNITY_LAUNCHER_IS_SCROLLER_MODEL (_tmp5_) ? ((UnityLauncherScrollerModel*) _tmp5_) : NULL), _g_object_unref0 (_tmp4_), _unity_testing_object_registry_unref0 (_tmp3_), _tmp6_); diff --git a/unity-private/places/places-default-renderer-group.c b/unity-private/places/places-default-renderer-group.c index 8acf3d160..b0918a84e 100644 --- a/unity-private/places/places-default-renderer-group.c +++ b/unity-private/places/places-default-renderer-group.c @@ -76,9 +76,6 @@ typedef struct _UnityPlacesExpanderClass UnityPlacesExpanderClass; typedef struct _UnityPlacesMoreResultsButton UnityPlacesMoreResultsButton; typedef struct _UnityPlacesMoreResultsButtonClass UnityPlacesMoreResultsButtonClass; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) #define UNITY_PLACES_TYPE_TILE (unity_places_tile_get_type ()) #define UNITY_PLACES_TILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_TILE, UnityPlacesTile)) @@ -89,6 +86,10 @@ typedef struct _UnityPlacesMoreResultsButtonClass UnityPlacesMoreResultsButtonCl typedef struct _UnityPlacesTile UnityPlacesTile; typedef struct _UnityPlacesTileClass UnityPlacesTileClass; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref (var), NULL))) +#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) #define UNITY_PLACES_TYPE_FILE_INFO_TILE (unity_places_file_info_tile_get_type ()) #define UNITY_PLACES_FILE_INFO_TILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_FILE_INFO_TILE, UnityPlacesFileInfoTile)) @@ -188,6 +189,8 @@ struct _UnityPlacesDefaultRendererGroupPrivate { gboolean dirty; gboolean allow_expand; gboolean last_result_timeout; + GList* cleanup_tiles; + guint cleanup_operation; }; typedef enum { @@ -241,6 +244,7 @@ GType unity_places_default_renderer_group_get_type (void) G_GNUC_CONST; GType unity_places_button_get_type (void) G_GNUC_CONST; GType unity_places_expander_get_type (void) G_GNUC_CONST; GType unity_places_more_results_button_get_type (void) G_GNUC_CONST; +GType unity_places_tile_get_type (void) G_GNUC_CONST; #define UNITY_PLACES_DEFAULT_RENDERER_GROUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_DEFAULT_RENDERER_GROUP, UnityPlacesDefaultRendererGroupPrivate)) enum { UNITY_PLACES_DEFAULT_RENDERER_GROUP_DUMMY_PROPERTY, @@ -251,6 +255,7 @@ enum { UNITY_PLACES_DEFAULT_RENDERER_GROUP_RESULTS, UNITY_PLACES_DEFAULT_RENDERER_GROUP_ALWAYS_EXPANDED }; +static void _g_list_free_g_object_unref (GList* self); #define UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING 52.0f #define UNITY_PLACES_DEFAULT_RENDERER_GROUP_SPACING 0 #define UNITY_PLACES_DEFAULT_RENDERER_GROUP_OMG_FOOTEL_SUCKS_CANT_HANDLE_MANY_TEXTURES 100 @@ -259,26 +264,33 @@ UnityPlacesDefaultRendererGroup* unity_places_default_renderer_group_construct ( static void unity_places_default_renderer_group_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); static gboolean unity_places_default_renderer_group_interesting (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); -GType unity_places_tile_get_type (void) G_GNUC_CONST; -const char* unity_places_default_renderer_group_get_group_renderer (UnityPlacesDefaultRendererGroup* self); +void unity_places_tile_update_details (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); DeeModel* unity_places_default_renderer_group_get_results (UnityPlacesDefaultRendererGroup* self); +void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value); +const char* unity_places_default_renderer_group_get_group_renderer (UnityPlacesDefaultRendererGroup* self); UnityPlacesFileInfoTile* unity_places_file_info_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesFileInfoTile* unity_places_file_info_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_file_info_tile_get_type (void) G_GNUC_CONST; +static void _lambda45_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self); +static void __lambda45__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self); UnityPlacesShowcaseTile* unity_places_showcase_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesShowcaseTile* unity_places_showcase_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_showcase_tile_get_type (void) G_GNUC_CONST; +static void _lambda47_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self); +static void __lambda47__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self); UnityPlacesDefaultTile* unity_places_default_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesDefaultTile* unity_places_default_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_default_tile_get_type (void) G_GNUC_CONST; +static void _lambda49_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self); +static void __lambda49__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self); void unity_places_tile_about_to_show (UnityPlacesTile* self); -static void _lambda48_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self); -static void __lambda48__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self); static void unity_places_default_renderer_group_add_to_n_results (UnityPlacesDefaultRendererGroup* self, gint i); +static gboolean unity_places_default_renderer_group_cleanup_operation_callback (UnityPlacesDefaultRendererGroup* self); static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter); DeeModelIter* unity_places_tile_get_iter (UnityPlacesTile* self); -static gboolean _lambda49_ (UnityPlacesDefaultRendererGroup* self); -static gboolean __lambda49__gsource_func (gpointer self); +static gboolean _unity_places_default_renderer_group_cleanup_operation_callback_gsource_func (gpointer self); +static gboolean _lambda50_ (UnityPlacesDefaultRendererGroup* self); +static gboolean __lambda50__gsource_func (gpointer self); guint unity_places_default_renderer_group_get_group_id (UnityPlacesDefaultRendererGroup* self); void unity_places_more_results_button_set_count (UnityPlacesMoreResultsButton* self, guint value); static void unity_places_default_renderer_group_on_n_cols_changed (UnityPlacesDefaultRendererGroup* self); @@ -295,20 +307,20 @@ UnityPlacesButton* unity_places_button_new (void); UnityPlacesButton* unity_places_button_construct (GType object_type); GType unity_places_button_normal_state_get_type (void) G_GNUC_CONST; void unity_places_button_set_normal_state (UnityPlacesButton* self, UnityPlacesButtonNormalState value); -static void _lambda50_ (UnityPlacesDefaultRendererGroup* self); -static void __lambda50__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void _lambda51_ (UnityPlacesDefaultRendererGroup* self); +static void __lambda51__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); UnityPlacesExpander* unity_places_expander_new (void); UnityPlacesExpander* unity_places_expander_construct (GType object_type); -static void _lambda51_ (UnityPlacesDefaultRendererGroup* self); +static void _lambda52_ (UnityPlacesDefaultRendererGroup* self); GType unity_places_expander_state_get_type (void) G_GNUC_CONST; void unity_places_expander_set_expanding_state (UnityPlacesExpander* self, UnityPlacesExpanderState value); -static void __lambda51__ctk_button_clicked (CtkButton* _sender, gpointer self); -static gboolean _lambda52_ (UnityPlacesDefaultRendererGroup* self); -static gboolean __lambda52__clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static void __lambda52__ctk_button_clicked (CtkButton* _sender, gpointer self); +static gboolean _lambda53_ (UnityPlacesDefaultRendererGroup* self); +static gboolean __lambda53__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); UnityPlacesMoreResultsButton* unity_places_more_results_button_new (void); UnityPlacesMoreResultsButton* unity_places_more_results_button_construct (GType object_type); -static void _lambda53_ (UnityPlacesDefaultRendererGroup* self); +static void _lambda54_ (UnityPlacesDefaultRendererGroup* self); gpointer unity_testing_object_registry_ref (gpointer instance); void unity_testing_object_registry_unref (gpointer instance); GParamSpec* unity_testing_param_spec_object_registry (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); @@ -323,7 +335,7 @@ GType unity_places_place_search_bar_get_type (void) G_GNUC_CONST; char* unity_places_place_search_bar_get_search_text (UnityPlacesPlaceSearchBar* self); void unity_places_controller_activate_entry (UnityPlacesController* self, const char* entry_name, gint section_id); void unity_places_place_search_bar_search (UnityPlacesPlaceSearchBar* self, const char* text); -static void __lambda53__ctk_button_clicked (CtkButton* _sender, gpointer self); +static void __lambda54__ctk_button_clicked (CtkButton* _sender, 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); @@ -365,6 +377,12 @@ static int _vala_strcmp0 (const char * str1, const char * str2); static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); +static void _g_list_free_g_object_unref (GList* self) { + g_list_foreach (self, (GFunc) g_object_unref, NULL); + g_list_free (self); +} + + 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) { UnityPlacesDefaultRendererGroup * self; g_return_val_if_fail (group_renderer != NULL, NULL); @@ -423,21 +441,45 @@ static void unity_places_default_renderer_group_real_allocate (ClutterActor* bas } -static void _lambda48_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self) { +static void _lambda45_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self) { + g_return_if_fail (u != NULL); + g_return_if_fail (m != NULL); + g_signal_emit_by_name (self, "activated", u, m); +} + + +static void __lambda45__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda45_ (uri, mimetype, self); +} + + +static void _lambda47_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self) { + g_return_if_fail (u != NULL); + g_return_if_fail (m != NULL); + g_signal_emit_by_name (self, "activated", u, m); +} + + +static void __lambda47__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda47_ (uri, mimetype, self); +} + + +static void _lambda49_ (const char* u, const char* m, UnityPlacesDefaultRendererGroup* self) { g_return_if_fail (u != NULL); g_return_if_fail (m != NULL); g_signal_emit_by_name (self, "activated", u, m); } -static void __lambda48__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self) { - _lambda48_ (uri, mimetype, self); +static void __lambda49__unity_places_tile_activated (UnityPlacesTile* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda49_ (uri, mimetype, self); } static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefaultRendererGroup* self, DeeModelIter* iter) { UnityPlacesTile* button; - gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (iter != NULL); if (!unity_places_default_renderer_group_interesting (self, iter)) { @@ -447,38 +489,58 @@ static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefa return; } button = NULL; - if (_vala_strcmp0 (self->priv->_group_renderer, "UnityFileInfoRenderer") == 0) { + if (g_list_length (self->priv->cleanup_tiles) > 0) { UnityPlacesTile* _tmp0_; - button = (_tmp0_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_file_info_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))), _g_object_unref0 (button), _tmp0_); + button = (_tmp0_ = _g_object_ref0 ((UnityPlacesTile*) g_list_nth_data (self->priv->cleanup_tiles, (guint) 0)), _g_object_unref0 (button), _tmp0_); + unity_places_tile_update_details (button, 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)); + unity_places_tile_set_iter (button, iter); + self->priv->cleanup_tiles = g_list_remove (self->priv->cleanup_tiles, button); } else { - if (_vala_strcmp0 (self->priv->_group_renderer, "UnityShowcaseRenderer") == 0) { + if (_vala_strcmp0 (self->priv->_group_renderer, "UnityFileInfoRenderer") == 0) { UnityPlacesTile* _tmp1_; - button = (_tmp1_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_showcase_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))), _g_object_unref0 (button), _tmp1_); + button = (_tmp1_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_file_info_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))), _g_object_unref0 (button), _tmp1_); + clutter_container_add_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) button); + clutter_actor_show ((ClutterActor*) button); + g_object_unref ((GObject*) button); + ; + g_signal_connect_object (button, "activated", (GCallback) __lambda45__unity_places_tile_activated, self, 0); } else { - UnityPlacesTile* _tmp2_; - button = (_tmp2_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_default_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))), _g_object_unref0 (button), _tmp2_); + if (_vala_strcmp0 (self->priv->_group_renderer, "UnityShowcaseRenderer") == 0) { + UnityPlacesTile* _tmp2_; + button = (_tmp2_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_showcase_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))), _g_object_unref0 (button), _tmp2_); + clutter_container_add_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) button); + clutter_actor_show ((ClutterActor*) button); + g_object_unref ((GObject*) button); + ; + g_signal_connect_object (button, "activated", (GCallback) __lambda47__unity_places_tile_activated, self, 0); + } else { + UnityPlacesTile* _tmp3_; + button = (_tmp3_ = (UnityPlacesTile*) g_object_ref_sink (unity_places_default_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))), _g_object_unref0 (button), _tmp3_); + clutter_container_add_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) button); + clutter_actor_show ((ClutterActor*) button); + g_object_unref ((GObject*) button); + ; + g_signal_connect_object (button, "activated", (GCallback) __lambda49__unity_places_tile_activated, self, 0); + } } } - clutter_container_add_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) button); - clutter_actor_show ((ClutterActor*) button); if (unity_expanding_bin_get_bin_state ((UnityExpandingBin*) self) == UNITY_EXPANDING_BIN_STATE_EXPANDED) { - _tmp3_ = TRUE; + _tmp4_ = TRUE; } else { - _tmp3_ = self->priv->_always_expanded; + _tmp4_ = self->priv->_always_expanded; } - if (_tmp3_) { + if (_tmp4_) { unity_places_tile_about_to_show (button); } - g_signal_connect_object (button, "activated", (GCallback) __lambda48__unity_places_tile_activated, self, 0); 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) { - gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; if (_vala_strcmp0 (self->priv->_group_renderer, "UnityFolderGroupRenderer") == 0) { - _tmp4_ = TRUE; + _tmp5_ = TRUE; } else { - _tmp4_ = self->priv->_always_expanded; + _tmp5_ = self->priv->_always_expanded; } - if (_tmp4_) { + if (_tmp5_) { unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_EXPANDED); } else { unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_UNEXPANDED); @@ -490,7 +552,40 @@ static void unity_places_default_renderer_group_on_result_added (UnityPlacesDefa } -static gboolean _lambda49_ (UnityPlacesDefaultRendererGroup* self) { +static gboolean unity_places_default_renderer_group_cleanup_operation_callback (UnityPlacesDefaultRendererGroup* self) { + gboolean result = FALSE; + GList* _tmp0_; + GList* _tmp1_; + g_return_val_if_fail (self != NULL, FALSE); + { + GList* tile_collection; + GList* tile_it; + tile_collection = self->priv->cleanup_tiles; + for (tile_it = tile_collection; tile_it != NULL; tile_it = tile_it->next) { + UnityPlacesTile* tile; + tile = _g_object_ref0 ((UnityPlacesTile*) tile_it->data); + { + clutter_container_remove_actor ((ClutterContainer*) self->priv->renderer, (ClutterActor*) tile); + _g_object_unref0 (tile); + } + } + } + self->priv->cleanup_tiles = (_tmp0_ = NULL, __g_list_free_g_object_unref0 (self->priv->cleanup_tiles), _tmp0_); + self->priv->cleanup_tiles = (_tmp1_ = NULL, __g_list_free_g_object_unref0 (self->priv->cleanup_tiles), _tmp1_); + self->priv->cleanup_operation = (guint) 0; + result = FALSE; + return result; +} + + +static gboolean _unity_places_default_renderer_group_cleanup_operation_callback_gsource_func (gpointer self) { + gboolean result; + result = unity_places_default_renderer_group_cleanup_operation_callback (self); + return result; +} + + +static gboolean _lambda50_ (UnityPlacesDefaultRendererGroup* self) { gboolean result = FALSE; if (self->priv->n_results < 1) { unity_expanding_bin_set_bin_state ((UnityExpandingBin*) self, UNITY_EXPANDING_BIN_STATE_CLOSED); @@ -501,9 +596,9 @@ static gboolean _lambda49_ (UnityPlacesDefaultRendererGroup* self) { } -static gboolean __lambda49__gsource_func (gpointer self) { +static gboolean __lambda50__gsource_func (gpointer self) { gboolean result; - result = _lambda49_ (self); + result = _lambda50_ (self); return result; } @@ -529,7 +624,10 @@ static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDe UnityPlacesTile* tile; 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); + self->priv->cleanup_tiles = g_list_append (self->priv->cleanup_tiles, _g_object_ref0 (tile)); + if (self->priv->cleanup_operation == 0) { + self->priv->cleanup_operation = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _unity_places_default_renderer_group_cleanup_operation_callback_gsource_func, g_object_ref (self), g_object_unref); + } unity_places_default_renderer_group_add_to_n_results (self, -1); _g_object_unref0 (tile); _g_object_unref0 (actor); @@ -546,7 +644,7 @@ static void unity_places_default_renderer_group_on_result_removed (UnityPlacesDe _tmp1_ = FALSE; } if (_tmp1_) { - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 100, __lambda49__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 100, __lambda50__gsource_func, g_object_ref (self), g_object_unref); self->priv->last_result_timeout = TRUE; } _g_list_free0 (children); @@ -579,6 +677,11 @@ static void unity_places_default_renderer_group_add_to_n_results (UnityPlacesDef unity_places_more_results_button_set_count (self->priv->more_results_button, (guint) 0); } } + if (self->priv->n_results == 1) { + UnityPixbufCache* _tmp0_; + unity_pixbuf_cache_load_iteration (_tmp0_ = unity_pixbuf_cache_get_default ()); + _g_object_unref0 (_tmp0_); + } } @@ -761,7 +864,7 @@ void unity_places_default_renderer_group_set_always_expanded (UnityPlacesDefault } -static void _lambda50_ (UnityPlacesDefaultRendererGroup* self) { +static void _lambda51_ (UnityPlacesDefaultRendererGroup* self) { GSList* effects; if (ctk_actor_get_state ((CtkActor*) self->priv->title_button) == CTK_STATE_ACTIVE) { ClutterColor _tmp0_ = {0}; @@ -788,12 +891,12 @@ static void _lambda50_ (UnityPlacesDefaultRendererGroup* self) { } -static void __lambda50__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda50_ (self); +static void __lambda51__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda51_ (self); } -static void _lambda51_ (UnityPlacesDefaultRendererGroup* self) { +static void _lambda52_ (UnityPlacesDefaultRendererGroup* self) { gboolean _tmp0_ = FALSE; if (self->priv->n_results <= ctk_icon_view_get_n_cols (self->priv->renderer)) { _tmp0_ = TRUE; @@ -813,12 +916,12 @@ static void _lambda51_ (UnityPlacesDefaultRendererGroup* self) { } -static void __lambda51__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda51_ (self); +static void __lambda52__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda52_ (self); } -static gboolean _lambda52_ (UnityPlacesDefaultRendererGroup* self) { +static gboolean _lambda53_ (UnityPlacesDefaultRendererGroup* self) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; if (self->priv->dirty) { @@ -854,9 +957,9 @@ static gboolean _lambda52_ (UnityPlacesDefaultRendererGroup* self) { } -static gboolean __lambda52__clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { +static gboolean __lambda53__clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { gboolean result; - result = _lambda52_ (self); + result = _lambda53_ (self); return result; } @@ -866,7 +969,7 @@ static void _unity_places_default_renderer_group_on_n_cols_changed_g_object_noti } -static void _lambda53_ (UnityPlacesDefaultRendererGroup* self) { +static void _lambda54_ (UnityPlacesDefaultRendererGroup* self) { UnityTestingObjectRegistry* _tmp0_; GeeArrayList* _tmp1_; GObject* _tmp2_; @@ -897,8 +1000,8 @@ static void _lambda53_ (UnityPlacesDefaultRendererGroup* self) { } -static void __lambda53__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda53_ (self); +static void __lambda54__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda54_ (self); } @@ -934,9 +1037,9 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu char* _tmp10_; char* _tmp11_; UnityPlacesExpander* _tmp12_; - CtkIconView* _tmp13_; - CtkPadding _tmp14_ = {0}; - CtkPadding _tmp15_; + CtkIconView* rend; + CtkPadding _tmp13_ = {0}; + CtkPadding _tmp14_; CtkButton* pad; DeeModelIter* iter; ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = 0.0f, _tmp0_.right = 0.0f, _tmp0_.bottom = 0.0f, _tmp0_.left = 0.0f, _tmp0_), &_tmp1_)); @@ -959,7 +1062,7 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu ctk_actor_set_padding ((CtkActor*) self->priv->title_button, (_tmp5_ = (_tmp4_.top = 4.0f, _tmp4_.right = 6.0f, _tmp4_.bottom = 4.0f, _tmp4_.left = 6.0f, _tmp4_), &_tmp5_)); ctk_box_pack ((CtkBox*) self->priv->vbox, (ClutterActor*) self->priv->title_button, FALSE, FALSE); clutter_actor_show ((ClutterActor*) self->priv->title_button); - g_signal_connect_object ((GObject*) self->priv->title_button, "notify::state", (GCallback) __lambda50__g_object_notify, self, 0); + g_signal_connect_object ((GObject*) self->priv->title_button, "notify::state", (GCallback) __lambda51__g_object_notify, self, 0); glow = g_object_ref_sink ((CtkEffectGlow*) ctk_effect_glow_new ()); ctk_effect_glow_set_factor (glow, 1.0f); ctk_effect_set_margin ((CtkEffect*) glow, 3); @@ -981,22 +1084,23 @@ static GObject * unity_places_default_renderer_group_constructor (GType type, gu 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); - g_signal_connect_object ((CtkButton*) self->priv->title_button, "clicked", (GCallback) __lambda51__ctk_button_clicked, self, 0); - g_signal_connect_object ((ClutterActor*) self->priv->title_button, "motion-event", (GCallback) __lambda52__clutter_actor_motion_event, self, 0); - self->priv->renderer = (_tmp13_ = g_object_ref_sink ((CtkIconView*) ctk_icon_view_new ()), _g_object_unref0 (self->priv->renderer), _tmp13_); - ctk_actor_set_padding ((CtkActor*) self->priv->renderer, (_tmp15_ = (_tmp14_.top = 12.0f, _tmp14_.right = 0.0f, _tmp14_.bottom = 0.0f, _tmp14_.left = 0.0f, _tmp14_), &_tmp15_)); + g_signal_connect_object ((CtkButton*) self->priv->title_button, "clicked", (GCallback) __lambda52__ctk_button_clicked, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->title_button, "motion-event", (GCallback) __lambda53__clutter_actor_motion_event, self, 0); + rend = g_object_ref_sink ((CtkIconView*) ctk_icon_view_new ()); + self->priv->renderer = rend; + ctk_actor_set_padding ((CtkActor*) self->priv->renderer, (_tmp14_ = (_tmp13_.top = 12.0f, _tmp13_.right = 0.0f, _tmp13_.bottom = 0.0f, _tmp13_.left = 0.0f, _tmp13_), &_tmp14_)); ctk_icon_view_set_spacing (self->priv->renderer, 24); 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); if (_vala_strcmp0 (self->priv->_group_renderer, "UnityLinkGroupRenderer") == 0) { - UnityPlacesMoreResultsButton* _tmp16_; + UnityPlacesMoreResultsButton* _tmp15_; self->priv->allow_expand = FALSE; - self->priv->more_results_button = (_tmp16_ = g_object_ref_sink (unity_places_more_results_button_new ()), _g_object_unref0 (self->priv->more_results_button), _tmp16_); + self->priv->more_results_button = (_tmp15_ = g_object_ref_sink (unity_places_more_results_button_new ()), _g_object_unref0 (self->priv->more_results_button), _tmp15_); ctk_box_pack ((CtkBox*) self->priv->vbox, (ClutterActor*) self->priv->more_results_button, FALSE, FALSE); clutter_actor_show ((ClutterActor*) self->priv->more_results_button); - g_signal_connect_object ((CtkButton*) self->priv->more_results_button, "clicked", (GCallback) __lambda53__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) self->priv->more_results_button, "clicked", (GCallback) __lambda54__ctk_button_clicked, self, 0); } pad = g_object_ref_sink ((CtkButton*) ctk_button_new (CTK_ORIENTATION_HORIZONTAL)); ctk_image_set_size (ctk_button_get_image (pad), (gint) UNITY_PLACES_DEFAULT_RENDERER_GROUP_PADDING); @@ -1019,6 +1123,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 (pad); + _g_object_unref0 (rend); _g_object_unref0 (glow); } return obj; @@ -1050,6 +1155,8 @@ static void unity_places_default_renderer_group_instance_init (UnityPlacesDefaul self->priv->dirty = FALSE; self->priv->allow_expand = TRUE; self->priv->last_result_timeout = FALSE; + self->priv->cleanup_tiles = NULL; + self->priv->cleanup_operation = (guint) 0; } @@ -1066,8 +1173,8 @@ static void unity_places_default_renderer_group_finalize (GObject* obj) { _g_object_unref0 (self->priv->icon); _g_object_unref0 (self->priv->text); _g_object_unref0 (self->priv->expander); - _g_object_unref0 (self->priv->renderer); _g_object_unref0 (self->priv->more_results_button); + __g_list_free_g_object_unref0 (self->priv->cleanup_tiles); G_OBJECT_CLASS (unity_places_default_renderer_group_parent_class)->finalize (obj); } diff --git a/unity-private/places/places-default-renderer-group.vala b/unity-private/places/places-default-renderer-group.vala index 9fe7b19f2..a98fd213d 100644 --- a/unity-private/places/places-default-renderer-group.vala +++ b/unity-private/places/places-default-renderer-group.vala @@ -59,7 +59,7 @@ namespace Unity.Places private Ctk.Image icon; private Ctk.Text text; private Expander expander; - private Ctk.IconView renderer; + private unowned Ctk.IconView renderer; private MoreResultsButton? more_results_button; @@ -73,6 +73,9 @@ namespace Unity.Places public signal void activated (string uri, string mimetype); + private GLib.List<Tile?> cleanup_tiles = new GLib.List<Tile?> (); + private uint cleanup_operation = 0; + public DefaultRendererGroup (uint group_id, string group_renderer, string display_name, @@ -172,7 +175,8 @@ namespace Unity.Places return false; }); - renderer = new Ctk.IconView (); + var rend = new Ctk.IconView (); + renderer = rend; renderer.padding = { 12.0f, 0.0f, 0.0f, 0.0f }; renderer.spacing = 24; vbox.pack (renderer, true, true); @@ -265,8 +269,18 @@ namespace Unity.Places Tile button; - - if (group_renderer == "UnityFileInfoRenderer") + if (cleanup_tiles.length () > 0) + { + button = cleanup_tiles.nth_data (0); + button.update_details (results.get_string (iter, 0), + results.get_string (iter, 1), + results.get_string (iter, 3), + results.get_string (iter, 4), + results.get_string (iter, 5)); + button.iter = iter; + cleanup_tiles.remove (button); + } + else if (group_renderer == "UnityFileInfoRenderer") { button = new FileInfoTile (iter, results.get_string (iter, 0), @@ -274,6 +288,11 @@ namespace Unity.Places results.get_string (iter, 3), results.get_string (iter, 4), results.get_string (iter, 5)); + + renderer.add_actor (button); + button.show (); + button.unref (); /* Because Vala sucks and holds references when it shouldn't*/; + button.activated.connect ((u, m) => { activated (u, m); }); } else if (group_renderer == "UnityShowcaseRenderer") { @@ -283,6 +302,11 @@ namespace Unity.Places results.get_string (iter, 3), results.get_string (iter, 4), results.get_string (iter, 5)); + renderer.add_actor (button); + button.show (); + button.unref (); /* Because Vala sucks and holds references when it shouldn't*/; + + button.activated.connect ((u, m) => { activated (u, m); }); } else { @@ -292,17 +316,18 @@ namespace Unity.Places results.get_string (iter, 3), results.get_string (iter, 4), results.get_string (iter, 5)); + renderer.add_actor (button); + button.show (); + button.unref (); /* Because Vala sucks and holds references when it shouldn't*/; + + button.activated.connect ((u, m) => { activated (u, m); }); } - renderer.add_actor (button); - button.show (); if (bin_state == ExpandingBinState.EXPANDED || _always_expanded) { button.about_to_show (); } - button.activated.connect ((u, m) => { activated (u, m); }); - add_to_n_results (1); if (bin_state == ExpandingBinState.CLOSED) @@ -317,6 +342,20 @@ namespace Unity.Places dirty = true; } + private bool cleanup_operation_callback () + { + foreach (Tile? tile in cleanup_tiles) + { + renderer.remove_actor (tile); + } + + cleanup_tiles = null; + cleanup_tiles = new GLib.List<Tile?> (); + + cleanup_operation = 0; + return false; + } + private void on_result_removed (Dee.ModelIter iter) { if (!interesting (iter)) @@ -329,7 +368,10 @@ namespace Unity.Places if (tile.iter == iter) { - actor.destroy (); + cleanup_tiles.append (tile); + if (cleanup_operation == 0) + cleanup_operation = Timeout.add (200, cleanup_operation_callback); + add_to_n_results (-1); break; } @@ -378,6 +420,9 @@ namespace Unity.Places more_results_button.count = 0; } } + + if (n_results == 1) + PixbufCache.get_default ().load_iteration (); } private void on_n_cols_changed () diff --git a/unity-private/places/places-default-renderer-tiles.c b/unity-private/places/places-default-renderer-tiles.c index 7d924822d..e3e8dc0e5 100644 --- a/unity-private/places/places-default-renderer-tiles.c +++ b/unity-private/places/places-default-renderer-tiles.c @@ -24,9 +24,9 @@ #include <glib-object.h> #include <clutk/clutk.h> #include <cairo.h> -#include <dee.h> #include <stdlib.h> #include <string.h> +#include <dee.h> #include <float.h> #include <math.h> #include <clutter/clutter.h> @@ -117,6 +117,7 @@ struct _UnityPlacesTile { struct _UnityPlacesTileClass { UnityPlacesButtonClass parent_class; void (*about_to_show) (UnityPlacesTile* self); + void (*update_details) (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); }; struct _UnityPlacesTilePrivate { @@ -205,21 +206,23 @@ enum { #define UNITY_PLACES_TILE_DEFAULT_ICON "text-x-preview" void unity_places_tile_about_to_show (UnityPlacesTile* self); static void unity_places_tile_real_about_to_show (UnityPlacesTile* self); +void unity_places_tile_update_details (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); +static void unity_places_tile_real_update_details (UnityPlacesTile* self, 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); UnityPlacesButton* unity_places_button_new (void); UnityPlacesButton* unity_places_button_construct (GType object_type); DeeModelIter* unity_places_tile_get_iter (UnityPlacesTile* self); -static void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value); +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); +void unity_places_tile_set_display_name (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_icon_hint (UnityPlacesTile* self); -static void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value); +void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_uri (UnityPlacesTile* self); -static void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value); +void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_mimetype (UnityPlacesTile* self); -static void unity_places_tile_set_mimetype (UnityPlacesTile* self, const char* value); +void unity_places_tile_set_mimetype (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_comment (UnityPlacesTile* self); -static void unity_places_tile_set_comment (UnityPlacesTile* self, const char* value); +void unity_places_tile_set_comment (UnityPlacesTile* self, const char* value); static void unity_places_tile_finalize (GObject* obj); static void unity_places_tile_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void unity_places_tile_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); @@ -236,18 +239,19 @@ enum { UnityPlacesFileInfoTile* unity_places_file_info_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesFileInfoTile* unity_places_file_info_tile_construct (GType object_type, DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); static void unity_places_file_info_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth); +static void unity_places_file_info_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); +static gboolean unity_places_file_info_tile_update_details_real (UnityPlacesFileInfoTile* self); static void unity_places_file_info_tile_real_about_to_show (UnityPlacesTile* base); GType unity_places_button_prelight_state_get_type (void) G_GNUC_CONST; void unity_places_button_set_prelight_state (UnityPlacesButton* self, UnityPlacesButtonPrelightState value); -static void _lambda43_ (UnityPlacesFileInfoTile* self); -static void __lambda43__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); -static gboolean _lambda44_ (UnityPlacesFileInfoTile* self); -static void _lambda45_ (Block1Data* _data1_); -static void __lambda45__ctk_button_clicked (CtkButton* _sender, gpointer self); +static void _lambda44_ (UnityPlacesFileInfoTile* self); +static void __lambda44__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static gboolean _unity_places_file_info_tile_update_details_real_gsource_func (gpointer self); +static void _lambda43_ (Block1Data* _data1_); +static void __lambda43__ctk_button_clicked (CtkButton* _sender, gpointer self); static Block1Data* block1_data_ref (Block1Data* _data1_); static void block1_data_unref (Block1Data* _data1_); static void unity_places_file_info_tile_set_icon (UnityPlacesFileInfoTile* self); -static gboolean __lambda44__gsource_func (gpointer self); static void unity_places_file_info_tile_real_clicked (CtkButton* base); static void unity_places_file_info_tile_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static void unity_places_file_info_tile_real_get_preferred_height (ClutterActor* base, float for_width, float* mheight, float* nheight); @@ -270,6 +274,7 @@ static void unity_places_showcase_tile_real_about_to_show (UnityPlacesTile* base static gboolean _lambda46_ (UnityPlacesShowcaseTile* self); static void unity_places_showcase_tile_set_icon (UnityPlacesShowcaseTile* self); static gboolean __lambda46__gsource_func (gpointer self); +static void unity_places_showcase_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); static void unity_places_showcase_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth); static void unity_places_showcase_tile_real_clicked (CtkButton* base); static GObject * unity_places_showcase_tile_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -284,9 +289,10 @@ enum { UnityPlacesDefaultTile* unity_places_default_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesDefaultTile* unity_places_default_tile_construct (GType object_type, DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); static void unity_places_default_tile_real_about_to_show (UnityPlacesTile* base); -static gboolean _lambda47_ (UnityPlacesDefaultTile* self); +static gboolean _lambda48_ (UnityPlacesDefaultTile* self); static void unity_places_default_tile_set_icon (UnityPlacesDefaultTile* self); -static gboolean __lambda47__gsource_func (gpointer self); +static gboolean __lambda48__gsource_func (gpointer self); +static void unity_places_default_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); static void unity_places_default_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth); static void unity_places_default_tile_real_clicked (CtkButton* base); static GObject * unity_places_default_tile_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -308,6 +314,18 @@ void unity_places_tile_about_to_show (UnityPlacesTile* self) { } +static void unity_places_tile_real_update_details (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment) { + g_return_if_fail (self != NULL); + g_critical ("Type `%s' does not implement abstract method `unity_places_tile_update_details'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void unity_places_tile_update_details (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment) { + UNITY_PLACES_TILE_GET_CLASS (self)->update_details (self, uri, icon_hint, mimetype, display_name, comment); +} + + UnityPlacesTile* unity_places_tile_construct (GType object_type) { UnityPlacesTile * self; self = (UnityPlacesTile*) unity_places_button_construct (object_type); @@ -323,7 +341,7 @@ DeeModelIter* unity_places_tile_get_iter (UnityPlacesTile* self) { } -static void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value) { +void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value) { g_return_if_fail (self != NULL); self->priv->_iter = value; g_object_notify ((GObject *) self, "iter"); @@ -338,7 +356,7 @@ const char* unity_places_tile_get_display_name (UnityPlacesTile* self) { } -static void unity_places_tile_set_display_name (UnityPlacesTile* self, const char* value) { +void unity_places_tile_set_display_name (UnityPlacesTile* self, const char* value) { char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_display_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_display_name), _tmp0_); @@ -354,7 +372,7 @@ const char* unity_places_tile_get_icon_hint (UnityPlacesTile* self) { } -static void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value) { +void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value) { char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_icon_hint = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_icon_hint), _tmp0_); @@ -370,7 +388,7 @@ const char* unity_places_tile_get_uri (UnityPlacesTile* self) { } -static void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value) { +void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value) { char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_uri = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_uri), _tmp0_); @@ -386,7 +404,7 @@ const char* unity_places_tile_get_mimetype (UnityPlacesTile* self) { } -static void unity_places_tile_set_mimetype (UnityPlacesTile* self, const char* value) { +void unity_places_tile_set_mimetype (UnityPlacesTile* self, const char* value) { char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_mimetype = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_mimetype), _tmp0_); @@ -402,7 +420,7 @@ const char* unity_places_tile_get_comment (UnityPlacesTile* self) { } -static void unity_places_tile_set_comment (UnityPlacesTile* self, const char* value) { +void unity_places_tile_set_comment (UnityPlacesTile* self, const char* value) { char* _tmp0_; g_return_if_fail (self != NULL); self->priv->_comment = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_comment), _tmp0_); @@ -414,15 +432,16 @@ static void unity_places_tile_class_init (UnityPlacesTileClass * klass) { unity_places_tile_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityPlacesTilePrivate)); UNITY_PLACES_TILE_CLASS (klass)->about_to_show = unity_places_tile_real_about_to_show; + UNITY_PLACES_TILE_CLASS (klass)->update_details = unity_places_tile_real_update_details; G_OBJECT_CLASS (klass)->get_property = unity_places_tile_get_property; G_OBJECT_CLASS (klass)->set_property = unity_places_tile_set_property; G_OBJECT_CLASS (klass)->finalize = unity_places_tile_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_ITER, g_param_spec_pointer ("iter", "iter", "iter", 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_PLACES_TILE_DISPLAY_NAME, g_param_spec_string ("display-name", "display-name", "display-name", 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_PLACES_TILE_ICON_HINT, g_param_spec_string ("icon-hint", "icon-hint", "icon-hint", 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_PLACES_TILE_URI, g_param_spec_string ("uri", "uri", "uri", 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_PLACES_TILE_MIMETYPE, g_param_spec_string ("mimetype", "mimetype", "mimetype", 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_PLACES_TILE_COMMENT, g_param_spec_string ("comment", "comment", "comment", 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_PLACES_TILE_ITER, g_param_spec_pointer ("iter", "iter", "iter", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_DISPLAY_NAME, g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_ICON_HINT, g_param_spec_string ("icon-hint", "icon-hint", "icon-hint", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_MIMETYPE, g_param_spec_string ("mimetype", "mimetype", "mimetype", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_TILE_COMMENT, g_param_spec_string ("comment", "comment", "comment", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); g_signal_new ("activated", UNITY_PLACES_TYPE_TILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); } @@ -435,6 +454,8 @@ static void unity_places_tile_instance_init (UnityPlacesTile * self) { static void unity_places_tile_finalize (GObject* obj) { UnityPlacesTile * self; self = UNITY_PLACES_TILE (obj); + { + } _g_free0 (self->priv->_display_name); _g_free0 (self->priv->_icon_hint); _g_free0 (self->priv->_uri); @@ -537,7 +558,24 @@ static void unity_places_file_info_tile_real_get_preferred_width (ClutterActor* } -static void _lambda43_ (UnityPlacesFileInfoTile* self) { +static void unity_places_file_info_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment) { + UnityPlacesFileInfoTile * self; + self = (UnityPlacesFileInfoTile*) base; + g_return_if_fail (uri != NULL); + g_return_if_fail (display_name != NULL); + unity_places_tile_set_display_name ((UnityPlacesTile*) self, display_name); + unity_places_tile_set_icon_hint ((UnityPlacesTile*) self, icon_hint); + unity_places_tile_set_uri ((UnityPlacesTile*) self, uri); + unity_places_tile_set_mimetype ((UnityPlacesTile*) self, mimetype); + unity_places_tile_set_comment ((UnityPlacesTile*) self, comment); + if (self->priv->shown == FALSE) { + return; + } + unity_places_file_info_tile_update_details_real (self); +} + + +static void _lambda44_ (UnityPlacesFileInfoTile* self) { gboolean _tmp0_ = FALSE; if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_NORMAL) { _tmp0_ = TRUE; @@ -568,8 +606,65 @@ static void _lambda43_ (UnityPlacesFileInfoTile* self) { } -static void __lambda43__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda43_ (self); +static void __lambda44__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda44_ (self); +} + + +static gboolean _unity_places_file_info_tile_update_details_real_gsource_func (gpointer self) { + gboolean result; + result = unity_places_file_info_tile_update_details_real (self); + return result; +} + + +static void unity_places_file_info_tile_real_about_to_show (UnityPlacesTile* base) { + UnityPlacesFileInfoTile * self; + CtkImage* _tmp0_; + CtkText* _tmp1_; + UnityPlacesButton* _tmp2_; + CtkPadding _tmp3_ = {0}; + CtkPadding _tmp4_; + CtkText* _tmp5_; + ClutterColor _tmp6_ = {0}; + ClutterColor _tmp7_; + const char* _tmp8_; + CtkText* _tmp9_; + self = (UnityPlacesFileInfoTile*) base; + if (self->priv->shown) { + return; + } + self->priv->shown = TRUE; + self->priv->icon = (_tmp0_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) UNITY_PLACES_FILE_INFO_TILE_ICON_HEIGHT)), _g_object_unref0 (self->priv->icon), _tmp0_); + clutter_actor_set_parent ((ClutterActor*) self->priv->icon, (ClutterActor*) self); + clutter_actor_show ((ClutterActor*) self->priv->icon); + self->priv->leaf = (_tmp1_ = g_object_ref_sink ((CtkText*) ctk_text_new (" ")), _g_object_unref0 (self->priv->leaf), _tmp1_); + clutter_text_set_ellipsize ((ClutterText*) self->priv->leaf, PANGO_ELLIPSIZE_MIDDLE); + clutter_actor_set_parent ((ClutterActor*) self->priv->leaf, (ClutterActor*) self); + clutter_actor_show ((ClutterActor*) self->priv->leaf); + self->priv->folder_button = (_tmp2_ = g_object_ref_sink (unity_places_button_new ()), _g_object_unref0 (self->priv->folder_button), _tmp2_); + unity_places_button_set_prelight_state (self->priv->folder_button, UNITY_PLACES_BUTTON_PRELIGHT_STATE_UNDERLINE); + clutter_actor_set_parent ((ClutterActor*) self->priv->folder_button, (ClutterActor*) self); + clutter_actor_show ((ClutterActor*) self->priv->folder_button); + ctk_actor_set_padding ((CtkActor*) self->priv->folder_button, (_tmp4_ = (_tmp3_.top = 1.0f, _tmp3_.right = 0.0f, _tmp3_.bottom = 0.0f, _tmp3_.left = 0.0f, _tmp3_), &_tmp4_)); + self->priv->folder = (_tmp5_ = g_object_ref_sink ((CtkText*) ctk_text_new ("")), _g_object_unref0 (self->priv->folder), _tmp5_); + clutter_text_set_ellipsize ((ClutterText*) self->priv->folder, PANGO_ELLIPSIZE_MIDDLE); + clutter_container_add_actor ((ClutterContainer*) self->priv->folder_button, (ClutterActor*) self->priv->folder); + clutter_text_set_color ((ClutterText*) self->priv->folder, (_tmp7_ = (_tmp6_.red = (guint8) 255, _tmp6_.green = (guint8) 255, _tmp6_.blue = (guint8) 255, _tmp6_.alpha = (guint8) 100, _tmp6_), &_tmp7_)); + clutter_actor_show ((ClutterActor*) self->priv->folder); + _tmp8_ = NULL; + if (_vala_strcmp0 (unity_places_tile_get_uri ((UnityPlacesTile*) self), unity_places_tile_get_comment ((UnityPlacesTile*) self)) == 0) { + _tmp8_ = ""; + } else { + _tmp8_ = unity_places_tile_get_comment ((UnityPlacesTile*) self); + } + self->priv->time = (_tmp9_ = g_object_ref_sink ((CtkText*) ctk_text_new (_tmp8_)), _g_object_unref0 (self->priv->time), _tmp9_); + clutter_text_set_ellipsize ((ClutterText*) self->priv->time, PANGO_ELLIPSIZE_MIDDLE); + clutter_actor_set_parent ((ClutterActor*) self->priv->time, (ClutterActor*) self); + clutter_actor_show ((ClutterActor*) self->priv->time); + g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) __lambda44__g_object_notify, self, 0); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, _unity_places_file_info_tile_update_details_real_gsource_func, g_object_ref (self), g_object_unref); + clutter_actor_queue_relayout ((ClutterActor*) self); } @@ -581,7 +676,7 @@ static const char* string_to_string (const char* self) { } -static void _lambda45_ (Block1Data* _data1_) { +static void _lambda43_ (Block1Data* _data1_) { UnityPlacesFileInfoTile * self; GError * _inner_error_ = NULL; self = _data1_->self; @@ -598,7 +693,7 @@ static void _lambda45_ (Block1Data* _data1_) { _inner_error_ = NULL; { char* _tmp1_; - g_warning ("places-default-renderer-tiles.vala:149: %s", _tmp1_ = g_strconcat ("Unable to launch parent folder: ", string_to_string (e->message), NULL)); + g_warning ("places-default-renderer-tiles.vala:188: %s", _tmp1_ = g_strconcat ("Unable to launch parent folder: ", string_to_string (e->message), NULL)); _g_free0 (_tmp1_); _g_error_free0 (e); } @@ -612,8 +707,8 @@ static void _lambda45_ (Block1Data* _data1_) { } -static void __lambda45__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda45_ (self); +static void __lambda43__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda43_ (self); } @@ -632,9 +727,10 @@ static void block1_data_unref (Block1Data* _data1_) { } -static gboolean _lambda44_ (UnityPlacesFileInfoTile* self) { +static gboolean unity_places_file_info_tile_update_details_real (UnityPlacesFileInfoTile* self) { gboolean result = FALSE; GFile* file; + g_return_val_if_fail (self != NULL, FALSE); clutter_text_set_text ((ClutterText*) self->priv->leaf, unity_places_tile_get_display_name ((UnityPlacesTile*) self)); file = g_file_new_for_uri (unity_places_tile_get_uri ((UnityPlacesTile*) self)); if (G_IS_FILE (file)) { @@ -647,7 +743,7 @@ static gboolean _lambda44_ (UnityPlacesFileInfoTile* self) { char* _tmp0_; clutter_text_set_text ((ClutterText*) self->priv->folder, _tmp0_ = g_file_get_basename (_data1_->parent)); _g_free0 (_tmp0_); - g_signal_connect_data ((CtkButton*) self->priv->folder_button, "clicked", (GCallback) __lambda45__ctk_button_clicked, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); + g_signal_connect_data ((CtkButton*) self->priv->folder_button, "clicked", (GCallback) __lambda43__ctk_button_clicked, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); } else { clutter_text_set_text ((ClutterText*) self->priv->folder, ""); } @@ -662,63 +758,6 @@ static gboolean _lambda44_ (UnityPlacesFileInfoTile* self) { } -static gboolean __lambda44__gsource_func (gpointer self) { - gboolean result; - result = _lambda44_ (self); - return result; -} - - -static void unity_places_file_info_tile_real_about_to_show (UnityPlacesTile* base) { - UnityPlacesFileInfoTile * self; - CtkImage* _tmp0_; - CtkText* _tmp1_; - UnityPlacesButton* _tmp2_; - CtkPadding _tmp3_ = {0}; - CtkPadding _tmp4_; - CtkText* _tmp5_; - ClutterColor _tmp6_ = {0}; - ClutterColor _tmp7_; - const char* _tmp8_; - CtkText* _tmp9_; - self = (UnityPlacesFileInfoTile*) base; - if (self->priv->shown) { - return; - } - self->priv->shown = TRUE; - self->priv->icon = (_tmp0_ = g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) UNITY_PLACES_FILE_INFO_TILE_ICON_HEIGHT)), _g_object_unref0 (self->priv->icon), _tmp0_); - clutter_actor_set_parent ((ClutterActor*) self->priv->icon, (ClutterActor*) self); - clutter_actor_show ((ClutterActor*) self->priv->icon); - self->priv->leaf = (_tmp1_ = g_object_ref_sink ((CtkText*) ctk_text_new (" ")), _g_object_unref0 (self->priv->leaf), _tmp1_); - clutter_text_set_ellipsize ((ClutterText*) self->priv->leaf, PANGO_ELLIPSIZE_MIDDLE); - clutter_actor_set_parent ((ClutterActor*) self->priv->leaf, (ClutterActor*) self); - clutter_actor_show ((ClutterActor*) self->priv->leaf); - self->priv->folder_button = (_tmp2_ = g_object_ref_sink (unity_places_button_new ()), _g_object_unref0 (self->priv->folder_button), _tmp2_); - unity_places_button_set_prelight_state (self->priv->folder_button, UNITY_PLACES_BUTTON_PRELIGHT_STATE_UNDERLINE); - clutter_actor_set_parent ((ClutterActor*) self->priv->folder_button, (ClutterActor*) self); - clutter_actor_show ((ClutterActor*) self->priv->folder_button); - ctk_actor_set_padding ((CtkActor*) self->priv->folder_button, (_tmp4_ = (_tmp3_.top = 1.0f, _tmp3_.right = 0.0f, _tmp3_.bottom = 0.0f, _tmp3_.left = 0.0f, _tmp3_), &_tmp4_)); - self->priv->folder = (_tmp5_ = g_object_ref_sink ((CtkText*) ctk_text_new ("")), _g_object_unref0 (self->priv->folder), _tmp5_); - clutter_text_set_ellipsize ((ClutterText*) self->priv->folder, PANGO_ELLIPSIZE_MIDDLE); - clutter_container_add_actor ((ClutterContainer*) self->priv->folder_button, (ClutterActor*) self->priv->folder); - clutter_text_set_color ((ClutterText*) self->priv->folder, (_tmp7_ = (_tmp6_.red = (guint8) 255, _tmp6_.green = (guint8) 255, _tmp6_.blue = (guint8) 255, _tmp6_.alpha = (guint8) 100, _tmp6_), &_tmp7_)); - clutter_actor_show ((ClutterActor*) self->priv->folder); - _tmp8_ = NULL; - if (_vala_strcmp0 (unity_places_tile_get_uri ((UnityPlacesTile*) self), unity_places_tile_get_comment ((UnityPlacesTile*) self)) == 0) { - _tmp8_ = ""; - } else { - _tmp8_ = unity_places_tile_get_comment ((UnityPlacesTile*) self); - } - self->priv->time = (_tmp9_ = g_object_ref_sink ((CtkText*) ctk_text_new (_tmp8_)), _g_object_unref0 (self->priv->time), _tmp9_); - clutter_text_set_ellipsize ((ClutterText*) self->priv->time, PANGO_ELLIPSIZE_MIDDLE); - clutter_actor_set_parent ((ClutterActor*) self->priv->time, (ClutterActor*) self); - clutter_actor_show ((ClutterActor*) self->priv->time); - g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) __lambda43__g_object_notify, self, 0); - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda44__gsource_func, g_object_ref (self), g_object_unref); - clutter_actor_queue_relayout ((ClutterActor*) self); -} - - static void unity_places_file_info_tile_real_clicked (CtkButton* base) { UnityPlacesFileInfoTile * self; self = (UnityPlacesFileInfoTile*) base; @@ -891,6 +930,7 @@ static void unity_places_file_info_tile_class_init (UnityPlacesFileInfoTileClass unity_places_file_info_tile_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityPlacesFileInfoTilePrivate)); CLUTTER_ACTOR_CLASS (klass)->get_preferred_width = unity_places_file_info_tile_real_get_preferred_width; + UNITY_PLACES_TILE_CLASS (klass)->update_details = unity_places_file_info_tile_real_update_details; UNITY_PLACES_TILE_CLASS (klass)->about_to_show = unity_places_file_info_tile_real_about_to_show; CTK_BUTTON_CLASS (klass)->clicked = unity_places_file_info_tile_real_clicked; CLUTTER_ACTOR_CLASS (klass)->allocate = unity_places_file_info_tile_real_allocate; @@ -913,6 +953,12 @@ static void unity_places_file_info_tile_instance_init (UnityPlacesFileInfoTile * static void unity_places_file_info_tile_finalize (GObject* obj) { UnityPlacesFileInfoTile * self; self = UNITY_PLACES_FILE_INFO_TILE (obj); + { + clutter_actor_unparent ((ClutterActor*) self->priv->icon); + clutter_actor_unparent ((ClutterActor*) self->priv->leaf); + clutter_actor_unparent ((ClutterActor*) self->priv->folder_button); + clutter_actor_unparent ((ClutterActor*) self->priv->time); + } _g_object_unref0 (self->priv->icon); _g_object_unref0 (self->priv->leaf); _g_object_unref0 (self->priv->folder_button); @@ -976,6 +1022,24 @@ static void unity_places_showcase_tile_real_about_to_show (UnityPlacesTile* base } +static void unity_places_showcase_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment) { + UnityPlacesShowcaseTile * self; + self = (UnityPlacesShowcaseTile*) base; + g_return_if_fail (uri != NULL); + g_return_if_fail (display_name != NULL); + unity_places_tile_set_display_name ((UnityPlacesTile*) self, display_name); + unity_places_tile_set_icon_hint ((UnityPlacesTile*) self, icon_hint); + unity_places_tile_set_uri ((UnityPlacesTile*) self, uri); + unity_places_tile_set_mimetype ((UnityPlacesTile*) self, mimetype); + unity_places_tile_set_comment ((UnityPlacesTile*) self, comment); + if (self->priv->shown == FALSE) { + return; + } + ctk_button_set_label ((CtkButton*) self, display_name); + unity_places_showcase_tile_set_icon (self); +} + + static void unity_places_showcase_tile_real_get_preferred_width (ClutterActor* base, float for_height, float* mwidth, float* nwidth) { UnityPlacesShowcaseTile * self; self = (UnityPlacesShowcaseTile*) base; @@ -1047,6 +1111,7 @@ static void unity_places_showcase_tile_class_init (UnityPlacesShowcaseTileClass unity_places_showcase_tile_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityPlacesShowcaseTilePrivate)); UNITY_PLACES_TILE_CLASS (klass)->about_to_show = unity_places_showcase_tile_real_about_to_show; + UNITY_PLACES_TILE_CLASS (klass)->update_details = unity_places_showcase_tile_real_update_details; CLUTTER_ACTOR_CLASS (klass)->get_preferred_width = unity_places_showcase_tile_real_get_preferred_width; CTK_BUTTON_CLASS (klass)->clicked = unity_places_showcase_tile_real_clicked; G_OBJECT_CLASS (klass)->constructor = unity_places_showcase_tile_constructor; @@ -1094,7 +1159,7 @@ UnityPlacesDefaultTile* unity_places_default_tile_new (DeeModelIter* iter, const } -static gboolean _lambda47_ (UnityPlacesDefaultTile* self) { +static gboolean _lambda48_ (UnityPlacesDefaultTile* self) { gboolean result = FALSE; ctk_button_set_label ((CtkButton*) self, unity_places_tile_get_display_name ((UnityPlacesTile*) self)); unity_places_default_tile_set_icon (self); @@ -1103,9 +1168,9 @@ static gboolean _lambda47_ (UnityPlacesDefaultTile* self) { } -static gboolean __lambda47__gsource_func (gpointer self) { +static gboolean __lambda48__gsource_func (gpointer self) { gboolean result; - result = _lambda47_ (self); + result = _lambda48_ (self); return result; } @@ -1117,7 +1182,25 @@ static void unity_places_default_tile_real_about_to_show (UnityPlacesTile* base) return; } self->priv->shown = TRUE; - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda47__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda48__gsource_func, g_object_ref (self), g_object_unref); +} + + +static void unity_places_default_tile_real_update_details (UnityPlacesTile* base, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment) { + UnityPlacesDefaultTile * self; + self = (UnityPlacesDefaultTile*) base; + g_return_if_fail (uri != NULL); + g_return_if_fail (display_name != NULL); + unity_places_tile_set_display_name ((UnityPlacesTile*) self, display_name); + unity_places_tile_set_icon_hint ((UnityPlacesTile*) self, icon_hint); + unity_places_tile_set_uri ((UnityPlacesTile*) self, uri); + unity_places_tile_set_mimetype ((UnityPlacesTile*) self, mimetype); + unity_places_tile_set_comment ((UnityPlacesTile*) self, comment); + if (self->priv->shown == FALSE) { + return; + } + ctk_button_set_label ((CtkButton*) self, display_name); + unity_places_default_tile_set_icon (self); } @@ -1191,6 +1274,7 @@ static void unity_places_default_tile_class_init (UnityPlacesDefaultTileClass * unity_places_default_tile_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityPlacesDefaultTilePrivate)); UNITY_PLACES_TILE_CLASS (klass)->about_to_show = unity_places_default_tile_real_about_to_show; + UNITY_PLACES_TILE_CLASS (klass)->update_details = unity_places_default_tile_real_update_details; CLUTTER_ACTOR_CLASS (klass)->get_preferred_width = unity_places_default_tile_real_get_preferred_width; CTK_BUTTON_CLASS (klass)->clicked = unity_places_default_tile_real_clicked; G_OBJECT_CLASS (klass)->constructor = unity_places_default_tile_constructor; diff --git a/unity-private/places/places-default-renderer-tiles.vala b/unity-private/places/places-default-renderer-tiles.vala index 1f4279678..ad5c3ca77 100644 --- a/unity-private/places/places-default-renderer-tiles.vala +++ b/unity-private/places/places-default-renderer-tiles.vala @@ -21,19 +21,28 @@ namespace Unity.Places { public abstract class Tile : Button { + ~Tile () + { + } + static const string DEFAULT_ICON = "text-x-preview"; - public unowned Dee.ModelIter iter { get; construct; } + public unowned Dee.ModelIter iter { get; construct set; } - public string display_name { get; construct; } - public string? icon_hint { get; construct; } - public string uri { get; construct; } - public string? mimetype { get; construct; } - public string? comment { get; construct; } + public string display_name { get; construct set; } + public string? icon_hint { get; construct set; } + public string uri { get; construct set; } + public string? mimetype { get; construct set; } + public string? comment { get; construct set; } public signal void activated (string uri, string mimetype); public abstract void about_to_show (); + public abstract void update_details (string uri, + string? icon_hint, + string? mimetype, + string display_name, + string? comment); } public class FileInfoTile : Tile @@ -68,6 +77,14 @@ namespace Unity.Places comment:comment); } + ~FileInfoTile () + { + icon.unparent (); + leaf.unparent (); + folder_button.unparent (); + time.unparent (); + } + construct { } @@ -80,6 +97,24 @@ namespace Unity.Places nwidth = 210.0f; } + public override void update_details (string uri, + string? icon_hint, + string? mimetype, + string display_name, + string? comment) + { + this.display_name = display_name; + this.icon_hint = icon_hint; + this.uri = uri; + this.mimetype = mimetype; + this.comment = comment; + + if (shown == false) + return; + + update_details_real (); + } + public override void about_to_show () { if (shown) @@ -129,38 +164,40 @@ namespace Unity.Places } }); - Timeout.add (0, () => { - - leaf.text = display_name; + Timeout.add (0, update_details_real); + queue_relayout (); + } - /* Set the parent directory */ - var file = File.new_for_uri (uri); - if (file is File) - { - var parent = file.get_parent (); - if (parent is File) - { - folder.text = parent.get_basename (); - folder_button.clicked.connect (() => { - try { - activated (parent.get_uri (), "inode/directory"); - - } catch (Error e) { - warning (@"Unable to launch parent folder: $(e.message)"); - } - }); - } - else - folder.text = ""; - } - else - folder.text = ""; + private bool update_details_real () + { + leaf.text = display_name; - set_icon (); - return false; - }); + /* Set the parent directory */ + var file = File.new_for_uri (uri); + if (file is File) + { + var parent = file.get_parent (); + if (parent is File) + { + folder.text = parent.get_basename (); + folder_button.clicked.connect (() => { + try { + activated (parent.get_uri (), "inode/directory"); + + } catch (Error e) { + warning (@"Unable to launch parent folder: $(e.message)"); + } + }); + } + else + folder.text = ""; + } + else + folder.text = ""; - queue_relayout (); + set_icon (); + + return false; } private override void clicked () @@ -359,6 +396,25 @@ namespace Unity.Places }); } + public override void update_details (string uri, + string? icon_hint, + string? mimetype, + string display_name, + string? comment) + { + this.display_name = display_name; + this.icon_hint = icon_hint; + this.uri = uri; + this.mimetype = mimetype; + this.comment = comment; + + if (shown == false) + return; + + set_label (display_name); + set_icon (); + } + private override void get_preferred_width (float for_height, out float mwidth, out float nwidth) @@ -444,7 +500,24 @@ namespace Unity.Places }); } - private override void get_preferred_width (float for_height, + public override void update_details (string uri, + string? icon_hint, + string? mimetype, + string display_name, + string? comment) + { + this.display_name = display_name; + this.icon_hint = icon_hint; + this.uri = uri; + this.mimetype = mimetype; + this.comment = comment; + + if (shown == false) + return; + + set_label (display_name); + set_icon (); + } private override void get_preferred_width (float for_height, out float mwidth, out float nwidth) { diff --git a/unity-private/places/places-default-renderer.c b/unity-private/places/places-default-renderer.c index 231dad053..8b1175956 100644 --- a/unity-private/places/places-default-renderer.c +++ b/unity-private/places/places-default-renderer.c @@ -30,8 +30,8 @@ #include <float.h> #include <math.h> #include <cairo.h> -#include <gee.h> #include <clutter/clutter.h> +#include <gee.h> #define UNITY_PLACES_TYPE_DEFAULT_RENDERER (unity_places_default_renderer_get_type ()) @@ -65,6 +65,9 @@ typedef struct _UnityPlacesEmptySearchGroupClass UnityPlacesEmptySearchGroupClas typedef struct _UnityPlacesEmptySectionGroup UnityPlacesEmptySectionGroup; typedef struct _UnityPlacesEmptySectionGroupClass UnityPlacesEmptySectionGroupClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _cairo_pattern_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_pattern_destroy (var), NULL))) +#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL))) +#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) #define UNITY_PLACES_TYPE_DEFAULT_RENDERER_GROUP (unity_places_default_renderer_group_get_type ()) @@ -81,7 +84,6 @@ typedef struct _UnityPlacesEmptySearchGroupPrivate UnityPlacesEmptySearchGroupPr #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) typedef struct _Block2Data Block2Data; typedef struct _UnityPlacesEmptySectionGroupPrivate UnityPlacesEmptySectionGroupPrivate; -#define _cairo_pattern_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_pattern_destroy (var), NULL))) struct _UnityPlacesDefaultRenderer { UnityLayeredBin parent_instance; @@ -98,6 +100,9 @@ struct _UnityPlacesDefaultRendererPrivate { CtkScrollView* scroll; UnityCairoCanvas* trough; UnityCairoCanvas* slider; + gint slider_state; + gboolean button_pressed; + CtkEffectGlow* slider_glow; CtkVBox* box; DeeModel* groups_model; DeeModel* results_model; @@ -163,11 +168,18 @@ enum { #define UNITY_PLACES_DEFAULT_RENDERER_TOP_PADDING 22.0f #define UNITY_PLACES_DEFAULT_RENDERER_PADDING 12.0f #define UNITY_PLACES_DEFAULT_RENDERER_SPACING 0 +#define UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_NORMAL 0 +#define UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT 1 +#define UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_ACTIVE 2 UnityPlacesDefaultRenderer* unity_places_default_renderer_new (void); UnityPlacesDefaultRenderer* unity_places_default_renderer_construct (GType object_type); static double _unity_places_default_renderer_align (double val); static void unity_places_default_renderer_trough_paint (UnityPlacesDefaultRenderer* self, cairo_t* cr, gint width, gint height); static void unity_places_default_renderer_slider_paint (UnityPlacesDefaultRenderer* self, cairo_t* cr, gint width, gint height); +static gboolean unity_places_default_renderer_on_slider_enter (UnityPlacesDefaultRenderer* self, ClutterEvent* event); +static gboolean unity_places_default_renderer_on_slider_leave (UnityPlacesDefaultRenderer* self, ClutterEvent* event); +static gboolean unity_places_default_renderer_on_slider_button_press (UnityPlacesDefaultRenderer* self, ClutterEvent* event); +static gboolean unity_places_default_renderer_on_slider_button_release (UnityPlacesDefaultRenderer* self, ClutterEvent* event); static void unity_places_default_renderer_real_set_models (UnityPlaceRenderer* base, DeeModel* groups, DeeModel* results, GeeHashMap* hints); static void unity_places_default_renderer_on_group_added (UnityPlacesDefaultRenderer* self, DeeModel* model, DeeModelIter* iter); static void _unity_places_default_renderer_on_group_added_dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self); @@ -178,20 +190,24 @@ gboolean unity_places_empty_search_group_get_active (UnityPlacesEmptySearchGroup gboolean unity_places_empty_section_group_get_active (UnityPlacesEmptySectionGroup* self); UnityPlacesEmptySearchGroup* unity_places_empty_search_group_new (guint group_id, DeeModel* results); UnityPlacesEmptySearchGroup* unity_places_empty_search_group_construct (GType object_type, guint group_id, DeeModel* results); -static void _lambda64_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self); -static void __lambda64__unity_places_empty_search_group_activated (UnityPlacesEmptySearchGroup* _sender, const char* uri, const char* mimetype, gpointer self); +static void _lambda65_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self); +static void __lambda65__unity_places_empty_search_group_activated (UnityPlacesEmptySearchGroup* _sender, const char* uri, const char* mimetype, gpointer self); static void _unity_places_default_renderer_update_views_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); UnityPlacesEmptySectionGroup* unity_places_empty_section_group_new (guint group_id, DeeModel* results); UnityPlacesEmptySectionGroup* unity_places_empty_section_group_construct (GType object_type, guint group_id, DeeModel* results); 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); GType unity_places_default_renderer_group_get_type (void) G_GNUC_CONST; -static void _lambda65_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self); -static void __lambda65__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self); +static void _lambda66_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self); +static void __lambda66__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self); void unity_places_default_renderer_group_set_always_expanded (UnityPlacesDefaultRendererGroup* self, gboolean value); static void _g_list_free_g_object_unref (GList* self); static void _unity_places_default_renderer_trough_paint_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); static void _unity_places_default_renderer_slider_paint_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); +static gboolean _unity_places_default_renderer_on_slider_enter_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _unity_places_default_renderer_on_slider_leave_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _unity_places_default_renderer_on_slider_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _unity_places_default_renderer_on_slider_button_release_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static GObject * unity_places_default_renderer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_default_renderer_finalize (GObject* obj); #define UNITY_PLACES_EMPTY_SEARCH_GROUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_EMPTY_SEARCH_GROUP, UnityPlacesEmptySearchGroupPrivate)) @@ -204,8 +220,8 @@ enum { static void unity_places_empty_search_group_on_result_added (UnityPlacesEmptySearchGroup* self, DeeModelIter* iter); static gboolean unity_places_empty_search_group_interesting (UnityPlacesEmptySearchGroup* self, DeeModelIter* iter); DeeModel* unity_places_empty_search_group_get_results (UnityPlacesEmptySearchGroup* self); -static void _lambda63_ (Block2Data* _data2_); -static void __lambda63__ctk_button_clicked (CtkButton* _sender, gpointer self); +static void _lambda64_ (Block2Data* _data2_); +static void __lambda64__ctk_button_clicked (CtkButton* _sender, gpointer self); static Block2Data* block2_data_ref (Block2Data* _data2_); static void block2_data_unref (Block2Data* _data2_); void unity_places_empty_search_group_set_active (UnityPlacesEmptySearchGroup* self, gboolean value); @@ -279,9 +295,16 @@ static double _unity_places_default_renderer_align (double val) { static void unity_places_default_renderer_trough_paint (UnityPlacesDefaultRenderer* self, cairo_t* cr, gint width, gint height) { + cairo_surface_t* dots; + cairo_t* cr_dots; + cairo_pattern_t* dot_pattern; double radius; + cairo_pattern_t* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (cr != NULL); + dots = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 4, 4); + cr_dots = cairo_create (dots); + dot_pattern = NULL; radius = ((double) width) / 2.0f; cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); @@ -294,18 +317,49 @@ static void unity_places_default_renderer_trough_paint (UnityPlacesDefaultRender cairo_arc (cr, radius, (((double) height) - radius) - 0.5f, radius - 0.5f, (0.0f * G_PI) / 180.0f, (180.0f * G_PI) / 180.0f); cairo_close_path (cr); cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.1f); + cairo_set_operator (cr_dots, CAIRO_OPERATOR_CLEAR); + cairo_paint (cr_dots); + cairo_scale (cr_dots, (double) 1.0f, (double) 1.0f); + cairo_set_operator (cr_dots, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba (cr_dots, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.025f); + cairo_rectangle (cr_dots, (double) 0.0f, (double) 0.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + cairo_rectangle (cr_dots, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + cairo_rectangle (cr_dots, (double) 2.0f, (double) 0.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + cairo_rectangle (cr_dots, (double) 0.0f, (double) 2.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + cairo_rectangle (cr_dots, (double) 2.0f, (double) 2.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + cairo_rectangle (cr_dots, (double) 3.0f, (double) 3.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_dots); + dot_pattern = (_tmp0_ = cairo_pattern_create_for_surface (dots), _cairo_pattern_destroy0 (dot_pattern), _tmp0_); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_set_source (cr, dot_pattern); + cairo_pattern_set_extend (dot_pattern, CAIRO_EXTEND_REPEAT); cairo_fill_preserve (cr); cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.35f); cairo_stroke (cr); + _cairo_pattern_destroy0 (dot_pattern); + _cairo_destroy0 (cr_dots); + _cairo_surface_destroy0 (dots); } static void unity_places_default_renderer_slider_paint (UnityPlacesDefaultRenderer* self, cairo_t* cr, gint width, gint height) { + cairo_surface_t* stripes; + cairo_t* cr_stripes; + cairo_pattern_t* stripe_pattern; double radius; double half; double half_height; + gboolean _tmp1_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (cr != NULL); + stripes = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 4, 4); + cr_stripes = cairo_create (stripes); + stripe_pattern = NULL; radius = ((double) width) / 2.0f; half = ((double) width) / 2.0f; half_height = ((double) height) / 2.0f; @@ -319,7 +373,34 @@ static void unity_places_default_renderer_slider_paint (UnityPlacesDefaultRender cairo_line_to (cr, ((double) width) - 0.5f, (((double) height) - radius) - 0.5f); cairo_arc (cr, radius, (((double) height) - radius) - 0.5f, radius - 0.5f, (0.0f * G_PI) / 180.0f, (180.0f * G_PI) / 180.0f); cairo_close_path (cr); - cairo_set_source_rgba (cr, (double) 0.0f, (double) 0.0f, (double) 0.0f, (double) 0.15f); + if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_NORMAL) { + cairo_set_source_rgba (cr, (double) 0.0f, (double) 0.0f, (double) 0.0f, (double) 0.15f); + } else { + if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT) { + cairo_pattern_t* _tmp0_; + cairo_set_operator (cr_stripes, CAIRO_OPERATOR_CLEAR); + cairo_paint (cr_stripes); + cairo_scale (cr_stripes, (double) 1.0f, (double) 1.0f); + cairo_set_operator (cr_stripes, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba (cr_stripes, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.25f); + cairo_rectangle (cr_stripes, (double) 0.0f, (double) 0.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_stripes); + cairo_rectangle (cr_stripes, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_stripes); + cairo_rectangle (cr_stripes, (double) 2.0f, (double) 2.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_stripes); + cairo_rectangle (cr_stripes, (double) 3.0f, (double) 3.0f, (double) 1.0f, (double) 1.0f); + cairo_fill (cr_stripes); + stripe_pattern = (_tmp0_ = cairo_pattern_create_for_surface (stripes), _cairo_pattern_destroy0 (stripe_pattern), _tmp0_); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_set_source (cr, stripe_pattern); + cairo_pattern_set_extend (stripe_pattern, CAIRO_EXTEND_REPEAT); + } else { + if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_ACTIVE) { + cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 1.0f); + } + } + } cairo_fill_preserve (cr); cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.5f); cairo_stroke (cr); @@ -330,7 +411,70 @@ static void unity_places_default_renderer_slider_paint (UnityPlacesDefaultRender cairo_line_to (cr, _unity_places_default_renderer_align (((double) width) - 2.0f), _unity_places_default_renderer_align (half_height)); cairo_move_to (cr, _unity_places_default_renderer_align ((double) 1.0f), _unity_places_default_renderer_align (half_height + 2.0f)); cairo_line_to (cr, _unity_places_default_renderer_align (((double) width) - 2.0f), _unity_places_default_renderer_align (half_height + 2.0f)); + if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_NORMAL) { + _tmp1_ = TRUE; + } else { + _tmp1_ = self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT; + } + if (_tmp1_) { + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + } else { + if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_ACTIVE) { + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + } + } cairo_stroke (cr); + _cairo_pattern_destroy0 (stripe_pattern); + _cairo_destroy0 (cr_stripes); + _cairo_surface_destroy0 (stripes); +} + + +static gboolean unity_places_default_renderer_on_slider_enter (UnityPlacesDefaultRenderer* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + self->priv->slider_state = UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT; + unity_cairo_canvas_update (self->priv->slider); + ctk_effect_set_invalidate_effect_cache ((CtkEffect*) self->priv->slider_glow, TRUE); + result = FALSE; + return result; +} + + +static gboolean unity_places_default_renderer_on_slider_leave (UnityPlacesDefaultRenderer* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (!self->priv->button_pressed) { + self->priv->slider_state = UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_NORMAL; + unity_cairo_canvas_update (self->priv->slider); + ctk_effect_set_invalidate_effect_cache ((CtkEffect*) self->priv->slider_glow, TRUE); + } + result = FALSE; + return result; +} + + +static gboolean unity_places_default_renderer_on_slider_button_press (UnityPlacesDefaultRenderer* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + self->priv->button_pressed = TRUE; + self->priv->slider_state = UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_ACTIVE; + unity_cairo_canvas_update (self->priv->slider); + ctk_effect_set_invalidate_effect_cache ((CtkEffect*) self->priv->slider_glow, TRUE); + result = FALSE; + return result; +} + + +static gboolean unity_places_default_renderer_on_slider_button_release (UnityPlacesDefaultRenderer* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + self->priv->button_pressed = FALSE; + self->priv->slider_state = UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT; + unity_cairo_canvas_update (self->priv->slider); + ctk_effect_set_invalidate_effect_cache ((CtkEffect*) self->priv->slider_glow, TRUE); + result = FALSE; + return result; } @@ -412,15 +556,15 @@ static void unity_places_default_renderer_update_views (UnityPlacesDefaultRender } -static void _lambda64_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self) { +static void _lambda65_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self) { g_return_if_fail (u != NULL); g_return_if_fail (m != NULL); g_signal_emit_by_name ((UnityPlaceRenderer*) self, "activated", u, m); } -static void __lambda64__unity_places_empty_search_group_activated (UnityPlacesEmptySearchGroup* _sender, const char* uri, const char* mimetype, gpointer self) { - _lambda64_ (uri, mimetype, self); +static void __lambda65__unity_places_empty_search_group_activated (UnityPlacesEmptySearchGroup* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda65_ (uri, mimetype, self); } @@ -429,15 +573,15 @@ static void _unity_places_default_renderer_update_views_g_object_notify (GObject } -static void _lambda65_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self) { +static void _lambda66_ (const char* u, const char* m, UnityPlacesDefaultRenderer* self) { g_return_if_fail (u != NULL); g_return_if_fail (m != NULL); g_signal_emit_by_name ((UnityPlaceRenderer*) self, "activated", u, m); } -static void __lambda65__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self) { - _lambda65_ (uri, mimetype, self); +static void __lambda66__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda66_ (uri, mimetype, self); } @@ -452,7 +596,7 @@ static void unity_places_default_renderer_on_group_added (UnityPlacesDefaultRend self->priv->search_empty = (_tmp0_ = g_object_ref_sink (unity_places_empty_search_group_new ((guint) dee_model_get_position (model, iter), self->priv->results_model)), _g_object_unref0 (self->priv->search_empty), _tmp0_); clutter_actor_set_opacity ((ClutterActor*) self->priv->search_empty, (guint8) 0); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->priv->search_empty); - g_signal_connect_object (self->priv->search_empty, "activated", (GCallback) __lambda64__unity_places_empty_search_group_activated, self, 0); + g_signal_connect_object (self->priv->search_empty, "activated", (GCallback) __lambda65__unity_places_empty_search_group_activated, self, 0); g_signal_connect_object ((GObject*) self->priv->search_empty, "notify::active", (GCallback) _unity_places_default_renderer_update_views_g_object_notify, self, 0); } else { if (_vala_strcmp0 (renderer, "UnityEmptySectionRenderer") == 0) { @@ -464,7 +608,7 @@ static void unity_places_default_renderer_on_group_added (UnityPlacesDefaultRend } else { UnityPlacesDefaultRendererGroup* group; group = g_object_ref_sink (unity_places_default_renderer_group_new ((guint) dee_model_get_position (model, iter), dee_model_get_string (model, iter, (guint) 0), dee_model_get_string (model, iter, (guint) 1), dee_model_get_string (model, iter, (guint) 2), self->priv->results_model)); - g_signal_connect_object (group, "activated", (GCallback) __lambda65__unity_places_default_renderer_group_activated, self, 0); + g_signal_connect_object (group, "activated", (GCallback) __lambda66__unity_places_default_renderer_group_activated, self, 0); g_object_set_data_full ((GObject*) group, "model-iter", iter, NULL); ctk_box_pack ((CtkBox*) self->priv->box, (ClutterActor*) group, FALSE, TRUE); { @@ -536,6 +680,34 @@ static void _unity_places_default_renderer_slider_paint_unity_cairo_canvas_cairo } +static gboolean _unity_places_default_renderer_on_slider_enter_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_places_default_renderer_on_slider_enter (self, event); + return result; +} + + +static gboolean _unity_places_default_renderer_on_slider_leave_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_places_default_renderer_on_slider_leave (self, event); + return result; +} + + +static gboolean _unity_places_default_renderer_on_slider_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_places_default_renderer_on_slider_button_press (self, event); + return result; +} + + +static gboolean _unity_places_default_renderer_on_slider_button_release_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_places_default_renderer_on_slider_button_release (self, event); + return result; +} + + static GObject * unity_places_default_renderer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; @@ -546,20 +718,34 @@ static GObject * unity_places_default_renderer_constructor (GType type, guint n_ { CtkPadding _tmp0_ = {0}; CtkPadding _tmp1_; - UnityCairoCanvas* _tmp2_; - UnityCairoCanvas* _tmp3_; - CtkScrollView* _tmp4_; - CtkVBox* _tmp5_; + CtkEffectGlow* _tmp2_; + ClutterColor _tmp3_ = {0}; + ClutterColor _tmp4_; + UnityCairoCanvas* _tmp5_; + UnityCairoCanvas* _tmp6_; + CtkScrollView* _tmp7_; + CtkVBox* _tmp8_; ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = UNITY_PLACES_DEFAULT_RENDERER_PADDING, _tmp0_.right = 0.0f, _tmp0_.bottom = 0.0f, _tmp0_.left = 0.0f, _tmp0_), &_tmp1_)); - self->priv->trough = (_tmp2_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_default_renderer_trough_paint_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->trough), _tmp2_); - self->priv->slider = (_tmp3_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_default_renderer_slider_paint_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->slider), _tmp3_); - self->priv->scroll = (_tmp4_ = g_object_ref_sink ((CtkScrollView*) ctk_scroll_view_new ()), _g_object_unref0 (self->priv->scroll), _tmp4_); + self->priv->slider_glow = (_tmp2_ = g_object_ref_sink ((CtkEffectGlow*) ctk_effect_glow_new ()), _g_object_unref0 (self->priv->slider_glow), _tmp2_); + ctk_effect_glow_set_color (self->priv->slider_glow, (_tmp4_ = (_tmp3_.red = (guint8) 255, _tmp3_.green = (guint8) 255, _tmp3_.blue = (guint8) 255, _tmp3_.alpha = (guint8) 255, _tmp3_), &_tmp4_)); + ctk_effect_glow_set_factor (self->priv->slider_glow, 1.0f); + ctk_effect_set_margin ((CtkEffect*) self->priv->slider_glow, 5); + self->priv->trough = (_tmp5_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_default_renderer_trough_paint_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->trough), _tmp5_); + self->priv->slider = (_tmp6_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_default_renderer_slider_paint_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->slider), _tmp6_); + g_signal_connect_object ((ClutterActor*) self->priv->slider, "enter-event", (GCallback) _unity_places_default_renderer_on_slider_enter_clutter_actor_enter_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->slider, "leave-event", (GCallback) _unity_places_default_renderer_on_slider_leave_clutter_actor_leave_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->slider, "button-press-event", (GCallback) _unity_places_default_renderer_on_slider_button_press_clutter_actor_button_press_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->slider, "button-release-event", (GCallback) _unity_places_default_renderer_on_slider_button_release_clutter_actor_button_release_event, self, 0); + self->priv->slider_state = UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_NORMAL; + self->priv->button_pressed = FALSE; + ctk_actor_add_effect ((CtkActor*) self->priv->slider, (CtkEffect*) self->priv->slider_glow); + self->priv->scroll = (_tmp7_ = g_object_ref_sink ((CtkScrollView*) ctk_scroll_view_new ()), _g_object_unref0 (self->priv->scroll), _tmp7_); ctk_scroll_view_set_scroll_bar (self->priv->scroll, (ClutterActor*) self->priv->trough, (ClutterActor*) self->priv->slider); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->priv->scroll); clutter_actor_show ((ClutterActor*) self->priv->scroll); clutter_actor_show ((ClutterActor*) self->priv->trough); clutter_actor_show ((ClutterActor*) self->priv->slider); - self->priv->box = (_tmp5_ = g_object_ref_sink ((CtkVBox*) ctk_vbox_new ((guint) UNITY_PLACES_DEFAULT_RENDERER_SPACING)), _g_object_unref0 (self->priv->box), _tmp5_); + self->priv->box = (_tmp8_ = g_object_ref_sink ((CtkVBox*) ctk_vbox_new ((guint) UNITY_PLACES_DEFAULT_RENDERER_SPACING)), _g_object_unref0 (self->priv->box), _tmp8_); ctk_box_set_homogeneous ((CtkBox*) self->priv->box, FALSE); clutter_container_add_actor ((ClutterContainer*) self->priv->scroll, (ClutterActor*) self->priv->box); clutter_actor_show ((ClutterActor*) self->priv->box); @@ -591,11 +777,14 @@ static void unity_places_default_renderer_instance_init (UnityPlacesDefaultRende static void unity_places_default_renderer_finalize (GObject* obj) { UnityPlacesDefaultRenderer * self; self = UNITY_PLACES_DEFAULT_RENDERER (obj); + { + } _g_object_unref0 (self->priv->search_empty); _g_object_unref0 (self->priv->section_empty); _g_object_unref0 (self->priv->scroll); _g_object_unref0 (self->priv->trough); _g_object_unref0 (self->priv->slider); + _g_object_unref0 (self->priv->slider_glow); _g_object_unref0 (self->priv->box); _g_object_unref0 (self->priv->groups_model); _g_object_unref0 (self->priv->results_model); @@ -631,15 +820,15 @@ UnityPlacesEmptySearchGroup* unity_places_empty_search_group_new (guint group_id } -static void _lambda63_ (Block2Data* _data2_) { +static void _lambda64_ (Block2Data* _data2_) { UnityPlacesEmptySearchGroup * self; self = _data2_->self; g_signal_emit_by_name (self, "activated", _data2_->uri, _data2_->mimetype); } -static void __lambda63__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda63_ (self); +static void __lambda64__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda64_ (self); } @@ -695,7 +884,7 @@ static void unity_places_empty_search_group_on_result_added (UnityPlacesEmptySea ctk_actor_set_background ((CtkActor*) button, (ClutterActor*) bg); _data2_->uri = g_strdup (dee_model_get_string (self->priv->_results, iter, (guint) 0)); _data2_->mimetype = g_strdup (dee_model_get_string (self->priv->_results, iter, (guint) 3)); - g_signal_connect_data (button, "clicked", (GCallback) __lambda63__ctk_button_clicked, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + g_signal_connect_data (button, "clicked", (GCallback) __lambda64__ctk_button_clicked, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); _g_object_unref0 (bg); block2_data_unref (_data2_); } diff --git a/unity-private/places/places-default-renderer.vala b/unity-private/places/places-default-renderer.vala index ab65b71b3..c4a8da2a7 100644 --- a/unity-private/places/places-default-renderer.vala +++ b/unity-private/places/places-default-renderer.vala @@ -24,13 +24,19 @@ namespace Unity.Places static const float TOP_PADDING = 22.0f; static const float PADDING = 12.0f; static const int SPACING = 0; - + static const int SLIDER_STATE_NORMAL = 0; + static const int SLIDER_STATE_PRELIGHT = 1; + static const int SLIDER_STATE_ACTIVE = 2; + private EmptySearchGroup search_empty; private EmptySectionGroup section_empty; private Ctk.ScrollView scroll; private Unity.CairoCanvas trough; private Unity.CairoCanvas slider; + private int slider_state; + private bool button_pressed; + private Ctk.EffectGlow slider_glow; private Ctk.VBox box; private Dee.Model groups_model; private Dee.Model results_model; @@ -42,6 +48,10 @@ namespace Unity.Places Object (); } + ~DefaultRenderer () + { + } + private static double _align (double val) { @@ -58,7 +68,12 @@ namespace Unity.Places int width, int height) { - double radius = (double) width / 2.0f; + Cairo.Surface dots = new Cairo.ImageSurface (Cairo.Format.ARGB32, + 4, + 4); + Cairo.Context cr_dots = new Cairo.Context (dots); + Cairo.Pattern dot_pattern; + double radius = (double) width / 2.0f; cr.set_operator (Cairo.Operator.CLEAR); cr.paint (); @@ -79,6 +94,30 @@ namespace Unity.Places 180.0f * GLib.Math.PI / 180.0f); cr.close_path (); cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.1f); + + // draw dotted pattern + cr_dots.set_operator (Cairo.Operator.CLEAR); + cr_dots.paint (); + cr_dots.scale (1.0f, 1.0f); + cr_dots.set_operator (Cairo.Operator.OVER); + cr_dots.set_source_rgba (1.0f, 1.0f, 1.0f, 0.025f); + cr_dots.rectangle (0.0f, 0.0f, 1.0f, 1.0f); + cr_dots.fill (); + cr_dots.rectangle (1.0f, 1.0f, 1.0f, 1.0f); + cr_dots.fill (); + cr_dots.rectangle (2.0f, 0.0f, 1.0f, 1.0f); + cr_dots.fill (); + cr_dots.rectangle (0.0f, 2.0f, 1.0f, 1.0f); + cr_dots.fill (); + cr_dots.rectangle (2.0f, 2.0f, 1.0f, 1.0f); + cr_dots.fill (); + cr_dots.rectangle (3.0f, 3.0f, 1.0f, 1.0f); + cr_dots.fill (); + + dot_pattern = new Cairo.Pattern.for_surface (dots); + cr.set_operator (Cairo.Operator.OVER); + cr.set_source (dot_pattern); + dot_pattern.set_extend (Cairo.Extend.REPEAT); cr.fill_preserve (); cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.35f); cr.stroke (); @@ -89,9 +128,14 @@ namespace Unity.Places int width, int height) { - double radius = (double) width / 2.0f; - double half = (double) width / 2.0f; - double half_height = (double) height / 2.0f; + Cairo.Surface stripes = new Cairo.ImageSurface (Cairo.Format.ARGB32, + 4, + 4); + Cairo.Context cr_stripes = new Cairo.Context (stripes); + Cairo.Pattern stripe_pattern; + double radius = (double) width / 2.0f; + double half = (double) width / 2.0f; + double half_height = (double) height / 2.0f; cr.set_operator (Cairo.Operator.CLEAR); cr.paint (); @@ -111,7 +155,37 @@ namespace Unity.Places 0.0f * GLib.Math.PI / 180.0f, 180.0f * GLib.Math.PI / 180.0f); cr.close_path (); - cr.set_source_rgba (0.0f, 0.0f, 0.0f, 0.15f); + + if (slider_state == SLIDER_STATE_NORMAL) + { + cr.set_source_rgba (0.0f, 0.0f, 0.0f, 0.15f); + } + else if (slider_state == SLIDER_STATE_PRELIGHT) + { + cr_stripes.set_operator (Cairo.Operator.CLEAR); + cr_stripes.paint (); + cr_stripes.scale (1.0f, 1.0f); + cr_stripes.set_operator (Cairo.Operator.OVER); + cr_stripes.set_source_rgba (1.0f, 1.0f, 1.0f, 0.25f); + cr_stripes.rectangle (0.0f, 0.0f, 1.0f, 1.0f); + cr_stripes.fill (); + cr_stripes.rectangle (1.0f, 1.0f, 1.0f, 1.0f); + cr_stripes.fill (); + cr_stripes.rectangle (2.0f, 2.0f, 1.0f, 1.0f); + cr_stripes.fill (); + cr_stripes.rectangle (3.0f, 3.0f, 1.0f, 1.0f); + cr_stripes.fill (); + + stripe_pattern = new Cairo.Pattern.for_surface (stripes); + cr.set_operator (Cairo.Operator.OVER); + cr.set_source (stripe_pattern); + stripe_pattern.set_extend (Cairo.Extend.REPEAT); + } + else if (slider_state == SLIDER_STATE_ACTIVE) + { + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 1.0f); + } + cr.fill_preserve (); cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.5f); cr.stroke (); @@ -123,19 +197,82 @@ namespace Unity.Places cr.line_to (_align ((double) width - 2.0f), _align (half_height)); cr.move_to (_align (1.0f), _align (half_height + 2.0f)); cr.line_to (_align ((double) width - 2.0f), _align (half_height + 2.0f)); + + if (slider_state == SLIDER_STATE_NORMAL || + slider_state == SLIDER_STATE_PRELIGHT) + { + cr.set_operator (Cairo.Operator.OVER); + } + else if (slider_state == SLIDER_STATE_ACTIVE) + { + cr.set_operator (Cairo.Operator.CLEAR); + } + cr.stroke (); } + private bool + on_slider_enter (Clutter.Event event) + { + slider_state = SLIDER_STATE_PRELIGHT; + slider.update (); + slider_glow.set_invalidate_effect_cache (true); + return false; + } + + private bool + on_slider_leave (Clutter.Event event) + { + if (!button_pressed) + { + slider_state = SLIDER_STATE_NORMAL; + slider.update (); + slider_glow.set_invalidate_effect_cache (true); + } + return false; + } + + private bool + on_slider_button_press (Clutter.Event event) + { + button_pressed = true; + slider_state = SLIDER_STATE_ACTIVE; + slider.update (); + slider_glow.set_invalidate_effect_cache (true); + return false; + } + + private bool + on_slider_button_release (Clutter.Event event) + { + button_pressed = false; + slider_state = SLIDER_STATE_PRELIGHT; + slider.update (); + slider_glow.set_invalidate_effect_cache (true); + return false; + } + construct { padding = { PADDING, 0.0f, 0.0f, 0.0f }; + slider_glow = new Ctk.EffectGlow (); + slider_glow.set_color ({ 255, 255, 255, 255 }); + slider_glow.set_factor (1.0f); + slider_glow.set_margin (5); + trough = new Unity.CairoCanvas (trough_paint); slider = new Unity.CairoCanvas (slider_paint); + slider.enter_event.connect (on_slider_enter); + slider.leave_event.connect (on_slider_leave); + slider.button_press_event.connect (on_slider_button_press); + slider.button_release_event.connect (on_slider_button_release); + slider_state = SLIDER_STATE_NORMAL; + button_pressed = false; + slider.add_effect (slider_glow); scroll = new Ctk.ScrollView (); scroll.set_scroll_bar (trough, slider); - //slider.reactive = true; add_actor (scroll); scroll.show (); trough.show (); diff --git a/unity-private/places/places-folder-browser-renderer.c b/unity-private/places/places-folder-browser-renderer.c index bbb077361..ba4cf7b1e 100644 --- a/unity-private/places/places-folder-browser-renderer.c +++ b/unity-private/places/places-folder-browser-renderer.c @@ -86,8 +86,8 @@ static void unity_places_folder_browser_renderer_real_set_models (UnityPlaceRend 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); GType unity_places_default_renderer_group_get_type (void) G_GNUC_CONST; -static void _lambda54_ (const char* u, const char* m, UnityPlacesFolderBrowserRenderer* self); -static void __lambda54__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self); +static void _lambda55_ (const char* u, const char* m, UnityPlacesFolderBrowserRenderer* self); +static void __lambda55__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self); static GObject * unity_places_folder_browser_renderer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_folder_browser_renderer_finalize (GObject* obj); @@ -110,15 +110,15 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _lambda54_ (const char* u, const char* m, UnityPlacesFolderBrowserRenderer* self) { +static void _lambda55_ (const char* u, const char* m, UnityPlacesFolderBrowserRenderer* self) { g_return_if_fail (u != NULL); g_return_if_fail (m != NULL); g_signal_emit_by_name ((UnityPlaceRenderer*) self, "activated", u, m); } -static void __lambda54__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self) { - _lambda54_ (uri, mimetype, self); +static void __lambda55__unity_places_default_renderer_group_activated (UnityPlacesDefaultRendererGroup* _sender, const char* uri, const char* mimetype, gpointer self) { + _lambda55_ (uri, mimetype, self); } @@ -132,7 +132,7 @@ static void unity_places_folder_browser_renderer_real_set_models (UnityPlaceRend g_return_if_fail (hints != NULL); self->priv->results_model = (_tmp0_ = _g_object_ref0 (results), _g_object_unref0 (self->priv->results_model), _tmp0_); group = g_object_ref_sink (unity_places_default_renderer_group_new ((guint) 0, "UnityFolderGroupRenderer", "__you_cant_see_me__", "gtk-apply", results)); - g_signal_connect_object (group, "activated", (GCallback) __lambda54__unity_places_default_renderer_group_activated, self, 0); + g_signal_connect_object (group, "activated", (GCallback) __lambda55__unity_places_default_renderer_group_activated, self, 0); ctk_box_pack ((CtkBox*) self->priv->box, (ClutterActor*) group, FALSE, TRUE); _g_object_unref0 (group); } diff --git a/unity-private/places/places-place-bar.c b/unity-private/places/places-place-bar.c index 206a506ce..0e235e0dd 100644 --- a/unity-private/places/places-place-bar.c +++ b/unity-private/places/places-place-bar.c @@ -250,8 +250,8 @@ UnityPlacesPlaceBarBackground* unity_places_place_bar_background_construct (GTyp UnityPlacesPlaceView* unity_places_place_view_new (UnityPlacesPlace* place); UnityPlacesPlaceView* unity_places_place_view_construct (GType object_type, UnityPlacesPlace* place); static void _unity_places_place_bar_on_entry_activated_unity_places_place_view_entry_activated (UnityPlacesPlaceView* _sender, UnityPlacesPlaceEntryView* entry_view, gpointer self); -static void _lambda71_ (UnityPlacesPlace* p, UnityPlacesPlaceBar* self); -static void __lambda71__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self); +static void _lambda72_ (UnityPlacesPlace* p, UnityPlacesPlaceBar* self); +static void __lambda72__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self); static GObject * unity_places_place_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_place_bar_finalize (GObject* obj); static void unity_places_place_bar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -443,7 +443,7 @@ static void _unity_places_place_bar_on_entry_activated_unity_places_place_view_e } -static void _lambda71_ (UnityPlacesPlace* p, UnityPlacesPlaceBar* self) { +static void _lambda72_ (UnityPlacesPlace* p, UnityPlacesPlaceBar* self) { UnityPlacesPlaceView* view; g_return_if_fail (p != NULL); view = g_object_ref_sink (unity_places_place_view_new (p)); @@ -454,8 +454,8 @@ static void _lambda71_ (UnityPlacesPlace* p, UnityPlacesPlaceBar* self) { } -static void __lambda71__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self) { - _lambda71_ (place, self); +static void __lambda72__unity_places_place_model_place_added (UnityPlacesPlaceModel* _sender, UnityPlacesPlace* place, gpointer self) { + _lambda72_ (place, self); } @@ -498,7 +498,7 @@ static GObject * unity_places_place_bar_constructor (GType type, guint n_constru } _g_object_unref0 (_place_it); } - g_signal_connect_object (self->priv->_model, "place-added", (GCallback) __lambda71__unity_places_place_model_place_added, self, 0); + g_signal_connect_object (self->priv->_model, "place-added", (GCallback) __lambda72__unity_places_place_model_place_added, self, 0); } return obj; } diff --git a/unity-private/places/places-place-entry-scroller-child.c b/unity-private/places/places-place-entry-scroller-child.c index 8d5358079..d35231f6a 100644 --- a/unity-private/places/places-place-entry-scroller-child.c +++ b/unity-private/places/places-place-entry-scroller-child.c @@ -244,8 +244,8 @@ UnityLauncherApplicationQuicklistController* unity_launcher_application_quicklis UnityLauncherApplicationQuicklistController* unity_launcher_application_quicklist_controller_construct (GType object_type, UnityLauncherScrollerChildController* scroller_child); GType unity_launcher_application_quicklist_controller_get_type (void) G_GNUC_CONST; static void unity_places_place_entry_scroller_child_controller_real_get_menu_actions (UnityLauncherScrollerChildController* base, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); -static void _lambda66_ (guint timestamp, Block3Data* _data3_); -static void __lambda66__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); +static void _lambda67_ (guint timestamp, Block3Data* _data3_); +static void __lambda67__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static Block3Data* block3_data_ref (Block3Data* _data3_); static void block3_data_unref (Block3Data* _data3_); static gboolean unity_places_place_entry_scroller_child_controller_real_can_drag (UnityLauncherScrollerChildController* base); @@ -254,10 +254,10 @@ const char* unity_places_place_entry_get_name (UnityPlacesPlaceEntry* self); void unity_launcher_scroller_child_controller_set_name (UnityLauncherScrollerChildController* self, const char* value); void unity_launcher_scroller_child_controller_load_icon_from_icon_name (UnityLauncherScrollerChildController* self, const char* icon_name); const char* unity_places_place_entry_get_icon (UnityPlacesPlaceEntry* self); -static void _lambda67_ (UnityPlacesPlaceEntryScrollerChildController* self); +static void _lambda68_ (UnityPlacesPlaceEntryScrollerChildController* self); gboolean unity_places_place_entry_get_active (UnityPlacesPlaceEntry* self); void unity_launcher_scroller_child_set_active (UnityLauncherScrollerChild* self, gboolean value); -static void __lambda67__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void __lambda68__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); GType unity_launcher_scroller_child_group_type_get_type (void) G_GNUC_CONST; void unity_launcher_scroller_child_set_group_type (UnityLauncherScrollerChild* self, UnityLauncherScrollerChildGroupType value); static GObject * unity_places_place_entry_scroller_child_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -326,15 +326,15 @@ static UnityLauncherQuicklistController* unity_places_place_entry_scroller_child } -static void _lambda66_ (guint timestamp, Block3Data* _data3_) { +static void _lambda67_ (guint timestamp, Block3Data* _data3_) { UnityPlacesPlaceEntryScrollerChildController * self; self = _data3_->self; g_signal_emit_by_name (self, "clicked", (guint) dbusmenu_menuitem_property_get_int (_data3_->item, "section-id")); } -static void __lambda66__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda66_ (object, self); +static void __lambda67__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda67_ (object, self); } @@ -385,7 +385,7 @@ static void unity_places_place_entry_scroller_child_controller_real_get_menu_act dbusmenu_menuitem_property_set_bool (_data3_->item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (_data3_->item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); dbusmenu_menuitem_property_set_int (_data3_->item, "section-id", dee_model_get_position (sections, iter)); - g_signal_connect_data (_data3_->item, "item-activated", (GCallback) __lambda66__dbusmenu_menuitem_item_activated, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0); + g_signal_connect_data (_data3_->item, "item-activated", (GCallback) __lambda67__dbusmenu_menuitem_item_activated, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0); dbusmenu_menuitem_child_append (root, _data3_->item); iter = dee_model_next (sections, iter); _g_free0 (name); @@ -422,13 +422,13 @@ static void unity_places_place_entry_scroller_child_controller_set_entry (UnityP } -static void _lambda67_ (UnityPlacesPlaceEntryScrollerChildController* self) { +static void _lambda68_ (UnityPlacesPlaceEntryScrollerChildController* self) { unity_launcher_scroller_child_set_active (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), unity_places_place_entry_get_active (self->priv->_entry)); } -static void __lambda67__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda67_ (self); +static void __lambda68__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda68_ (self); } @@ -442,7 +442,7 @@ static GObject * unity_places_place_entry_scroller_child_controller_constructor { unity_launcher_scroller_child_controller_set_name ((UnityLauncherScrollerChildController*) self, unity_places_place_entry_get_name (self->priv->_entry)); unity_launcher_scroller_child_controller_load_icon_from_icon_name ((UnityLauncherScrollerChildController*) self, unity_places_place_entry_get_icon (self->priv->_entry)); - g_signal_connect_object ((GObject*) self->priv->_entry, "notify::active", (GCallback) __lambda67__g_object_notify, self, 0); + g_signal_connect_object ((GObject*) self->priv->_entry, "notify::active", (GCallback) __lambda68__g_object_notify, self, 0); unity_launcher_scroller_child_set_group_type (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_PLACE); g_signal_connect_object ((ClutterActor*) unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), "motion-event", (GCallback) _unity_places_place_entry_scroller_child_controller_get_sections_clutter_actor_motion_event, self, 0); } diff --git a/unity-private/places/places-place-home-renderer.c b/unity-private/places/places-place-home-renderer.c index 2eb93b9e2..fe2316b83 100644 --- a/unity-private/places/places-place-home-renderer.c +++ b/unity-private/places/places-place-home-renderer.c @@ -32,7 +32,6 @@ #include <clutter/clutter.h> #include <float.h> #include <math.h> -#include <glib/gstdio.h> #include <glib/gi18n-lib.h> #include <gconf/gconf-client.h> @@ -71,7 +70,6 @@ typedef struct _UnityPlacesControllerClass UnityPlacesControllerClass; #define _unity_testing_object_registry_unref0(var) ((var == NULL) ? NULL : (var = (unity_testing_object_registry_unref (var), NULL))) #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) -#define _gtk_icon_info_free0(var) ((var == NULL) ? NULL : (var = (gtk_icon_info_free (var), NULL))) #define UNITY_PLACES_TYPE_HOME_BUTTON (unity_places_home_button_get_type ()) #define UNITY_PLACES_HOME_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_HOME_BUTTON, UnityPlacesHomeButton)) @@ -147,8 +145,6 @@ static char* unity_places_home_renderer_filename_for_icon (UnityPlacesHomeRender UnityPlacesHomeButton* unity_places_home_button_new (const char* name, const char* icon, const char* exec); UnityPlacesHomeButton* unity_places_home_button_construct (GType object_type, const char* name, const char* icon, const char* exec); GType unity_places_home_button_get_type (void) G_GNUC_CONST; -static void _lambda55_ (UnityPlacesHomeRenderer* self); -static void __lambda55__ctk_button_clicked (CtkButton* _sender, gpointer self); static void _lambda56_ (UnityPlacesHomeRenderer* self); static void __lambda56__ctk_button_clicked (CtkButton* _sender, gpointer self); static void _lambda57_ (UnityPlacesHomeRenderer* self); @@ -163,6 +159,8 @@ static void _lambda61_ (UnityPlacesHomeRenderer* self); static void __lambda61__ctk_button_clicked (CtkButton* _sender, gpointer self); static void _lambda62_ (UnityPlacesHomeRenderer* self); static void __lambda62__ctk_button_clicked (CtkButton* _sender, gpointer self); +static void _lambda63_ (UnityPlacesHomeRenderer* self); +static void __lambda63__ctk_button_clicked (CtkButton* _sender, gpointer self); static GObject * unity_places_home_renderer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_home_renderer_finalize (GObject* obj); #define UNITY_PLACES_HOME_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_HOME_BUTTON, UnityPlacesHomeButtonPrivate)) @@ -260,30 +258,11 @@ static void unity_places_home_renderer_real_allocate (ClutterActor* base, const static char* unity_places_home_renderer_filename_for_icon (UnityPlacesHomeRenderer* self, const char* icon) { char* result = NULL; - char* icon_file; + char* _tmp0_; + char* _tmp1_; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (icon != NULL, NULL); - if (self->priv->theme == NULL) { - GtkIconTheme* _tmp0_; - self->priv->theme = (_tmp0_ = gtk_icon_theme_new (), _g_object_unref0 (self->priv->theme), _tmp0_); - gtk_icon_theme_set_custom_theme (self->priv->theme, "unity-icon-theme"); - } - icon_file = g_strdup (""); - if (gtk_icon_theme_has_icon (self->priv->theme, icon)) { - GtkIconInfo* info; - info = gtk_icon_theme_lookup_icon (self->priv->theme, icon, 128, 0); - if (info != NULL) { - char* filename; - filename = g_strdup (gtk_icon_info_get_filename (info)); - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - char* _tmp1_; - icon_file = (_tmp1_ = g_strdup (filename), _g_free0 (icon_file), _tmp1_); - } - _g_free0 (filename); - } - _gtk_icon_info_free0 (info); - } - result = icon_file; + result = (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat ("/usr/share/icons/unity-icon-theme/apps/128/", icon, NULL), ".svg", NULL), _g_free0 (_tmp0_), _tmp1_); return result; } @@ -296,7 +275,7 @@ static const char* string_to_string (const char* self) { } -static void _lambda55_ (UnityPlacesHomeRenderer* self) { +static void _lambda56_ (UnityPlacesHomeRenderer* self) { GConfClient* client; GError * _inner_error_ = NULL; client = _g_object_ref0 (gconf_client_get_default ()); @@ -323,7 +302,7 @@ static void _lambda55_ (UnityPlacesHomeRenderer* self) { _inner_error_ = NULL; { char* _tmp0_; - g_warning ("places-place-home-renderer.vala:55: %s", _tmp0_ = g_strconcat ("Unable to start web browser: ", string_to_string (e->message), NULL)); + g_warning ("places-place-home-renderer.vala:60: %s", _tmp0_ = g_strconcat ("Unable to start web browser: ", string_to_string (e->message), NULL)); _g_free0 (_tmp0_); _g_error_free0 (e); } @@ -340,16 +319,6 @@ static void _lambda55_ (UnityPlacesHomeRenderer* self) { } -static void __lambda55__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda55_ (self); -} - - -static void _lambda56_ (UnityPlacesHomeRenderer* self) { - unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 4); -} - - static void __lambda56__ctk_button_clicked (CtkButton* _sender, gpointer self) { _lambda56_ (self); } @@ -366,7 +335,7 @@ static void __lambda57__ctk_button_clicked (CtkButton* _sender, gpointer self) { static void _lambda58_ (UnityPlacesHomeRenderer* self) { - unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 2); + unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 4); } @@ -376,7 +345,7 @@ static void __lambda58__ctk_button_clicked (CtkButton* _sender, gpointer self) { static void _lambda59_ (UnityPlacesHomeRenderer* self) { - unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 3); + unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 2); } @@ -386,7 +355,7 @@ static void __lambda59__ctk_button_clicked (CtkButton* _sender, gpointer self) { static void _lambda60_ (UnityPlacesHomeRenderer* self) { - unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 5); + unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 3); } @@ -396,7 +365,7 @@ static void __lambda60__ctk_button_clicked (CtkButton* _sender, gpointer self) { static void _lambda61_ (UnityPlacesHomeRenderer* self) { - unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_FILES_PLACE, 0); + unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_APPS_PLACE, 5); } @@ -406,6 +375,16 @@ static void __lambda61__ctk_button_clicked (CtkButton* _sender, gpointer self) { static void _lambda62_ (UnityPlacesHomeRenderer* self) { + unity_places_home_renderer_activate_place (self, UNITY_PLACES_HOME_RENDERER_FILES_PLACE, 0); +} + + +static void __lambda62__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda62_ (self); +} + + +static void _lambda63_ (UnityPlacesHomeRenderer* self) { GError * _inner_error_ = NULL; { g_spawn_command_line_async ("software-center", &_inner_error_); @@ -421,7 +400,7 @@ static void _lambda62_ (UnityPlacesHomeRenderer* self) { _inner_error_ = NULL; { char* _tmp0_; - g_warning ("places-place-home-renderer.vala:111: %s", _tmp0_ = g_strconcat ("Unable to start software centre: ", string_to_string (e->message), NULL)); + g_warning ("places-place-home-renderer.vala:116: %s", _tmp0_ = g_strconcat ("Unable to start software centre: ", string_to_string (e->message), NULL)); _g_free0 (_tmp0_); _g_error_free0 (e); } @@ -436,8 +415,8 @@ static void _lambda62_ (UnityPlacesHomeRenderer* self) { } -static void __lambda62__ctk_button_clicked (CtkButton* _sender, gpointer self) { - _lambda62_ (self); +static void __lambda63__ctk_button_clicked (CtkButton* _sender, gpointer self) { + _lambda63_ (self); } @@ -477,42 +456,42 @@ static GObject * unity_places_home_renderer_constructor (GType type, guint n_con icon = (_tmp4_ = g_object_ref_sink (unity_places_home_button_new (_ ("Web"), _tmp3_ = unity_places_home_renderer_filename_for_icon (self, "web"), "")), _g_free0 (_tmp3_), _tmp4_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda55__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda56__ctk_button_clicked, self, 0); icon = (_tmp6_ = g_object_ref_sink (unity_places_home_button_new (_ ("Music"), _tmp5_ = unity_places_home_renderer_filename_for_icon (self, "music"), "")), _g_object_unref0 (icon), _tmp6_); _g_free0 (_tmp5_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda56__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda57__ctk_button_clicked, self, 0); icon = (_tmp8_ = g_object_ref_sink (unity_places_home_button_new (_ ("Photos & Videos"), _tmp7_ = unity_places_home_renderer_filename_for_icon (self, "photos"), "")), _g_object_unref0 (icon), _tmp8_); _g_free0 (_tmp7_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda57__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda58__ctk_button_clicked, self, 0); icon = (_tmp10_ = g_object_ref_sink (unity_places_home_button_new (_ ("Games"), _tmp9_ = unity_places_home_renderer_filename_for_icon (self, "games"), "")), _g_object_unref0 (icon), _tmp10_); _g_free0 (_tmp9_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda58__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda59__ctk_button_clicked, self, 0); icon = (_tmp12_ = g_object_ref_sink (unity_places_home_button_new (_ ("Email & Chat"), _tmp11_ = unity_places_home_renderer_filename_for_icon (self, "email_and_chat"), "")), _g_object_unref0 (icon), _tmp12_); _g_free0 (_tmp11_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda59__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda60__ctk_button_clicked, self, 0); icon = (_tmp14_ = g_object_ref_sink (unity_places_home_button_new (_ ("Office"), _tmp13_ = unity_places_home_renderer_filename_for_icon (self, "work"), "")), _g_object_unref0 (icon), _tmp14_); _g_free0 (_tmp13_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda60__ctk_button_clicked, self, 0); - icon = (_tmp16_ = g_object_ref_sink (unity_places_home_button_new (_ ("Files & Folders"), _tmp15_ = unity_places_home_renderer_filename_for_icon (self, "work"), "")), _g_object_unref0 (icon), _tmp16_); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda61__ctk_button_clicked, self, 0); + icon = (_tmp16_ = g_object_ref_sink (unity_places_home_button_new (_ ("Files & Folders"), _tmp15_ = unity_places_home_renderer_filename_for_icon (self, "filesandfolders"), "")), _g_object_unref0 (icon), _tmp16_); _g_free0 (_tmp15_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda61__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda62__ctk_button_clicked, self, 0); icon = (_tmp18_ = g_object_ref_sink (unity_places_home_button_new (_ ("Get New Apps"), _tmp17_ = unity_places_home_renderer_filename_for_icon (self, "softwarecentre"), "")), _g_object_unref0 (icon), _tmp18_); _g_free0 (_tmp17_); clutter_container_add_actor ((ClutterContainer*) self->priv->icon_view, (ClutterActor*) icon); clutter_actor_show ((ClutterActor*) icon); - g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda62__ctk_button_clicked, self, 0); + g_signal_connect_object ((CtkButton*) icon, "clicked", (GCallback) __lambda63__ctk_button_clicked, self, 0); _g_object_unref0 (icon); } return obj; @@ -543,6 +522,8 @@ static void unity_places_home_renderer_instance_init (UnityPlacesHomeRenderer * static void unity_places_home_renderer_finalize (GObject* obj) { UnityPlacesHomeRenderer * self; self = UNITY_PLACES_HOME_RENDERER (obj); + { + } _g_object_unref0 (self->priv->theme); _g_object_unref0 (self->priv->icon_view); G_OBJECT_CLASS (unity_places_home_renderer_parent_class)->finalize (obj); diff --git a/unity-private/places/places-place-home-renderer.vala b/unity-private/places/places-place-home-renderer.vala index 360a5e269..d13550d4b 100644 --- a/unity-private/places/places-place-home-renderer.vala +++ b/unity-private/places/places-place-home-renderer.vala @@ -33,6 +33,11 @@ namespace Unity.Places Object (); } + ~HomeRenderer () + { + + } + construct { padding = { 0.0f, 0.0f, 0.0f, 0.0f }; @@ -94,7 +99,7 @@ namespace Unity.Places activate_place (APPS_PLACE, 5); }); - icon = new HomeButton (_("Files & Folders"), filename_for_icon ("work"), ""); + icon = new HomeButton (_("Files & Folders"), filename_for_icon ("filesandfolders"), ""); icon_view.add_actor (icon); icon.show (); icon.clicked.connect (() => { @@ -168,28 +173,8 @@ namespace Unity.Places private string filename_for_icon (string icon) { - if (theme == null) - { - theme = new Gtk.IconTheme (); - theme.set_custom_theme ("unity-icon-theme"); - } - - string icon_file = ""; - if (theme.has_icon (icon)) - { - var info = theme.lookup_icon (icon, 128, 0); - if (info != null) - { - var filename = info.get_filename (); - if (FileUtils.test(filename, FileTest.IS_REGULAR)) - { - icon_file = filename; - } - } - - } - - return icon_file; + /* FIXME: We'll autoget this from the theme before release */ + return "/usr/share/icons/unity-icon-theme/apps/128/" + icon + ".svg"; } } diff --git a/unity-private/places/places-place-search-entry.c b/unity-private/places/places-place-search-entry.c index d6767719f..aa6d31fdb 100644 --- a/unity-private/places/places-place-search-entry.c +++ b/unity-private/places/places-place-search-entry.c @@ -577,6 +577,9 @@ static void unity_places_place_search_entry_instance_init (UnityPlacesPlaceSearc static void unity_places_place_search_entry_finalize (GObject* obj) { UnityPlacesPlaceSearchEntry * self; self = UNITY_PLACES_PLACE_SEARCH_ENTRY (obj); + { + clutter_actor_unparent ((ClutterActor*) self->hint_text); + } _g_object_unref0 (self->left_icon); _g_object_unref0 (self->hint_text); _g_object_unref0 (self->text); diff --git a/unity-private/places/places-place-search-entry.vala b/unity-private/places/places-place-search-entry.vala index 66c9a4bd8..b8ccf91e3 100644 --- a/unity-private/places/places-place-search-entry.vala +++ b/unity-private/places/places-place-search-entry.vala @@ -91,6 +91,11 @@ namespace Unity.Places spacing:0); } + ~PlaceSearchEntry () + { + hint_text.unparent (); + } + construct { padding = { PADDING, PADDING * 4, PADDING , PADDING * 4}; diff --git a/unity-private/places/places-trash-controller.c b/unity-private/places/places-trash-controller.c index f9eb6a71b..c6b047fbe 100644 --- a/unity-private/places/places-trash-controller.c +++ b/unity-private/places/places-trash-controller.c @@ -193,12 +193,12 @@ UnityLauncherApplicationQuicklistController* unity_launcher_application_quicklis GType unity_launcher_application_quicklist_controller_get_type (void) G_GNUC_CONST; static void unity_places_trash_controller_real_get_menu_actions (UnityLauncherScrollerChildController* base, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); static void unity_places_trash_controller_real_get_menu_navigation (UnityLauncherScrollerChildController* base, UnityLauncherScrollerChildControllermenu_cb callback, void* callback_target); -static void _lambda69_ (UnityPlacesTrashController* self); -static void __lambda69__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static void _lambda70_ (UnityPlacesTrashController* self); +static void __lambda70__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); +static void _lambda71_ (UnityPlacesTrashController* self); static void unity_places_trash_controller_recursively_delete_contents (UnityPlacesTrashController* self, GFile* dir, GAsyncReadyCallback _callback_, gpointer _user_data_); static void unity_places_trash_controller_recursively_delete_contents_finish (UnityPlacesTrashController* self, GAsyncResult* _res_); -static void __lambda70__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); +static void __lambda71__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); static void unity_places_trash_controller_recursively_delete_contents_data_free (gpointer _data); static void unity_places_trash_controller_recursively_delete_contents_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static gboolean unity_places_trash_controller_recursively_delete_contents_co (UnityPlacesTrashControllerRecursivelyDeleteContentsData* data); @@ -334,7 +334,7 @@ static void unity_places_trash_controller_real_get_menu_actions (UnityLauncherSc DbusmenuMenuitem* _tmp2_; char* _tmp3_; item = NULL; - label = g_strdup (_ ("%d items")); + label = g_strdup (ngettext ("%d item", "%d items", (gulong) self->priv->n_items)); item = (_tmp2_ = dbusmenu_menuitem_new (), _g_object_unref0 (item), _tmp2_); dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp3_ = g_strdup_printf (label, self->priv->n_items)); _g_free0 (_tmp3_); @@ -349,7 +349,7 @@ static void unity_places_trash_controller_real_get_menu_actions (UnityLauncherSc } -static void _lambda69_ (UnityPlacesTrashController* self) { +static void _lambda70_ (UnityPlacesTrashController* self) { GError * _inner_error_ = NULL; { gtk_show_uri (NULL, "trash://", clutter_get_current_event_time (), &_inner_error_); @@ -379,18 +379,18 @@ static void _lambda69_ (UnityPlacesTrashController* self) { } -static void __lambda69__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda69_ (self); +static void __lambda70__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda70_ (self); } -static void _lambda70_ (UnityPlacesTrashController* self) { +static void _lambda71_ (UnityPlacesTrashController* self) { unity_places_trash_controller_recursively_delete_contents (self, self->priv->trash_dir, NULL, NULL); } -static void __lambda70__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { - _lambda70_ (self); +static void __lambda71__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + _lambda71_ (self); } @@ -408,7 +408,7 @@ static void unity_places_trash_controller_real_get_menu_navigation (UnityLaunche dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); dbusmenu_menuitem_child_append (root, item); - g_signal_connect_object (item, "item-activated", (GCallback) __lambda69__dbusmenu_menuitem_item_activated, self, 0); + g_signal_connect_object (item, "item-activated", (GCallback) __lambda70__dbusmenu_menuitem_item_activated, self, 0); if (self->priv->n_items != 0) { DbusmenuMenuitem* _tmp1_; item = (_tmp1_ = dbusmenu_menuitem_new (), _g_object_unref0 (item), _tmp1_); @@ -416,7 +416,7 @@ static void unity_places_trash_controller_real_get_menu_navigation (UnityLaunche dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); dbusmenu_menuitem_child_append (root, item); - g_signal_connect_object (item, "item-activated", (GCallback) __lambda70__dbusmenu_menuitem_item_activated, self, 0); + g_signal_connect_object (item, "item-activated", (GCallback) __lambda71__dbusmenu_menuitem_item_activated, self, 0); } callback (root, callback_target); _g_object_unref0 (item); diff --git a/unity-private/places/places-trash-controller.vala b/unity-private/places/places-trash-controller.vala index 690ad8ef7..2ab4bd340 100644 --- a/unity-private/places/places-trash-controller.vala +++ b/unity-private/places/places-trash-controller.vala @@ -16,9 +16,9 @@ * Authored by Neil Jagdish Patel <neil.patel@canonical.com> * */ - + using Unity.Launcher; - + namespace Unity.Places { public class TrashController : ScrollerChildController @@ -47,7 +47,7 @@ namespace Unity.Places child.group_type = ScrollerChild.GroupType.SYSTEM; } - + public override void activate () { try { @@ -83,7 +83,7 @@ namespace Unity.Places { Dbusmenu.Menuitem item; /* i18n: This is the number of items in the Trash folder */ - string label = _("%d items"); + string label = ngettext("%d item", "%d items", n_items); item = new Dbusmenu.Menuitem (); item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, label.printf (n_items)); @@ -91,7 +91,7 @@ namespace Unity.Places item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); root.child_append (item); } - + callback (root); } @@ -143,7 +143,7 @@ namespace Unity.Places dialog.destroy (); }); - + dialog.show (); return false; diff --git a/unity-private/places/places-view.c b/unity-private/places/places-view.c index 223b0cf07..96bdd0b07 100644 --- a/unity-private/places/places-view.c +++ b/unity-private/places/places-view.c @@ -377,10 +377,12 @@ static void unity_places_view_update_views (UnityPlacesView* self, UnityPlacesPl ClutterAnimation* anim; anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->renderer, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 300, "opacity", 0, NULL)); g_signal_connect_object (anim, "completed", (GCallback) __lambda41__clutter_animation_completed, self, 0); + clutter_container_remove_actor ((ClutterContainer*) self->priv->layered_bin, (ClutterActor*) self->priv->renderer); _g_object_unref0 (anim); } self->priv->renderer = (_tmp0_ = unity_places_view_lookup_renderer (self, entry), _g_object_unref0 (self->priv->renderer), _tmp0_); clutter_container_add_actor ((ClutterContainer*) self->priv->layered_bin, (ClutterActor*) self->priv->renderer); + g_object_unref ((GObject*) self->priv->renderer); clutter_actor_set_opacity ((ClutterActor*) self->priv->renderer, (guint8) 0); clutter_actor_animate ((ClutterActor*) self->priv->renderer, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 300, "opacity", 255, NULL); unity_place_renderer_set_models (self->priv->renderer, unity_places_place_entry_get_entry_groups_model (entry), unity_places_place_entry_get_entry_results_model (entry), unity_places_place_entry_get_entry_renderer_hints (entry)); @@ -461,7 +463,7 @@ static void unity_places_view_on_result_activated (UnityPlacesView* self, const } default: { - g_warning ("places-view.vala:188: Unexpected activation status: %u", (guint) _result_); + g_warning ("places-view.vala:191: Unexpected activation status: %u", (guint) _result_); break; } } diff --git a/unity-private/places/places-view.vala b/unity-private/places/places-view.vala index 7e87a51ca..817addc3f 100644 --- a/unity-private/places/places-view.vala +++ b/unity-private/places/places-view.vala @@ -119,16 +119,19 @@ namespace Unity.Places /* Create the correct results view */ if (renderer is Clutter.Actor) { + var anim = renderer.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 300, "opacity", 0); anim.completed.connect ((a)=> { (a.get_object () as Clutter.Actor).destroy (); }); + layered_bin.remove_actor (renderer); } renderer = lookup_renderer (entry); layered_bin.add_actor (renderer); + renderer.unref (); /* Because lookup_renderer returns it unfloating */ renderer.opacity = 0; renderer.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 300, "opacity", 255); diff --git a/unity-private/places/places-volume-child-controller.c b/unity-private/places/places-volume-child-controller.c index be1a8900b..cb20b8ee6 100644 --- a/unity-private/places/places-volume-child-controller.c +++ b/unity-private/places/places-volume-child-controller.c @@ -177,7 +177,7 @@ enum { UNITY_PLACES_VOLUME_CHILD_CONTROLLER_DUMMY_PROPERTY, UNITY_PLACES_VOLUME_CHILD_CONTROLLER_VOLUME }; -#define UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON "/usr/share/unity/trash.png" +#define UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON "/usr/share/unity/devices.png" UnityPlacesVolumeChildController* unity_places_volume_child_controller_new (GVolume* volume); UnityPlacesVolumeChildController* unity_places_volume_child_controller_construct (GType object_type, GVolume* volume); UnityLauncherScrollerChild* unity_launcher_scroller_child_new (void); @@ -295,7 +295,7 @@ static void unity_places_volume_child_controller_open_volume (UnityPlacesVolumeC _inner_error_ = NULL; { char* _tmp1_; - g_warning ("places-volume-child-controller.vala:84: %s", _tmp1_ = g_strconcat (error_msg, err->message, NULL)); + g_warning ("places-volume-child-controller.vala:69: %s", _tmp1_ = g_strconcat (error_msg, err->message, NULL)); _g_free0 (_tmp1_); _g_error_free0 (err); } @@ -313,7 +313,7 @@ static void unity_places_volume_child_controller_open_volume (UnityPlacesVolumeC } else { if (g_volume_can_mount (self->priv->_volume) == FALSE) { char* _tmp2_; - g_warning ("places-volume-child-controller.vala:91: %s", _tmp2_ = g_strconcat (error_msg, "Cannot be mounted", NULL)); + g_warning ("places-volume-child-controller.vala:76: %s", _tmp2_ = g_strconcat (error_msg, "Cannot be mounted", NULL)); _g_free0 (_tmp2_); _g_free0 (error_msg); _g_object_unref0 (mount); @@ -332,7 +332,7 @@ static void unity_places_volume_child_controller_open_volume (UnityPlacesVolumeC } } else { char* _tmp5_; - g_warning ("places-volume-child-controller.vala:101: %s", _tmp5_ = g_strconcat (error_msg, "Unable to mount", NULL)); + g_warning ("places-volume-child-controller.vala:86: %s", _tmp5_ = g_strconcat (error_msg, "Unable to mount", NULL)); _g_free0 (_tmp5_); } } @@ -344,7 +344,7 @@ static void unity_places_volume_child_controller_open_volume (UnityPlacesVolumeC _inner_error_ = NULL; { char* _tmp6_; - g_warning ("places-volume-child-controller.vala:104: %s", _tmp6_ = g_strconcat (error_msg, e->message, NULL)); + g_warning ("places-volume-child-controller.vala:89: %s", _tmp6_ = g_strconcat (error_msg, e->message, NULL)); _g_free0 (_tmp6_); _g_error_free0 (e); } @@ -482,31 +482,11 @@ static GObject * unity_places_volume_child_controller_constructor (GType type, g obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = UNITY_PLACES_VOLUME_CHILD_CONTROLLER (obj); { - GIcon* icon; - char* icon_name; unity_launcher_scroller_child_controller_set_name ((UnityLauncherScrollerChildController*) self, g_volume_get_name (self->priv->_volume)); - icon = _g_object_ref0 (g_volume_get_icon (self->priv->_volume)); - icon_name = g_strdup (""); - if (G_IS_THEMED_ICON (icon)) { - GIcon* _tmp0_; - char* _tmp1_; - icon_name = (_tmp1_ = g_strdup (g_themed_icon_get_names ((_tmp0_ = icon, G_IS_THEMED_ICON (_tmp0_) ? ((GThemedIcon*) _tmp0_) : NULL))[0]), _g_free0 (icon_name), _tmp1_); - } else { - if (G_IS_FILE_ICON (icon)) { - GIcon* _tmp2_; - char* _tmp3_; - icon_name = (_tmp3_ = g_file_get_path (g_file_icon_get_file ((_tmp2_ = icon, G_IS_FILE_ICON (_tmp2_) ? ((GFileIcon*) _tmp2_) : NULL))), _g_free0 (icon_name), _tmp3_); - } else { - char* _tmp4_; - icon_name = (_tmp4_ = g_strdup (UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON), _g_free0 (icon_name), _tmp4_); - } - } - unity_launcher_scroller_child_controller_load_icon_from_icon_name ((UnityLauncherScrollerChildController*) self, icon_name); + unity_launcher_scroller_child_controller_load_icon_from_icon_name ((UnityLauncherScrollerChildController*) self, UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON); unity_launcher_scroller_child_set_group_type (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_DEVICE); g_signal_connect_object (unity_launcher_scroller_child_controller_get_child ((UnityLauncherScrollerChildController*) self), "drag-removed", (GCallback) _unity_places_volume_child_controller_eject_volume_unity_launcher_scroller_child_drag_removed, self, 0); g_signal_connect_object (self->priv->_volume, "removed", (GCallback) _unity_places_volume_child_controller_on_volume_removed_g_volume_removed, self, 0); - _g_free0 (icon_name); - _g_object_unref0 (icon); } return obj; } diff --git a/unity-private/places/places-volume-child-controller.vala b/unity-private/places/places-volume-child-controller.vala index 9d587895c..0e46203d9 100644 --- a/unity-private/places/places-volume-child-controller.vala +++ b/unity-private/places/places-volume-child-controller.vala @@ -24,7 +24,7 @@ namespace Unity.Places { public class VolumeChildController : ScrollerChildController { - public static const string ICON = "/usr/share/unity/trash.png"; + public static const string ICON = "/usr/share/unity/devices.png"; public Volume volume { get; construct; } @@ -37,22 +37,7 @@ namespace Unity.Places construct { name = volume.get_name (); - - var icon = volume.get_icon (); - var icon_name = ""; - if (icon is ThemedIcon) - { - icon_name = (icon as ThemedIcon).get_names ()[0]; - } - else if (icon is FileIcon) - { - icon_name = (icon as FileIcon).get_file ().get_path (); - } - else - { - icon_name = ICON; - } - load_icon_from_icon_name (icon_name); + load_icon_from_icon_name (ICON); child.group_type = ScrollerChild.GroupType.DEVICE; child.drag_removed.connect (eject_volume); diff --git a/unity-private/testing/background.c b/unity-private/testing/background.c index 848fc678b..c494a76c3 100644 --- a/unity-private/testing/background.c +++ b/unity-private/testing/background.c @@ -94,9 +94,9 @@ enum { UnityTestingBackground* unity_testing_background_new (void); UnityTestingBackground* unity_testing_background_construct (GType object_type); static void _unity_testing_background_on_allocation_changed (UnityTestingBackground* self); -static gboolean _lambda93_ (UnityTestingBackground* self); +static gboolean _lambda94_ (UnityTestingBackground* self); static void _unity_testing_background_update_gradient (UnityTestingBackground* self); -static gboolean __lambda93__gsource_func (gpointer self); +static gboolean __lambda94__gsource_func (gpointer self); static void _unity_testing_background_on_gconf_changed (UnityTestingBackground* self, GConfClient* client, guint cxnid, GConfEntry* entry); static void __unity_testing_background_on_gconf_changed_gconf_client_notify_func (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer self); static void __unity_testing_background_on_allocation_changed_clutter_actor_allocation_changed (ClutterActor* _sender, const ClutterActorBox* box, ClutterAllocationFlags flags, gpointer self); @@ -118,7 +118,7 @@ UnityTestingBackground* unity_testing_background_new (void) { } -static gboolean _lambda93_ (UnityTestingBackground* self) { +static gboolean _lambda94_ (UnityTestingBackground* self) { gboolean result = FALSE; _unity_testing_background_update_gradient (self); result = FALSE; @@ -126,16 +126,16 @@ static gboolean _lambda93_ (UnityTestingBackground* self) { } -static gboolean __lambda93__gsource_func (gpointer self) { +static gboolean __lambda94__gsource_func (gpointer self) { gboolean result; - result = _lambda93_ (self); + result = _lambda94_ (self); return result; } static void _unity_testing_background_on_allocation_changed (UnityTestingBackground* self) { g_return_if_fail (self != NULL); - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda93__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda94__gsource_func, g_object_ref (self), g_object_unref); } diff --git a/unity-private/testing/test-director.c b/unity-private/testing/test-director.c index 9a0b0b493..c96e5e433 100644 --- a/unity-private/testing/test-director.c +++ b/unity-private/testing/test-director.c @@ -69,8 +69,8 @@ UnityTestingDirector* unity_testing_director_construct (GType object_type, Clutt 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); void unity_testing_director_do_wait_for_timeout (UnityTestingDirector* self, guint32 msecs); -static gboolean _lambda94_ (UnityTestingDirector* self); -static gboolean __lambda94__gsource_func (gpointer self); +static gboolean _lambda95_ (UnityTestingDirector* self); +static gboolean __lambda95__gsource_func (gpointer self); 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); void unity_testing_director_enter_event (UnityTestingDirector* self, ClutterActor* actor, float relative_x, float relative_y); @@ -137,7 +137,7 @@ void unity_testing_director_do_wait_for_animation (UnityTestingDirector* self, C } -static gboolean _lambda94_ (UnityTestingDirector* self) { +static gboolean _lambda95_ (UnityTestingDirector* self) { gboolean result = FALSE; self->priv->break_loop = TRUE; result = FALSE; @@ -145,9 +145,9 @@ static gboolean _lambda94_ (UnityTestingDirector* self) { } -static gboolean __lambda94__gsource_func (gpointer self) { +static gboolean __lambda95__gsource_func (gpointer self) { gboolean result; - result = _lambda94_ (self); + result = _lambda95_ (self); return result; } @@ -155,7 +155,7 @@ static gboolean __lambda94__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, __lambda94__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda95__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 061b84aa4..ffa6a5afc 100644 --- a/unity-private/testing/test-window.c +++ b/unity-private/testing/test-window.c @@ -256,14 +256,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 _lambda95_ (UnityTestingWindow* self); -static gboolean __lambda95__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); static gboolean _lambda96_ (UnityTestingWindow* self); static gboolean __lambda96__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _lambda97_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda97__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static gboolean _lambda97_ (UnityTestingWindow* self); +static gboolean __lambda97__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); static void _lambda98_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda98__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); +static void __lambda98__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static void _lambda99_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda99__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); @@ -279,8 +279,8 @@ static void _unity_testing_window_on_active_window_changed_wnck_screen_active_wi UnityGestureXCBDispatcher* unity_gesture_xcb_dispatcher_new (void); UnityGestureXCBDispatcher* unity_gesture_xcb_dispatcher_construct (GType object_type); GType unity_gesture_xcb_dispatcher_get_type (void) G_GNUC_CONST; -static gboolean _lambda99_ (UnityTestingWindow* self); -static gboolean __lambda99__gsource_func (gpointer self); +static gboolean _lambda100_ (UnityTestingWindow* self); +static gboolean __lambda100__gsource_func (gpointer self); static GObject * unity_testing_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_testing_window_finalize (GObject* obj); static void unity_testing_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -729,7 +729,7 @@ static void unity_testing_window_set_popup_height (UnityTestingWindow* self, gin } -static gboolean _lambda95_ (UnityTestingWindow* self) { +static gboolean _lambda96_ (UnityTestingWindow* self) { gboolean result = FALSE; gtk_main_quit (); result = FALSE; @@ -737,46 +737,46 @@ static gboolean _lambda95_ (UnityTestingWindow* self) { } -static gboolean __lambda95__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda96__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda95_ (self); + result = _lambda96_ (self); return result; } -static gboolean _lambda96_ (UnityTestingWindow* self) { +static gboolean _lambda97_ (UnityTestingWindow* self) { gboolean result = FALSE; result = TRUE; return result; } -static gboolean __lambda96__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda97__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda96_ (self); + result = _lambda97_ (self); return result; } -static void _lambda97_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda98_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda97__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { - _lambda97_ (_sender, self); +static void __lambda98__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { + _lambda98_ (_sender, self); } -static void _lambda98_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda99_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda98__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { - _lambda98_ (_sender, self); +static void __lambda99__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { + _lambda99_ (_sender, self); } @@ -792,7 +792,7 @@ static void _unity_testing_window_on_active_window_changed_wnck_screen_active_wi } -static gboolean _lambda99_ (UnityTestingWindow* self) { +static gboolean _lambda100_ (UnityTestingWindow* self) { gboolean result = FALSE; unity_shell_set_is_starting ((UnityShell*) self, FALSE); result = FALSE; @@ -800,9 +800,9 @@ static gboolean _lambda99_ (UnityTestingWindow* self) { } -static gboolean __lambda99__gsource_func (gpointer self) { +static gboolean __lambda100__gsource_func (gpointer self) { gboolean result; - result = _lambda99_ (self); + result = _lambda100_ (self); return result; } @@ -854,7 +854,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) __lambda95__gtk_widget_delete_event, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda96__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); @@ -863,9 +863,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) __lambda96__gtk_widget_delete_event, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda97__gdk_screen_size_changed, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda98__gdk_screen_monitors_changed, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda97__gtk_widget_delete_event, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda98__gdk_screen_size_changed, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda99__gdk_screen_monitors_changed, self, 0); } gtk_window_set_title ((GtkWindow*) self, "Unity"); gtk_window_set_icon_name ((GtkWindow*) self, "distributor-logo"); @@ -912,7 +912,7 @@ static GObject * unity_testing_window_constructor (GType type, guint n_construct g_signal_connect_object (self->priv->wnck_screen, "active-window-changed", (GCallback) _unity_testing_window_on_active_window_changed_wnck_screen_active_window_changed, self, 0); } self->priv->gesture_dispatcher = (_tmp24_ = (UnityGestureDispatcher*) unity_gesture_xcb_dispatcher_new (), _g_object_unref0 (self->priv->gesture_dispatcher), _tmp24_); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda99__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda100__gsource_func, g_object_ref (self), g_object_unref); END_FUNCTION (); target_list = (g_free (target_list), NULL); } diff --git a/unity-private/unity-private.h b/unity-private/unity-private.h index b96b12f69..b7f11b819 100644 --- a/unity-private/unity-private.h +++ b/unity-private/unity-private.h @@ -1303,6 +1303,7 @@ struct _UnityPlacesTile { struct _UnityPlacesTileClass { UnityPlacesButtonClass parent_class; void (*about_to_show) (UnityPlacesTile* self); + void (*update_details) (UnityPlacesTile* self, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); }; struct _UnityPlacesFileInfoTile { @@ -1708,6 +1709,7 @@ typedef enum { struct _UnityLauncherApplicationController { UnityLauncherScrollerChildController parent_instance; UnityLauncherApplicationControllerPrivate * priv; + gboolean is_favorite; }; struct _UnityLauncherApplicationControllerClass { @@ -2162,13 +2164,20 @@ guint unity_places_more_results_button_get_count (UnityPlacesMoreResultsButton* void unity_places_more_results_button_set_count (UnityPlacesMoreResultsButton* self, guint value); GType unity_places_tile_get_type (void) G_GNUC_CONST; void unity_places_tile_about_to_show (UnityPlacesTile* self); +void unity_places_tile_update_details (UnityPlacesTile* self, 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* unity_places_tile_get_iter (UnityPlacesTile* self); +void unity_places_tile_set_iter (UnityPlacesTile* self, DeeModelIter* value); const char* unity_places_tile_get_display_name (UnityPlacesTile* self); +void unity_places_tile_set_display_name (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_icon_hint (UnityPlacesTile* self); +void unity_places_tile_set_icon_hint (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_uri (UnityPlacesTile* self); +void unity_places_tile_set_uri (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_mimetype (UnityPlacesTile* self); +void unity_places_tile_set_mimetype (UnityPlacesTile* self, const char* value); const char* unity_places_tile_get_comment (UnityPlacesTile* self); +void unity_places_tile_set_comment (UnityPlacesTile* self, const char* value); GType unity_places_file_info_tile_get_type (void) G_GNUC_CONST; UnityPlacesFileInfoTile* unity_places_file_info_tile_new (DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); UnityPlacesFileInfoTile* unity_places_file_info_tile_construct (GType object_type, DeeModelIter* iter, const char* uri, const char* icon_hint, const char* mimetype, const char* display_name, const char* comment); @@ -2412,7 +2421,7 @@ UnityPlacesPlaceModel* unity_places_view_get_model (UnityPlacesView* self); UnityPlacesVolumeController* unity_places_volume_controller_new (void); UnityPlacesVolumeController* unity_places_volume_controller_construct (GType object_type); GType unity_places_volume_child_controller_get_type (void) G_GNUC_CONST; -#define UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON "/usr/share/unity/trash.png" +#define UNITY_PLACES_VOLUME_CHILD_CONTROLLER_ICON "/usr/share/unity/devices.png" UnityPlacesVolumeChildController* unity_places_volume_child_controller_new (GVolume* volume); UnityPlacesVolumeChildController* unity_places_volume_child_controller_construct (GType object_type, GVolume* volume); GVolume* unity_places_volume_child_controller_get_volume (UnityPlacesVolumeChildController* self); diff --git a/unity-private/unity-private.vapi b/unity-private/unity-private.vapi index 7ece78b04..596e6cb95 100644 --- a/unity-private/unity-private.vapi +++ b/unity-private/unity-private.vapi @@ -88,6 +88,7 @@ namespace Unity { namespace Launcher { [CCode (cheader_filename = "unity-private.h")] public class ApplicationController : Unity.Launcher.ScrollerChildController { + public bool is_favorite; public ApplicationController (string? desktop_file_, Unity.Launcher.ScrollerChild child_); public override void activate (); public void attach_application (Bamf.Application application); @@ -453,6 +454,7 @@ namespace Unity { public class DefaultTile : Unity.Places.Tile { public DefaultTile (Dee.ModelIter iter, string uri, string? icon_hint, string? mimetype, string display_name, string? comment); public override void about_to_show (); + public override void update_details (string uri, string? icon_hint, string? mimetype, string display_name, string? comment); } [CCode (cheader_filename = "unity-private.h")] public class EmptySearchGroup : Ctk.Bin { @@ -484,6 +486,7 @@ namespace Unity { public class FileInfoTile : Unity.Places.Tile { public FileInfoTile (Dee.ModelIter iter, string uri, string? icon_hint, string? mimetype, string display_name, string? comment); public override void about_to_show (); + public override void update_details (string uri, string? icon_hint, string? mimetype, string display_name, string? comment); } [CCode (cheader_filename = "unity-private.h")] public class FolderBrowserRenderer : Ctk.ScrollView, Unity.Place.Renderer { @@ -656,17 +659,19 @@ namespace Unity { public class ShowcaseTile : Unity.Places.Tile { public ShowcaseTile (Dee.ModelIter iter, string uri, string? icon_hint, string? mimetype, string display_name, string? comment); public override void about_to_show (); + public override void update_details (string uri, string? icon_hint, string? mimetype, string display_name, string? comment); } [CCode (cheader_filename = "unity-private.h")] public abstract class Tile : Unity.Places.Button { public Tile (); public abstract void about_to_show (); - public string? comment { get; construct; } - public string display_name { get; construct; } - public string? icon_hint { get; construct; } - public Dee.ModelIter iter { get; construct; } - public string? mimetype { get; construct; } - public string uri { get; construct; } + public abstract void update_details (string uri, string? icon_hint, string? mimetype, string display_name, string? comment); + public string? comment { get; set construct; } + public string display_name { get; set construct; } + public string? icon_hint { get; set construct; } + public Dee.ModelIter iter { get; set construct; } + public string? mimetype { get; set construct; } + public string uri { get; set construct; } public signal void activated (string uri, string mimetype); } [CCode (cheader_filename = "unity-private.h")] diff --git a/unity/unity-layered-bin.c b/unity/unity-layered-bin.c index d73a3873c..92df7544d 100644 --- a/unity/unity-layered-bin.c +++ b/unity/unity-layered-bin.c @@ -430,6 +430,23 @@ static void unity_layered_bin_instance_init (UnityLayeredBin * self) { static void unity_layered_bin_finalize (GObject* obj) { UnityLayeredBin * self; self = UNITY_LAYERED_BIN (obj); + { + GList* _tmp0_; + { + GList* child_collection; + GList* child_it; + child_collection = self->priv->_children; + for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { + ClutterActor* child; + child = _g_object_ref0 ((ClutterActor*) child_it->data); + { + clutter_actor_unparent (child); + _g_object_unref0 (child); + } + } + } + self->priv->_children = (_tmp0_ = NULL, __g_list_free_g_object_unref0 (self->priv->_children), _tmp0_); + } __g_list_free_g_object_unref0 (self->priv->_children); G_OBJECT_CLASS (unity_layered_bin_parent_class)->finalize (obj); } diff --git a/unity/unity-layered-bin.vala b/unity/unity-layered-bin.vala index 31600ddd7..471716b80 100644 --- a/unity/unity-layered-bin.vala +++ b/unity/unity-layered-bin.vala @@ -39,6 +39,14 @@ namespace Unity Object (); } + ~LayeredBin () + { + foreach (Clutter.Actor child in _children) + child.unparent (); + + _children = null; + } + construct { diff --git a/unity/unity-pixbuf-cache.c b/unity/unity-pixbuf-cache.c index cf4ee26c5..d45633a2f 100644 --- a/unity/unity-pixbuf-cache.c +++ b/unity/unity-pixbuf-cache.c @@ -24,13 +24,29 @@ #include <glib-object.h> #include <stdlib.h> #include <string.h> +#include <clutk/clutk.h> #include <gtk/gtk.h> #include <gee.h> #include <gdk-pixbuf/gdk-pixdata.h> #include <clutter/clutter.h> #include <gio/gio.h> -#include <clutk/clutk.h> +#include <gobject/gvaluecollector.h> + + +#define UNITY_TYPE_PIXBUF_CACHE_TASK (unity_pixbuf_cache_task_get_type ()) +#define UNITY_PIXBUF_CACHE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTask)) +#define UNITY_PIXBUF_CACHE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTaskClass)) +#define UNITY_IS_PIXBUF_CACHE_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK)) +#define UNITY_IS_PIXBUF_CACHE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PIXBUF_CACHE_TASK)) +#define UNITY_PIXBUF_CACHE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTaskClass)) +typedef struct _UnityPixbufCacheTask UnityPixbufCacheTask; +typedef struct _UnityPixbufCacheTaskClass UnityPixbufCacheTaskClass; +typedef struct _UnityPixbufCacheTaskPrivate UnityPixbufCacheTaskPrivate; + +#define UNITY_TYPE_PIXBUF_REQUEST_TYPE (unity_pixbuf_request_type_get_type ()) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _UnityParamSpecPixbufCacheTask UnityParamSpecPixbufCacheTask; #define UNITY_TYPE_PIXBUF_CACHE (unity_pixbuf_cache_get_type ()) #define UNITY_PIXBUF_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PIXBUF_CACHE, UnityPixbufCache)) @@ -55,12 +71,40 @@ typedef struct _UnityShellIface UnityShellIface; #define UNITY_TYPE_SHELL_MODE (unity_shell_mode_get_type ()) #define UNITY_TYPE_WINDOW_ACTION (unity_window_action_get_type ()) -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +#define _unity_pixbuf_cache_task_unref0(var) ((var == NULL) ? NULL : (var = (unity_pixbuf_cache_task_unref (var), NULL))) typedef struct _UnityPixbufCacheSetImageFromIconNameData UnityPixbufCacheSetImageFromIconNameData; #define _gtk_icon_info_free0(var) ((var == NULL) ? NULL : (var = (gtk_icon_info_free (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _UnityPixbufCacheSetImageFromIconNameRealData UnityPixbufCacheSetImageFromIconNameRealData; typedef struct _UnityPixbufCacheSetImageFromGiconStringData UnityPixbufCacheSetImageFromGiconStringData; +typedef struct _UnityPixbufCacheSetImageFromGiconStringRealData UnityPixbufCacheSetImageFromGiconStringRealData; typedef struct _UnityPixbufCacheSetImageFromGiconData UnityPixbufCacheSetImageFromGiconData; +typedef struct _UnityPixbufCacheLoadFromFilepathData UnityPixbufCacheLoadFromFilepathData; + +typedef enum { + UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME, + UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING +} UnityPixbufRequestType; + +struct _UnityPixbufCacheTask { + GTypeInstance parent_instance; + volatile int ref_count; + UnityPixbufCacheTaskPrivate * priv; + char* data; + CtkImage* image; + gint size; + char* key; + UnityPixbufRequestType type; +}; + +struct _UnityPixbufCacheTaskClass { + GTypeClass parent_class; + void (*finalize) (UnityPixbufCacheTask *self); +}; + +struct _UnityParamSpecPixbufCacheTask { + GParamSpec parent_instance; +}; struct _UnityPixbufCache { GObject parent_instance; @@ -75,6 +119,8 @@ struct _UnityPixbufCachePrivate { GtkIconTheme* theme; GeeHashMap* cache; gboolean autodispose; + GeePriorityQueue* queue; + guint queue_timeout; }; typedef enum { @@ -128,8 +174,23 @@ struct _UnityPixbufCacheSetImageFromIconNameData { gint size; char* key; GdkPixbuf* ret; + UnityPixbufCacheTask* task; + char* _tmp0_; +}; + +struct _UnityPixbufCacheSetImageFromIconNameRealData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + UnityPixbufCache* self; + CtkImage* image; + char* icon_name; + gint size; + char* key; + GdkPixbuf* ret; + GtkIconInfo* info; + char* filename; GdkPixbuf* _tmp0_; - GdkPixbuf* _tmp1_; GError * e; GError * _inner_error_; }; @@ -140,25 +201,39 @@ struct _UnityPixbufCacheSetImageFromGiconStringData { GSimpleAsyncResult* _async_result; UnityPixbufCache* self; CtkImage* image; + char* data; + gint size; + char* key; + GdkPixbuf* ret; + UnityPixbufCacheTask* task; + char* _tmp0_; +}; + +struct _UnityPixbufCacheSetImageFromGiconStringRealData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + UnityPixbufCache* self; + CtkImage* image; char* gicon_as_string; gint size; char* key; GdkPixbuf* ret; GdkPixbuf* _tmp0_; - GdkPixbuf* _tmp1_; - char* _tmp2_; + char* _tmp1_; GError * err; GIcon* icon; GtkIconInfo* info; - GdkPixbuf* _tmp3_; - GdkPixbuf* _tmp4_; + char* filename; + GdkPixbuf* _tmp2_; + gboolean _tmp3_; + gboolean _tmp4_; gboolean _tmp5_; - gboolean _tmp6_; - gboolean _tmp7_; char* real_name; - GdkPixbuf* _tmp8_; - GdkPixbuf* _tmp9_; - char* _tmp10_; + GtkIconInfo* _tmp6_; + char* fname; + GdkPixbuf* _tmp7_; + char* _tmp8_; GError * e; GError * _inner_error_; }; @@ -173,12 +248,52 @@ struct _UnityPixbufCacheSetImageFromGiconData { gint size; }; +struct _UnityPixbufCacheLoadFromFilepathData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + UnityPixbufCache* self; + char* filename; + gint size; + CtkImage* image; + char* key; + GdkPixbuf* result; + GFile* datafile; + GFileInputStream* stream; + guchar* buf; + gint buf_length1; + gint _buf_size_; + guchar* _tmp0_; + void* data; + gsize data_size; + guchar* _tmp1_; + char* sdata; + GdkPixbufLoader* loader; + GError * ee; + GError * _inner_error_; +}; + +static gpointer unity_pixbuf_cache_task_parent_class = NULL; extern UnityPixbufCache* unity__pixbuf_cache; UnityPixbufCache* unity__pixbuf_cache = NULL; extern UnityShell* unity_global_shell; static gpointer unity_pixbuf_cache_parent_class = NULL; +gpointer unity_pixbuf_cache_task_ref (gpointer instance); +void unity_pixbuf_cache_task_unref (gpointer instance); +GParamSpec* unity_param_spec_pixbuf_cache_task (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void unity_value_set_pixbuf_cache_task (GValue* value, gpointer v_object); +void unity_value_take_pixbuf_cache_task (GValue* value, gpointer v_object); +gpointer unity_value_get_pixbuf_cache_task (const GValue* value); +GType unity_pixbuf_cache_task_get_type (void) G_GNUC_CONST; +GType unity_pixbuf_request_type_get_type (void) G_GNUC_CONST; +enum { + UNITY_PIXBUF_CACHE_TASK_DUMMY_PROPERTY +}; +UnityPixbufCacheTask* unity_pixbuf_cache_task_new (void); +UnityPixbufCacheTask* unity_pixbuf_cache_task_construct (GType object_type); +static void unity_pixbuf_cache_task_finalize (UnityPixbufCacheTask* obj); #define UNITY_hash_template "%s%d" GType unity_pixbuf_cache_get_type (void) G_GNUC_CONST; #define UNITY_PIXBUF_CACHE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_PIXBUF_CACHE, UnityPixbufCachePrivate)) @@ -197,23 +312,43 @@ UnityPixbufCache* unity_pixbuf_cache_get_default (void); void unity_pixbuf_cache_set (UnityPixbufCache* self, const char* icon_id, GdkPixbuf* pixbuf, gint size); GdkPixbuf* unity_pixbuf_cache_get (UnityPixbufCache* self, const char* icon_id, gint size); void unity_pixbuf_cache_clear (UnityPixbufCache* self); +gboolean unity_pixbuf_cache_load_iteration (UnityPixbufCache* self); +void unity_pixbuf_cache_set_image_from_icon_name_real (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_icon_name_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); +void unity_pixbuf_cache_set_image_from_gicon_string_real (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_gicon_string_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); static void unity_pixbuf_cache_set_image_from_icon_name_data_free (gpointer _data); static void unity_pixbuf_cache_set_image_from_icon_name_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_icon_name_finish (UnityPixbufCache* self, GAsyncResult* _res_); static gboolean unity_pixbuf_cache_set_image_from_icon_name_co (UnityPixbufCacheSetImageFromIconNameData* data); -static gboolean _unity_pixbuf_cache_set_image_from_icon_name_co_gsource_func (gpointer self); +static gboolean _unity_pixbuf_cache_load_iteration_gsource_func (gpointer self); +static void unity_pixbuf_cache_set_image_from_icon_name_real_data_free (gpointer _data); +static void unity_pixbuf_cache_set_image_from_icon_name_real_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static gboolean unity_pixbuf_cache_set_image_from_icon_name_real_co (UnityPixbufCacheSetImageFromIconNameRealData* data); +static gboolean _unity_pixbuf_cache_set_image_from_icon_name_real_co_gsource_func (gpointer self); +void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, CtkImage* image, const char* key, GAsyncReadyCallback _callback_, gpointer _user_data_); +GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_); static void unity_pixbuf_cache_set_image_from_gicon_string_data_free (gpointer _data); static void unity_pixbuf_cache_set_image_from_gicon_string_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_gicon_string_finish (UnityPixbufCache* self, GAsyncResult* _res_); static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCacheSetImageFromGiconStringData* data); -void unity_pixbuf_cache_set_image_from_gicon (UnityPixbufCache* self, CtkImage* image, GIcon* icon, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); -void unity_pixbuf_cache_set_image_from_gicon_finish (UnityPixbufCache* self, GAsyncResult* _res_); -static gboolean _unity_pixbuf_cache_set_image_from_gicon_string_co_gsource_func (gpointer self); +static void unity_pixbuf_cache_set_image_from_gicon_string_real_data_free (gpointer _data); +static void unity_pixbuf_cache_set_image_from_gicon_string_real_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static gboolean unity_pixbuf_cache_set_image_from_gicon_string_real_co (UnityPixbufCacheSetImageFromGiconStringRealData* data); +static gboolean _unity_pixbuf_cache_set_image_from_gicon_string_real_co_gsource_func (gpointer self); static void unity_pixbuf_cache_set_image_from_gicon_data_free (gpointer _data); static void unity_pixbuf_cache_set_image_from_gicon_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_gicon (UnityPixbufCache* self, CtkImage* image, GIcon* icon, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_gicon_finish (UnityPixbufCache* self, GAsyncResult* _res_); static gboolean unity_pixbuf_cache_set_image_from_gicon_co (UnityPixbufCacheSetImageFromGiconData* data); +static void unity_pixbuf_cache_load_from_filepath_data_free (gpointer _data); +static void unity_pixbuf_cache_load_from_filepath_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static gboolean unity_pixbuf_cache_load_from_filepath_co (UnityPixbufCacheLoadFromFilepathData* data); +void unity_io_read_stream_async (GInputStream* input, guchar* buffer, int buffer_length1, gsize buffer_lenght, gint io_priority, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_io_read_stream_finish (GAsyncResult* _res_, void** data, gsize* size, GError** error); +static guchar* _vala_array_dup4 (guchar* self, int length); guint unity_pixbuf_cache_get_size (UnityPixbufCache* self); static GObject * unity_pixbuf_cache_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_pixbuf_cache_finalize (GObject* obj); @@ -221,6 +356,191 @@ static void unity_pixbuf_cache_get_property (GObject * object, guint property_id +UnityPixbufCacheTask* unity_pixbuf_cache_task_construct (GType object_type) { + UnityPixbufCacheTask* self; + self = (UnityPixbufCacheTask*) g_type_create_instance (object_type); + return self; +} + + +UnityPixbufCacheTask* unity_pixbuf_cache_task_new (void) { + return unity_pixbuf_cache_task_construct (UNITY_TYPE_PIXBUF_CACHE_TASK); +} + + +static void unity_value_pixbuf_cache_task_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void unity_value_pixbuf_cache_task_free_value (GValue* value) { + if (value->data[0].v_pointer) { + unity_pixbuf_cache_task_unref (value->data[0].v_pointer); + } +} + + +static void unity_value_pixbuf_cache_task_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = unity_pixbuf_cache_task_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer unity_value_pixbuf_cache_task_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* unity_value_pixbuf_cache_task_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + UnityPixbufCacheTask* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = unity_pixbuf_cache_task_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* unity_value_pixbuf_cache_task_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + UnityPixbufCacheTask** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = unity_pixbuf_cache_task_ref (value->data[0].v_pointer); + } + return NULL; +} + + +GParamSpec* unity_param_spec_pixbuf_cache_task (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + UnityParamSpecPixbufCacheTask* spec; + g_return_val_if_fail (g_type_is_a (object_type, UNITY_TYPE_PIXBUF_CACHE_TASK), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +gpointer unity_value_get_pixbuf_cache_task (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_TYPE_PIXBUF_CACHE_TASK), NULL); + return value->data[0].v_pointer; +} + + +void unity_value_set_pixbuf_cache_task (GValue* value, gpointer v_object) { + UnityPixbufCacheTask* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_TYPE_PIXBUF_CACHE_TASK)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNITY_TYPE_PIXBUF_CACHE_TASK)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + unity_pixbuf_cache_task_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + unity_pixbuf_cache_task_unref (old); + } +} + + +void unity_value_take_pixbuf_cache_task (GValue* value, gpointer v_object) { + UnityPixbufCacheTask* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_TYPE_PIXBUF_CACHE_TASK)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNITY_TYPE_PIXBUF_CACHE_TASK)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + unity_pixbuf_cache_task_unref (old); + } +} + + +static void unity_pixbuf_cache_task_class_init (UnityPixbufCacheTaskClass * klass) { + unity_pixbuf_cache_task_parent_class = g_type_class_peek_parent (klass); + UNITY_PIXBUF_CACHE_TASK_CLASS (klass)->finalize = unity_pixbuf_cache_task_finalize; +} + + +static void unity_pixbuf_cache_task_instance_init (UnityPixbufCacheTask * self) { + self->ref_count = 1; +} + + +static void unity_pixbuf_cache_task_finalize (UnityPixbufCacheTask* obj) { + UnityPixbufCacheTask * self; + self = UNITY_PIXBUF_CACHE_TASK (obj); + _g_free0 (self->data); + _g_free0 (self->key); +} + + +GType unity_pixbuf_cache_task_get_type (void) { + static volatile gsize unity_pixbuf_cache_task_type_id__volatile = 0; + if (g_once_init_enter (&unity_pixbuf_cache_task_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { unity_value_pixbuf_cache_task_init, unity_value_pixbuf_cache_task_free_value, unity_value_pixbuf_cache_task_copy_value, unity_value_pixbuf_cache_task_peek_pointer, "p", unity_value_pixbuf_cache_task_collect_value, "p", unity_value_pixbuf_cache_task_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (UnityPixbufCacheTaskClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_pixbuf_cache_task_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityPixbufCacheTask), 0, (GInstanceInitFunc) unity_pixbuf_cache_task_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType unity_pixbuf_cache_task_type_id; + unity_pixbuf_cache_task_type_id = g_type_register_fundamental (g_type_fundamental_next (), "UnityPixbufCacheTask", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&unity_pixbuf_cache_task_type_id__volatile, unity_pixbuf_cache_task_type_id); + } + return unity_pixbuf_cache_task_type_id__volatile; +} + + +gpointer unity_pixbuf_cache_task_ref (gpointer instance) { + UnityPixbufCacheTask* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +void unity_pixbuf_cache_task_unref (gpointer instance) { + UnityPixbufCacheTask* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + UNITY_PIXBUF_CACHE_TASK_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +GType unity_pixbuf_request_type_get_type (void) { + static volatile gsize unity_pixbuf_request_type_type_id__volatile = 0; + if (g_once_init_enter (&unity_pixbuf_request_type_type_id__volatile)) { + static const GEnumValue values[] = {{UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME, "UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME", "icon-name"}, {UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING, "UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING", "gicon-string"}, {0, NULL, NULL}}; + GType unity_pixbuf_request_type_type_id; + unity_pixbuf_request_type_type_id = g_enum_register_static ("UnityPixbufRequestType", values); + g_once_init_leave (&unity_pixbuf_request_type_type_id__volatile, unity_pixbuf_request_type_type_id); + } + return unity_pixbuf_request_type_type_id__volatile; +} + + static void _unity_pixbuf_cache_on_shell_destroyed_gweak_notify (gpointer self, GObject* object) { unity_pixbuf_cache_on_shell_destroyed (self); } @@ -298,6 +618,43 @@ void unity_pixbuf_cache_clear (UnityPixbufCache* self) { } +gboolean unity_pixbuf_cache_load_iteration (UnityPixbufCache* self) { + gboolean result = FALSE; + gint i; + g_return_val_if_fail (self != NULL, FALSE); + i = 0; + while (TRUE) { + gboolean _tmp0_ = FALSE; + UnityPixbufCacheTask* task; + if (gee_collection_get_size ((GeeCollection*) self->priv->queue) > 0) { + _tmp0_ = i < 10; + } else { + _tmp0_ = FALSE; + } + if (!_tmp0_) { + break; + } + task = (UnityPixbufCacheTask*) gee_abstract_queue_poll ((GeeAbstractQueue*) self->priv->queue); + if (CTK_IS_IMAGE (task->image)) { + if (task->type == UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME) { + unity_pixbuf_cache_set_image_from_icon_name_real (self, task->image, task->data, task->size, NULL, NULL); + } else { + if (task->type == UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING) { + unity_pixbuf_cache_set_image_from_gicon_string_real (self, task->image, task->data, task->size, NULL, NULL); + } + } + } + i++; + _unity_pixbuf_cache_task_unref0 (task); + } + if (gee_collection_get_size ((GeeCollection*) self->priv->queue) == 0) { + self->priv->queue_timeout = (guint) 0; + } + result = gee_collection_get_size ((GeeCollection*) self->priv->queue) != 0; + return result; +} + + static void unity_pixbuf_cache_set_image_from_icon_name_data_free (gpointer _data) { UnityPixbufCacheSetImageFromIconNameData* data; data = _data; @@ -335,9 +692,9 @@ static void unity_pixbuf_cache_set_image_from_icon_name_ready (GObject* source_o } -static gboolean _unity_pixbuf_cache_set_image_from_icon_name_co_gsource_func (gpointer self) { +static gboolean _unity_pixbuf_cache_load_iteration_gsource_func (gpointer self) { gboolean result; - result = unity_pixbuf_cache_set_image_from_icon_name_co (self); + result = unity_pixbuf_cache_load_iteration (self); return result; } @@ -348,8 +705,102 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_co (UnityPixbufCache goto _state_0; default: g_assert_not_reached (); + } + _state_0: + data->key = g_strdup_printf (UNITY_hash_template, data->icon_name, data->size); + data->ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->cache, data->key); + if (GDK_IS_PIXBUF (data->ret)) { + ctk_image_set_from_pixbuf (data->image, data->ret); + _g_object_unref0 (data->ret); + _g_free0 (data->key); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } + } + data->task = unity_pixbuf_cache_task_new (); + data->task->data = (data->_tmp0_ = g_strdup (data->icon_name), _g_free0 (data->task->data), data->_tmp0_); + data->task->image = data->image; + data->task->size = data->size; + data->task->type = UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME; + gee_abstract_collection_add ((GeeAbstractCollection*) data->self->priv->queue, data->task); + if (data->self->priv->queue_timeout == 0) { + data->self->priv->queue_timeout = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_load_iteration_gsource_func, g_object_ref (data->self), g_object_unref); + } + _unity_pixbuf_cache_task_unref0 (data->task); + _g_object_unref0 (data->ret); + _g_free0 (data->key); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } +} + + +static void unity_pixbuf_cache_set_image_from_icon_name_real_data_free (gpointer _data) { + UnityPixbufCacheSetImageFromIconNameRealData* data; + data = _data; + _g_object_unref0 (data->image); + _g_free0 (data->icon_name); + g_object_unref (data->self); + g_slice_free (UnityPixbufCacheSetImageFromIconNameRealData, data); +} + + +void unity_pixbuf_cache_set_image_from_icon_name_real (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_) { + UnityPixbufCacheSetImageFromIconNameRealData* _data_; + _data_ = g_slice_new0 (UnityPixbufCacheSetImageFromIconNameRealData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_pixbuf_cache_set_image_from_icon_name_real); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_pixbuf_cache_set_image_from_icon_name_real_data_free); + _data_->self = g_object_ref (self); + _data_->image = _g_object_ref0 (image); + _data_->icon_name = g_strdup (icon_name); + _data_->size = size; + unity_pixbuf_cache_set_image_from_icon_name_real_co (_data_); +} + + +void unity_pixbuf_cache_set_image_from_icon_name_real_finish (UnityPixbufCache* self, GAsyncResult* _res_) { + UnityPixbufCacheSetImageFromIconNameRealData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +} + + +static void unity_pixbuf_cache_set_image_from_icon_name_real_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + UnityPixbufCacheSetImageFromIconNameRealData* data; + data = _user_data_; + data->_res_ = _res_; + unity_pixbuf_cache_set_image_from_icon_name_real_co (data); +} + + +static gboolean _unity_pixbuf_cache_set_image_from_icon_name_real_co_gsource_func (gpointer self) { + gboolean result; + result = unity_pixbuf_cache_set_image_from_icon_name_real_co (self); + return result; +} + + +static gboolean unity_pixbuf_cache_set_image_from_icon_name_real_co (UnityPixbufCacheSetImageFromIconNameRealData* data) { + switch (data->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); case 10: goto _state_10; + case 11: + goto _state_11; } _state_0: data->key = g_strdup_printf (UNITY_hash_template, data->icon_name, data->size); @@ -368,21 +819,27 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_co (UnityPixbufCache return FALSE; } } - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_set_image_from_icon_name_co_gsource_func, data, NULL); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_set_image_from_icon_name_real_co_gsource_func, data, NULL); data->_state_ = 10; return FALSE; _state_10: ; if (data->ret == NULL) { { - data->_tmp0_ = gtk_icon_theme_load_icon (data->self->priv->theme, data->icon_name, data->size, 0, &data->_inner_error_); - if (data->_inner_error_ != NULL) { - goto __catch33_g_error; + data->info = gtk_icon_theme_lookup_icon (data->self->priv->theme, data->icon_name, data->size, 0); + if (data->info != NULL) { + data->filename = g_strdup (gtk_icon_info_get_filename (data->info)); + data->_state_ = 11; + unity_pixbuf_cache_load_from_filepath (data->self, data->filename, data->size, data->image, data->key, unity_pixbuf_cache_set_image_from_icon_name_real_ready, data); + return FALSE; + _state_11: + data->ret = (data->_tmp0_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp0_); + _g_free0 (data->filename); } - data->ret = (data->_tmp1_ = _g_object_ref0 (data->_tmp0_), _g_object_unref0 (data->ret), data->_tmp1_); 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 __finally33; __catch33_g_error: @@ -390,7 +847,7 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_co (UnityPixbufCache data->e = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("unity-pixbuf-cache.vala:132: Unable to load icon_name: %s", data->e->message); + g_warning ("unity-pixbuf-cache.vala:212: Unable to load icon_name: %s", data->e->message); _g_error_free0 (data->e); } } @@ -424,20 +881,20 @@ static void unity_pixbuf_cache_set_image_from_gicon_string_data_free (gpointer _ UnityPixbufCacheSetImageFromGiconStringData* data; data = _data; _g_object_unref0 (data->image); - _g_free0 (data->gicon_as_string); + _g_free0 (data->data); g_object_unref (data->self); g_slice_free (UnityPixbufCacheSetImageFromGiconStringData, data); } -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_) { +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_) { UnityPixbufCacheSetImageFromGiconStringData* _data_; _data_ = g_slice_new0 (UnityPixbufCacheSetImageFromGiconStringData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_pixbuf_cache_set_image_from_gicon_string); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_pixbuf_cache_set_image_from_gicon_string_data_free); _data_->self = g_object_ref (self); _data_->image = _g_object_ref0 (image); - _data_->gicon_as_string = g_strdup (gicon_as_string); + _data_->data = g_strdup (data); _data_->size = size; unity_pixbuf_cache_set_image_from_gicon_string_co (_data_); } @@ -457,9 +914,94 @@ static void unity_pixbuf_cache_set_image_from_gicon_string_ready (GObject* sourc } -static gboolean _unity_pixbuf_cache_set_image_from_gicon_string_co_gsource_func (gpointer self) { +static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCacheSetImageFromGiconStringData* data) { + switch (data->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); + } + _state_0: + data->key = g_strdup_printf (UNITY_hash_template, data->data, data->size); + data->ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->cache, data->key); + if (GDK_IS_PIXBUF (data->ret)) { + ctk_image_set_from_pixbuf (data->image, data->ret); + _g_object_unref0 (data->ret); + _g_free0 (data->key); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } + } + data->task = unity_pixbuf_cache_task_new (); + data->task->image = data->image; + data->task->data = (data->_tmp0_ = g_strdup (data->data), _g_free0 (data->task->data), data->_tmp0_); + data->task->size = data->size; + data->task->type = UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING; + gee_abstract_collection_add ((GeeAbstractCollection*) data->self->priv->queue, data->task); + if (data->self->priv->queue_timeout == 0) { + data->self->priv->queue_timeout = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_load_iteration_gsource_func, g_object_ref (data->self), g_object_unref); + } + _unity_pixbuf_cache_task_unref0 (data->task); + _g_object_unref0 (data->ret); + _g_free0 (data->key); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } +} + + +static void unity_pixbuf_cache_set_image_from_gicon_string_real_data_free (gpointer _data) { + UnityPixbufCacheSetImageFromGiconStringRealData* data; + data = _data; + _g_object_unref0 (data->image); + _g_free0 (data->gicon_as_string); + g_object_unref (data->self); + g_slice_free (UnityPixbufCacheSetImageFromGiconStringRealData, data); +} + + +void unity_pixbuf_cache_set_image_from_gicon_string_real (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_) { + UnityPixbufCacheSetImageFromGiconStringRealData* _data_; + _data_ = g_slice_new0 (UnityPixbufCacheSetImageFromGiconStringRealData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_pixbuf_cache_set_image_from_gicon_string_real); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_pixbuf_cache_set_image_from_gicon_string_real_data_free); + _data_->self = g_object_ref (self); + _data_->image = _g_object_ref0 (image); + _data_->gicon_as_string = g_strdup (gicon_as_string); + _data_->size = size; + unity_pixbuf_cache_set_image_from_gicon_string_real_co (_data_); +} + + +void unity_pixbuf_cache_set_image_from_gicon_string_real_finish (UnityPixbufCache* self, GAsyncResult* _res_) { + UnityPixbufCacheSetImageFromGiconStringRealData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +} + + +static void unity_pixbuf_cache_set_image_from_gicon_string_real_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + UnityPixbufCacheSetImageFromGiconStringRealData* data; + data = _user_data_; + data->_res_ = _res_; + unity_pixbuf_cache_set_image_from_gicon_string_real_co (data); +} + + +static gboolean _unity_pixbuf_cache_set_image_from_gicon_string_real_co_gsource_func (gpointer self) { gboolean result; - result = unity_pixbuf_cache_set_image_from_gicon_string_co (self); + result = unity_pixbuf_cache_set_image_from_gicon_string_real_co (self); return result; } @@ -513,14 +1055,20 @@ static glong string_get_length (const char* self) { } -static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCacheSetImageFromGiconStringData* data) { +static gboolean unity_pixbuf_cache_set_image_from_gicon_string_real_co (UnityPixbufCacheSetImageFromGiconStringRealData* data) { switch (data->_state_) { case 0: goto _state_0; default: g_assert_not_reached (); - case 11: - goto _state_11; + case 12: + goto _state_12; + case 13: + goto _state_13; + case 14: + goto _state_14; + case 15: + goto _state_15; } _state_0: data->key = g_strdup_printf (UNITY_hash_template, data->gicon_as_string, data->size); @@ -539,19 +1087,19 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCa return FALSE; } } - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_set_image_from_gicon_string_co_gsource_func, data, NULL); - data->_state_ = 11; + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_set_image_from_gicon_string_real_co_gsource_func, data, NULL); + data->_state_ = 12; return FALSE; - _state_11: + _state_12: ; if (data->ret == NULL) { 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) { - goto __catch34_g_error; - } - data->ret = (data->_tmp1_ = data->_tmp0_, _g_object_unref0 (data->ret), data->_tmp1_); + data->_state_ = 13; + unity_pixbuf_cache_load_from_filepath (data->self, data->gicon_as_string, data->size, data->image, data->key, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_13: + data->ret = (data->_tmp0_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp0_); } goto __finally34; __catch34_g_error: @@ -559,8 +1107,8 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCa 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_message (data->_tmp1_ = g_strconcat ("Unable to load ", string_to_string (data->gicon_as_string), " as file: %s", NULL), data->err->message); + _g_free0 (data->_tmp1_); _g_error_free0 (data->err); } } @@ -581,38 +1129,42 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCa } 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) { - _gtk_icon_info_free0 (data->info); - goto __catch35_g_error; - } - data->ret = (data->_tmp4_ = data->_tmp3_, _g_object_unref0 (data->ret), data->_tmp4_); + data->filename = g_strdup (gtk_icon_info_get_filename (data->info)); + data->_state_ = 14; + unity_pixbuf_cache_load_from_filepath (data->self, data->filename, data->size, data->image, data->key, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_14: + data->ret = (data->_tmp2_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp2_); + _g_free0 (data->filename); } if (data->ret == NULL) { if (g_str_has_suffix (data->gicon_as_string, ".png")) { - data->_tmp7_ = TRUE; + data->_tmp5_ = TRUE; } else { - data->_tmp7_ = g_str_has_suffix (data->gicon_as_string, ".xpm"); + data->_tmp5_ = g_str_has_suffix (data->gicon_as_string, ".xpm"); } - if (data->_tmp7_) { - data->_tmp6_ = TRUE; + if (data->_tmp5_) { + data->_tmp4_ = TRUE; } else { - data->_tmp6_ = g_str_has_suffix (data->gicon_as_string, ".gir"); + data->_tmp4_ = g_str_has_suffix (data->gicon_as_string, ".gir"); } - if (data->_tmp6_) { - data->_tmp5_ = TRUE; + if (data->_tmp4_) { + data->_tmp3_ = TRUE; } else { - data->_tmp5_ = g_str_has_suffix (data->gicon_as_string, ".jpg"); + data->_tmp3_ = g_str_has_suffix (data->gicon_as_string, ".jpg"); } - if (data->_tmp5_) { + if (data->_tmp3_) { 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 __catch35_g_error; + data->info = (data->_tmp6_ = gtk_icon_theme_lookup_icon (data->self->priv->theme, data->real_name, data->size, 0), _gtk_icon_info_free0 (data->info), data->_tmp6_); + if (data->info != NULL) { + data->fname = g_strdup (gtk_icon_info_get_filename (data->info)); + data->_state_ = 15; + unity_pixbuf_cache_load_from_filepath (data->self, data->fname, data->size, data->image, data->key, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_15: + data->ret = (data->_tmp7_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp7_); + _g_free0 (data->fname); } - data->ret = (data->_tmp9_ = _g_object_ref0 (data->_tmp8_), _g_object_unref0 (data->ret), data->_tmp9_); _g_free0 (data->real_name); } } @@ -624,8 +1176,8 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_co (UnityPixbufCa 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_warning (data->_tmp8_ = g_strconcat ("Unable to load icon ", string_to_string (data->gicon_as_string), ": '%s'", NULL), data->e->message); + _g_free0 (data->_tmp8_); _g_error_free0 (data->e); } } @@ -702,15 +1254,173 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_co (UnityPixbufCacheSetI goto _state_0; default: g_assert_not_reached (); - case 12: - goto _state_12; } _state_0: - data->_state_ = 12; - unity_pixbuf_cache_set_image_from_gicon_string (data->self, data->image, g_icon_to_string (data->icon), data->size, unity_pixbuf_cache_set_image_from_gicon_ready, data); - return FALSE; - _state_12: - unity_pixbuf_cache_set_image_from_gicon_string_finish (data->self, data->_res_); + unity_pixbuf_cache_set_image_from_gicon_string (data->self, data->image, g_icon_to_string (data->icon), data->size, NULL, NULL); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } +} + + +static void unity_pixbuf_cache_load_from_filepath_data_free (gpointer _data) { + UnityPixbufCacheLoadFromFilepathData* data; + data = _data; + _g_free0 (data->filename); + _g_object_unref0 (data->image); + _g_free0 (data->key); + _g_object_unref0 (data->result); + g_object_unref (data->self); + g_slice_free (UnityPixbufCacheLoadFromFilepathData, data); +} + + +void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, CtkImage* image, const char* key, GAsyncReadyCallback _callback_, gpointer _user_data_) { + UnityPixbufCacheLoadFromFilepathData* _data_; + _data_ = g_slice_new0 (UnityPixbufCacheLoadFromFilepathData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_pixbuf_cache_load_from_filepath); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_pixbuf_cache_load_from_filepath_data_free); + _data_->self = g_object_ref (self); + _data_->filename = g_strdup (filename); + _data_->size = size; + _data_->image = _g_object_ref0 (image); + _data_->key = g_strdup (key); + unity_pixbuf_cache_load_from_filepath_co (_data_); +} + + +GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_) { + GdkPixbuf* result; + UnityPixbufCacheLoadFromFilepathData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); + result = _data_->result; + _data_->result = NULL; + return result; +} + + +static void unity_pixbuf_cache_load_from_filepath_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + UnityPixbufCacheLoadFromFilepathData* data; + data = _user_data_; + data->_res_ = _res_; + unity_pixbuf_cache_load_from_filepath_co (data); +} + + +static guchar* _vala_array_dup4 (guchar* self, int length) { + return g_memdup (self, length * sizeof (guchar)); +} + + +static gboolean unity_pixbuf_cache_load_from_filepath_co (UnityPixbufCacheLoadFromFilepathData* data) { + switch (data->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); + case 16: + goto _state_16; + case 17: + goto _state_17; + } + _state_0: + if (data->filename != NULL) { + data->datafile = g_file_new_for_path (data->filename); + { + data->_state_ = 16; + g_file_read_async (data->datafile, G_PRIORITY_DEFAULT, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); + return FALSE; + _state_16: + data->stream = g_file_read_finish (data->datafile, data->_res_, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + goto __catch36_g_error; + } + if (G_IS_FILE_INPUT_STREAM (data->stream)) { + data->buf = (data->_tmp0_ = g_new0 (guchar, 16), data->buf_length1 = 16, data->_buf_size_ = data->buf_length1, data->_tmp0_); + data->_state_ = 17; + unity_io_read_stream_async ((GInputStream*) data->stream, (data->_tmp1_ = data->buf, (data->_tmp1_ == NULL) ? ((gpointer) data->_tmp1_) : _vala_array_dup4 (data->_tmp1_, data->buf_length1)), data->buf_length1, (gsize) 16, G_PRIORITY_DEFAULT, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); + return FALSE; + _state_17: + unity_io_read_stream_finish (data->_res_, &data->data, &data->data_size, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + data->buf = (g_free (data->buf), NULL); + _g_object_unref0 (data->stream); + goto __catch36_g_error; + } + data->sdata = g_strndup ((const char*) data->data, data->data_size); + data->loader = gdk_pixbuf_loader_new (); + gdk_pixbuf_loader_write (data->loader, (guchar*) data->data, data->data_size, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->loader); + _g_free0 (data->sdata); + data->buf = (g_free (data->buf), NULL); + _g_object_unref0 (data->stream); + goto __catch36_g_error; + } + gdk_pixbuf_loader_close (data->loader, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->loader); + _g_free0 (data->sdata); + data->buf = (g_free (data->buf), NULL); + _g_object_unref0 (data->stream); + goto __catch36_g_error; + } + data->result = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (data->loader)); + _g_object_unref0 (data->loader); + _g_free0 (data->sdata); + data->buf = (g_free (data->buf), NULL); + _g_object_unref0 (data->stream); + _g_object_unref0 (data->datafile); + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } + _g_object_unref0 (data->loader); + _g_free0 (data->sdata); + data->buf = (g_free (data->buf), NULL); + } + _g_object_unref0 (data->stream); + } + goto __finally36; + __catch36_g_error: + { + data->ee = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_warning ("unity-pixbuf-cache.vala:362: Unable to load image file '%s': %s", data->filename, data->ee->message); + _g_error_free0 (data->ee); + } + } + __finally36: + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->datafile); + 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; + } + _g_object_unref0 (data->datafile); + } + data->result = NULL; + { + if (data->_state_ == 0) { + g_simple_async_result_complete_in_idle (data->_async_result); + } else { + g_simple_async_result_complete (data->_async_result); + } + g_object_unref (data->_async_result); + return FALSE; + } { if (data->_state_ == 0) { g_simple_async_result_complete_in_idle (data->_async_result); @@ -739,9 +1449,11 @@ static GObject * unity_pixbuf_cache_constructor (GType type, guint n_construct_p obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = UNITY_PIXBUF_CACHE (obj); { - GeeHashMap* _tmp0_; + GeePriorityQueue* _tmp0_; + GeeHashMap* _tmp1_; + self->priv->queue = (_tmp0_ = gee_priority_queue_new (UNITY_TYPE_PIXBUF_CACHE_TASK, (GBoxedCopyFunc) unity_pixbuf_cache_task_ref, unity_pixbuf_cache_task_unref, NULL), _g_object_unref0 (self->priv->queue), _tmp0_); self->priv->theme = gtk_icon_theme_get_default (); - self->priv->cache = (_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, GDK_TYPE_PIXBUF, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL), _g_object_unref0 (self->priv->cache), _tmp0_); + self->priv->cache = (_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, GDK_TYPE_PIXBUF, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL), _g_object_unref0 (self->priv->cache), _tmp1_); } return obj; } @@ -760,6 +1472,7 @@ static void unity_pixbuf_cache_class_init (UnityPixbufCacheClass * klass) { static void unity_pixbuf_cache_instance_init (UnityPixbufCache * self) { self->priv = UNITY_PIXBUF_CACHE_GET_PRIVATE (self); self->priv->autodispose = FALSE; + self->priv->queue_timeout = (guint) 0; } @@ -767,6 +1480,7 @@ static void unity_pixbuf_cache_finalize (GObject* obj) { UnityPixbufCache * self; self = UNITY_PIXBUF_CACHE (obj); _g_object_unref0 (self->priv->cache); + _g_object_unref0 (self->priv->queue); G_OBJECT_CLASS (unity_pixbuf_cache_parent_class)->finalize (obj); } diff --git a/unity/unity-pixbuf-cache.vala b/unity/unity-pixbuf-cache.vala index 26b082171..45159a956 100644 --- a/unity/unity-pixbuf-cache.vala +++ b/unity/unity-pixbuf-cache.vala @@ -23,6 +23,25 @@ using GLib; namespace Unity { + public class PixbufCacheTask + { + public string data; + public unowned Ctk.Image image; + public int size; + public string key; + public PixbufRequestType type; + + public PixbufCacheTask () + { + } + } + + public enum PixbufRequestType + { + ICON_NAME, + GICON_STRING + } + /* This is what we use for lookups, namely the id of the icon and it's size. * Currently this means we just use one HashMap for all the pixbufs, it * might be useful to have one HashMap per size in the future... @@ -43,6 +62,10 @@ namespace Unity public uint size { get { return cache.size; } } + private PriorityQueue<PixbufCacheTask> queue; + + private uint queue_timeout = 0; + /* * Construction */ @@ -60,6 +83,8 @@ namespace Unity construct { + queue = new PriorityQueue<PixbufCacheTask> (); + theme = Gtk.IconTheme.get_default (); cache = new HashMap<string, Gdk.Pixbuf> (); } @@ -102,6 +127,31 @@ namespace Unity cache.clear (); } + public bool load_iteration () + { + int i = 0; + + while (queue.size > 0 && i < 10) + { + var task = queue.poll (); + + if (task.image is Ctk.Image) + { + if (task.type == PixbufRequestType.ICON_NAME) + set_image_from_icon_name_real (task.image, task.data, task.size); + else if (task.type == PixbufRequestType.GICON_STRING) + set_image_from_gicon_string_real (task.image, task.data, task.size); + } + + i++; + } + + if (queue.size == 0) + queue_timeout = 0; + + return queue.size != 0; + } + public async void set_image_from_icon_name (Ctk.Image image, string icon_name, int size) @@ -115,13 +165,43 @@ namespace Unity return; } - Idle.add (set_image_from_icon_name.callback); - yield; + var task = new PixbufCacheTask (); + task.data = icon_name; + task.image = image; + task.size = size; + task.type = PixbufRequestType.ICON_NAME; + + queue.add (task); + + if (queue_timeout == 0) + queue_timeout = Idle.add (load_iteration); + } + + public async void set_image_from_icon_name_real (Ctk.Image image, + string icon_name, + int size) + { + var key = hash_template.printf (icon_name, size); + Pixbuf? ret = cache[key]; + + if (ret is Pixbuf) + { + image.set_from_pixbuf (ret); + return; + } + Idle.add (set_image_from_icon_name_real.callback); + yield; + if (ret == null) { try { - ret = theme.load_icon (icon_name, size, 0); + var info = theme.lookup_icon (icon_name, size, 0); + if (info != null) + { + var filename = info.get_filename (); + ret = yield load_from_filepath (filename, size, image, key); + } if (ret is Pixbuf) { @@ -140,6 +220,31 @@ namespace Unity } public async void set_image_from_gicon_string (Ctk.Image image, + string data, + int size) + { + var key = hash_template.printf (data, size); + Pixbuf? ret = cache[key]; + + if (ret is Pixbuf) + { + image.set_from_pixbuf (ret); + return; + } + + var task = new PixbufCacheTask (); + task.image = image; + task.data = data; + task.size = size; + task.type = PixbufRequestType.GICON_STRING; + + queue.add (task); + + if (queue_timeout == 0) + queue_timeout = Idle.add (load_iteration); + } + + public async void set_image_from_gicon_string_real (Ctk.Image image, string gicon_as_string, int size) { @@ -152,7 +257,7 @@ namespace Unity return; } - Idle.add (set_image_from_gicon.callback); + Idle.add (set_image_from_gicon_string_real.callback); yield; if (ret == null) @@ -160,7 +265,7 @@ namespace Unity if (gicon_as_string[0] == '/') { try { - ret = new Gdk.Pixbuf.from_file (gicon_as_string); + ret = yield load_from_filepath (gicon_as_string, size, image, key); } catch (Error err) { message (@"Unable to load $gicon_as_string as file: %s", err.message); @@ -173,7 +278,11 @@ namespace Unity 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 (); + { + var filename = info.get_filename (); + + ret = yield load_from_filepath (filename, size, image, key); + } if (ret == null) { @@ -188,7 +297,12 @@ namespace Unity || 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); + info = theme.lookup_icon (real_name, size, 0); + if (info != null) + { + var fname = info.get_filename (); + ret = yield load_from_filepath (fname, size, image, key); + } } } @@ -213,8 +327,89 @@ namespace Unity GLib.Icon icon, int size) { - yield set_image_from_gicon_string (image, icon.to_string (), size); + set_image_from_gicon_string (image, icon.to_string (), size); + } + + public async Gdk.Pixbuf? load_from_filepath (string filename, int size, Ctk.Image? image=null, string key) + { + + if (filename != null) + { + File datafile = File.new_for_path (filename); + try + { + var stream = yield datafile.read_async (Priority.DEFAULT, null); + + if (stream is FileInputStream) + { + uchar[] buf = new uchar[16]; + void *data; + size_t data_size; + yield IO.read_stream_async (stream, buf, 16, Priority.DEFAULT, + + null, out data, out data_size); + string sdata = ((string)data).ndup(data_size); + + var loader = new Gdk.PixbufLoader (); + loader.write ((uchar[])data, data_size); + loader.close (); + + return loader.get_pixbuf (); + } + } + catch (Error ee) + { + warning ("Unable to load image file '%s': %s", filename, ee.message); + } + } + + return null; + } + + /* + private async void load_from_file_async (Ctk.Image i, + string f, + int s, + string k) + { + unowned Ctk.Image image = i; + string filename = f; + int size = s; + string key = k; + + if (filename != null) + { + File datafile = File.new_for_path (filename); + try + { + var stream = yield datafile.read_async (Priority.DEFAULT, null); + + if (stream is FileInputStream) + { + uchar[] buf = new uchar[16]; + void *data; + size_t data_size; + yield IO.read_stream_async (stream, buf, 16, Priority.DEFAULT, + + null, out data, out data_size); + string sdata = ((string)data).ndup(data_size); + + var loader = new Gdk.PixbufLoader (); + loader.write ((uchar[])data, data_size); + loader.close (); + + image.set_from_pixbuf (loader.get_pixbuf ()); + + cache[key] = loader.get_pixbuf (); + } + } + catch (Error ee) + { + warning ("Unable to load image file '%s': %s", filename, ee.message); + } + } } + */ /* * Private Methods diff --git a/unity/unity-place-browser.c b/unity/unity-place-browser.c index bfbab62e2..50aa7334b 100644 --- a/unity/unity-place-browser.c +++ b/unity/unity-place-browser.c @@ -258,13 +258,13 @@ static void unity_place_browser_service_impl_set_dbus_path (UnityPlaceBrowserSer static void unity_place_browser_service_impl_set_browsing_state (UnityPlaceBrowserServiceImpl* self, UnityPlace_BrowsingState* value, int value_length1); static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_go_back (UnityPlaceBrowserService* base, int* result_length1, GError** error); UnityPlace_BrowsingState* unity_place_browser_service_impl_get_browsing_state (UnityPlaceBrowserServiceImpl* self, int* result_length1); -static UnityPlace_BrowsingState* _vala_array_dup8 (UnityPlace_BrowsingState* self, int length); -static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_go_forward (UnityPlaceBrowserService* base, int* result_length1, GError** error); static UnityPlace_BrowsingState* _vala_array_dup9 (UnityPlace_BrowsingState* self, int length); -static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_get_state (UnityPlaceBrowserService* base, int* result_length1, GError** error); +static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_go_forward (UnityPlaceBrowserService* base, int* result_length1, GError** error); static UnityPlace_BrowsingState* _vala_array_dup10 (UnityPlace_BrowsingState* self, int length); -const char* unity_place_browser_service_impl_get_dbus_path (UnityPlaceBrowserServiceImpl* self); +static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_get_state (UnityPlaceBrowserService* base, int* result_length1, GError** error); static UnityPlace_BrowsingState* _vala_array_dup11 (UnityPlace_BrowsingState* self, int length); +const char* unity_place_browser_service_impl_get_dbus_path (UnityPlaceBrowserServiceImpl* self); +static UnityPlace_BrowsingState* _vala_array_dup12 (UnityPlace_BrowsingState* self, int length); void unity_place_browser_service_impl_dbus_register_object (DBusConnection* connection, const char* path, void* object); void _unity_place_browser_service_impl_dbus_unregister (DBusConnection* connection, void* _user_data_); DBusHandlerResult unity_place_browser_service_impl_dbus_message (DBusConnection* connection, DBusMessage* message, void* object); @@ -1535,7 +1535,7 @@ UnityPlaceBrowserServiceImpl* unity_place_browser_service_impl_new (const char* } -static UnityPlace_BrowsingState* _vala_array_dup8 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup9 (UnityPlace_BrowsingState* self, int length) { UnityPlace_BrowsingState* result; int i; UnityPlace_BrowsingState _tmp0_ = {0}; @@ -1555,12 +1555,12 @@ static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_go_back ( UnityPlace_BrowsingState* _tmp2_; self = (UnityPlaceBrowserServiceImpl*) base; g_signal_emit_by_name (self, "back"); - result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup8 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); + result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup9 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); return result; } -static UnityPlace_BrowsingState* _vala_array_dup9 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup10 (UnityPlace_BrowsingState* self, int length) { UnityPlace_BrowsingState* result; int i; UnityPlace_BrowsingState _tmp0_ = {0}; @@ -1580,12 +1580,12 @@ static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_go_forwar UnityPlace_BrowsingState* _tmp2_; self = (UnityPlaceBrowserServiceImpl*) base; g_signal_emit_by_name (self, "forward"); - result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup9 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); + result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup10 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); return result; } -static UnityPlace_BrowsingState* _vala_array_dup10 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup11 (UnityPlace_BrowsingState* self, int length) { UnityPlace_BrowsingState* result; int i; UnityPlace_BrowsingState _tmp0_ = {0}; @@ -1604,7 +1604,7 @@ static UnityPlace_BrowsingState* unity_place_browser_service_impl_real_get_state UnityPlace_BrowsingState* _tmp1_; UnityPlace_BrowsingState* _tmp2_; self = (UnityPlaceBrowserServiceImpl*) base; - result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup10 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); + result = (_tmp2_ = (_tmp1_ = unity_place_browser_service_impl_get_browsing_state (self, &_tmp0_), (_tmp1_ == NULL) ? ((gpointer) _tmp1_) : _vala_array_dup11 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); return result; } @@ -1634,7 +1634,7 @@ UnityPlace_BrowsingState* unity_place_browser_service_impl_get_browsing_state (U } -static UnityPlace_BrowsingState* _vala_array_dup11 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup12 (UnityPlace_BrowsingState* self, int length) { UnityPlace_BrowsingState* result; int i; UnityPlace_BrowsingState _tmp0_ = {0}; @@ -1650,7 +1650,7 @@ static void unity_place_browser_service_impl_set_browsing_state (UnityPlaceBrows UnityPlace_BrowsingState* _tmp0_; UnityPlace_BrowsingState* _tmp1_; g_return_if_fail (self != NULL); - self->priv->_browsing_state = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup11 (_tmp0_, value_length1)), self->priv->_browsing_state = (_vala_UnityPlace_BrowsingState_array_free (self->priv->_browsing_state, self->priv->_browsing_state_length1), NULL), self->priv->_browsing_state_length1 = value_length1, self->priv->__browsing_state_size_ = self->priv->_browsing_state_length1, _tmp1_); + self->priv->_browsing_state = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup12 (_tmp0_, value_length1)), self->priv->_browsing_state = (_vala_UnityPlace_BrowsingState_array_free (self->priv->_browsing_state, self->priv->_browsing_state_length1), NULL), self->priv->_browsing_state_length1 = value_length1, self->priv->__browsing_state_size_ = self->priv->_browsing_state_length1, _tmp1_); } diff --git a/unity/unity-place.c b/unity/unity-place.c index 29017ed8e..7b4dd35f6 100644 --- a/unity/unity-place.c +++ b/unity/unity-place.c @@ -460,13 +460,13 @@ UnityPlace_EntryInfo* unity_place__entryinfo_dup (const UnityPlace_EntryInfo* se void unity_place__entryinfo_free (UnityPlace_EntryInfo* self); void unity_place__entryinfo_copy (const UnityPlace_EntryInfo* self, UnityPlace_EntryInfo* dest); void unity_place__entryinfo_destroy (UnityPlace_EntryInfo* self); -static char** _vala_array_dup4 (char** self, int length); +static char** _vala_array_dup5 (char** self, int length); GType unity_place__entryinfodata_get_type (void) G_GNUC_CONST; UnityPlace_EntryInfoData* unity_place__entryinfodata_dup (const UnityPlace_EntryInfoData* self); void unity_place__entryinfodata_free (UnityPlace_EntryInfoData* self); void unity_place__entryinfodata_copy (const UnityPlace_EntryInfoData* self, UnityPlace_EntryInfoData* dest); void unity_place__entryinfodata_destroy (UnityPlace_EntryInfoData* self); -static char** _vala_array_dup5 (char** self, int length); +static char** _vala_array_dup6 (char** self, int length); GType unity_place_entry_info_get_type (void) G_GNUC_CONST; GType unity_place_browser_get_type (void) G_GNUC_CONST; #define UNITY_PLACE_ENTRY_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACE_TYPE_ENTRY_INFO, UnityPlaceEntryInfoPrivate)) @@ -507,7 +507,7 @@ guint unity_place_entry_info_get_position (UnityPlaceEntryInfo* self); void unity_place_entry_info_set_position (UnityPlaceEntryInfo* self, guint value); char** unity_place_entry_info_get_mimetypes (UnityPlaceEntryInfo* self, int* result_length1); void unity_place_entry_info_set_mimetypes (UnityPlaceEntryInfo* self, char** value, int value_length1); -static char** _vala_array_dup6 (char** self, int length); +static char** _vala_array_dup7 (char** self, int length); gboolean unity_place_entry_info_get_sensitive (UnityPlaceEntryInfo* self); void unity_place_entry_info_set_sensitive (UnityPlaceEntryInfo* self, gboolean value); DeeModel* unity_place_entry_info_get_sections_model (UnityPlaceEntryInfo* self); @@ -655,7 +655,7 @@ UnityPlaceBrowserService* unity_place_browser_get_service (UnityPlaceBrowser* se void unity_place_entry_service_impl_queue_place_entry_info_changed_signal (UnityPlaceEntryServiceImpl* self); static gboolean unity_place_entry_service_impl_emit_place_entry_info_changed_signal (UnityPlaceEntryServiceImpl* self); static gboolean _unity_place_entry_service_impl_emit_place_entry_info_changed_signal_gsource_func (gpointer self); -static char** _vala_array_dup7 (char** self, int length); +static char** _vala_array_dup8 (char** self, int length); static void unity_place_entry_service_impl_set_entry_info (UnityPlaceEntryServiceImpl* self, UnityPlaceEntryInfo* value); gboolean unity_place_entry_service_impl_get_exported (UnityPlaceEntryServiceImpl* self); void unity_place_entry_service_impl_dbus_register_object (DBusConnection* connection, const char* path, void* object); @@ -1134,7 +1134,7 @@ GType unity_place_search_get_type (void) { } -static char** _vala_array_dup4 (char** self, int length) { +static char** _vala_array_dup5 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -1153,7 +1153,7 @@ void unity_place__entryinfo_copy (const UnityPlace_EntryInfo* self, UnityPlace_E dest->display_name = g_strdup (self->display_name); dest->icon = g_strdup (self->icon); dest->position = self->position; - dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup4 (_tmp0_, (*self).mimetypes_length1)); + dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup5 (_tmp0_, (*self).mimetypes_length1)); dest->mimetypes_length1 = self->mimetypes_length1; dest->sensitive = self->sensitive; dest->sections_model = g_strdup (self->sections_model); @@ -1200,7 +1200,7 @@ GType unity_place__entryinfo_get_type (void) { } -static char** _vala_array_dup5 (char** self, int length) { +static char** _vala_array_dup6 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -1217,7 +1217,7 @@ void unity_place__entryinfodata_copy (const UnityPlace_EntryInfoData* self, Unit dest->display_name = g_strdup (self->display_name); dest->icon = g_strdup (self->icon); dest->position = self->position; - dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup5 (_tmp0_, (*self).mimetypes_length1)); + dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup6 (_tmp0_, (*self).mimetypes_length1)); dest->mimetypes_length1 = self->mimetypes_length1; dest->sensitive = self->sensitive; dest->sections_model = g_strdup (self->sections_model); @@ -1413,7 +1413,7 @@ char** unity_place_entry_info_get_mimetypes (UnityPlaceEntryInfo* self, int* res } -static char** _vala_array_dup6 (char** self, int length) { +static char** _vala_array_dup7 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -1428,7 +1428,7 @@ void unity_place_entry_info_set_mimetypes (UnityPlaceEntryInfo* self, char** val char** _tmp0_; char** _tmp1_; g_return_if_fail (self != NULL); - self->priv->info.mimetypes = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup6 (_tmp0_, value_length1)), self->priv->info.mimetypes = (_vala_array_free (self->priv->info.mimetypes, self->priv->info.mimetypes_length1, (GDestroyNotify) g_free), NULL), self->priv->info.mimetypes_length1 = value_length1, self->priv->info._mimetypes_size_ = self->priv->info.mimetypes_length1, _tmp1_); + self->priv->info.mimetypes = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup7 (_tmp0_, value_length1)), self->priv->info.mimetypes = (_vala_array_free (self->priv->info.mimetypes, self->priv->info.mimetypes_length1, (GDestroyNotify) g_free), NULL), self->priv->info.mimetypes_length1 = value_length1, self->priv->info._mimetypes_size_ = self->priv->info.mimetypes_length1, _tmp1_); g_object_notify ((GObject *) self, "mimetypes"); } @@ -4588,7 +4588,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 __catch36_dbus_gerror; + goto __catch37_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); @@ -4596,8 +4596,8 @@ void unity_place_service_impl_add_entry (UnityPlaceServiceImpl* self, UnityPlace return; } } - goto __finally36; - __catch36_dbus_gerror: + goto __finally37; + __catch37_dbus_gerror: { GError * e; e = _inner_error_; @@ -4607,7 +4607,7 @@ void unity_place_service_impl_add_entry (UnityPlaceServiceImpl* self, UnityPlace _g_error_free0 (e); } } - __finally36: + __finally37: 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); @@ -4715,7 +4715,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 __catch37_dbus_gerror; + goto __catch38_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); @@ -4723,8 +4723,8 @@ void unity_place_service_impl_remove_entry (UnityPlaceServiceImpl* self, const c return; } } - goto __finally37; - __catch37_dbus_gerror: + goto __finally38; + __catch38_dbus_gerror: { GError * e; e = _inner_error_; @@ -4734,7 +4734,7 @@ void unity_place_service_impl_remove_entry (UnityPlaceServiceImpl* self, const c _g_error_free0 (e); } } - __finally37: + __finally38: 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); @@ -4888,8 +4888,8 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl goto _state_0; default: g_assert_not_reached (); - case 13: - goto _state_13; + case 18: + goto _state_18; } _state_0: if (data->self->priv->_activation == NULL) { @@ -4905,14 +4905,14 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl } } { - data->_state_ = 13; + data->_state_ = 18; unity_place_activation_activate (data->self->priv->_activation, data->uri, unity_place_service_impl_activate_ready, data); return FALSE; - _state_13: + _state_18: data->activated = unity_place_activation_activate_finish (data->self->priv->_activation, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { if (data->_inner_error_->domain == DBUS_GERROR) { - goto __catch38_dbus_gerror; + goto __catch39_dbus_gerror; } g_critical ("file %s: line %d: unexpected 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_); @@ -4929,8 +4929,8 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl return FALSE; } } - goto __finally38; - __catch38_dbus_gerror: + goto __finally39; + __catch39_dbus_gerror: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -4949,7 +4949,7 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl _g_error_free0 (data->e); } } - __finally38: + __finally39: { 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_); @@ -5322,7 +5322,7 @@ static void unity_place_entry_service_impl_on_browser_changed (UnityPlaceEntrySe _tmp0_ = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch39_dbus_gerror; + goto __catch40_dbus_gerror; } _dbus_g_connection_unref0 (conn); 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); @@ -5331,8 +5331,8 @@ static void unity_place_entry_service_impl_on_browser_changed (UnityPlaceEntrySe } conn = (_tmp1_ = _tmp0_, _dbus_g_connection_unref0 (conn), _tmp1_); } - goto __finally39; - __catch39_dbus_gerror: + goto __finally40; + __catch40_dbus_gerror: { GError * e; e = _inner_error_; @@ -5344,7 +5344,7 @@ static void unity_place_entry_service_impl_on_browser_changed (UnityPlaceEntrySe return; } } - __finally39: + __finally40: if (_inner_error_ != NULL) { _dbus_g_connection_unref0 (conn); 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); @@ -5397,7 +5397,7 @@ void unity_place_entry_service_impl_queue_place_entry_info_changed_signal (Unity } -static char** _vala_array_dup7 (char** self, int length) { +static char** _vala_array_dup8 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -5427,7 +5427,7 @@ static gboolean unity_place_entry_service_impl_emit_place_entry_info_changed_sig entry_data.display_name = (_tmp2_ = g_strdup (_entry.display_name), _g_free0 (entry_data.display_name), _tmp2_); entry_data.icon = (_tmp3_ = g_strdup (_entry.icon), _g_free0 (entry_data.icon), _tmp3_); entry_data.position = _entry.position; - entry_data.mimetypes = (_tmp5_ = (_tmp4_ = _entry.mimetypes, (_tmp4_ == NULL) ? ((gpointer) _tmp4_) : _vala_array_dup7 (_tmp4_, _entry.mimetypes_length1)), entry_data.mimetypes = (_vala_array_free (entry_data.mimetypes, entry_data.mimetypes_length1, (GDestroyNotify) g_free), NULL), entry_data.mimetypes_length1 = _entry.mimetypes_length1, entry_data._mimetypes_size_ = entry_data.mimetypes_length1, _tmp5_); + entry_data.mimetypes = (_tmp5_ = (_tmp4_ = _entry.mimetypes, (_tmp4_ == NULL) ? ((gpointer) _tmp4_) : _vala_array_dup8 (_tmp4_, _entry.mimetypes_length1)), entry_data.mimetypes = (_vala_array_free (entry_data.mimetypes, entry_data.mimetypes_length1, (GDestroyNotify) g_free), NULL), entry_data.mimetypes_length1 = _entry.mimetypes_length1, entry_data._mimetypes_size_ = entry_data.mimetypes_length1, _tmp5_); entry_data.sensitive = _entry.sensitive; entry_data.sections_model = (_tmp6_ = g_strdup (_entry.sections_model), _g_free0 (entry_data.sections_model), _tmp6_); entry_data.hints = (_tmp7_ = _g_hash_table_ref0 (_entry.hints), _g_hash_table_unref0 (entry_data.hints), _tmp7_); diff --git a/unity/unity.h b/unity/unity.h index fe0dc10b1..5f81a071e 100644 --- a/unity/unity.h +++ b/unity/unity.h @@ -246,6 +246,19 @@ typedef struct _UnityLayeredBin UnityLayeredBin; typedef struct _UnityLayeredBinClass UnityLayeredBinClass; typedef struct _UnityLayeredBinPrivate UnityLayeredBinPrivate; +#define UNITY_TYPE_PIXBUF_CACHE_TASK (unity_pixbuf_cache_task_get_type ()) +#define UNITY_PIXBUF_CACHE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTask)) +#define UNITY_PIXBUF_CACHE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTaskClass)) +#define UNITY_IS_PIXBUF_CACHE_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK)) +#define UNITY_IS_PIXBUF_CACHE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PIXBUF_CACHE_TASK)) +#define UNITY_PIXBUF_CACHE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PIXBUF_CACHE_TASK, UnityPixbufCacheTaskClass)) + +typedef struct _UnityPixbufCacheTask UnityPixbufCacheTask; +typedef struct _UnityPixbufCacheTaskClass UnityPixbufCacheTaskClass; +typedef struct _UnityPixbufCacheTaskPrivate UnityPixbufCacheTaskPrivate; + +#define UNITY_TYPE_PIXBUF_REQUEST_TYPE (unity_pixbuf_request_type_get_type ()) + #define UNITY_TYPE_PIXBUF_CACHE (unity_pixbuf_cache_get_type ()) #define UNITY_PIXBUF_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PIXBUF_CACHE, UnityPixbufCache)) #define UNITY_PIXBUF_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PIXBUF_CACHE, UnityPixbufCacheClass)) @@ -621,6 +634,27 @@ struct _UnityLayeredBinClass { CtkActorClass parent_class; }; +typedef enum { + UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME, + UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING +} UnityPixbufRequestType; + +struct _UnityPixbufCacheTask { + GTypeInstance parent_instance; + volatile int ref_count; + UnityPixbufCacheTaskPrivate * priv; + char* data; + CtkImage* image; + gint size; + char* key; + UnityPixbufRequestType type; +}; + +struct _UnityPixbufCacheTaskClass { + GTypeClass parent_class; + void (*finalize) (UnityPixbufCacheTask *self); +}; + struct _UnityPixbufCache { GObject parent_instance; UnityPixbufCachePrivate * priv; @@ -907,6 +941,16 @@ GType unity_layered_bin_get_type (void) G_GNUC_CONST; UnityLayeredBin* unity_layered_bin_new (void); UnityLayeredBin* unity_layered_bin_construct (GType object_type); GList* unity_layered_bin_get_children (UnityLayeredBin* self); +gpointer unity_pixbuf_cache_task_ref (gpointer instance); +void unity_pixbuf_cache_task_unref (gpointer instance); +GParamSpec* unity_param_spec_pixbuf_cache_task (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void unity_value_set_pixbuf_cache_task (GValue* value, gpointer v_object); +void unity_value_take_pixbuf_cache_task (GValue* value, gpointer v_object); +gpointer unity_value_get_pixbuf_cache_task (const GValue* value); +GType unity_pixbuf_cache_task_get_type (void) G_GNUC_CONST; +GType unity_pixbuf_request_type_get_type (void) G_GNUC_CONST; +UnityPixbufCacheTask* unity_pixbuf_cache_task_new (void); +UnityPixbufCacheTask* unity_pixbuf_cache_task_construct (GType object_type); GType unity_pixbuf_cache_get_type (void) G_GNUC_CONST; UnityPixbufCache* unity_pixbuf_cache_new (gboolean _autodispose); UnityPixbufCache* unity_pixbuf_cache_construct (GType object_type, gboolean _autodispose); @@ -914,12 +958,19 @@ UnityPixbufCache* unity_pixbuf_cache_get_default (void); void unity_pixbuf_cache_set (UnityPixbufCache* self, const char* icon_id, GdkPixbuf* pixbuf, gint size); GdkPixbuf* unity_pixbuf_cache_get (UnityPixbufCache* self, const char* icon_id, gint size); void unity_pixbuf_cache_clear (UnityPixbufCache* self); +gboolean unity_pixbuf_cache_load_iteration (UnityPixbufCache* self); void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_icon_name_finish (UnityPixbufCache* self, GAsyncResult* _res_); -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_icon_name_real (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_icon_name_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_gicon_string_finish (UnityPixbufCache* self, GAsyncResult* _res_); +void unity_pixbuf_cache_set_image_from_gicon_string_real (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); +void unity_pixbuf_cache_set_image_from_gicon_string_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); void unity_pixbuf_cache_set_image_from_gicon (UnityPixbufCache* self, CtkImage* image, GIcon* icon, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_pixbuf_cache_set_image_from_gicon_finish (UnityPixbufCache* self, GAsyncResult* _res_); +void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, CtkImage* image, const char* key, GAsyncReadyCallback _callback_, gpointer _user_data_); +GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_); guint unity_pixbuf_cache_get_size (UnityPixbufCache* self); GType unity_place_renderer_info_get_type (void) G_GNUC_CONST; void unity_place_renderer_info_set_hint (UnityPlaceRendererInfo* self, const char* hint, const char* val); diff --git a/unity/unity.vapi b/unity/unity.vapi index 2960487eb..a46b9660a 100644 --- a/unity/unity.vapi +++ b/unity/unity.vapi @@ -305,12 +305,25 @@ namespace Unity { public void clear (); public Gdk.Pixbuf? @get (string icon_id, int size); public static Unity.PixbufCache get_default (); + public async Gdk.Pixbuf? load_from_filepath (string filename, int size, Ctk.Image? image = null, string key); + public bool load_iteration (); public void @set (string icon_id, Gdk.Pixbuf pixbuf, int size); public async void set_image_from_gicon (Ctk.Image image, GLib.Icon icon, int size); - public async void set_image_from_gicon_string (Ctk.Image image, string gicon_as_string, int size); + public async void set_image_from_gicon_string (Ctk.Image image, string data, int size); + public async void set_image_from_gicon_string_real (Ctk.Image image, string gicon_as_string, int size); public async void set_image_from_icon_name (Ctk.Image image, string icon_name, int size); + public async void set_image_from_icon_name_real (Ctk.Image image, string icon_name, int size); public uint size { get; } } + [CCode (ref_function = "unity_pixbuf_cache_task_ref", unref_function = "unity_pixbuf_cache_task_unref", cheader_filename = "unity.h")] + public class PixbufCacheTask { + public string data; + public weak Ctk.Image image; + public string key; + public int size; + public Unity.PixbufRequestType type; + public PixbufCacheTask (); + } [CCode (cheader_filename = "unity.h")] public class StripeTexture : Unity.CairoCanvas { [CCode (cheader_filename = "unity.h")] @@ -389,6 +402,11 @@ namespace Unity { UNEXPANDED, EXPANDED } + [CCode (cprefix = "UNITY_PIXBUF_REQUEST_TYPE_", cheader_filename = "unity.h")] + public enum PixbufRequestType { + ICON_NAME, + GICON_STRING + } [CCode (cprefix = "UNITY_SHELL_MODE_", cheader_filename = "unity.h")] public enum ShellMode { MINIMIZED, diff --git a/unity/webapp-fetcher.c b/unity/webapp-fetcher.c index 06f6b297d..94bcfcb04 100644 --- a/unity/webapp-fetcher.c +++ b/unity/webapp-fetcher.c @@ -284,7 +284,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 __catch40_g_regex_error; + goto __catch41_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); @@ -295,7 +295,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch40_g_regex_error; + goto __catch41_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -306,8 +306,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp1_ = _tmp0_, _g_free0 (return_string), _tmp1_); _g_regex_unref0 (regex); } - goto __finally40; - __catch40_g_regex_error: + goto __finally41; + __catch41_g_regex_error: { GError * e; e = _inner_error_; @@ -317,7 +317,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally40: + __finally41: 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); @@ -331,7 +331,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 __catch41_g_regex_error; + goto __catch42_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); @@ -342,7 +342,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch41_g_regex_error; + goto __catch42_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -353,8 +353,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp3_ = _tmp2_, _g_free0 (return_string), _tmp3_); _g_regex_unref0 (regex); } - goto __finally41; - __catch41_g_regex_error: + goto __finally42; + __catch42_g_regex_error: { GError * e; e = _inner_error_; @@ -364,7 +364,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally41: + __finally42: 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); @@ -378,7 +378,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 __catch42_g_regex_error; + goto __catch43_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); @@ -389,7 +389,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch42_g_regex_error; + goto __catch43_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -400,8 +400,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp5_ = _tmp4_, _g_free0 (return_string), _tmp5_); _g_regex_unref0 (regex); } - goto __finally42; - __catch42_g_regex_error: + goto __finally43; + __catch43_g_regex_error: { GError * e; e = _inner_error_; @@ -411,7 +411,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally42: + __finally43: 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); @@ -425,7 +425,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 __catch43_g_regex_error; + goto __catch44_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); @@ -436,7 +436,7 @@ char* unity_webapp_urlify (const char* uri) { if (_inner_error_ != NULL) { _g_regex_unref0 (regex); if (_inner_error_->domain == G_REGEX_ERROR) { - goto __catch43_g_regex_error; + goto __catch44_g_regex_error; } _g_regex_unref0 (regex); _g_free0 (return_string); @@ -447,8 +447,8 @@ char* unity_webapp_urlify (const char* uri) { return_string = (_tmp7_ = _tmp6_, _g_free0 (return_string), _tmp7_); _g_regex_unref0 (regex); } - goto __finally43; - __catch43_g_regex_error: + goto __finally44; + __catch44_g_regex_error: { GError * e; e = _inner_error_; @@ -458,7 +458,7 @@ char* unity_webapp_urlify (const char* uri) { _g_error_free0 (e); } } - __finally43: + __finally44: 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); @@ -526,14 +526,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 __catch44_g_error; + goto __catch45_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 __finally44; - __catch44_g_error: + goto __finally45; + __catch45_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -542,7 +542,7 @@ static gboolean unity_webapp_fetch_file_fetch_data_co (UnityWebappFetchFileFetch _g_error_free0 (data->e); } } - __finally44: + __finally45: 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_); @@ -599,8 +599,8 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc goto _state_0; default: g_assert_not_reached (); - case 14: - goto _state_14; + case 19: + goto _state_19; } _state_0: data->size = (gssize) 1024; @@ -616,13 +616,13 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc } data->_tmp1_ = FALSE; { - data->_state_ = 14; + data->_state_ = 19; g_input_stream_read_async ((GInputStream*) data->self->priv->stream, data->buffer, (gsize) data->size, G_PRIORITY_DEFAULT, NULL, unity_webapp_fetch_file_read_something_async_ready, data); return FALSE; - _state_14: + _state_19: data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { - goto __catch45_g_error; + goto __catch46_g_error; } data->bufsize = data->_tmp2_; if (data->bufsize < 1) { @@ -637,8 +637,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 __finally45; - __catch45_g_error: + goto __finally46; + __catch46_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -647,7 +647,7 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc _g_error_free0 (data->e); } } - __finally45: + __finally46: 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); @@ -788,12 +788,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 __catch46_g_error; + goto __catch47_g_error; } unity_webapp_hostname_match = (_tmp1_ = _tmp0_, _g_regex_unref0 (unity_webapp_hostname_match), _tmp1_); } - goto __finally46; - __catch46_g_error: + goto __finally47; + __catch47_g_error: { GError * e; e = _inner_error_; @@ -803,7 +803,7 @@ char* unity_webapp_get_hostname (const char* uri) { _g_error_free0 (e); } } - __finally46: + __finally47: 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_); @@ -852,7 +852,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 __catch47_g_error; + goto __catch48_g_error; } desktop_file = g_key_file_new (); g_key_file_load_from_file (desktop_file, self->priv->_desktop_location, 0, &_inner_error_); @@ -860,7 +860,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_key_file_free0 (desktop_file); _g_object_unref0 (file_stream); _g_object_unref0 (file); - goto __catch47_g_error; + goto __catch48_g_error; } g_key_file_set_string (desktop_file, "Desktop Entry", "Icon", iconname); desktop_data = g_key_file_to_data (desktop_file, NULL, NULL); @@ -872,7 +872,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_key_file_free0 (desktop_file); _g_object_unref0 (file_stream); _g_object_unref0 (file); - goto __catch47_g_error; + goto __catch48_g_error; } g_output_stream_close ((GOutputStream*) data_stream, NULL, &_inner_error_); if (_inner_error_ != NULL) { @@ -881,7 +881,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_key_file_free0 (desktop_file); _g_object_unref0 (file_stream); _g_object_unref0 (file); - goto __catch47_g_error; + goto __catch48_g_error; } _g_object_unref0 (data_stream); _g_free0 (desktop_data); @@ -889,8 +889,8 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_object_unref0 (file_stream); _g_object_unref0 (file); } - goto __finally47; - __catch47_g_error: + goto __finally48; + __catch48_g_error: { GError * e; e = _inner_error_; @@ -900,7 +900,7 @@ static void unity_webapp_webicon_fetcher_set_desktop_file_icon (UnityWebappWebic _g_error_free0 (e); } } - __finally47: + __finally48: 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_); @@ -1034,25 +1034,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 __catch48_g_error; + goto __catch49_g_error; } gdk_pixbuf_loader_close (loader, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (loader); - goto __catch48_g_error; + goto __catch49_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 (icon); _g_object_unref0 (loader); - goto __catch48_g_error; + goto __catch49_g_error; } _g_object_unref0 (icon); _g_object_unref0 (loader); } - goto __finally48; - __catch48_g_error: + goto __finally49; + __catch49_g_error: { GError * e; e = _inner_error_; @@ -1063,7 +1063,7 @@ static void unity_webapp_webicon_fetcher_on_fetcher_completed (UnityWebappWebico return; } } - __finally48: + __finally49: 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_); @@ -1279,32 +1279,32 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c GRegex* _tmp9_; _tmp0_ = g_regex_new (primary_match_prefix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch49_g_error; + goto __catch50_g_error; } unity_webapp_primary_match_prefix = (_tmp1_ = _tmp0_, _g_regex_unref0 (unity_webapp_primary_match_prefix), _tmp1_); _tmp2_ = g_regex_new (primary_match_suffix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch49_g_error; + goto __catch50_g_error; } unity_webapp_primary_match_suffix = (_tmp3_ = _tmp2_, _g_regex_unref0 (unity_webapp_primary_match_suffix), _tmp3_); _tmp4_ = g_regex_new (secondary_match_prefix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch49_g_error; + goto __catch50_g_error; } unity_webapp_secondary_match_prefix = (_tmp5_ = _tmp4_, _g_regex_unref0 (unity_webapp_secondary_match_prefix), _tmp5_); _tmp6_ = g_regex_new (secondary_match_suffix, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch49_g_error; + goto __catch50_g_error; } unity_webapp_secondary_match_suffix = (_tmp7_ = _tmp6_, _g_regex_unref0 (unity_webapp_secondary_match_suffix), _tmp7_); _tmp8_ = g_regex_new (hostname_string, G_REGEX_UNGREEDY, 0, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch49_g_error; + goto __catch50_g_error; } unity_webapp_hostname_match = (_tmp9_ = _tmp8_, _g_regex_unref0 (unity_webapp_hostname_match), _tmp9_); } - goto __finally49; - __catch49_g_error: + goto __finally50; + __catch50_g_error: { GError * e; e = _inner_error_; @@ -1314,7 +1314,7 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_error_free0 (e); } } - __finally49: + __finally50: if (_inner_error_ != NULL) { _g_free0 (secondary_match_suffix); _g_free0 (secondary_match_prefix); @@ -1337,12 +1337,12 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_object_unref0 (_tmp11_); if (_inner_error_ != NULL) { _g_object_unref0 (make_file); - goto __catch50_g_error; + goto __catch51_g_error; } _g_object_unref0 (make_file); } - goto __finally50; - __catch50_g_error: + goto __finally51; + __catch51_g_error: { GError * e; e = _inner_error_; @@ -1351,7 +1351,7 @@ static GObject * unity_webapp_webicon_fetcher_constructor (GType type, guint n_c _g_error_free0 (e); } } - __finally50: + __finally51: 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_); |
