diff options
| author | Didier Roche <didier.roche@canonical.com> | 2010-09-22 20:47:30 +0200 |
|---|---|---|
| committer | Didier Roche <didier.roche@canonical.com> | 2010-09-22 20:47:30 +0200 |
| commit | 71763f0213e55d107d58430e8d9a350f5260b88d (patch) | |
| tree | 0ed59c81a4676291deef9a702a8356094e0f1c1a | |
| parent | 9d4a1a1212b2e6f98b1ca76946fa2da691c26c6b (diff) | |
| parent | f3c07bcd39e902ee2f9b72904f391f65a30e36ce (diff) | |
Import upstream version 0.2.42upstream-0.2.42
(bzr r55.4.28)
94 files changed, 3379 insertions, 1183 deletions
@@ -1,5 +1,452 @@ # Generated by Makefile. Do not edit. +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [release] 0.2.42 + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Merge Neil's branch lp:~unity-team/unity/places-fixes-2010-09-22: + + * Bug #607821: Search Field does not behave as specified when the search fails + * Bug #607829: Clicking a Place icon while viewing the same place in the Dash should return to the Home screen of that place and clear the search + * Bug #612562: URI activation in global view + * Bug #637136: launchers should act like if the application was not focussed in the place views + * Bug #638402: clicking on a category from CoFs does not directly take you to the desired category + * Bug #638857: dash initial icons states + * Bug #641554: cropping an image in shotwell crashes unity + * Bug #641669: Launcher loads 48 px icons instead of 32 px + * Bug #642669: mutter crashes when closing pop-up dialog + * Bug #644215: "Applications" and "Files & Folders" tooltips are not translatable + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + Load icons at 32px for the launcher, thanks to Severin Heiniger for pointing this out + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] trunk + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + We were validating the wrong mutter window! this obviously can lead to crashes galore during MT stuff + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + Load locale strings + +2010-09-20 Neil Jagdish Patel <neil.patel@canonical.com> + + Add URI activation support for the global place + +2010-09-20 Neil Jagdish Patel <neil.patel@canonical.com> + + Use gdk_error_trap properly + +2010-09-20 Neil Jagdish Patel <neil.patel@canonical.com> + + Guard against a null entry or null entry.parent. Now vala won't ignore these checks + +2010-09-20 Neil Jagdish Patel <neil.patel@canonical.com> + + Set the search bar first, otherwise we might still receive events from the old place when we shouldn't + +2010-09-20 Neil Jagdish Patel <neil.patel@canonical.com> + + Make switching quicker, make sure that file browsing works + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Make sure we correctly reset the dash on clicking on places + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Show the failed search red bg on the entry + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Don't expose an active application if we're in dash mode when the user clicks + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Make the home buttons reactive + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Add red tint when search fails + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Support new libindicator API + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + Add support for entry_activated () + +2010-09-22 jassmith@gmail.com + + merge window spread popup fix branch + +2010-09-22 jassmith@gmail.com + + Ensure we dont map windows when expose is active + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes lp:619344 by removing glow on fold + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes lp:619344 by removing glow on fold + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + adds support into unity for using a gconf key to disable super key support + +2010-09-22 Ying-Chun Liu (PaulLiu) <grandpaul@gmail.com> + + Add gconf key to disable/enable super key. + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Multi-monitor support + +2010-09-19 Neil Jagdish Patel <neil.patel@canonical.com> + + Make sure the input region is correct + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + dummy + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + Make the other bits work with multi-monitor setups + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + Basic multi monitor support + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes launcher focus grabbing lp:637123 + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes lp:637123 + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes the places icons and workspace manager icon so that you can't drag them out + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + stops drag events from affecting special launcher icons such as places, also stops you dragging past those icons + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Merge lp:~unity-team/unity/trash-i18n-fixes. Partial fix for bug #645038 "Trash menu items in Unity are either not translatable or translations are not loaded". + + Still missing an issue with ngettext("%d item", "%d items", n_items); Please see the linked bug. + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + First stab at fixing bug #645038: "Trash menu items in Unity are either not translatable or translations are not loaded". Still haven't figured out why the "%d items" statement with ngettext() is not working. + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Merge Mikkel's branch lp:~unity-team/unity/fast-icons: + + * This branch optimizes the icon loading considerably. Most notably the places will now appear on screen much faster. You will note that on initial launch of a place the icons will not appear instantly - in fact may appear to arrive slower than before. This is due to the fact that the new code shows the place on screen much earlier than the old code. + + * Fixes the bug where tiles in the places could sometimes have the wrong icon. + + * DISCLAIMER: It breaks ABI and API of Unity.IO. Slightly. This was required to remove a heckuwa lot of reallocations of some big IO buffers. Unity internally has been updated to reflect this (of course). The place daemons are the only other consumers, and I will update them to require the latest unity, which should make this a non-problem. + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Make process_icon_queue() private now that we don't have to leak this logic anymore (all optimizations are handled internally) + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Make the PixbufCache a *lot* more clever on when to start loading icons - and do some more aggresively than before. This change allowed us to remove a hack from places-default-renderer-group.vala that leaked some logic into the group renderer class to optimize responsiveness. + + Simplify and clean up the logic of PixbufCache + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Outcomment dubious call to internals of Unity.PixbufCache + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Add some docs to the public methods of UnityPixbufCache + +2010-09-22 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Rename method load_iteration() to process_icon_queue_dispatcher() and make it private + +2010-09-21 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + API/ABI break of libunity: in unity_io_read_stream_async() only consumer is unity internally and the place daemons. They will be bumped to require the new libunity version. So no reason to change soname. + + Fixes bug where the wrong icon where at times associated with a tile in the places view. LP bug #642935 + + Work on optimizing file icon loading: + + * Reduced number of reallocations + * Increased buffer size and made sure the buffer is allocated only once + * Less roundtrips to mainloop + * Try and match read buffer size to default inode size (4k) + * Sequential reading of queued files. Before this we'd load at minimum 10 in parallel! Note that this change might actually make the loading *slower* on SSD while almost certainly faster on conventional drives + +2010-09-21 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + make PixbufRequestType a private enum + +2010-09-21 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Make PixbufCacheTask a private class and add [Compact] annotation in order to make them a little lighter (we might spawn several thousands of these) + +2010-09-21 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com> + + Unregister the icon queue timeout (if set) when a PixbufCache is destroyed + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Some menu's keep showing + +2010-09-22 jassmith@gmail.com + + Ensure our dnd window is set to not accept input focus + +2010-09-22 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Jasons maximus fixes + +2010-09-22 jassmith@gmail.com + + Ensure we dont process any window that is already too big for the stage + +2010-09-22 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/places/places-place-search-navigation.vala + + Merged unity.fix-638285 after review and approval from Mikkel. The + forward- and back-buttons in the places-view are now rendered with + lowered opacity to better indicate being insensitive, thus the user does + not accidentally assume they can be pressed. Fixes LP: #638285 + +2010-09-21 Mirco Müller <mirco.mueller@ubuntu.com> + + Made the insensitive state of the forward- and back-button more obvious by decreasing their opacity, thus users don't assume they are actually clickable. Fixes LP: #638285 + +2010-09-22 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + targets/mutter/window-management.vala + + Merged Jason's restore-foce-activate branch after review and approval. + +2010-09-22 jassmith@gmail.com + + restore force activate function using timeout of 0 instead of idle. This seems to eliminate the crash + +2010-09-22 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/places/places-button.vala + unity-private/places/places-default-renderer.vala + unity-private/places/places-place-search-sections-bar.vala + + Merged Cimi's fix-cairo-misalignments branch after review and approval. + This fixes some fills, line-widths, alignments in the default + places-renderer and scrollbar. + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Fixes to scrollbar + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + More fixes, now to places default rendered + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Fixes fill of places_button when pressed + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Fixes some misalignments, different design (sharp borders), should be faster + +2010-09-22 Gord Allott <gord.allott@canonical.com> + + fixes for various bugs, linked in the commits + +2010-09-21 Gord Allott <gord.allott@canonical.com> + + moves the auto-scroll animation from 30fps based to clutter animation based, fixes lp:640560 + +2010-09-21 Gord Allott <gord.allott@canonical.com> + + fixes issue with icons that are dragged out remaining, fixes lp:643434 + +2010-09-20 Gord Allott <gord.allott@canonical.com> + + hides hidden menu items, fixes lp:641543 + +2010-09-22 Didier Roche <didier.roche@canonical.com> + + detects if software acceleration rather than hw is available and if so, try to + logout from the session after a dialog prompt, changing the selected session in + gdm to gnome. + +2010-09-21 Didier Roche <didier.roche@canonical.com> + + change user session selected by default if no 3D driver detected + +2010-09-18 Didier Roche <didier.roche@canonical.com> + + prompt a dialog and exit if we detect that GL is software rendered + +2010-09-22 Didier Roche <didier.roche@canonical.com> + + People are sometime insane in filling their custom launcher name. Try to be + smart and to convert some of them. + +2010-09-21 Didier Roche <didier.roche@canonical.com> + + being safe when people are using crazy caracters in desktop file (LP: #644114, #635156) + +2010-09-22 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/panel/panel-indicator-object-entry-view.vala + + Merged branch unity.fix-604505-2 after review and approval from Gordon. + Upon initial focus of insensitive menus (upon program startup) they are + no longer reactive, thus the user can't activate them with the mouse or + keyboard as intended. Fixes LP: #604505 + +2010-09-21 Mirco Müller <mirco.mueller@ubuntu.com> + + Make insensitive menu really inactive, when window is initially focused (program is started). Fixes LP: #604505 + +2010-09-22 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/launcher/quicklist-menu-item.vala + + Merged branch unity.fix-643315 for after review and approval by Gordon. + Makes quicklist-items have equal width again and fixes regression of all + the clutter-warning about relayout happening during an allocation cycle. + Fixes LP: #643315 + +2010-09-21 Mirco Müller <mirco.mueller@ubuntu.com> + + use timeout again, fixes LP: #643315 (quicklist items having different widths) and the other regression of clutter spitting out warnings about relayout being performed during an allocation cycle + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + Unref item returned from menu_item_from_dbusmenuitem. They have an extra reference that stop them from being properly deleted. + + [modified] + unity-private/launcher/quicklist-controller.vala + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + Unref item returned from menu_item_from_dbusmenuitem. They have an extra reference that stop them from being properly deleted. + + [modified] + unity-private/launcher/quicklist-controller.vala + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + Unref item returned from menu_item_from_dbusmenuitem. They have an extra reference that stop themfrom being properly deleted. + + [modified] + unity-private/launcher/quicklist-controller.vala + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + Unref item returned from menu_item_from_dbusmenuitem. They have an extra reference that stop themfrom being properly deleted. + + [modified] + unity-private/launcher/quicklist-controller.vala + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + Add correct destructor name to menu items. + + [modified] + unity-private/launcher/quicklist-check-menu-item.vala + unity-private/launcher/quicklist-image-menu-item.vala + unity-private/launcher/quicklist-radio-menu-item.vala + unity-private/launcher/quicklist-seperator-menu-item.vala + +2010-09-21 Jay Taoko <jay.taoko@canonical.com> + + * Add correct destructor name to menu items. + + [modified] + unity-private/launcher/quicklist-check-menu-item.vala + unity-private/launcher/quicklist-image-menu-item.vala + unity-private/launcher/quicklist-radio-menu-item.vala + unity-private/launcher/quicklist-seperator-menu-item.vala + +2010-09-21 Mirco Müller <mirco.mueller@ubuntu.com> + + modified: + unity-private/launcher/quicklist-controller.vala + + Merged branch unity.fix-631446-2 after review and approval from Gordon. + Make sure the anchor-position/offset of label and quicklist is really + the same. Fixes LP: #631446. + +2010-09-21 Mirco Müller <mirco.mueller@ubuntu.com> + + use same offset for label and quicklist, should fix LP: #631446 for real now + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Improved breadcrumb look by Cimi + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Improved look of breadcrumbs in folder view + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Cimi's work that fixes up menuitem look and feel + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Update text color to reflect Ambiance changes + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Fix ambiance theme in maverick, hardcoded, bug #611967 + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + Update ignores + +2010-09-18 Neil Jagdish Patel <neil.patel@canonical.com> + + [merge] Cimi's fix window buttons branch + +2010-09-17 Andrea Cimitan <andrea.cimitan@gmail.com> + + Fixes for window decorations buttons in the panel, using new Ambiance theme + +2010-09-17 Neil Jagdish Patel <neil.patel@canonical.com> + + Post release bump + +2010-09-17 Neil Jagdish Patel <neil.patel@canonical.com> + + [release] 0.2.40 + 2010-09-16 Neil Jagdish Patel <neil.patel@canonical.com> Merge gords launcher fixes branches @@ -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.40. +# Generated by GNU Autoconf 2.67 for unity 0.2.42. # # 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.40' -PACKAGE_STRING='unity 0.2.40' +PACKAGE_VERSION='0.2.42' +PACKAGE_STRING='unity 0.2.42' 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.40 to adapt to many kinds of systems. +\`configure' configures unity 0.2.42 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.40:";; + short | recursive ) echo "Configuration of unity 0.2.42:";; 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.40 +unity configure 0.2.42 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.40, which was +It was created by unity $as_me 0.2.42, 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.40 + VERSION=0.2.42 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=40 -DL_VERSION=0.2.40 +DL_MICRO_VERSION=42 +DL_VERSION=0.2.42 @@ -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.40, which was +This file was extended by unity $as_me 0.2.42, 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.40 +unity config.status 0.2.42 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 8baad4e94..5d3faa6a4 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], [40]) +m4_define([unity_micro], [42]) m4_define([unity_api], [unity_major.unity_minor]) diff --git a/data/unity.schemas b/data/unity.schemas index 405226e32..0ca280caf 100644 --- a/data/unity.schemas +++ b/data/unity.schemas @@ -41,6 +41,17 @@ </locale> </schema> + <schema> + <key>/schemas/desktop/unity/launcher/super_key_enable</key> + <applyto>/desktop/unity/launcher/super_key_enable</applyto> + <owner>unity</owner> + <type>bool</type> + <default>1</default> + <locale name="C"> + <short>Enable super key or not</short> + <long>Enable/disable super key. If this is False, super key will not function.</long> + </locale> + </schema> + </schemalist> </gconfschemafile> - diff --git a/targets/mutter/Makefile.am b/targets/mutter/Makefile.am index 1e34e1d33..41ed39813 100644 --- a/targets/mutter/Makefile.am +++ b/targets/mutter/Makefile.am @@ -43,6 +43,7 @@ libunity_mutter_la_VALAFLAGS = \ --pkg Dbusmenu-Glib-0.2 \ --pkg dee-1.0 \ --pkg gtk+-2.0 \ + --pkg gdk-x11-2.0 \ --pkg gee-1.0 \ --pkg indicator \ --pkg mutter-2.28 \ @@ -51,6 +52,7 @@ libunity_mutter_la_VALAFLAGS = \ --pkg unity-const \ --pkg unity \ --pkg unity-private \ + --pkg gconf-2.0 \ $(MAINTAINER_VALAFLAGS) libunity_mutter_la_LIBADD = \ diff --git a/targets/mutter/Makefile.in b/targets/mutter/Makefile.in index 4b8df976c..0e706e9f9 100644 --- a/targets/mutter/Makefile.in +++ b/targets/mutter/Makefile.in @@ -337,6 +337,7 @@ EXTRA_DIST = $(am__append_3) @ENABLE_MUTTER_TRUE@ --pkg Dbusmenu-Glib-0.2 \ @ENABLE_MUTTER_TRUE@ --pkg dee-1.0 \ @ENABLE_MUTTER_TRUE@ --pkg gtk+-2.0 \ +@ENABLE_MUTTER_TRUE@ --pkg gdk-x11-2.0 \ @ENABLE_MUTTER_TRUE@ --pkg gee-1.0 \ @ENABLE_MUTTER_TRUE@ --pkg indicator \ @ENABLE_MUTTER_TRUE@ --pkg mutter-2.28 \ @@ -345,6 +346,7 @@ EXTRA_DIST = $(am__append_3) @ENABLE_MUTTER_TRUE@ --pkg unity-const \ @ENABLE_MUTTER_TRUE@ --pkg unity \ @ENABLE_MUTTER_TRUE@ --pkg unity-private \ +@ENABLE_MUTTER_TRUE@ --pkg gconf-2.0 \ @ENABLE_MUTTER_TRUE@ $(MAINTAINER_VALAFLAGS) @ENABLE_MUTTER_TRUE@libunity_mutter_la_LIBADD = \ diff --git a/targets/mutter/expose-manager.c b/targets/mutter/expose-manager.c index 2b08881ba..0e0347cfc 100644 --- a/targets/mutter/expose-manager.c +++ b/targets/mutter/expose-manager.c @@ -28,6 +28,8 @@ #include <mutter-plugins.h> #include <unity-private.h> #include <unity.h> +#include <gee.h> +#include <gdk/gdk.h> #define UNITY_TYPE_EXPOSE_CLONE (unity_expose_clone_get_type ()) @@ -65,6 +67,7 @@ typedef struct _UnityPlugin UnityPlugin; typedef struct _UnityPluginClass UnityPluginClass; #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))) +typedef struct _UnityPluginPrivate UnityPluginPrivate; struct _UnityExposeClone { ClutterGroup parent_instance; @@ -128,6 +131,18 @@ struct _UnityExposeManagerPrivate { UnityExposeClone* last_selected_clone; }; +struct _UnityPlugin { + GObject parent_instance; + UnityPluginPrivate * priv; + GeeArrayList* backgrounds; + GdkRectangle primary_monitor; + UnityGestureDispatcher* gesture_dispatcher; +}; + +struct _UnityPluginClass { + GObjectClass parent_class; +}; + static gpointer unity_expose_clone_parent_class = NULL; static gpointer unity_expose_manager_parent_class = NULL; @@ -202,8 +217,8 @@ enum { UNITY_EXPOSE_MANAGER_DARKEN }; static void _g_list_free_g_object_unref (GList* self); -UnityExposeManager* unity_expose_manager_new (UnityPlugin* plugin, UnityLauncherLauncher* launcher); -UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* plugin, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_new (UnityPlugin* owner, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* owner, UnityLauncherLauncher* launcher); void unity_expose_manager_set_hovered_opacity (UnityExposeManager* self, guint8 value); void unity_expose_manager_set_unhovered_opacity (UnityExposeManager* self, guint8 value); void unity_expose_manager_set_darken (UnityExposeManager* self, guint8 value); @@ -803,19 +818,19 @@ static void _g_list_free_g_object_unref (GList* self) { } -UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* plugin, UnityLauncherLauncher* launcher) { +UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* owner, UnityLauncherLauncher* launcher) { UnityExposeManager * self; UnityLauncherLauncher* _tmp0_; UnityPlugin* _tmp1_; GList* _tmp2_; ClutterStage* _tmp3_; - g_return_val_if_fail (plugin != NULL, NULL); + g_return_val_if_fail (owner != NULL, NULL); g_return_val_if_fail (launcher != NULL, NULL); self = (UnityExposeManager*) g_object_new (object_type, NULL); self->priv->launcher = (_tmp0_ = _g_object_ref0 (launcher), _g_object_unref0 (self->priv->launcher), _tmp0_); - self->priv->owner = (_tmp1_ = _g_object_ref0 (plugin), _g_object_unref0 (self->priv->owner), _tmp1_); + self->priv->owner = (_tmp1_ = _g_object_ref0 (owner), _g_object_unref0 (self->priv->owner), _tmp1_); self->exposed_windows = (_tmp2_ = NULL, __g_list_free_g_object_unref0 (self->exposed_windows), _tmp2_); - self->priv->stage = (_tmp3_ = CLUTTER_STAGE (unity_shell_get_stage ((UnityShell*) plugin)), _g_object_unref0 (self->priv->stage), _tmp3_); + self->priv->stage = (_tmp3_ = CLUTTER_STAGE (unity_shell_get_stage ((UnityShell*) owner)), _g_object_unref0 (self->priv->stage), _tmp3_); unity_expose_manager_set_hovered_opacity (self, (guint8) 255); unity_expose_manager_set_unhovered_opacity (self, (guint8) 255); unity_expose_manager_set_darken (self, (guint8) 0); @@ -823,8 +838,8 @@ UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlug } -UnityExposeManager* unity_expose_manager_new (UnityPlugin* plugin, UnityLauncherLauncher* launcher) { - return unity_expose_manager_construct (UNITY_TYPE_EXPOSE_MANAGER, plugin, launcher); +UnityExposeManager* unity_expose_manager_new (UnityPlugin* owner, UnityLauncherLauncher* launcher) { + return unity_expose_manager_construct (UNITY_TYPE_EXPOSE_MANAGER, owner, launcher); } @@ -1050,16 +1065,16 @@ static void unity_expose_manager_position_windows_coverflow (UnityExposeManager* g_return_if_fail (self != NULL); g_return_if_fail (active != NULL); last = NULL; - middle_size = (gint) (clutter_actor_get_width ((ClutterActor*) self->priv->stage) * 0.8f); - width = (((gint) clutter_actor_get_width ((ClutterActor*) self->priv->stage)) - self->priv->_left_buffer) - self->priv->_right_buffer; + middle_size = (gint) (self->priv->owner->primary_monitor.width * 0.8f); + width = (((gint) self->priv->owner->primary_monitor.width) - self->priv->_left_buffer) - self->priv->_right_buffer; slice_width = width / 10; - middle_y = ((gint) clutter_actor_get_height ((ClutterActor*) self->priv->stage)) / 2; + middle_y = ((gint) self->priv->owner->primary_monitor.height) / 2; middle_x = self->priv->_left_buffer + (width / 2); middle_index = g_list_index (windows, active); - scale = MIN (1.f, (clutter_actor_get_height ((ClutterActor*) self->priv->stage) / 2) / MAX (clutter_actor_get_height (active), clutter_actor_get_width (active))); + scale = MIN (1.f, (self->priv->owner->primary_monitor.height / 2) / MAX (clutter_actor_get_height (active), clutter_actor_get_width (active))); scale = 1.f; clutter_actor_set_anchor_point_from_gravity (active, CLUTTER_GRAVITY_CENTER); - clutter_actor_animate (active, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) middle_x, "y", (float) middle_y, "depth", clutter_actor_get_width ((ClutterActor*) self->priv->stage) * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", 0.f, NULL); + clutter_actor_animate (active, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) middle_x, "y", (float) middle_y, "depth", self->priv->owner->primary_monitor.width * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", 0.f, NULL); clutter_actor_raise_top (active); last = (_tmp0_ = _g_object_ref0 (active), _g_object_unref0 (last), _tmp0_); current_x = middle_x - middle_size; @@ -1082,9 +1097,9 @@ static void unity_expose_manager_position_windows_coverflow (UnityExposeManager* actor = _g_object_ref0 ((ClutterActor*) g_list_nth_data (windows, (guint) i)); clutter_actor_set_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER); clutter_actor_lower (actor, last); - scale = MIN (1.f, (clutter_actor_get_height ((ClutterActor*) self->priv->stage) / 2) / MAX (clutter_actor_get_height (actor), clutter_actor_get_width (actor))); + scale = MIN (1.f, (self->priv->owner->primary_monitor.height / 2) / MAX (clutter_actor_get_height (actor), clutter_actor_get_width (actor))); scale = 1.f; - clutter_actor_animate (actor, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) current_x, "y", (float) middle_y, "depth", clutter_actor_get_width ((ClutterActor*) self->priv->stage) * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", 60.f, NULL); + clutter_actor_animate (actor, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) current_x, "y", (float) middle_y, "depth", self->priv->owner->primary_monitor.width * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", 60.f, NULL); current_x = current_x - slice_width; last = (_tmp2_ = _g_object_ref0 (actor), _g_object_unref0 (last), _tmp2_); _g_object_unref0 (actor); @@ -1112,9 +1127,9 @@ static void unity_expose_manager_position_windows_coverflow (UnityExposeManager* actor = _g_object_ref0 ((ClutterActor*) g_list_nth_data (windows, (guint) i)); clutter_actor_set_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER); clutter_actor_lower (actor, last); - scale = MIN (1.f, (clutter_actor_get_height ((ClutterActor*) self->priv->stage) / 2) / MAX (clutter_actor_get_height (actor), clutter_actor_get_width (actor))); + scale = MIN (1.f, (self->priv->owner->primary_monitor.height / 2) / MAX (clutter_actor_get_height (actor), clutter_actor_get_width (actor))); scale = 1.f; - clutter_actor_animate (actor, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) current_x, "y", (float) middle_y, "depth", clutter_actor_get_width ((ClutterActor*) self->priv->stage) * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", -60.f, NULL); + clutter_actor_animate (actor, (gulong) CLUTTER_EASE_IN_OUT_SINE, (guint) 250, "x", (float) current_x, "y", (float) middle_y, "depth", self->priv->owner->primary_monitor.width * (-0.7), "scale-x", scale, "scale-y", scale, "rotation-angle-y", -60.f, NULL); current_x = current_x + slice_width; last = (_tmp5_ = _g_object_ref0 (actor), _g_object_unref0 (last), _tmp5_); _g_object_unref0 (actor); @@ -1150,10 +1165,17 @@ void unity_expose_manager_position_windows_on_grid (UnityExposeManager* self, GL gint boxWidth; gint boxHeight; g_return_if_fail (self != NULL); + if (g_list_length (_windows) < 1) { + g_warning ("expose-manager.vala:479: There are no windows to position on grid"); + return; + } windows = g_list_copy (_windows); windows = g_list_sort (windows, (GCompareFunc) unity_expose_manager_direct_comparison); count = (gint) g_list_length (windows); cols = (gint) ceil (sqrt ((double) count)); + if (cols < 1) { + cols = 1; + } rows = 1; while (TRUE) { if (!((cols * rows) < count)) { @@ -1161,8 +1183,8 @@ void unity_expose_manager_position_windows_on_grid (UnityExposeManager* self, GL } rows++; } - boxWidth = (gint) (((clutter_actor_get_width ((ClutterActor*) self->priv->stage) - left_buffer) - right_buffer) / cols); - boxHeight = (gint) (((clutter_actor_get_height ((ClutterActor*) self->priv->stage) - top_buffer) - bottom_buffer) / rows); + boxWidth = (gint) (((self->priv->owner->primary_monitor.width - left_buffer) - right_buffer) / cols); + boxHeight = (gint) (((self->priv->owner->primary_monitor.height - top_buffer) - bottom_buffer) / rows); { gint row; row = 0; @@ -1178,7 +1200,7 @@ void unity_expose_manager_position_windows_on_grid (UnityExposeManager* self, GL break; } if (row == (rows - 1)) { - boxWidth = (gint) (((clutter_actor_get_width ((ClutterActor*) self->priv->stage) - left_buffer) - right_buffer) / g_list_length (windows)); + boxWidth = (gint) (((self->priv->owner->primary_monitor.width - left_buffer) - right_buffer) / g_list_length (windows)); } { gint col; diff --git a/targets/mutter/expose-manager.vala b/targets/mutter/expose-manager.vala index 22f513d44..afdaf773e 100644 --- a/targets/mutter/expose-manager.vala +++ b/targets/mutter/expose-manager.vala @@ -260,12 +260,12 @@ namespace Unity private ExposeClone? last_selected_clone = null; - public ExposeManager (Plugin plugin, Launcher.Launcher launcher) + public ExposeManager (Plugin owner, Launcher.Launcher launcher) { this.launcher = launcher; - this.owner = plugin; + this.owner = owner; this.exposed_windows = new List<ExposeClone> (); - this.stage = (Clutter.Stage)plugin.get_stage (); + this.stage = (Clutter.Stage)owner.get_stage (); hovered_opacity = 255; unhovered_opacity = 255; @@ -394,23 +394,23 @@ namespace Unity { Clutter.Actor last = null; - int middle_size = (int) (stage.width * 0.8f); - int width = (int) stage.width - left_buffer - right_buffer; + int middle_size = (int) (owner.primary_monitor.width * 0.8f); + int width = (int) owner.primary_monitor.width - left_buffer - right_buffer; int slice_width = width / 10; - int middle_y = (int) stage.height / 2; + int middle_y = (int) owner.primary_monitor.height / 2; int middle_x = left_buffer + width / 2; int middle_index = windows.index (active); - float scale = float.min (1f, (stage.height / 2) / float.max (active.height, active.width)); + float scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (active.height, active.width)); scale = 1f; active.set_anchor_point_from_gravity (Clutter.Gravity.CENTER); active.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250, "x", (float) middle_x, "y", (float) middle_y, - "depth", stage.width * -0.7, + "depth", owner.primary_monitor.width * -0.7, "scale-x", scale, "scale-y", scale, "rotation-angle-y", 0f); @@ -425,13 +425,13 @@ namespace Unity actor.set_anchor_point_from_gravity (Clutter.Gravity.CENTER); actor.lower (last); - scale = float.min (1f, (stage.height / 2) / float.max (actor.height, actor.width)); + scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (actor.height, actor.width)); scale = 1f; actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250, "x", (float) current_x, "y", (float) middle_y, - "depth", stage.width * -0.7, + "depth", owner.primary_monitor.width * -0.7, "scale-x", scale, "scale-y", scale, "rotation-angle-y", 60f); @@ -448,13 +448,13 @@ namespace Unity actor.set_anchor_point_from_gravity (Clutter.Gravity.CENTER); actor.lower (last); - scale = float.min (1f, (stage.height / 2) / float.max (actor.height, actor.width)); + scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (actor.height, actor.width)); scale = 1f; actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250, "x", (float) current_x, "y", (float) middle_y, - "depth", stage.width * -0.7, + "depth", owner.primary_monitor.width * -0.7, "scale-x", scale, "scale-y", scale, "rotation-angle-y", -60f); @@ -474,25 +474,32 @@ namespace Unity public void position_windows_on_grid (List<Clutter.Actor> _windows, int top_buffer, int left_buffer, int right_buffer, int bottom_buffer) { + if (_windows.length () < 1) + { + warning ("There are no windows to position on grid"); + return; + } + List<Clutter.Actor> windows = _windows.copy (); windows.sort ((CompareFunc) direct_comparison); int count = (int) windows.length (); int cols = (int) Math.ceil (Math.sqrt (count)); + if (cols < 1) cols = 1; int rows = 1; while (cols * rows < count) rows++; - int boxWidth = (int) ((stage.width - left_buffer - right_buffer) / cols); - int boxHeight = (int) ((stage.height - top_buffer - bottom_buffer) / rows); + int boxWidth = (int) ((owner.primary_monitor.width - left_buffer - right_buffer) / cols); + int boxHeight = (int) ((owner.primary_monitor.height - top_buffer - bottom_buffer) / rows); for (int row = 0; row < rows; row++) { if (row == rows - 1) { /* Last row, time to perform centering as needed */ - boxWidth = (int) ((stage.width - left_buffer - right_buffer) / windows.length ()); + boxWidth = (int) ((owner.primary_monitor.width - left_buffer - right_buffer) / windows.length ()); } for (int col = 0; col < cols; col++) diff --git a/targets/mutter/main.c b/targets/mutter/main.c index 4bf913081..f90c874b0 100644 --- a/targets/mutter/main.c +++ b/targets/mutter/main.c @@ -22,6 +22,9 @@ #include <glib.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> +#include <dbus/dbus-glib.h> + +#include <GL/gl.h> #include <clutter/x11/clutter-x11.h> #include "unity-mutter.h" @@ -63,6 +66,10 @@ MUTTER_PLUGIN_DECLARE(UnityMutter, unity_mutter); static void unity_mutter_constructed (GObject *object); +static void change_user_session (const char *session_name); +static gboolean session_logout_success (void); +static gboolean rendering_available (void); + static void unity_mutter_minimize (MutterPlugin *self, MutterWindow *window); static void unity_mutter_maximize (MutterPlugin *self, @@ -128,6 +135,15 @@ unity_mutter_constructed (GObject *object) { UnityMutter *self = UNITY_MUTTER (object); + if (!rendering_available ()) + { + g_warning ("No rendering avaible for unity, prompting for changing session"); + change_user_session ("gnome"); + // if we can't logout, fallback to trying to run unity... + if (session_logout_success ()) + exit (0); // 0 or will be respawn as required_component + } + self->plugin = unity_plugin_new (); g_signal_connect (self->plugin, "restore-input-region", G_CALLBACK (on_restore_input_region), self); @@ -136,6 +152,128 @@ unity_mutter_constructed (GObject *object) } static void +change_user_session (const char *session_name) +{ + + GKeyFile *key_file; + GError *error; + char *filename; + gsize length; + gchar *contents; + + filename = g_build_filename (g_get_home_dir(), ".dmrc", NULL); + error = NULL; + + key_file = g_key_file_new (); + g_key_file_load_from_file (key_file, filename, + G_KEY_FILE_KEEP_COMMENTS | + G_KEY_FILE_KEEP_TRANSLATIONS, + NULL); + g_key_file_set_string (key_file, "Desktop", "Session", + session_name); + + contents = g_key_file_to_data (key_file, &length, &error); + if (contents == NULL) + { + g_debug ("Can't create content for .dmrc file: %s", error->message); + g_key_file_free (key_file); + g_free (filename); + return; + } + + if (!g_file_set_contents (filename, contents, length, &error)) + { + g_debug ("Can't update .dmrc file: %s", error->message); + g_error_free (error); + } + + g_free (contents); + g_key_file_free (key_file); + g_free (filename); + +} + +static gboolean +session_logout_success (void) +{ + GtkWidget* dialog_warn_logout; + gint response; + + dialog_warn_logout = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + _("No required driver detected for unity."), + NULL); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG(dialog_warn_logout), + _("You will need to choose the Ubuntu Desktop session once you select your user name.")); + response = gtk_dialog_run (GTK_DIALOG(dialog_warn_logout)); + gtk_widget_destroy (dialog_warn_logout); + + if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_DELETE_EVENT) + { + DBusGConnection * sbus; + DBusGProxy * sm_proxy; + GError * error = NULL; + gboolean res = FALSE; + + sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + if (sbus == NULL) + { + g_warning ("Unable to get DBus session bus."); + return FALSE; + } + sm_proxy = dbus_g_proxy_new_for_name_owner (sbus, + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + &error); + if (sm_proxy == NULL) + { + g_warning ("Unable to get DBus proxy to SessionManager interface: %s", error->message); + g_error_free (error); + return FALSE; + } + g_clear_error (&error); + + res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, + G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID); + if (!res) + { + if (error != NULL) + g_warning ("SessionManager action failed: %s", error->message); + else + g_warning ("SessionManager action failed: unknown error"); + + g_object_unref(sm_proxy); + g_error_free(error); + return FALSE; + } + + g_object_unref(sm_proxy); + g_warning ("logout"); + return TRUE; + } + g_warning ("Logout denied, trying to start unity"); + return FALSE; +} + +/* take an optimistic approach: only return FALSE when we are sure it's FALSE */ +static gboolean +rendering_available (void) +{ + gchar *renderer = NULL; + const char *glRenderer = (const char *) glGetString(GL_RENDERER); + renderer = g_ascii_strdown (glRenderer, -1); + g_debug ("OpenGL renderer string: %s\n", glRenderer); + + if (renderer && strstr (renderer, "software")) + return FALSE; + + return TRUE; +} + +static void on_restore_input_region (UnityPlugin *plugin, gboolean fullscreen) { MutterPlugin *self; @@ -174,16 +312,16 @@ on_restore_input_region (UnityPlugin *plugin, gboolean fullscreen) rects = g_new (XRectangle, 2); /* Panel first */ - rects[0].x = 0; - rects[0].y = 0; - rects[0].width = width; + rects[0].x = plugin->primary_monitor.x; + rects[0].y = plugin->primary_monitor.y; + rects[0].width = plugin->primary_monitor.width; rects[0].height = unity_plugin_get_panel_height (plugin); /* Launcher */ - rects[1].x = 0; + rects[1].x = plugin->primary_monitor.y; rects[1].y = rects[0].height; rects[1].width = unity_plugin_get_launcher_width (plugin) + 1; - rects[1].height = height - rects[0].height; + rects[1].height = plugin->primary_monitor.height - rects[0].height; /* Update region */ region = XFixesCreateRegion (xdisplay, rects, 2); diff --git a/targets/mutter/maximus.c b/targets/mutter/maximus.c index becfbcbcf..03f5e36e9 100644 --- a/targets/mutter/maximus.c +++ b/targets/mutter/maximus.c @@ -153,11 +153,23 @@ static gboolean unity_maximus_window_is_excluded (UnityMaximus* self, MutterWind gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; stage = _g_object_ref0 (clutter_stage_get_default ()); if (clutter_actor_get_width ((ClutterActor*) window) < (clutter_actor_get_width (stage) * 0.6)) { + _tmp5_ = TRUE; + } else { + _tmp5_ = clutter_actor_get_width ((ClutterActor*) window) > clutter_actor_get_width (stage); + } + if (_tmp5_) { + _tmp4_ = TRUE; + } else { + _tmp4_ = clutter_actor_get_height ((ClutterActor*) window) < (clutter_actor_get_height (stage) * 0.6); + } + if (_tmp4_) { _tmp3_ = TRUE; } else { - _tmp3_ = clutter_actor_get_height ((ClutterActor*) window) < (clutter_actor_get_height (stage) * 0.6); + _tmp3_ = clutter_actor_get_height ((ClutterActor*) window) > clutter_actor_get_height (stage); } if (_tmp3_) { _tmp2_ = TRUE; diff --git a/targets/mutter/maximus.vala b/targets/mutter/maximus.vala index f8f751147..8d36bc92e 100644 --- a/targets/mutter/maximus.vala +++ b/targets/mutter/maximus.vala @@ -78,10 +78,10 @@ namespace Unity { Clutter.Actor stage = Clutter.Stage.get_default (); - if (window.width < stage.width * 0.6 || - window.height < stage.height * 0.6 || - (window.width/window.height) < 0.6 || - (window.width/window.height) > 2.0) + if (window.width < stage.width * 0.6 || window.width > stage.width || + window.height < stage.height * 0.6 || window.height > stage.height || + window.width / window.height < 0.6 || + window.width / window.height > 2.0) { return true; } diff --git a/targets/mutter/plugin.c b/targets/mutter/plugin.c index 3939ec715..14616c28c 100644 --- a/targets/mutter/plugin.c +++ b/targets/mutter/plugin.c @@ -27,21 +27,24 @@ #include <gtk/gtk.h> #include <gdk/gdk.h> #include <unity.h> +#include <gee.h> #include <unity-private.h> #include <mutter-plugins.h> #include <clutter/clutter.h> -#include <gee.h> #include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib.h> #include <float.h> #include <math.h> #include <unity-utils.h> #include <clutk/clutk.h> +#include <gconf/gconf-client.h> +#include <gconf/gconf.h> #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/Xutil.h> #include <X11/Xregion.h> #include <libbamf/libbamf.h> +#include <gdk/gdkx.h> #define UNITY_TYPE_DRAG_DEST (unity_drag_dest_get_type ()) @@ -111,12 +114,12 @@ typedef struct _UnitySpacesManagerClass UnitySpacesManagerClass; #define UNITY_PLUGIN_TYPE_MAXIMIZE_TYPE (unity_plugin_maximize_type_get_type ()) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define __g_slist_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_slist_free_g_object_unref (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) #define _g_array_free0(var) ((var == NULL) ? NULL : (var = (g_array_free (var, TRUE), NULL))) #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) typedef struct _Block6Data Block6Data; -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) struct _UnityDragDest { GtkWindow parent_instance; @@ -137,6 +140,8 @@ typedef enum { struct _UnityPlugin { GObject parent_instance; UnityPluginPrivate * priv; + GeeArrayList* backgrounds; + GdkRectangle primary_monitor; UnityGestureDispatcher* gesture_dispatcher; }; @@ -153,8 +158,8 @@ typedef enum { struct _UnityPluginPrivate { MutterPlugin* _plugin; + gboolean _super_key_enable; UnityExposeManager* _expose_manager; - UnityTestingBackground* _background; gboolean _super_key_active; gboolean _is_starting; ClutterStage* stage; @@ -218,8 +223,8 @@ static GType unity_plugin_maximize_type_get_type (void) G_GNUC_UNUSED; enum { UNITY_PLUGIN_DUMMY_PROPERTY, UNITY_PLUGIN_PLUGIN, + UNITY_PLUGIN_SUPER_KEY_ENABLE, UNITY_PLUGIN_EXPOSE_MANAGER, - UNITY_PLUGIN_BACKGROUND, UNITY_PLUGIN_MENUS_SWALLOW_EVENTS, UNITY_PLUGIN_SUPER_KEY_ACTIVE, UNITY_PLUGIN_IS_STARTING, @@ -228,13 +233,19 @@ enum { #define UNITY_PLUGIN_PANEL_HEIGHT 24 #define UNITY_PLUGIN_QUICKLAUNCHER_WIDTH 58 #define UNITY_PLUGIN_UNDECORATED_HINT "UNDECORATED_HINT" +#define UNITY_PLUGIN_GCONF_DIR "/desktop/unity/launcher" +#define UNITY_PLUGIN_GCONF_SUPER_KEY_ENABLE_KEY "super_key_enable" static gboolean unity_plugin_real_construct (UnityPlugin* self); MutterPlugin* unity_plugin_get_plugin (UnityPlugin* self); static void _lambda1_ (ClutterActor* a, UnityPlugin* self); static void __lambda1__clutter_container_actor_added (ClutterContainer* _sender, ClutterActor* actor, gpointer self); static void _lambda2_ (ClutterActor* a, UnityPlugin* self); static void __lambda2__clutter_container_actor_removed (ClutterContainer* _sender, ClutterActor* actor, gpointer self); +void unity_plugin_set_super_key_enable (UnityPlugin* self, gboolean value); +static void unity_plugin_gconf_super_key_enable_cb (UnityPlugin* self, GConfClient* gc, guint cxnid, GConfEntry* entry); +static void _unity_plugin_gconf_super_key_enable_cb_gconf_client_notify_func (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer self); static void _lambda3_ (UnityPlugin* self); +gboolean unity_plugin_get_super_key_enable (UnityPlugin* self); static void __lambda3__mutter_meta_display_overlay_key_down (MetaDisplay* _sender, gpointer self); static void _lambda4_ (UnityPlugin* self); static void __lambda4__mutter_meta_display_overlay_key (MetaDisplay* _sender, gpointer self); @@ -242,14 +253,15 @@ static void _lambda5_ (guint keysym, UnityPlugin* self); static void __lambda5__mutter_meta_display_overlay_key_with_modifier (MetaDisplay* _sender, guint keysym, gpointer self); static void _lambda6_ (guint keysym, UnityPlugin* self); static void __lambda6__mutter_meta_display_overlay_key_with_modifier_down (MetaDisplay* _sender, guint keysym, gpointer self); -static void unity_plugin_set_background (UnityPlugin* self, UnityTestingBackground* value); -UnityTestingBackground* unity_plugin_get_background (UnityPlugin* self); +static void unity_plugin_relayout (UnityPlugin* self); +static void _unity_plugin_relayout_gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); +static void _unity_plugin_relayout_gdk_screen_size_changed (GdkScreen* _sender, gpointer self); UnitySpacesManager* unity_spaces_manager_new (UnityPlugin* plugin); UnitySpacesManager* unity_spaces_manager_construct (GType object_type, UnityPlugin* plugin); void unity_spaces_manager_set_padding (UnitySpacesManager* self, guint top, guint right, guint left, guint bottom); UnityLauncherScrollerChild* unity_spaces_manager_get_button (UnitySpacesManager* self); -UnityExposeManager* unity_expose_manager_new (UnityPlugin* plugin, UnityLauncherLauncher* launcher); -UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* plugin, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_new (UnityPlugin* owner, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* owner, UnityLauncherLauncher* launcher); static void unity_plugin_set_expose_manager (UnityPlugin* self, UnityExposeManager* value); UnityExposeManager* unity_plugin_get_expose_manager (UnityPlugin* self); void unity_expose_manager_set_hovered_opacity (UnityExposeManager* self, guint8 value); @@ -260,7 +272,6 @@ void unity_expose_manager_set_bottom_buffer (UnityExposeManager* self, gint valu gint unity_expose_manager_get_bottom_buffer (UnityExposeManager* self); void unity_expose_manager_set_top_buffer (UnityExposeManager* self, gint value); void unity_expose_manager_set_coverflow (UnityExposeManager* self, gboolean value); -static void unity_plugin_relayout (UnityPlugin* self); static void _unity_plugin_relayout_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static gboolean _lambda16_ (UnityPlugin* self); static gboolean __lambda16__gsource_func (gpointer self); @@ -279,6 +290,7 @@ static void _lambda20_ (UnityPlugin* self); static void __lambda20__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static void _lambda21_ (UnityPlugin* self); static void __lambda21__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static void unity_plugin_refresh_n_backgrounds (UnityPlugin* self, gint n_monitors); static void unity_plugin_real_add_fullscreen_request (UnityShell* base, GObject* o); static gboolean unity_plugin_real_remove_fullscreen_request (UnityShell* base, GObject* o); static void unity_plugin_real_ensure_input_region (UnityShell* base); @@ -369,7 +381,7 @@ static GObject * unity_drag_dest_constructor (GType type, guint n_construct_prop obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = UNITY_DRAG_DEST (obj); { - ; + gtk_window_set_accept_focus ((GtkWindow*) self, FALSE); } return obj; } @@ -448,8 +460,15 @@ static void __lambda2__clutter_container_actor_removed (ClutterContainer* _sende } +static void _unity_plugin_gconf_super_key_enable_cb_gconf_client_notify_func (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer self) { + unity_plugin_gconf_super_key_enable_cb (self, client, cnxn_id, entry); +} + + static void _lambda3_ (UnityPlugin* self) { - unity_shell_set_super_key_active ((UnityShell*) self, TRUE); + if (unity_plugin_get_super_key_enable (self)) { + unity_shell_set_super_key_active ((UnityShell*) self, TRUE); + } } @@ -479,7 +498,9 @@ static void __lambda5__mutter_meta_display_overlay_key_with_modifier (MetaDispla static void _lambda6_ (guint keysym, UnityPlugin* self) { - g_signal_emit_by_name ((UnityShell*) self, "super-key-modifier-press", keysym); + if (unity_plugin_get_super_key_enable (self)) { + g_signal_emit_by_name ((UnityShell*) self, "super-key-modifier-press", keysym); + } } @@ -488,6 +509,16 @@ static void __lambda6__mutter_meta_display_overlay_key_with_modifier_down (MetaD } +static void _unity_plugin_relayout_gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { + unity_plugin_relayout (self); +} + + +static void _unity_plugin_relayout_gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { + unity_plugin_relayout (self); +} + + static void _unity_plugin_relayout_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { unity_plugin_relayout (self); } @@ -544,24 +575,27 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { GtkTargetEntry* _tmp8_ = NULL; GtkTargetEntry* target_list; ClutterGroup* window_group; + GConfClient* gc; MetaDisplay* display; - UnityTestingBackground* _tmp10_; - UnityLauncherLauncher* _tmp11_; - ClutterActor* _tmp12_; - UnitySpacesManager* _tmp13_; - UnityExposeManager* _tmp14_; - ClutterActor* _tmp15_; + GdkScreen* screen; + GeeArrayList* _tmp11_; + UnityLauncherLauncher* _tmp12_; + ClutterActor* _tmp13_; + UnitySpacesManager* _tmp14_; + UnityExposeManager* _tmp15_; ClutterActor* _tmp16_; - CtkBin* _tmp17_; - ClutterActor* _tmp18_; + ClutterActor* _tmp17_; + CtkBin* _tmp18_; ClutterActor* _tmp19_; ClutterActor* _tmp20_; - UnityPlacesController* _tmp21_; - UnityPlacesView* _tmp22_; - ClutterActor* _tmp23_; - UnityPanelView* _tmp24_; - ClutterActor* _tmp25_; - UnityGestureDispatcher* _tmp26_; + ClutterActor* _tmp21_; + UnityPlacesController* _tmp22_; + UnityPlacesView* _tmp23_; + ClutterActor* _tmp24_; + UnityPanelView* _tmp25_; + ClutterActor* _tmp26_; + UnityGestureDispatcher* _tmp27_; + GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); START_FUNCTION (); clutter_set_gl_picking_enabled (FALSE); @@ -573,52 +607,114 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { target_list = (_tmp9_ = (_tmp8_ = g_new0 (GtkTargetEntry, 6), _tmp8_[0] = (memset (&_tmp2_, 0, sizeof (GtkTargetEntry)), _tmp2_.target = "STRING", _tmp2_.flags = (guint) 0, _tmp2_.info = (guint) UNITY_DND_TARGETS_TARGET_STRING, _tmp2_), _tmp8_[1] = (memset (&_tmp3_, 0, sizeof (GtkTargetEntry)), _tmp3_.target = "text/plain", _tmp3_.flags = (guint) 0, _tmp3_.info = (guint) UNITY_DND_TARGETS_TARGET_STRING, _tmp3_), _tmp8_[2] = (memset (&_tmp4_, 0, sizeof (GtkTargetEntry)), _tmp4_.target = "text/uri-list", _tmp4_.flags = (guint) 0, _tmp4_.info = (guint) UNITY_DND_TARGETS_TARGET_URL, _tmp4_), _tmp8_[3] = (memset (&_tmp5_, 0, sizeof (GtkTargetEntry)), _tmp5_.target = "x-url/http", _tmp5_.flags = (guint) 0, _tmp5_.info = (guint) UNITY_DND_TARGETS_TARGET_URL, _tmp5_), _tmp8_[4] = (memset (&_tmp6_, 0, sizeof (GtkTargetEntry)), _tmp6_.target = "x-url/ftp", _tmp6_.flags = (guint) 0, _tmp6_.info = (guint) UNITY_DND_TARGETS_TARGET_URL, _tmp6_), _tmp8_[5] = (memset (&_tmp7_, 0, sizeof (GtkTargetEntry)), _tmp7_.target = "_NETSCAPE_URL", _tmp7_.flags = (guint) 0, _tmp7_.info = (guint) UNITY_DND_TARGETS_TARGET_URL, _tmp7_), _tmp8_), target_list_length1 = 6, _target_list_size_ = target_list_length1, _tmp9_); ctk_dnd_init (GTK_WIDGET (self->priv->drag_dest), target_list, target_list_length1); window_group = _g_object_ref0 (CLUTTER_GROUP (mutter_plugin_get_window_group (unity_plugin_get_plugin (self)))); + gc = _g_object_ref0 (gconf_client_get_default ()); display = _g_object_ref0 (meta_screen_get_display (mutter_plugin_get_screen (unity_plugin_get_plugin (self)))); + { + gboolean _tmp10_; + _tmp10_ = gconf_client_get_bool (gc, UNITY_PLUGIN_GCONF_DIR "/" UNITY_PLUGIN_GCONF_SUPER_KEY_ENABLE_KEY, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch0_g_error; + } + unity_plugin_set_super_key_enable (self, _tmp10_); + } + goto __finally0; + __catch0_g_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + unity_plugin_set_super_key_enable (self, TRUE); + g_warning ("plugin.vala:294: Cannot find super_key_enable gconf key"); + _g_error_free0 (e); + } + } + __finally0: + if (_inner_error_ != NULL) { + _g_object_unref0 (display); + _g_object_unref0 (gc); + _g_object_unref0 (window_group); + target_list = (g_free (target_list), 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_); + return FALSE; + } + { + gconf_client_add_dir (gc, UNITY_PLUGIN_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch1_g_error; + } + gconf_client_notify_add (gc, UNITY_PLUGIN_GCONF_DIR "/" UNITY_PLUGIN_GCONF_SUPER_KEY_ENABLE_KEY, _unity_plugin_gconf_super_key_enable_cb_gconf_client_notify_func, g_object_ref (self), g_object_unref, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch1_g_error; + } + } + goto __finally1; + __catch1_g_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("plugin.vala:300: Cannot set gconf callback function of super_key_enabl" \ +"e"); + _g_error_free0 (e); + } + } + __finally1: + if (_inner_error_ != NULL) { + _g_object_unref0 (display); + _g_object_unref0 (gc); + _g_object_unref0 (window_group); + target_list = (g_free (target_list), 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_); + return FALSE; + } g_signal_connect_object (display, "overlay-key-down", (GCallback) __lambda3__mutter_meta_display_overlay_key_down, self, 0); g_signal_connect_object (display, "overlay-key", (GCallback) __lambda4__mutter_meta_display_overlay_key, self, 0); g_signal_connect_object (display, "overlay-key-with-modifier", (GCallback) __lambda5__mutter_meta_display_overlay_key_with_modifier, self, 0); g_signal_connect_object (display, "overlay-key-with-modifier-down", (GCallback) __lambda6__mutter_meta_display_overlay_key_with_modifier_down, self, 0); - unity_plugin_set_background (self, _tmp10_ = g_object_ref_sink (unity_testing_background_new ())); - _g_object_unref0 (_tmp10_); - clutter_container_add_actor ((ClutterContainer*) self->priv->stage, (ClutterActor*) self->priv->_background); - clutter_actor_lower_bottom ((ClutterActor*) self->priv->_background); - clutter_actor_show ((ClutterActor*) self->priv->_background); - self->priv->launcher = (_tmp11_ = unity_launcher_launcher_new ((UnityShell*) self), _g_object_unref0 (self->priv->launcher), _tmp11_); - clutter_actor_set_opacity (_tmp12_ = unity_launcher_launcher_get_view (self->priv->launcher), (guint8) 0); - _g_object_unref0 (_tmp12_); - self->priv->spaces_manager = (_tmp13_ = unity_spaces_manager_new (self), _g_object_unref0 (self->priv->spaces_manager), _tmp13_); + screen = gdk_screen_get_default (); + self->backgrounds = (_tmp11_ = gee_array_list_new (UNITY_TESTING_TYPE_BACKGROUND, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->backgrounds), _tmp11_); + g_signal_connect_object (screen, "monitors-changed", (GCallback) _unity_plugin_relayout_gdk_screen_monitors_changed, self, 0); + g_signal_connect_object (screen, "size-changed", (GCallback) _unity_plugin_relayout_gdk_screen_size_changed, self, 0); + self->priv->launcher = (_tmp12_ = unity_launcher_launcher_new ((UnityShell*) self), _g_object_unref0 (self->priv->launcher), _tmp12_); + clutter_actor_set_opacity (_tmp13_ = unity_launcher_launcher_get_view (self->priv->launcher), (guint8) 0); + _g_object_unref0 (_tmp13_); + self->priv->spaces_manager = (_tmp14_ = unity_spaces_manager_new (self), _g_object_unref0 (self->priv->spaces_manager), _tmp14_); unity_spaces_manager_set_padding (self->priv->spaces_manager, (guint) 50, (guint) 50, (guint) (unity_shell_get_launcher_width_foobar ((UnityShell*) self) + 50), (guint) 50); unity_launcher_scroller_model_add (unity_launcher_launcher_get_model (self->priv->launcher), unity_spaces_manager_get_button (self->priv->spaces_manager)); - unity_plugin_set_expose_manager (self, _tmp14_ = unity_expose_manager_new (self, self->priv->launcher)); - _g_object_unref0 (_tmp14_); + unity_plugin_set_expose_manager (self, _tmp15_ = unity_expose_manager_new (self, self->priv->launcher)); + _g_object_unref0 (_tmp15_); unity_expose_manager_set_hovered_opacity (self->priv->_expose_manager, (guint8) 255); unity_expose_manager_set_unhovered_opacity (self->priv->_expose_manager, (guint8) 255); unity_expose_manager_set_darken (self->priv->_expose_manager, (guint8) 25); unity_expose_manager_set_right_buffer (self->priv->_expose_manager, 10); unity_expose_manager_set_top_buffer (self->priv->_expose_manager, (unity_expose_manager_set_bottom_buffer (self->priv->_expose_manager, 20), unity_expose_manager_get_bottom_buffer (self->priv->_expose_manager))); unity_expose_manager_set_coverflow (self->priv->_expose_manager, FALSE); - clutter_container_add_actor ((ClutterContainer*) window_group, _tmp15_ = unity_launcher_launcher_get_container (self->priv->launcher)); - _g_object_unref0 (_tmp15_); - clutter_container_add_actor ((ClutterContainer*) (_tmp17_ = (_tmp16_ = unity_launcher_launcher_get_container (self->priv->launcher), CTK_IS_BIN (_tmp16_) ? ((CtkBin*) _tmp16_) : NULL)), _tmp18_ = unity_launcher_launcher_get_view (self->priv->launcher)); - _g_object_unref0 (_tmp18_); - _g_object_unref0 (_tmp17_); - clutter_container_raise_child ((ClutterContainer*) window_group, _tmp19_ = unity_launcher_launcher_get_container (self->priv->launcher), mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); + clutter_container_add_actor ((ClutterContainer*) window_group, _tmp16_ = unity_launcher_launcher_get_container (self->priv->launcher)); + _g_object_unref0 (_tmp16_); + clutter_container_add_actor ((ClutterContainer*) (_tmp18_ = (_tmp17_ = unity_launcher_launcher_get_container (self->priv->launcher), CTK_IS_BIN (_tmp17_) ? ((CtkBin*) _tmp17_) : NULL)), _tmp19_ = unity_launcher_launcher_get_view (self->priv->launcher)); _g_object_unref0 (_tmp19_); - clutter_actor_animate (_tmp20_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 400, "opacity", 255, NULL); + _g_object_unref0 (_tmp18_); + clutter_container_raise_child ((ClutterContainer*) window_group, _tmp20_ = unity_launcher_launcher_get_container (self->priv->launcher), mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); _g_object_unref0 (_tmp20_); - self->priv->places_controller = (_tmp21_ = unity_places_controller_new ((UnityShell*) self), _g_object_unref0 (self->priv->places_controller), _tmp21_); - self->priv->places = (_tmp22_ = unity_places_controller_get_view (self->priv->places_controller), _g_object_unref0 (self->priv->places), _tmp22_); + clutter_actor_animate (_tmp21_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 400, "opacity", 255, NULL); + _g_object_unref0 (_tmp21_); + self->priv->places_controller = (_tmp22_ = unity_places_controller_new ((UnityShell*) self), _g_object_unref0 (self->priv->places_controller), _tmp22_); + self->priv->places = (_tmp23_ = unity_places_controller_get_view (self->priv->places_controller), _g_object_unref0 (self->priv->places), _tmp23_); clutter_container_add_actor ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places); - clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places, _tmp23_ = unity_launcher_launcher_get_container (self->priv->launcher)); - _g_object_unref0 (_tmp23_); + clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places, _tmp24_ = unity_launcher_launcher_get_container (self->priv->launcher)); + _g_object_unref0 (_tmp24_); clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 0); clutter_actor_set_reactive ((ClutterActor*) self->priv->places, FALSE); clutter_actor_hide ((ClutterActor*) self->priv->places); self->priv->places_showing = FALSE; - self->priv->panel = (_tmp24_ = g_object_ref_sink (unity_panel_view_new ((UnityShell*) self)), _g_object_unref0 (self->priv->panel), _tmp24_); + self->priv->panel = (_tmp25_ = g_object_ref_sink (unity_panel_view_new ((UnityShell*) self)), _g_object_unref0 (self->priv->panel), _tmp25_); clutter_container_add_actor ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel); - clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel, _tmp25_ = unity_launcher_launcher_get_container (self->priv->launcher)); - _g_object_unref0 (_tmp25_); + clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel, _tmp26_ = unity_launcher_launcher_get_container (self->priv->launcher)); + _g_object_unref0 (_tmp26_); clutter_actor_show ((ClutterActor*) self->priv->panel); g_signal_connect_object ((GObject*) self->priv->stage, "notify::width", (GCallback) _unity_plugin_relayout_g_object_notify, self, 0); g_signal_connect_object ((GObject*) self->priv->stage, "notify::height", (GCallback) _unity_plugin_relayout_g_object_notify, self, 0); @@ -627,18 +723,55 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { if (boot_logging_filename != NULL) { g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 5, __lambda16__gsource_func, g_object_ref (self), g_object_unref); } - self->gesture_dispatcher = (_tmp26_ = (UnityGestureDispatcher*) unity_gesture_xcb_dispatcher_new (), _g_object_unref0 (self->gesture_dispatcher), _tmp26_); + self->gesture_dispatcher = (_tmp27_ = (UnityGestureDispatcher*) unity_gesture_xcb_dispatcher_new (), _g_object_unref0 (self->gesture_dispatcher), _tmp27_); g_signal_connect_object (self->gesture_dispatcher, "gesture", (GCallback) _unity_plugin_on_gesture_received_unity_gesture_dispatcher_gesture, self, 0); unity_shell_ensure_input_region ((UnityShell*) self); g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda19__gsource_func, g_object_ref (self), g_object_unref); result = FALSE; _g_object_unref0 (display); + _g_object_unref0 (gc); _g_object_unref0 (window_group); target_list = (g_free (target_list), NULL); return result; } +static void unity_plugin_gconf_super_key_enable_cb (UnityPlugin* self, GConfClient* gc, guint cxnid, GConfEntry* entry) { + gboolean new_value; + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (gc != NULL); + g_return_if_fail (entry != NULL); + new_value = TRUE; + { + gboolean _tmp0_; + _tmp0_ = gconf_client_get_bool (gc, UNITY_PLUGIN_GCONF_DIR "/" UNITY_PLUGIN_GCONF_SUPER_KEY_ENABLE_KEY, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch2_g_error; + } + new_value = _tmp0_; + } + goto __finally2; + __catch2_g_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + new_value = TRUE; + _g_error_free0 (e); + } + } + __finally2: + 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_); + return; + } + unity_plugin_set_super_key_enable (self, new_value); +} + + static void _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { unity_plugin_on_focus_window_fullscreen_changed (self); } @@ -809,30 +942,128 @@ static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self) { } +static void unity_plugin_refresh_n_backgrounds (UnityPlugin* self, gint n_monitors) { + gint size; + g_return_if_fail (self != NULL); + size = gee_collection_get_size ((GeeCollection*) self->backgrounds); + if (size == n_monitors) { + return; + } else { + if (size < n_monitors) { + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + UnityTestingBackground* bg; + if (!_tmp0_) { + i++; + } + _tmp0_ = FALSE; + if (!(i < (n_monitors - size))) { + break; + } + bg = g_object_ref_sink (unity_testing_background_new ()); + gee_abstract_collection_add ((GeeAbstractCollection*) self->backgrounds, bg); + clutter_container_add_actor ((ClutterContainer*) self->priv->stage, (ClutterActor*) bg); + clutter_actor_lower_bottom ((ClutterActor*) bg); + clutter_actor_set_opacity ((ClutterActor*) bg, (guint8) 0); + clutter_actor_show ((ClutterActor*) bg); + clutter_actor_animate ((ClutterActor*) bg, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 2000, "opacity", 255, NULL); + _g_object_unref0 (bg); + } + } + } + } else { + { + gint i; + i = 0; + { + gboolean _tmp1_; + _tmp1_ = TRUE; + while (TRUE) { + UnityTestingBackground* bg; + if (!_tmp1_) { + i++; + } + _tmp1_ = FALSE; + if (!(i < (size - n_monitors))) { + break; + } + bg = (UnityTestingBackground*) gee_abstract_list_get ((GeeAbstractList*) self->backgrounds, 0); + if (CLUTTER_IS_ACTOR (bg)) { + gee_abstract_collection_remove ((GeeAbstractCollection*) self->backgrounds, bg); + clutter_container_remove_actor ((ClutterContainer*) self->priv->stage, (ClutterActor*) bg); + } + _g_object_unref0 (bg); + } + } + } + } + } +} + + static void unity_plugin_relayout (UnityPlugin* self) { - float width = 0.0F; - float height = 0.0F; - ClutterActor* _tmp0_; + GdkScreen* screen; + gint x = 0; + gint y = 0; + gint width = 0; + gint height = 0; ClutterActor* _tmp1_; ClutterActor* _tmp2_; + ClutterActor* _tmp3_; g_return_if_fail (self != NULL); START_FUNCTION (); - clutter_actor_get_size ((ClutterActor*) self->priv->stage, &width, &height); - gtk_window_resize ((GtkWindow*) self->priv->drag_dest, UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, ((gint) height) - UNITY_PLUGIN_PANEL_HEIGHT); - gtk_window_move ((GtkWindow*) self->priv->drag_dest, 0, UNITY_PLUGIN_PANEL_HEIGHT); - clutter_actor_set_size ((ClutterActor*) self->priv->_background, width, height); - clutter_actor_set_position ((ClutterActor*) self->priv->_background, (float) 0, (float) 0); - clutter_actor_set_size (_tmp0_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, height - UNITY_PLUGIN_PANEL_HEIGHT); - _g_object_unref0 (_tmp0_); - clutter_actor_set_position (_tmp1_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) 0, (float) UNITY_PLUGIN_PANEL_HEIGHT); + screen = gdk_screen_get_default (); + gdk_screen_get_monitor_geometry (screen, 0, &self->primary_monitor); + x = self->primary_monitor.x; + y = self->primary_monitor.y; + width = self->primary_monitor.width; + height = self->primary_monitor.height; + gtk_window_resize ((GtkWindow*) self->priv->drag_dest, UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, height - UNITY_PLUGIN_PANEL_HEIGHT); + gtk_window_move ((GtkWindow*) self->priv->drag_dest, x, y + UNITY_PLUGIN_PANEL_HEIGHT); + unity_plugin_refresh_n_backgrounds (self, gdk_screen_get_n_monitors (screen)); + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + UnityTestingBackground* bg; + if (!_tmp0_) { + i++; + } + _tmp0_ = FALSE; + if (!(i < gdk_screen_get_n_monitors (screen))) { + break; + } + bg = (UnityTestingBackground*) gee_abstract_list_get ((GeeAbstractList*) self->backgrounds, i); + if (UNITY_TESTING_IS_BACKGROUND (bg)) { + GdkRectangle rect = {0}; + gdk_screen_get_monitor_geometry (screen, i, &rect); + clutter_actor_set_position ((ClutterActor*) bg, (float) rect.x, (float) rect.y); + clutter_actor_set_size ((ClutterActor*) bg, (float) rect.width, (float) rect.height); + } + _g_object_unref0 (bg); + } + } + } + clutter_actor_set_size (_tmp1_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, (float) (height - UNITY_PLUGIN_PANEL_HEIGHT)); _g_object_unref0 (_tmp1_); - clutter_actor_set_clip (_tmp2_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) 0, (float) 0, (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, height - UNITY_PLUGIN_PANEL_HEIGHT); + clutter_actor_set_position (_tmp2_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) x, (float) (y + UNITY_PLUGIN_PANEL_HEIGHT)); _g_object_unref0 (_tmp2_); - utils_set_strut (GTK_WINDOW (self->priv->drag_dest), (guint32) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, (guint32) 0, (guint32) height, (guint32) UNITY_PLUGIN_PANEL_HEIGHT, (guint32) 0, (guint32) width); - clutter_actor_set_size ((ClutterActor*) self->priv->places, width - UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, height); - clutter_actor_set_position ((ClutterActor*) self->priv->places, (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, (float) 0); - clutter_actor_set_size ((ClutterActor*) self->priv->panel, width, (float) 24); - clutter_actor_set_position ((ClutterActor*) self->priv->panel, (float) 0, (float) 0); + clutter_actor_set_clip (_tmp3_ = unity_launcher_launcher_get_container (self->priv->launcher), (float) 0, (float) 0, (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, (float) (height - UNITY_PLUGIN_PANEL_HEIGHT)); + _g_object_unref0 (_tmp3_); + utils_set_strut (GTK_WINDOW (self->priv->drag_dest), (guint32) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, (guint32) y, (guint32) height, (guint32) UNITY_PLUGIN_PANEL_HEIGHT, (guint32) x, (guint32) width); + clutter_actor_set_size ((ClutterActor*) self->priv->places, (float) (width - UNITY_PLUGIN_QUICKLAUNCHER_WIDTH), (float) height); + clutter_actor_set_position ((ClutterActor*) self->priv->places, (float) (x + UNITY_PLUGIN_QUICKLAUNCHER_WIDTH), (float) y); + clutter_actor_set_size ((ClutterActor*) self->priv->panel, (float) width, (float) UNITY_PLUGIN_PANEL_HEIGHT); + clutter_actor_set_position ((ClutterActor*) self->priv->panel, (float) x, (float) y); + unity_shell_ensure_input_region ((UnityShell*) self); END_FUNCTION (); } @@ -1165,8 +1396,8 @@ static void unity_plugin_real_show_unity (UnityShell* base) { self->priv->dark_box = (_tmp2_ = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp1_ = (_tmp0_.red = (guint8) 0, _tmp0_.green = (guint8) 0, _tmp0_.blue = (guint8) 0, _tmp0_.alpha = (guint8) 255, _tmp0_), &_tmp1_))), _g_object_unref0 (self->priv->dark_box), _tmp2_); clutter_container_add_actor ((_tmp3_ = mutter_plugin_get_window_group (unity_plugin_get_plugin (self)), CLUTTER_IS_CONTAINER (_tmp3_) ? ((ClutterContainer*) _tmp3_) : NULL), (ClutterActor*) self->priv->dark_box); clutter_actor_raise ((ClutterActor*) self->priv->dark_box, mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); - clutter_actor_set_position ((ClutterActor*) self->priv->dark_box, (float) 0, (float) 0); - clutter_actor_set_size ((ClutterActor*) self->priv->dark_box, clutter_actor_get_width ((ClutterActor*) self->priv->stage), clutter_actor_get_height ((ClutterActor*) self->priv->stage)); + clutter_actor_set_position ((ClutterActor*) self->priv->dark_box, (float) self->primary_monitor.x, (float) self->primary_monitor.y); + clutter_actor_set_size ((ClutterActor*) self->priv->dark_box, (float) self->primary_monitor.width, (float) self->primary_monitor.height); clutter_actor_show ((ClutterActor*) self->priv->dark_box); unity_panel_view_set_indicator_mode (self->priv->panel, TRUE); unity_shell_ensure_input_region ((UnityShell*) self); @@ -1289,7 +1520,7 @@ static void unity_plugin_real_do_window_action (UnityShell* base, guint32 xid, U { GEnumValue* _tmp0_; char* _tmp1_; - g_warning ("plugin.vala:800: %s", _tmp1_ = g_strconcat ("Window action type ", (_tmp0_ = g_enum_get_value (g_type_class_ref (UNITY_TYPE_WINDOW_ACTION), (int) action), (_tmp0_ != NULL) ? _tmp0_->value_name : NULL), " not supported", NULL)); + g_warning ("plugin.vala:903: %s", _tmp1_ = g_strconcat ("Window action type ", (_tmp0_ = g_enum_get_value (g_type_class_ref (UNITY_TYPE_WINDOW_ACTION), (int) action), (_tmp0_ != NULL) ? _tmp0_->value_name : NULL), " not supported", NULL)); _g_free0 (_tmp1_); break; } @@ -1347,18 +1578,18 @@ static void unity_plugin_on_gesture_received (UnityPlugin* self, UnityGestureEve gboolean _tmp7_ = FALSE; gboolean _tmp8_ = FALSE; window = (_tmp5_ = _g_object_ref0 ((_tmp4_ = actor, MUTTER_IS_WINDOW (_tmp4_) ? ((MutterWindow*) _tmp4_) : NULL)), _g_object_unref0 (window), _tmp5_); - if (mutter_window_get_window_type (self->priv->start_pan_window) != META_COMP_WINDOW_NORMAL) { - _tmp8_ = mutter_window_get_window_type (self->priv->start_pan_window) != META_COMP_WINDOW_DIALOG; + if (mutter_window_get_window_type (window) != META_COMP_WINDOW_NORMAL) { + _tmp8_ = mutter_window_get_window_type (window) != META_COMP_WINDOW_DIALOG; } else { _tmp8_ = FALSE; } if (_tmp8_) { - _tmp7_ = mutter_window_get_window_type (self->priv->start_pan_window) != META_COMP_WINDOW_MODAL_DIALOG; + _tmp7_ = mutter_window_get_window_type (window) != META_COMP_WINDOW_MODAL_DIALOG; } else { _tmp7_ = FALSE; } if (_tmp7_) { - _tmp6_ = mutter_window_get_window_type (self->priv->start_pan_window) != META_COMP_WINDOW_UTILITY; + _tmp6_ = mutter_window_get_window_type (window) != META_COMP_WINDOW_UTILITY; } else { _tmp6_ = FALSE; } @@ -1871,6 +2102,12 @@ void unity_plugin_map (UnityPlugin* self, MutterWindow* window) { _data6_->win = mutter_window_get_meta_window (_data6_->window); if (mutter_window_get_window_type (_data6_->window) == META_COMP_WINDOW_NORMAL) { g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda22__gsource_func, block6_data_ref (_data6_), block6_data_unref); + } else { + if (mutter_window_get_window_type (_data6_->window) == META_COMP_WINDOW_DOCK) { + if (meta_window_get_xwindow (_data6_->win) == gdk_x11_drawable_get_xid ((GdkDrawable*) ((GtkWidget*) self->priv->drag_dest)->window)) { + clutter_actor_set_opacity ((ClutterActor*) _data6_->window, (guint8) 0); + } + } } unity_maximus_process_window (self->priv->maximus, _data6_->window); g_signal_emit_by_name (self, "window-mapped", self, _data6_->window); @@ -1978,35 +2215,34 @@ void unity_plugin_set_plugin (UnityPlugin* self, MutterPlugin* value) { } -UnityExposeManager* unity_plugin_get_expose_manager (UnityPlugin* self) { - UnityExposeManager* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_expose_manager; +gboolean unity_plugin_get_super_key_enable (UnityPlugin* self) { + gboolean result; + g_return_val_if_fail (self != NULL, FALSE); + result = self->priv->_super_key_enable; return result; } -static void unity_plugin_set_expose_manager (UnityPlugin* self, UnityExposeManager* value) { - UnityExposeManager* _tmp0_; +void unity_plugin_set_super_key_enable (UnityPlugin* self, gboolean value) { g_return_if_fail (self != NULL); - self->priv->_expose_manager = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_expose_manager), _tmp0_); - g_object_notify ((GObject *) self, "expose-manager"); + self->priv->_super_key_enable = value; + g_object_notify ((GObject *) self, "super-key-enable"); } -UnityTestingBackground* unity_plugin_get_background (UnityPlugin* self) { - UnityTestingBackground* result; +UnityExposeManager* unity_plugin_get_expose_manager (UnityPlugin* self) { + UnityExposeManager* result; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_background; + result = self->priv->_expose_manager; return result; } -static void unity_plugin_set_background (UnityPlugin* self, UnityTestingBackground* value) { - UnityTestingBackground* _tmp0_; +static void unity_plugin_set_expose_manager (UnityPlugin* self, UnityExposeManager* value) { + UnityExposeManager* _tmp0_; g_return_if_fail (self != NULL); - self->priv->_background = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_background), _tmp0_); - g_object_notify ((GObject *) self, "background"); + self->priv->_expose_manager = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_expose_manager), _tmp0_); + g_object_notify ((GObject *) self, "expose-manager"); } @@ -2109,6 +2345,9 @@ static GObject * unity_plugin_constructor (GType type, guint n_construct_propert UnityApplication* _tmp5_; UnityWindowManagement* _tmp9_; UnityMaximus* _tmp10_; + ClutterActor* _tmp11_; + ClutterColor _tmp12_ = {0}; + ClutterColor _tmp13_; unity_shell_set_is_starting ((UnityShell*) self, TRUE); self->priv->fullscreen_requests = (_tmp0_ = gee_array_list_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->fullscreen_requests), _tmp0_); unity_global_shell = (_tmp1_ = _g_object_ref0 ((UnityShell*) self), _g_object_unref0 (unity_global_shell), _tmp1_); @@ -2135,24 +2374,24 @@ static GObject * unity_plugin_constructor (GType type, guint n_construct_propert DBusGProxy* _tmp8_; _tmp6_ = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { - goto __catch0_g_error; + goto __catch3_g_error; } self->priv->screensaver_conn = (_tmp7_ = _tmp6_, _dbus_g_connection_unref0 (self->priv->screensaver_conn), _tmp7_); self->priv->screensaver = (_tmp8_ = dbus_g_proxy_new_for_name (self->priv->screensaver_conn, "org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver"), _g_object_unref0 (self->priv->screensaver), _tmp8_); _dynamic_ActiveChanged1_connect (self->priv->screensaver, "ActiveChanged", (GCallback) _unity_plugin_got_screensaver_changed_dynamic_ActiveChanged0_, self); } - goto __finally0; - __catch0_g_error: + goto __finally3; + __catch3_g_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; { - g_warning ("plugin.vala:228: %s", e->message); + g_warning ("plugin.vala:241: %s", e->message); _g_error_free0 (e); } } - __finally0: + __finally3: if (_inner_error_ != NULL) { args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), 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); @@ -2160,6 +2399,7 @@ static GObject * unity_plugin_constructor (GType type, guint n_construct_propert } self->priv->wm = (_tmp9_ = unity_window_management_new (self), _g_object_unref0 (self->priv->wm), _tmp9_); self->priv->maximus = (_tmp10_ = unity_maximus_new (), _g_object_unref0 (self->priv->maximus), _tmp10_); + clutter_stage_set_color ((_tmp11_ = clutter_stage_get_default (), CLUTTER_IS_STAGE (_tmp11_) ? ((ClutterStage*) _tmp11_) : NULL), (_tmp13_ = (_tmp12_.red = (guint8) 0, _tmp12_.green = (guint8) 0, _tmp12_.blue = (guint8) 0, _tmp12_.alpha = (guint8) 255, _tmp12_), &_tmp13_)); END_FUNCTION (); args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); } @@ -2175,8 +2415,8 @@ static void unity_plugin_class_init (UnityPluginClass * klass) { G_OBJECT_CLASS (klass)->constructor = unity_plugin_constructor; G_OBJECT_CLASS (klass)->finalize = unity_plugin_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_PLUGIN, g_param_spec_object ("plugin", "plugin", "plugin", MUTTER_TYPE_PLUGIN, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_SUPER_KEY_ENABLE, g_param_spec_boolean ("super-key-enable", "super-key-enable", "super-key-enable", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_EXPOSE_MANAGER, g_param_spec_object ("expose-manager", "expose-manager", "expose-manager", UNITY_TYPE_EXPOSE_MANAGER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_BACKGROUND, g_param_spec_object ("background", "background", "background", UNITY_TESTING_TYPE_BACKGROUND, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); g_object_class_override_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_MENUS_SWALLOW_EVENTS, "menus-swallow-events"); g_object_class_override_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_SUPER_KEY_ACTIVE, "super-key-active"); g_object_class_override_property (G_OBJECT_CLASS (klass), UNITY_PLUGIN_IS_STARTING, "is-starting"); @@ -2224,6 +2464,7 @@ static void unity_plugin_unity_shell_interface_init (UnityShellIface * iface) { static void unity_plugin_instance_init (UnityPlugin * self) { self->priv = UNITY_PLUGIN_GET_PRIVATE (self); + self->priv->_super_key_enable = TRUE; self->priv->_super_key_active = FALSE; self->priv->focus_window = NULL; self->priv->display = NULL; @@ -2244,7 +2485,7 @@ static void unity_plugin_finalize (GObject* obj) { self = UNITY_PLUGIN (obj); _g_object_unref0 (self->priv->_plugin); _g_object_unref0 (self->priv->_expose_manager); - _g_object_unref0 (self->priv->_background); + _g_object_unref0 (self->backgrounds); _g_object_unref0 (self->priv->stage); _g_object_unref0 (self->priv->app); _g_object_unref0 (self->priv->wm); @@ -2285,12 +2526,12 @@ static void unity_plugin_get_property (GObject * object, guint property_id, GVal case UNITY_PLUGIN_PLUGIN: g_value_set_object (value, unity_plugin_get_plugin (self)); break; + case UNITY_PLUGIN_SUPER_KEY_ENABLE: + g_value_set_boolean (value, unity_plugin_get_super_key_enable (self)); + break; case UNITY_PLUGIN_EXPOSE_MANAGER: g_value_set_object (value, unity_plugin_get_expose_manager (self)); break; - case UNITY_PLUGIN_BACKGROUND: - g_value_set_object (value, unity_plugin_get_background (self)); - break; case UNITY_PLUGIN_MENUS_SWALLOW_EVENTS: g_value_set_boolean (value, unity_shell_get_menus_swallow_events ((UnityShell*) self)); break; @@ -2317,12 +2558,12 @@ static void unity_plugin_set_property (GObject * object, guint property_id, cons case UNITY_PLUGIN_PLUGIN: unity_plugin_set_plugin (self, g_value_get_object (value)); break; + case UNITY_PLUGIN_SUPER_KEY_ENABLE: + unity_plugin_set_super_key_enable (self, g_value_get_boolean (value)); + break; case UNITY_PLUGIN_EXPOSE_MANAGER: unity_plugin_set_expose_manager (self, g_value_get_object (value)); break; - case UNITY_PLUGIN_BACKGROUND: - unity_plugin_set_background (self, g_value_get_object (value)); - break; case UNITY_PLUGIN_SUPER_KEY_ACTIVE: unity_shell_set_super_key_active ((UnityShell*) self, g_value_get_boolean (value)); break; diff --git a/targets/mutter/plugin.vala b/targets/mutter/plugin.vala index f7cf13ba0..9eb207179 100644 --- a/targets/mutter/plugin.vala +++ b/targets/mutter/plugin.vala @@ -16,6 +16,8 @@ * Authored by Neil Jagdish Patel <neil.patel@canonical.com> * */ + +using GConf; using Unity; using Unity.Testing; @@ -34,7 +36,7 @@ namespace Unity construct { - ; + this.set_accept_focus (false); } } @@ -106,10 +108,14 @@ namespace Unity get { return _plugin; } set { _plugin = value; Idle.add (real_construct); } } + private bool _super_key_enable=true; + public bool super_key_enable { + get { return _super_key_enable; } + set { _super_key_enable = value; } + } public ExposeManager expose_manager { get; private set; } - public Background background { get; private set; } - + public bool menus_swallow_events { get { return false; } } private bool _super_key_active = false; @@ -125,6 +131,9 @@ namespace Unity private static const int QUICKLAUNCHER_WIDTH = 58; private static const string UNDECORATED_HINT = "UNDECORATED_HINT"; + public Gee.ArrayList<Background> backgrounds; + public Gdk.Rectangle primary_monitor; + private Clutter.Stage stage; private Application app; private WindowManagement wm; @@ -185,7 +194,11 @@ namespace Unity RIGHT } private MaximizeType maximize_type = MaximizeType.NONE; - + + /* const */ + private const string GCONF_DIR = "/desktop/unity/launcher"; + private const string GCONF_SUPER_KEY_ENABLE_KEY = "super_key_enable"; + construct { is_starting = true; @@ -223,7 +236,7 @@ namespace Unity this.screensaver = this.screensaver_conn.get_object ("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver"); this.screensaver.ActiveChanged.connect (got_screensaver_changed); } - catch (Error e) + catch (GLib.Error e) { warning (e.message); } @@ -231,6 +244,8 @@ namespace Unity this.wm = new WindowManagement (this); this.maximus = new Maximus (); + (Clutter.Stage.get_default () as Clutter.Stage).color = { 0, 0, 0, 255 }; + END_FUNCTION (); } @@ -269,9 +284,26 @@ namespace Unity /* we need to hook into the super key bound by mutter for g-shell. don't ask me why mutter binds things for g-shell explictly... */ + var gc = GConf.Client.get_default(); Mutter.MetaDisplay display = Mutter.MetaScreen.get_display (plugin.get_screen ()); + + try { + super_key_enable = gc.get_bool(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY); + } catch (GLib.Error e) { + super_key_enable = true; + warning("Cannot find super_key_enable gconf key"); + } + try { + gc.add_dir(GCONF_DIR, GConf.ClientPreloadType.ONELEVEL); + gc.notify_add(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY, this.gconf_super_key_enable_cb); + } catch (GLib.Error e) { + warning("Cannot set gconf callback function of super_key_enable"); + } + display.overlay_key_down.connect (() => { - super_key_active = true; + if (super_key_enable) { + super_key_active = true; + } }); display.overlay_key.connect (() => { @@ -283,13 +315,18 @@ namespace Unity }); display.overlay_key_with_modifier_down.connect ((keysym) => { - super_key_modifier_press (keysym); + if (super_key_enable) { + super_key_modifier_press (keysym); + } }); - this.background = new Background (); - this.stage.add_actor (background); - this.background.lower_bottom (); - this.background.show (); + /* Setup the backgrounds */ + unowned Gdk.Screen screen = Gdk.Screen.get_default (); + backgrounds = new Gee.ArrayList<Background> (); + + /* Connect to interestng signals */ + screen.monitors_changed.connect (relayout); + screen.size_changed.connect (relayout); this.launcher = new Launcher.Launcher (this); this.launcher.get_view ().opacity = 0; @@ -354,6 +391,16 @@ namespace Unity } + private void gconf_super_key_enable_cb(GConf.Client gc, uint cxnid, GConf.Entry entry) { + bool new_value = true; + try { + new_value = gc.get_bool(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY); + } catch (GLib.Error e) { + new_value = true; + } + super_key_enable = new_value; + } + private void on_focus_window_changed () { check_fullscreen_obstruction (); @@ -453,41 +500,97 @@ namespace Unity } } + private void refresh_n_backgrounds (int n_monitors) + { + int size = backgrounds.size; + + if (size == n_monitors) + return; + else if (size < n_monitors) + { + for (int i = 0; i < n_monitors - size; i++) + { + var bg = new Background (); + backgrounds.add (bg); + stage.add_actor (bg); + bg.lower_bottom (); + bg.opacity = 0; + bg.show (); + bg.animate (Clutter.AnimationMode.EASE_IN_QUAD, 2000, + "opacity", 255); + } + } + else + { + for (int i = 0; i < size - n_monitors; i++) + { + var bg = backgrounds.get (0); + if (bg is Clutter.Actor) + { + backgrounds.remove (bg); + stage.remove_actor (bg); + } + } + } + } private void relayout () { START_FUNCTION (); - float width, height; - this.stage.get_size (out width, out height); + unowned Gdk.Screen screen = Gdk.Screen.get_default (); + int x, y, width, height; - this.drag_dest.resize (this.QUICKLAUNCHER_WIDTH, - (int)height - this.PANEL_HEIGHT); - this.drag_dest.move (0, this.PANEL_HEIGHT); + /* Figure out what should be the right size and location of Unity */ + /* FIXME: This needs to always be monitor 0 right now as it doesn't + * seem possible to have panels on a vertical edge of a monitor unless + * it's the first or last monitor :( + */ + screen.get_monitor_geometry (0, // Should be screen.get_primary_monitor() + out primary_monitor); + x = primary_monitor.x; + y = primary_monitor.y; + width = primary_monitor.width; + height = primary_monitor.height; + + /* The drag-n-drop region */ + drag_dest.resize (QUICKLAUNCHER_WIDTH, + height - PANEL_HEIGHT); + drag_dest.move (x, y + PANEL_HEIGHT); + + /* We're responsible for painting the backgrounds on all the monitors */ + refresh_n_backgrounds (screen.get_n_monitors ()); + for (int i = 0; i < screen.get_n_monitors (); i++) + { + var bg = backgrounds.get (i); + if (bg is Background) + { + Gdk.Rectangle rect; + screen.get_monitor_geometry (i, out rect); - this.background.set_size (width, height); - this.background.set_position (0, 0); + bg.set_position (rect.x, rect.y); + bg.set_size (rect.width, rect.height); + } + } this.launcher.get_container ().set_size (this.QUICKLAUNCHER_WIDTH, (height-this.PANEL_HEIGHT)); - this.launcher.get_container ().set_position (0, this.PANEL_HEIGHT); + this.launcher.get_container ().set_position (x, y + this.PANEL_HEIGHT); this.launcher.get_container ().set_clip (0, 0, this.QUICKLAUNCHER_WIDTH, height-this.PANEL_HEIGHT); + Utils.set_strut ((Gtk.Window)this.drag_dest, - this.QUICKLAUNCHER_WIDTH, 0, (uint32)height, - PANEL_HEIGHT, 0, (uint32)width); + this.QUICKLAUNCHER_WIDTH, y, (uint32)height, + PANEL_HEIGHT, x, (uint32)width); this.places.set_size (width - this.QUICKLAUNCHER_WIDTH, height); - this.places.set_position (this.QUICKLAUNCHER_WIDTH, 0); + this.places.set_position (x + this.QUICKLAUNCHER_WIDTH, y); - this.panel.set_size (width, 24); - this.panel.set_position (0, 0); + this.panel.set_size (width, PANEL_HEIGHT); + this.panel.set_position (x, y); + + ensure_input_region (); - /* Leaving this here to remind me that we need to use these when - * there are fullscreen windows etc - * this.plugin.set_stage_input_region (uint region); - * this.plugin.set_stage_reactive (true); - */ END_FUNCTION (); } @@ -686,8 +789,8 @@ namespace Unity (this.plugin.get_window_group () as Clutter.Container).add_actor (this.dark_box); this.dark_box.raise (plugin.get_normal_window_group ()); - this.dark_box.set_position (0, 0); - this.dark_box.set_size (this.stage.width, this.stage.height); + this.dark_box.set_position (primary_monitor.x, primary_monitor.y); + this.dark_box.set_size (primary_monitor.width, primary_monitor.height); this.dark_box.show (); @@ -844,10 +947,10 @@ namespace Unity { window = actor as Mutter.Window; - if (start_pan_window.get_window_type () != Mutter.MetaCompWindowType.NORMAL && - start_pan_window.get_window_type () != Mutter.MetaCompWindowType.DIALOG && - start_pan_window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG && - start_pan_window.get_window_type () != Mutter.MetaCompWindowType.UTILITY) + if (window.get_window_type () != Mutter.MetaCompWindowType.NORMAL && + window.get_window_type () != Mutter.MetaCompWindowType.DIALOG && + window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG && + window.get_window_type () != Mutter.MetaCompWindowType.UTILITY) window = null; } @@ -1426,6 +1529,13 @@ namespace Unity return false; }); } + else if (window.get_window_type () == Mutter.MetaCompWindowType.DOCK) + { + if (win.get_xwindow (win) == Gdk.x11_drawable_get_xid (drag_dest.window)) + { + window.opacity = 0; + } + } this.maximus.process_window (window); this.window_mapped (this, window); diff --git a/targets/mutter/spaces-manager.c b/targets/mutter/spaces-manager.c index 33d0e9a33..29f33c44e 100644 --- a/targets/mutter/spaces-manager.c +++ b/targets/mutter/spaces-manager.c @@ -29,6 +29,8 @@ #include <unity.h> #include <float.h> #include <math.h> +#include <gee.h> +#include <gdk/gdk.h> #define UNITY_TYPE_SPACES_BUTTON_CONTROLLER (unity_spaces_button_controller_get_type ()) @@ -99,6 +101,7 @@ typedef struct _UnitySpacesManagerPrivate UnitySpacesManagerPrivate; typedef struct _Block2Data Block2Data; typedef struct _Block4Data Block4Data; typedef struct _Block3Data Block3Data; +typedef struct _UnityPluginPrivate UnityPluginPrivate; typedef struct _Block5Data Block5Data; struct _UnitySpacesButtonController { @@ -173,6 +176,18 @@ struct _Block3Data { UnityExposeClone* clone; }; +struct _UnityPlugin { + GObject parent_instance; + UnityPluginPrivate * priv; + GeeArrayList* backgrounds; + GdkRectangle primary_monitor; + UnityGestureDispatcher* gesture_dispatcher; +}; + +struct _UnityPluginClass { + GObjectClass parent_class; +}; + struct _Block5Data { int _ref_count_; UnitySpacesManager * self; @@ -291,7 +306,6 @@ static void block4_data_unref (Block4Data* _data4_); static gboolean __lambda11__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static Block3Data* block3_data_ref (Block3Data* _data3_); static void block3_data_unref (Block3Data* _data3_); -UnityTestingBackground* unity_plugin_get_background (UnityPlugin* self); static void _lambda9_ (Block5Data* _data5_); static void __lambda9__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static Block5Data* block5_data_ref (Block5Data* _data5_); @@ -376,7 +390,7 @@ static gboolean unity_spaces_button_controller_real_can_drag (UnityLauncherScrol UnitySpacesButtonController * self; gboolean result = FALSE; self = (UnitySpacesButtonController*) base; - result = TRUE; + result = FALSE; return result; } @@ -1060,6 +1074,8 @@ static ClutterActor* unity_spaces_manager_workspace_clone (UnitySpacesManager* s UnityWorkspaceClone* wsp; GList* windows; UnityWorkspaceClone* _tmp0_; + UnityTestingBackground* _tmp5_; + UnityExposeClone* _tmp6_; UnityExposeClone* background_clone; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (workspace != NULL, NULL); @@ -1126,7 +1142,7 @@ static ClutterActor* unity_spaces_manager_workspace_clone (UnitySpacesManager* s } } } - background_clone = g_object_ref_sink (unity_expose_clone_new ((ClutterActor*) unity_plugin_get_background (self->priv->plugin))); + background_clone = (_tmp6_ = g_object_ref_sink (unity_expose_clone_new ((ClutterActor*) (_tmp5_ = (UnityTestingBackground*) gee_abstract_list_get ((GeeAbstractList*) self->priv->plugin->backgrounds, 0)))), _g_object_unref0 (_tmp5_), _tmp6_); unity_expose_clone_set_fade_on_close (background_clone, FALSE); clutter_container_add_actor ((ClutterContainer*) wsp, (ClutterActor*) background_clone); clutter_actor_lower_bottom ((ClutterActor*) background_clone); diff --git a/targets/mutter/spaces-manager.vala b/targets/mutter/spaces-manager.vala index f5908f3c4..bc7eb3483 100644 --- a/targets/mutter/spaces-manager.vala +++ b/targets/mutter/spaces-manager.vala @@ -69,50 +69,50 @@ namespace Unity { public override bool can_drag () { - return true; + return false; } } - + public class WorkspaceClone : Clutter.Group { bool gridded; Unity.Plugin plugin; public unowned Mutter.MetaWorkspace workspace { get; private set; } - + public WorkspaceClone (Mutter.MetaWorkspace wsp, Unity.Plugin plugin) { workspace = wsp; this.plugin = plugin; - + actor_added.connect (() => { if (gridded) grid (); }); - + actor_removed.connect (() => { if (gridded) grid (); }); } - + private List<Clutter.Actor> toplevel_windows () { List<Clutter.Actor> windows = new List<Clutter.Actor> (); - + foreach (Clutter.Actor actor in get_children ()) if (actor is ExposeClone && (actor as ExposeClone).source is Mutter.Window) windows.prepend (actor); - + return windows; } - + public void grid () { gridded = true; plugin.expose_manager.position_windows_on_grid (toplevel_windows (), 50, 50, 50, 50); } - + public void ungrid () { gridded = false; @@ -193,13 +193,13 @@ namespace Unity { if (background is Clutter.Actor) background.destroy (); - + if (selector_group is Clutter.Actor) selector_group.destroy (); background = new Clutter.Rectangle.with_color ({0, 0, 0, 255}); selector_group = new Clutter.Group (); - + unowned Mutter.MetaScreen screen = plugin.plugin.get_screen (); unowned GLib.List<Mutter.MetaWorkspace> workspaces = Mutter.MetaScreen.get_workspaces (screen); unowned Clutter.Container window_group = plugin.plugin.get_normal_window_group() as Clutter.Container; @@ -222,28 +222,28 @@ namespace Unity { clone.raise_top (); clone.show (); clone.opacity = 200; - + unowned Mutter.MetaWorkspace cpy = workspace; - clone.button_release_event.connect (() => { + clone.button_release_event.connect (() => { select_workspace (cpy); - return true; + return true; }); - - clone.enter_event.connect (() => { + + clone.enter_event.connect (() => { clone.opacity = 255; clone.raise_top (); - return true; + return true; }); - - clone.leave_event.connect (() => { - clone.opacity = 200; - return true; + + clone.leave_event.connect (() => { + clone.opacity = 200; + return true; }); } window_group.add_actor (selector_group); selector_group.raise_top (); - + layout_workspaces (clones, screen); unowned GLib.List<Mutter.Window> windows = plugin.plugin.get_windows (); @@ -272,7 +272,7 @@ namespace Unity { return false; } - + private void select_workspace (Mutter.MetaWorkspace? workspace) { if (workspace == null) { @@ -289,7 +289,7 @@ namespace Unity { global_shell.get_stage ().captured_event.disconnect (on_stage_capture_event); } - + private Clutter.Actor workspace_clone (Mutter.MetaWorkspace workspace) { WorkspaceClone wsp; unowned GLib.List<Mutter.Window> windows; @@ -314,10 +314,10 @@ namespace Unity { clone.reactive = true; clone.darken = 25; clone.enable_dnd = true; - + clone.drag_dropped.connect ((t) => { WorkspaceClone new_parent = clone.pre_drag_parent as WorkspaceClone; - + while (!(t is Clutter.Stage)) { if (t is WorkspaceClone) @@ -327,20 +327,20 @@ namespace Unity { } t = t.get_parent (); } - + float x, y; - + clone.move_anchor_point_from_gravity (Clutter.Gravity.CENTER); new_parent.transform_stage_point (clone.x, clone.y, out x, out y); - + clone.set_scale (clone.pre_drag_scale_x, clone.pre_drag_scale_y); clone.set_position (x, y); - + clone.move_anchor_point_from_gravity (Clutter.Gravity.NORTH_WEST); clone.reparent (new_parent); - - Mutter.MetaWindow.change_workspace_by_index ((clone.source as Mutter.Window).get_meta_window (), + + Mutter.MetaWindow.change_workspace_by_index ((clone.source as Mutter.Window).get_meta_window (), Mutter.MetaWorkspace.index (new_parent.workspace), true, plugin.get_current_time ()); @@ -350,7 +350,7 @@ namespace Unity { clone.set_size (window.width, window.height); clone.set_position (window.x, window.y); - + clone.button_release_event.connect (() => { uint32 time_; @@ -360,7 +360,7 @@ namespace Unity { time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta)); Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_); Mutter.MetaWindow.activate (meta, time_); - + GLib.Timeout.add (250, () => { Mutter.MetaWindow.activate (meta, time_); return false; }); return false; @@ -370,15 +370,15 @@ namespace Unity { } } - ExposeClone background_clone = new ExposeClone (plugin.background); + ExposeClone background_clone = new ExposeClone (plugin.backgrounds.get (0)); background_clone.fade_on_close = false; wsp.add_actor (background_clone); background_clone.lower_bottom (); background_clone.show (); - + wsp.grid (); - + wsp.set_size (background_clone.width, background_clone.height); return wsp; @@ -411,7 +411,7 @@ namespace Unity { "y", (float) yoffset, "scale-x", 1.0f, "scale-y", 1.0f); - + (clone as WorkspaceClone).ungrid (); anim.completed.connect (() => { diff --git a/targets/mutter/unity-mutter.h b/targets/mutter/unity-mutter.h index 45b84dab6..805c06a58 100644 --- a/targets/mutter/unity-mutter.h +++ b/targets/mutter/unity-mutter.h @@ -13,6 +13,8 @@ #include <mutter-plugins.h> #include <gtk/gtk.h> #include <unity.h> +#include <gee.h> +#include <gdk/gdk.h> #include <stdlib.h> #include <string.h> @@ -185,6 +187,8 @@ typedef enum { struct _UnityPlugin { GObject parent_instance; UnityPluginPrivate * priv; + GeeArrayList* backgrounds; + GdkRectangle primary_monitor; UnityGestureDispatcher* gesture_dispatcher; }; @@ -231,8 +235,8 @@ gboolean unity_expose_clone_get_enable_dnd (UnityExposeClone* self); void unity_expose_clone_set_enable_dnd (UnityExposeClone* self, gboolean value); GType unity_expose_manager_get_type (void) G_GNUC_CONST; GType unity_plugin_get_type (void) G_GNUC_CONST; -UnityExposeManager* unity_expose_manager_new (UnityPlugin* plugin, UnityLauncherLauncher* launcher); -UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* plugin, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_new (UnityPlugin* owner, UnityLauncherLauncher* launcher); +UnityExposeManager* unity_expose_manager_construct (GType object_type, UnityPlugin* owner, UnityLauncherLauncher* launcher); void unity_expose_manager_start_expose (UnityExposeManager* self, GSList* windows); void unity_expose_manager_end_expose (UnityExposeManager* self); void unity_expose_manager_position_windows_on_grid (UnityExposeManager* self, GList* _windows, gint top_buffer, gint left_buffer, gint right_buffer, gint bottom_buffer); @@ -299,8 +303,9 @@ UnityPlugin* unity_plugin_new (void); UnityPlugin* unity_plugin_construct (GType object_type); MutterPlugin* unity_plugin_get_plugin (UnityPlugin* self); void unity_plugin_set_plugin (UnityPlugin* self, MutterPlugin* value); +gboolean unity_plugin_get_super_key_enable (UnityPlugin* self); +void unity_plugin_set_super_key_enable (UnityPlugin* self, gboolean value); UnityExposeManager* unity_plugin_get_expose_manager (UnityPlugin* self); -UnityTestingBackground* unity_plugin_get_background (UnityPlugin* self); gboolean unity_plugin_get_expose_showing (UnityPlugin* self); GType unity_maximus_get_type (void) G_GNUC_CONST; extern char* unity_maximus_user_unmaximize_hint; diff --git a/targets/mutter/unity-mutter.vapi b/targets/mutter/unity-mutter.vapi index 6d018db40..ab119c1b5 100644 --- a/targets/mutter/unity-mutter.vapi +++ b/targets/mutter/unity-mutter.vapi @@ -24,7 +24,7 @@ namespace Unity { [CCode (cheader_filename = "unity-mutter.h")] public class ExposeManager : GLib.Object { public GLib.List<Unity.ExposeClone> exposed_windows; - public ExposeManager (Unity.Plugin plugin, Unity.Launcher.Launcher launcher); + public ExposeManager (Unity.Plugin owner, Unity.Launcher.Launcher launcher); public void end_expose (); public void position_windows_on_grid (GLib.List<Clutter.Actor> _windows, int top_buffer, int left_buffer, int right_buffer, int bottom_buffer); public void start_expose (GLib.SList<Clutter.Actor> windows); @@ -46,7 +46,9 @@ namespace Unity { } [CCode (cheader_filename = "unity-mutter.h")] public class Plugin : GLib.Object, Unity.Shell { + public Gee.ArrayList<Unity.Testing.Background> backgrounds; public Unity.Gesture.Dispatcher gesture_dispatcher; + public Gdk.Rectangle primary_monitor; public Plugin (); public void destroy (Mutter.Window window); public void expose_windows (GLib.SList<Clutter.Actor> windows, int left_buffer = 75); @@ -59,10 +61,10 @@ namespace Unity { public void on_kill_window_effects (Mutter.Window window); public void switch_workspace (int from, int to, int direction); public void unmaximize (Mutter.Window window, int x, int y, int width, int height); - public Unity.Testing.Background background { get; set; } public Unity.ExposeManager expose_manager { get; set; } public bool expose_showing { get; } public Mutter.Plugin? plugin { get; set; } + public bool super_key_enable { get; set; } public signal void kill_switch_workspace (Unity.Plugin plugin); public signal void kill_window_effects (Unity.Plugin plugin, Mutter.Window window); public signal void restore_input_region (bool fullscreen); diff --git a/targets/mutter/window-management.c b/targets/mutter/window-management.c index c7088d286..266d03e3d 100644 --- a/targets/mutter/window-management.c +++ b/targets/mutter/window-management.c @@ -52,6 +52,16 @@ typedef struct _UnityPlugin UnityPlugin; typedef struct _UnityPluginClass UnityPluginClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define UNITY_TYPE_EXPOSE_MANAGER (unity_expose_manager_get_type ()) +#define UNITY_EXPOSE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_EXPOSE_MANAGER, UnityExposeManager)) +#define UNITY_EXPOSE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_EXPOSE_MANAGER, UnityExposeManagerClass)) +#define UNITY_IS_EXPOSE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_EXPOSE_MANAGER)) +#define UNITY_IS_EXPOSE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_EXPOSE_MANAGER)) +#define UNITY_EXPOSE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_EXPOSE_MANAGER, UnityExposeManagerClass)) + +typedef struct _UnityExposeManager UnityExposeManager; +typedef struct _UnityExposeManagerClass UnityExposeManagerClass; + struct _UnityWindowManagement { GObject parent_instance; UnityWindowManagementPrivate * priv; @@ -94,6 +104,11 @@ static gint unity_window_management_get_animation_speed (UnityWindowManagement* MutterPlugin* unity_plugin_get_plugin (UnityPlugin* self); static void unity_window_management_window_minimized_completed (UnityWindowManagement* self, ClutterAnimation* anim); static void _unity_window_management_window_minimized_completed_clutter_animation_completed (ClutterAnimation* _sender, gpointer self); +static gboolean unity_window_management_force_activate (UnityWindowManagement* self); +GType unity_expose_manager_get_type (void) G_GNUC_CONST; +UnityExposeManager* unity_plugin_get_expose_manager (UnityPlugin* self); +gboolean unity_expose_manager_get_expose_showing (UnityExposeManager* self); +static gboolean _unity_window_management_force_activate_gsource_func (gpointer self); static void unity_window_management_window_mapped_completed (UnityWindowManagement* self, ClutterAnimation* anim); static void _unity_window_management_window_mapped_completed_clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static void unity_window_management_window_destroyed_completed (UnityWindowManagement* self, ClutterAnimation* anim); @@ -279,6 +294,28 @@ static void unity_window_management_window_minimized_completed (UnityWindowManag } +static gboolean unity_window_management_force_activate (UnityWindowManagement* self) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (MUTTER_IS_WINDOW (self->priv->last_mapped)) { + MetaWindow* w; + MetaDisplay* d; + w = mutter_window_get_meta_window (self->priv->last_mapped); + d = meta_window_get_display (w); + meta_window_activate (mutter_window_get_meta_window (self->priv->last_mapped), meta_display_get_current_time (d)); + } + result = FALSE; + return result; +} + + +static gboolean _unity_window_management_force_activate_gsource_func (gpointer self) { + gboolean result; + result = unity_window_management_force_activate (self); + return result; +} + + static void _unity_window_management_window_mapped_completed_clutter_animation_completed (ClutterAnimation* _sender, gpointer self) { unity_window_management_window_mapped_completed (self, _sender); } @@ -319,6 +356,11 @@ static void unity_window_management_window_mapped (UnityWindowManagement* self, mutter_plugin_map_completed (unity_plugin_get_plugin (self->priv->plugin), window); return; } + if (unity_expose_manager_get_expose_showing (unity_plugin_get_expose_manager (plugin))) { + clutter_actor_set_opacity ((ClutterActor*) window, (guint8) 0); + mutter_plugin_map_completed (unity_plugin_get_plugin (self->priv->plugin), window); + return; + } if (type == META_WINDOW_NORMAL) { _tmp3_ = TRUE; } else { @@ -327,6 +369,7 @@ static void unity_window_management_window_mapped (UnityWindowManagement* self, if (_tmp3_) { meta_window_activate (mutter_window_get_meta_window (window), meta_window_get_user_time (mutter_window_get_meta_window (window))); self->priv->last_mapped = window; + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, _unity_window_management_force_activate_gsource_func, g_object_ref (self), g_object_unref); } anim = NULL; actor = _g_object_ref0 ((_tmp4_ = window, CLUTTER_IS_ACTOR (_tmp4_) ? ((ClutterActor*) _tmp4_) : NULL)); diff --git a/targets/mutter/window-management.vala b/targets/mutter/window-management.vala index c9ddd5e2a..a7a94f1fe 100644 --- a/targets/mutter/window-management.vala +++ b/targets/mutter/window-management.vala @@ -133,6 +133,21 @@ namespace Unity window.hide (); this.plugin.plugin.minimize_completed (window); } + + private bool force_activate () + { + if (this.last_mapped is Mutter.Window) + { + unowned Mutter.MetaWindow w = this.last_mapped.get_meta_window (); + unowned Mutter.MetaDisplay d = Mutter.MetaWindow.get_display (w); + + Mutter.MetaWindow.activate (this.last_mapped.get_meta_window (), + Mutter.MetaDisplay.get_current_time (d)); + } + + return false; + } + private void window_mapped (Plugin plugin, Mutter.Window window) { @@ -147,6 +162,13 @@ namespace Unity this.plugin.plugin.map_completed (window); return; } + + if (plugin.expose_manager.expose_showing) + { + window.opacity = 0; + this.plugin.plugin.map_completed (window); + return; + } if (type == Mutter.MetaWindowType.NORMAL || type == Mutter.MetaWindowType.DIALOG) @@ -155,13 +177,14 @@ namespace Unity Mutter.MetaWindow.get_user_time ( window.get_meta_window ())); this.last_mapped = window; + Timeout.add (0, this.force_activate); } Clutter.Animation anim = null; Clutter.Actor actor = window as Clutter.Actor; actor.opacity = 0; window.show (); - + int speed = get_animation_speed (window); Mutter.MetaRectangle rect = {0, 0, 0, 0}; diff --git a/tests/unit/test-io.c b/tests/unit/test-io.c index 6a7a6d128..141646f11 100644 --- a/tests/unit/test-io.c +++ b/tests/unit/test-io.c @@ -76,7 +76,6 @@ struct _UnityTestsUnitIoSuiteDoTestAsyncFindAndLoadData { guchar* _tmp2_; void* data; gsize data_size; - guchar* _tmp3_; char* sdata; GError * e; GError * _inner_error_; @@ -110,7 +109,6 @@ void unity_tests_unit_io_suite_do_test_async_find_and_load_finish (GAsyncResult* static void unity_tests_unit_io_suite_do_test_async_find_and_load_data_free (gpointer _data); static void unity_tests_unit_io_suite_do_test_async_find_and_load_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static gboolean unity_tests_unit_io_suite_do_test_async_find_and_load_co (UnityTestsUnitIoSuiteDoTestAsyncFindAndLoadData* data); -static guchar* _vala_array_dup1 (guchar* self, int length); static void unity_tests_unit_io_suite_finalize (UnityTestsUnitIOSuite* obj); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); @@ -182,11 +180,6 @@ static void unity_tests_unit_io_suite_do_test_async_find_and_load_ready (GObject } -static guchar* _vala_array_dup1 (guchar* self, int length) { - return g_memdup (self, length * sizeof (guchar)); -} - - static gboolean unity_tests_unit_io_suite_do_test_async_find_and_load_co (UnityTestsUnitIoSuiteDoTestAsyncFindAndLoadData* data) { switch (data->_state_) { case 0: @@ -213,7 +206,7 @@ static gboolean unity_tests_unit_io_suite_do_test_async_find_and_load_co (UnityT g_assert (G_IS_FILE_INPUT_STREAM (data->input)); data->buf = (data->_tmp2_ = g_new0 (guchar, 16), data->buf_length1 = 16, data->_buf_size_ = data->buf_length1, data->_tmp2_); data->_state_ = 2; - unity_io_read_stream_async ((GInputStream*) data->input, (data->_tmp3_ = data->buf, (data->_tmp3_ == NULL) ? ((gpointer) data->_tmp3_) : _vala_array_dup1 (data->_tmp3_, data->buf_length1)), data->buf_length1, (gsize) 16, G_PRIORITY_DEFAULT, NULL, unity_tests_unit_io_suite_do_test_async_find_and_load_ready, data); + unity_io_read_stream_async ((GInputStream*) data->input, data->buf, (gsize) 16, G_PRIORITY_DEFAULT, NULL, unity_tests_unit_io_suite_do_test_async_find_and_load_ready, data); return FALSE; _state_2: unity_io_read_stream_finish (data->_res_, &data->data, &data->data_size, &data->_inner_error_); diff --git a/tools/migrate_favorites.py b/tools/migrate_favorites.py index 19a8a9d69..d8a8081b7 100755 --- a/tools/migrate_favorites.py +++ b/tools/migrate_favorites.py @@ -36,6 +36,9 @@ def get_desktop_dir(): def register_new_app(client, launcher_location, apps_list, priority_position): key_name = 'app-%s' % launcher_location.split('/')[-1] + # remove forbidden key in gconf: + for val in [' ', '+', '\'', '"', '\\', '`', '[', ']', '(', ')', '°', '#', '~', '|', '&']: + key_name = key_name.replace(val, '_') # default distribution launcher don't begin with / and don't have a desktop file in ~/.gnome2 if os.path.exists(launcher_location) and key_name not in apps_list: apps_list.append(key_name) diff --git a/unity-private/launcher/application-controller.c b/unity-private/launcher/application-controller.c index af1fce2be..ee7f3302f 100644 --- a/unity-private/launcher/application-controller.c +++ b/unity-private/launcher/application-controller.c @@ -947,13 +947,14 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc UnityLauncherApplicationController * self; GError * _inner_error_ = NULL; self = (UnityLauncherApplicationController*) base; - unity_shell_hide_unity (unity_global_shell); if (BAMF_IS_APPLICATION (self->priv->app)) { if (bamf_view_is_active ((BamfView*) self->priv->app)) { - GArray* xids; - xids = bamf_application_get_xids (self->priv->app); - unity_shell_expose_xids (unity_global_shell, xids); - _g_array_free0 (xids); + if (unity_shell_get_mode (unity_global_shell) == UNITY_SHELL_MODE_MINIMIZED) { + GArray* xids; + xids = bamf_application_get_xids (self->priv->app); + unity_shell_expose_xids (unity_global_shell, xids); + _g_array_free0 (xids); + } } else { if (bamf_view_is_running ((BamfView*) self->priv->app)) { GList* windows; @@ -986,7 +987,7 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:384: %s", e->message); + g_warning ("application-controller.vala:388: %s", e->message); _g_error_free0 (e); } } @@ -999,6 +1000,7 @@ static void unity_launcher_application_controller_real_activate (UnityLauncherSc } _g_object_unref0 (context); } + unity_shell_hide_unity (unity_global_shell); } @@ -1069,7 +1071,7 @@ void unity_launcher_application_controller_attach_application (UnityLauncherAppl } if (_tmp3_) { char* _tmp4_; - g_warning ("application-controller.vala:411: %s", _tmp4_ = g_strconcat ("Bamf returned null for app.get_name (): ", string_to_string (self->priv->_desktop_file), NULL)); + g_warning ("application-controller.vala:416: %s", _tmp4_ = g_strconcat ("Bamf returned null for app.get_name (): ", string_to_string (self->priv->_desktop_file), NULL)); _g_free0 (_tmp4_); } self->priv->icon_name = (_tmp5_ = bamf_view_get_icon ((BamfView*) self->priv->app), _g_free0 (self->priv->icon_name), _tmp5_); @@ -1147,7 +1149,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:463: could not load desktop file: %s", e->message); + g_warning ("application-controller.vala:468: could not load desktop file: %s", e->message); _g_error_free0 (e); } } @@ -1174,7 +1176,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:473: could not load icon name from desktop" \ + g_warning ("application-controller.vala:478: could not load icon name from desktop" \ " file: %s", e->message); _g_error_free0 (e); } @@ -1202,7 +1204,7 @@ static void unity_launcher_application_controller_load_desktop_file_info (UnityL e = _inner_error_; _inner_error_ = NULL; { - g_warning ("application-controller.vala:482: could not load name from desktop file" \ + g_warning ("application-controller.vala:487: could not load name from desktop file" \ ": %s", e->message); _g_error_free0 (e); } diff --git a/unity-private/launcher/application-controller.vala b/unity-private/launcher/application-controller.vala index 6ab692561..7b79082c0 100644 --- a/unity-private/launcher/application-controller.vala +++ b/unity-private/launcher/application-controller.vala @@ -349,14 +349,18 @@ namespace Unity.Launcher public override void activate () { - global_shell.hide_unity (); - if (app is Bamf.Application) { if (app.is_active ()) { - Array<uint32> xids = app.get_xids (); - global_shell.expose_xids (xids); + /* We only want to do expose if the window was _actually_ + * active i.e. the dash wasn't showing. + */ + if (global_shell.get_mode () == ShellMode.MINIMIZED) + { + Array<uint32> xids = app.get_xids (); + global_shell.expose_xids (xids); + } } else if (app.is_running ()) { @@ -384,6 +388,7 @@ namespace Unity.Launcher warning (e.message); } } + global_shell.hide_unity (); } private bool on_launch_timeout () diff --git a/unity-private/launcher/launcher.c b/unity-private/launcher/launcher.c index 840ccac62..4a4051c49 100644 --- a/unity-private/launcher/launcher.c +++ b/unity-private/launcher/launcher.c @@ -134,6 +134,7 @@ struct _UnityLauncherScrollerView { float friction; gboolean is_animating; ClutterTimeline* fling_timeline; + ClutterTimeline* autoscroll_timeline; }; struct _UnityLauncherScrollerViewClass { @@ -184,8 +185,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 _lambda97_ (UnityLauncherLauncher* self); -static void __lambda97__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self); +static void _lambda99_ (UnityLauncherLauncher* self); +static void __lambda99__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 +369,15 @@ static void unity_launcher_launcher_set_model (UnityLauncherLauncher* self, Unit } -static void _lambda97_ (UnityLauncherLauncher* self) { +static void _lambda99_ (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 __lambda97__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self) { - _lambda97_ (self); +static void __lambda99__clutter_actor_queue_redraw (ClutterActor* _sender, ClutterActor* origin, gpointer self) { + _lambda99_ (self); } @@ -397,7 +398,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) __lambda97__clutter_actor_queue_redraw, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->view, "queue-redraw", (GCallback) __lambda99__clutter_actor_queue_redraw, self, 0); } return obj; } diff --git a/unity-private/launcher/quicklist-check-menu-item.vala b/unity-private/launcher/quicklist-check-menu-item.vala index 9a001de84..0802f38f7 100644 --- a/unity-private/launcher/quicklist-check-menu-item.vala +++ b/unity-private/launcher/quicklist-check-menu-item.vala @@ -203,7 +203,7 @@ namespace Unity.Launcher return true; } - ~QuicklistMenuItem () + ~QuicklistCheckMenuItem () { this.notify["label"].disconnect (this._on_label_changed); this.enter_event.disconnect (this._on_enter); diff --git a/unity-private/launcher/quicklist-controller.c b/unity-private/launcher/quicklist-controller.c index 38446bfb4..4262d7adb 100644 --- a/unity-private/launcher/quicklist-controller.c +++ b/unity-private/launcher/quicklist-controller.c @@ -592,6 +592,7 @@ static void _lambda26_ (DbusmenuMenuitem* top_menu, UnityLauncherApplicationQuic view_menuitem = unity_launcher_application_quicklist_controller_menu_item_from_dbusmenuitem (self, menuitem); if (view_menuitem != NULL) { ctk_menu_prepend ((CtkMenu*) unity_launcher_quicklist_controller_get_view ((UnityLauncherQuicklistController*) self), (ClutterActor*) view_menuitem, FALSE); + g_object_unref ((GObject*) view_menuitem); } _g_object_unref0 (view_menuitem); _g_object_unref0 (menuitem); @@ -600,7 +601,7 @@ static void _lambda26_ (DbusmenuMenuitem* top_menu, UnityLauncherApplicationQuic } menu_items = g_list_reverse (menu_items); } else { - g_warning ("quicklist-controller.vala:237: menu given not a root item"); + g_warning ("quicklist-controller.vala:243: menu given not a root item"); } } } @@ -638,6 +639,7 @@ static void _lambda33_ (DbusmenuMenuitem* bottom_menu, UnityLauncherApplicationQ view_menuitem = unity_launcher_application_quicklist_controller_menu_item_from_dbusmenuitem (self, menuitem); if (view_menuitem != NULL) { ctk_menu_append ((CtkMenu*) unity_launcher_quicklist_controller_get_view ((UnityLauncherQuicklistController*) self), (ClutterActor*) view_menuitem, FALSE); + g_object_unref ((GObject*) view_menuitem); } _g_object_unref0 (view_menuitem); _g_object_unref0 (menuitem); @@ -646,7 +648,7 @@ static void _lambda33_ (DbusmenuMenuitem* bottom_menu, UnityLauncherApplicationQ } _g_object_unref0 (separator); } else { - g_warning ("quicklist-controller.vala:262: menu given not a root item"); + g_warning ("quicklist-controller.vala:272: menu given not a root item"); } } clutter_actor_get_transformed_position ((ClutterActor*) (_tmp0_ = unity_launcher_scroller_child_controller_get_child (unity_launcher_quicklist_controller_get_attached_controller ((UnityLauncherQuicklistController*) self)), CTK_IS_ACTOR (_tmp0_) ? ((CtkActor*) _tmp0_) : NULL), &x, &y); @@ -654,7 +656,7 @@ static void _lambda33_ (DbusmenuMenuitem* bottom_menu, UnityLauncherApplicationQ h = clutter_actor_get_height ((ClutterActor*) (_tmp2_ = unity_launcher_scroller_child_controller_get_child (unity_launcher_quicklist_controller_get_attached_controller ((UnityLauncherQuicklistController*) self)), CTK_IS_ACTOR (_tmp2_) ? ((CtkActor*) _tmp2_) : NULL)); ctk_menu_expandable_compute_style_textures (((UnityLauncherQuicklistController*) self)->menu); ctk_menu_expandable_set_expansion_size_factor (((UnityLauncherQuicklistController*) self)->menu, 0.0f); - ctk_menu_expandable_set_anchor_position (((UnityLauncherQuicklistController*) self)->menu, (x + w) - 9, y + (h / 2.0f), 0); + ctk_menu_expandable_set_anchor_position (((UnityLauncherQuicklistController*) self)->menu, (x + w) - 4, y + (h / 2.0f), 0); clutter_actor_animate ((ClutterActor*) ((UnityLauncherQuicklistController*) self)->menu, (gulong) CLUTTER_LINEAR, (guint) 100, "expansion-size-factor", 1.0f, NULL); } @@ -858,6 +860,11 @@ static CtkMenuItem* unity_launcher_application_quicklist_controller_menu_item_fr _data10_->_ref_count_ = 1; _data10_->self = g_object_ref (self); _data10_->dbusmenuitem = _g_object_ref0 (dbusmenuitem); + if (dbusmenu_menuitem_property_get_bool (_data10_->dbusmenuitem, DBUSMENU_MENUITEM_PROP_VISIBLE) == FALSE) { + result = NULL; + block10_data_unref (_data10_); + return result; + } label = g_strdup ("UNDEFINED"); label = (_tmp0_ = g_strdup (dbusmenu_menuitem_property_get (_data10_->dbusmenuitem, DBUSMENU_MENUITEM_PROP_LABEL)), _g_free0 (label), _tmp0_); type = g_strdup ("label"); @@ -910,7 +917,7 @@ static CtkMenuItem* unity_launcher_application_quicklist_controller_menu_item_fr CtkMenuItem* _tmp11_; _data10_->menuitem = (_tmp11_ = (CtkMenuItem*) g_object_ref_sink (unity_launcher_quicklist_menu_seperator_new ()), _g_object_unref0 (_data10_->menuitem), _tmp11_); } else { - g_warning ("quicklist-controller.vala:354: not a menu item we understand, %s", dbusmenu_menuitem_property_get (_data10_->dbusmenuitem, "type")); + g_warning ("quicklist-controller.vala:370: not a menu item we understand, %s", dbusmenu_menuitem_property_get (_data10_->dbusmenuitem, "type")); result = NULL; _g_free0 (check_type); _g_free0 (type); diff --git a/unity-private/launcher/quicklist-controller.vala b/unity-private/launcher/quicklist-controller.vala index 15ef188a7..1c1be144c 100644 --- a/unity-private/launcher/quicklist-controller.vala +++ b/unity-private/launcher/quicklist-controller.vala @@ -201,14 +201,14 @@ namespace Unity.Launcher if(menu.get_num_items() == 0) { - // It can happen that the quicklist menu is requested and the menu was not previously filled with a label. + // It can happen that the quicklist menu is requested and the menu was not previously filled with a label. // In this case we fill the menu with the label first. string label = attached_controller.name; var menuitem = new QuicklistMenuItem.with_label (label); menuitem.reactive = false; menu.append (menuitem, false); } - + menu.close_on_leave = false; menu.set_detect_clicks (true); // grab the top menu @@ -227,8 +227,14 @@ namespace Unity.Launcher foreach (Dbusmenu.Menuitem menuitem in menu_items) { var view_menuitem = menu_item_from_dbusmenuitem (menuitem); + if (view_menuitem != null) - get_view ().prepend (view_menuitem, false); + { + get_view ().prepend (view_menuitem, false); + // Items returned from menu_item_from_dbusmenuitem have an extra reference + // stopping them from being properly deleted. Remove that reference here. + view_menuitem.unref (); + } } menu_items.reverse (); } @@ -251,9 +257,13 @@ namespace Unity.Launcher foreach (Dbusmenu.Menuitem menuitem in menu_items) { var view_menuitem = menu_item_from_dbusmenuitem (menuitem); + if (view_menuitem != null) { get_view ().append (view_menuitem, false); + // Items returned from menu_item_from_dbusmenuitem have an extra reference + // stopping them from being properly deleted. Remove that reference here. + view_menuitem.unref (); } } } @@ -271,7 +281,7 @@ namespace Unity.Launcher h = (attached_controller.child as Ctk.Actor).get_height(); menu.compute_style_textures (); menu.set_expansion_size_factor (0.0f); - menu.set_anchor_position (x + w - 9, y + h/2.0f, 0); + menu.set_anchor_position (x + w - 4, y + h/2.0f, 0); menu.animate (Clutter.AnimationMode.LINEAR, 100, "expansion-size-factor", 1.0f); @@ -282,6 +292,12 @@ namespace Unity.Launcher private Ctk.MenuItem? menu_item_from_dbusmenuitem (Dbusmenu.Menuitem dbusmenuitem) { + // we should really add the item anyway and make it hidden, but its late in + // the cycle and any action will close the menu anyway. hopefully this won't + // be to visible a problem + if (dbusmenuitem.property_get_bool (Dbusmenu.MENUITEM_PROP_VISIBLE) == false) + return null; + string label = "UNDEFINED"; label = dbusmenuitem.property_get (Dbusmenu.MENUITEM_PROP_LABEL); string type = "label"; diff --git a/unity-private/launcher/quicklist-image-menu-item.vala b/unity-private/launcher/quicklist-image-menu-item.vala index 566b9b63b..3b7bf9ca1 100644 --- a/unity-private/launcher/quicklist-image-menu-item.vala +++ b/unity-private/launcher/quicklist-image-menu-item.vala @@ -200,7 +200,7 @@ namespace Unity.Launcher return true; } - ~QuicklistMenuItem () + ~QuicklistImageMenuItem () { this.notify["label"].disconnect (this._on_label_changed); this.enter_event.disconnect (this._on_enter); diff --git a/unity-private/launcher/quicklist-menu-item.c b/unity-private/launcher/quicklist-menu-item.c index 680ee2171..dcbe79ff5 100644 --- a/unity-private/launcher/quicklist-menu-item.c +++ b/unity-private/launcher/quicklist-menu-item.c @@ -82,6 +82,7 @@ static void unity_launcher_quicklist_menu_item_real_get_preferred_width (Clutter #define UNITY_LAUNCHER_ITEM_INDENT_ABS 20.0f static void unity_launcher_quicklist_menu_item_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static gboolean _unity_launcher_quicklist_menu_item_update_item_background (UnityLauncherQuicklistMenuItem* self); +static gboolean __unity_launcher_quicklist_menu_item_update_item_background_gsource_func (gpointer self); char* utils_strip_characters (const char* text, const char* replace_text, const char* match_regex, const char* replace_regex); static gboolean _unity_launcher_quicklist_menu_item_on_enter (UnityLauncherQuicklistMenuItem* self, ClutterEvent* event); static gboolean _unity_launcher_quicklist_menu_item_on_leave (UnityLauncherQuicklistMenuItem* self, ClutterEvent* event); @@ -140,6 +141,13 @@ static void unity_launcher_quicklist_menu_item_real_get_preferred_width (Clutter } +static gboolean __unity_launcher_quicklist_menu_item_update_item_background_gsource_func (gpointer self) { + gboolean result; + result = _unity_launcher_quicklist_menu_item_update_item_background (self); + return result; +} + + static void unity_launcher_quicklist_menu_item_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags) { UnityLauncherQuicklistMenuItem * self; gint new_width; @@ -161,7 +169,7 @@ static void unity_launcher_quicklist_menu_item_real_allocate (ClutterActor* base } self->priv->last_width = new_width; self->priv->last_height = new_height; - _unity_launcher_quicklist_menu_item_update_item_background (self); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __unity_launcher_quicklist_menu_item_update_item_background_gsource_func, g_object_ref (self), g_object_unref); } diff --git a/unity-private/launcher/quicklist-menu-item.vala b/unity-private/launcher/quicklist-menu-item.vala index e761543c0..5f8cb6ffa 100644 --- a/unity-private/launcher/quicklist-menu-item.vala +++ b/unity-private/launcher/quicklist-menu-item.vala @@ -84,8 +84,7 @@ namespace Unity.Launcher last_width = new_width; last_height = new_height; - _update_item_background (); // removed the timeout because it was causing a frame of lag - //Timeout.add (0, _update_item_background); + Timeout.add (0, _update_item_background); } private bool diff --git a/unity-private/launcher/quicklist-radio-menu-item.vala b/unity-private/launcher/quicklist-radio-menu-item.vala index dac90fcc6..592944f3f 100644 --- a/unity-private/launcher/quicklist-radio-menu-item.vala +++ b/unity-private/launcher/quicklist-radio-menu-item.vala @@ -201,7 +201,7 @@ namespace Unity.Launcher return true; } - ~QuicklistMenuItem () + ~QuicklistRadioMenuItem () { this.notify["label"].disconnect (this._on_label_changed); this.enter_event.disconnect (this._on_enter); diff --git a/unity-private/launcher/quicklist-seperator-menu-item.c b/unity-private/launcher/quicklist-seperator-menu-item.c index a281de0bd..d55e02316 100644 --- a/unity-private/launcher/quicklist-seperator-menu-item.c +++ b/unity-private/launcher/quicklist-seperator-menu-item.c @@ -232,6 +232,11 @@ static void unity_launcher_quicklist_menu_seperator_instance_init (UnityLauncher static void unity_launcher_quicklist_menu_seperator_finalize (GObject* obj) { UnityLauncherQuicklistMenuSeperator * self; self = UNITY_LAUNCHER_QUICKLIST_MENU_SEPERATOR (obj); + { + if (CLUTTER_IS_ACTOR (self->priv->seperator_background)) { + clutter_actor_unparent ((ClutterActor*) self->priv->seperator_background); + } + } _g_object_unref0 (self->priv->seperator_background); G_OBJECT_CLASS (unity_launcher_quicklist_menu_seperator_parent_class)->finalize (obj); } diff --git a/unity-private/launcher/quicklist-seperator-menu-item.vala b/unity-private/launcher/quicklist-seperator-menu-item.vala index 10f8b911d..600942364 100644 --- a/unity-private/launcher/quicklist-seperator-menu-item.vala +++ b/unity-private/launcher/quicklist-seperator-menu-item.vala @@ -122,6 +122,12 @@ namespace Unity.Launcher return false; } + ~QuicklistMenuSeperator () + { + if (this.seperator_background is Clutter.Actor) + this.seperator_background.unparent (); + } + construct { Ctk.Padding padding = Ctk.Padding () { diff --git a/unity-private/launcher/scroller-controller.c b/unity-private/launcher/scroller-controller.c index 63062c2c5..549749a4c 100644 --- a/unity-private/launcher/scroller-controller.c +++ b/unity-private/launcher/scroller-controller.c @@ -255,10 +255,10 @@ 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 _lambda95_ (UnityLauncherScrollerController* self); +static gboolean _lambda97_ (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 __lambda95__gsource_func (gpointer self); +static gboolean __lambda97__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); @@ -272,14 +272,14 @@ UnityLauncherApplicationController* unity_launcher_application_controller_constr 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 _lambda96_ (Block12Data* _data12_); +static void _lambda98_ (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 __lambda96__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void __lambda98__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); @@ -388,7 +388,7 @@ static void unity_launcher_scroller_controller_on_super_key_modifier_release (Un } -static gboolean _lambda95_ (UnityLauncherScrollerController* self) { +static gboolean _lambda97_ (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; @@ -396,9 +396,9 @@ static gboolean _lambda95_ (UnityLauncherScrollerController* self) { } -static gboolean __lambda95__gsource_func (gpointer self) { +static gboolean __lambda97__gsource_func (gpointer self) { gboolean result; - result = _lambda95_ (self); + result = _lambda97_ (self); return result; } @@ -412,7 +412,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, __lambda95__gsource_func, g_object_ref (self), g_object_unref); + self->priv->super_key_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda97__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); @@ -433,7 +433,7 @@ static void _unity_launcher_scroller_controller_on_scroller_controller_closed_un } -static void _lambda96_ (Block12Data* _data12_) { +static void _lambda98_ (Block12Data* _data12_) { UnityLauncherScrollerController * self; gboolean _tmp0_ = FALSE; self = _data12_->self; @@ -465,8 +465,8 @@ static void _lambda96_ (Block12Data* _data12_) { } -static void __lambda96__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda96_ (self); +static void __lambda98__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda98_ (self); } @@ -526,7 +526,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) __lambda96__g_object_notify, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0); + g_signal_connect_data ((GObject*) _data12_->controller, "notify::hide", (GCallback) __lambda98__g_object_notify, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0); _g_object_unref0 (child); } _g_free0 (desktop_file); @@ -875,6 +875,8 @@ static void unity_launcher_scroller_controller_on_unity_drag_motion (UnityLaunch } } else { gint model_index; + UnityLauncherScrollerChild* _tmp9_; + gboolean _tmp10_; if (UNITY_LAUNCHER_IS_SCROLLER_CHILD (retcont)) { if (unity_launcher_scroller_child_get_enable_close_state (retcont) == TRUE) { unity_launcher_scroller_child_set_enable_close_state (retcont, FALSE); @@ -906,6 +908,11 @@ static void unity_launcher_scroller_controller_on_unity_drag_motion (UnityLaunch _g_object_unref0 (drag_controller); return; } + if ((_tmp10_ = unity_launcher_scroller_child_get_group_type (_tmp9_ = unity_launcher_scroller_model_get (self->priv->_model, model_index)) != UNITY_LAUNCHER_SCROLLER_CHILD_GROUP_TYPE_APPLICATION, _g_object_unref0 (_tmp9_), _tmp10_)) { + _g_object_unref0 (retcont); + _g_object_unref0 (drag_controller); + return; + } if (unity_launcher_scroller_model_contains (self->priv->_model, retcont)) { unity_launcher_scroller_model_move (self->priv->_model, retcont, MAX (model_index, 0)); } else { diff --git a/unity-private/launcher/scroller-controller.vala b/unity-private/launcher/scroller-controller.vala index 833338dfa..380d14f87 100644 --- a/unity-private/launcher/scroller-controller.vala +++ b/unity-private/launcher/scroller-controller.vala @@ -82,7 +82,7 @@ namespace Unity.Launcher var childcontroller = get_controller_for_view (model[index]); if (childcontroller is ScrollerChildController) - { + { childcontroller.activate (); } else @@ -344,7 +344,6 @@ namespace Unity.Launcher { if (retcont is ScrollerChild) { - if (retcont.enable_close_state == true) { retcont.enable_close_state = false; @@ -370,6 +369,8 @@ namespace Unity.Launcher int model_index = view.get_model_index_at_y_pos_no_anim (y - 24, true); if (model_index < 0) return; + if (model[model_index].group_type != ScrollerChild.GroupType.APPLICATION) + return; //we have to check to see if we would still be over the index //if it was done animating diff --git a/unity-private/launcher/scroller-view.c b/unity-private/launcher/scroller-view.c index 77aedca8e..a3c74f3a7 100644 --- a/unity-private/launcher/scroller-view.c +++ b/unity-private/launcher/scroller-view.c @@ -187,6 +187,7 @@ struct _UnityLauncherScrollerView { float friction; gboolean is_animating; ClutterTimeline* fling_timeline; + ClutterTimeline* autoscroll_timeline; }; struct _UnityLauncherScrollerViewClass { @@ -233,6 +234,7 @@ struct _UnityLauncherScrollerViewPrivate { GeeArrayList* child_refs; ClutterActor* last_picked_actor; float last_scroll_position; + guint autoscroll_stored_delta; guint queue_contract_launcher; UnityLauncherQuicklistController* attached_menu; float autoscroll_mouse_pos_cache; @@ -379,10 +381,9 @@ static void __lambda84__clutter_animation_completed (ClutterAnimation* _sender, 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_autoscroll_frame (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); 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 _lambda85_ (UnityLauncherScrollerView* self); -static gboolean __lambda85__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); @@ -406,8 +407,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 _lambda86_ (UnityLauncherScrollerView* self); -static gboolean __lambda86__gsource_func (gpointer self); +static gboolean _lambda85_ (UnityLauncherScrollerView* self); +static gboolean __lambda85__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); @@ -447,22 +448,29 @@ 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 _lambda86_ (UnityLauncherScrollerView* self); +static void __lambda86__clutter_timeline_started (ClutterTimeline* _sender, gpointer self); static void _lambda87_ (UnityLauncherScrollerView* self); -static void __lambda87__clutter_timeline_started (ClutterTimeline* _sender, gpointer self); -static void _lambda88_ (UnityLauncherScrollerView* self); -static gboolean _lambda89_ (UnityLauncherScrollerView* self); -static gboolean __lambda89__gsource_func (gpointer self); -static void __lambda88__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self); +static gboolean _lambda88_ (UnityLauncherScrollerView* self); +static gboolean __lambda88__gsource_func (gpointer self); +static void __lambda87__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self); +static void _unity_launcher_scroller_view_on_autoscroll_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); +static void _lambda89_ (UnityLauncherScrollerView* self); +static void __lambda89__clutter_timeline_started (ClutterTimeline* _sender, gpointer self); static void _lambda90_ (UnityLauncherScrollerView* self); -static void __lambda90__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); -static void _lambda91_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self); -static gboolean _lambda92_ (UnityLauncherScrollerView* self); -static gboolean __lambda92__gsource_func (gpointer self); -static void __lambda91__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); -static void _lambda93_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self); -static void __lambda93__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); +static gboolean _lambda91_ (UnityLauncherScrollerView* self); +static gboolean __lambda91__gsource_func (gpointer self); +static void __lambda90__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self); +static void _lambda92_ (UnityLauncherScrollerView* self); +static void __lambda92__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); +static void _lambda93_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self); static gboolean _lambda94_ (UnityLauncherScrollerView* self); static gboolean __lambda94__gsource_func (gpointer self); +static void __lambda93__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); +static void _lambda95_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self); +static void __lambda95__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self); +static gboolean _lambda96_ (UnityLauncherScrollerView* self); +static gboolean __lambda96__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); @@ -1612,6 +1620,12 @@ static void unity_launcher_scroller_view_model_child_removed (UnityLauncherScrol _data13_->_ref_count_ = 1; _data13_->self = g_object_ref (self); _data13_->child = _g_object_ref0 (child); + if (gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->draw_btf, _data13_->child)) { + gee_abstract_collection_remove ((GeeAbstractCollection*) self->priv->draw_btf, _data13_->child); + } + if (gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->draw_ftb, _data13_->child)) { + gee_abstract_collection_remove ((GeeAbstractCollection*) self->priv->draw_ftb, _data13_->child); + } drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); if (unity_drag_controller_get_is_dragging (drag_controller)) { unity_launcher_scroller_view_order_children (self, FALSE); @@ -1638,18 +1652,36 @@ static void unity_launcher_scroller_view_model_order_changed (UnityLauncherScrol } -static gboolean _lambda85_ (UnityLauncherScrollerView* self) { - gboolean result = FALSE; - float speed; +static void unity_launcher_scroller_view_on_autoscroll_frame (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs) { + guint delta; ClutterEvent _tmp0_ = {0}; ClutterEvent motion_event; ClutterActor* _tmp1_; - speed = 12.0f - fabsf (self->priv->autoscroll_mouse_pos_cache); - speed = speed / 12.0f; - speed = speed * ((float) 30); - speed = speed * ((float) self->priv->autoscroll_direction); - unity_launcher_scroller_view_move_scroll_position (self, speed, TRUE, 160.0f); - self->priv->autoscroll_anim_active = self->priv->_is_autoscrolling; + g_return_if_fail (self != NULL); + g_return_if_fail (timeline != NULL); + delta = clutter_timeline_get_delta (timeline); + delta = delta + self->priv->autoscroll_stored_delta; + if (delta <= 16) { + self->priv->autoscroll_stored_delta = delta; + return; + } + while (TRUE) { + float speed; + if (!(delta > 33)) { + break; + } + delta = delta - ((guint) 33); + speed = 0.0f; + if (self->priv->autoscroll_mouse_pos_cache < 0) { + speed = fabsf ((-12) - self->priv->autoscroll_mouse_pos_cache); + } else { + speed = 12.0f - fabsf (self->priv->autoscroll_mouse_pos_cache); + } + speed = speed / 12.0f; + speed = speed * ((float) 30); + speed = speed * ((float) self->priv->autoscroll_direction); + unity_launcher_scroller_view_move_scroll_position (self, speed, TRUE, 160.0f); + } motion_event = (_tmp0_.type = 0, _tmp0_); motion_event.type = CLUTTER_MOTION; motion_event.motion.x = self->priv->last_known_x; @@ -1657,28 +1689,30 @@ static gboolean _lambda85_ (UnityLauncherScrollerView* self) { motion_event.motion.stage = (_tmp1_ = clutter_actor_get_stage ((ClutterActor*) self), CLUTTER_IS_STAGE (_tmp1_) ? ((ClutterStage*) _tmp1_) : NULL); motion_event.motion.flags = CLUTTER_EVENT_FLAG_SYNTHETIC; unity_launcher_scroller_view_passthrough_motion_event (self, &motion_event); - result = self->priv->_is_autoscrolling; - return result; -} - - -static gboolean __lambda85__gsource_func (gpointer self) { - gboolean result; - result = _lambda85_ (self); - return result; + self->priv->autoscroll_stored_delta = delta; } static void unity_launcher_scroller_view_on_auto_scrolling_state_change (UnityLauncherScrollerView* self) { gboolean _tmp0_ = FALSE; g_return_if_fail (self != NULL); - if (self->priv->autoscroll_anim_active == FALSE) { + if (clutter_timeline_is_playing (self->autoscroll_timeline) == FALSE) { _tmp0_ = self->priv->_is_autoscrolling; } else { _tmp0_ = FALSE; } if (_tmp0_) { - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 33, __lambda85__gsource_func, g_object_ref (self), g_object_unref); + clutter_timeline_start (self->autoscroll_timeline); + } else { + gboolean _tmp1_ = FALSE; + if (clutter_timeline_is_playing (self->autoscroll_timeline)) { + _tmp1_ = self->priv->_is_autoscrolling == FALSE; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + clutter_timeline_stop (self->autoscroll_timeline); + } } } @@ -2111,7 +2145,7 @@ static void unity_launcher_scroller_view_do_anim_settle (UnityLauncherScrollerVi } -static gboolean _lambda86_ (UnityLauncherScrollerView* self) { +static gboolean _lambda85_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_SETTLING; self->priv->settle_position = unity_launcher_scroller_view_get_aligned_settle_position (self); @@ -2121,9 +2155,9 @@ static gboolean _lambda86_ (UnityLauncherScrollerView* self) { } -static gboolean __lambda86__gsource_func (gpointer self) { +static gboolean __lambda85__gsource_func (gpointer self) { gboolean result; - result = _lambda86_ (self); + result = _lambda85_ (self); return result; } @@ -2137,7 +2171,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, __lambda86__gsource_func, g_object_ref (self), g_object_unref); + self->priv->fling_timeout_source = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, __lambda85__gsource_func, g_object_ref (self), g_object_unref); } } @@ -3104,17 +3138,17 @@ static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new } -static void _lambda87_ (UnityLauncherScrollerView* self) { +static void _lambda86_ (UnityLauncherScrollerView* self) { ctk_effect_cache_invalidate_texture_cache (self->priv->_cache); } -static void __lambda87__clutter_timeline_started (ClutterTimeline* _sender, gpointer self) { - _lambda87_ (self); +static void __lambda86__clutter_timeline_started (ClutterTimeline* _sender, gpointer self) { + _lambda86_ (self); } -static gboolean _lambda89_ (UnityLauncherScrollerView* self) { +static gboolean _lambda88_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; ctk_effect_cache_update_texture_cache (self->priv->_cache); result = FALSE; @@ -3122,25 +3156,66 @@ static gboolean _lambda89_ (UnityLauncherScrollerView* self) { } -static gboolean __lambda89__gsource_func (gpointer self) { +static gboolean __lambda88__gsource_func (gpointer self) { gboolean result; - result = _lambda89_ (self); + result = _lambda88_ (self); return result; } -static void _lambda88_ (UnityLauncherScrollerView* self) { - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda89__gsource_func, g_object_ref (self), g_object_unref); +static void _lambda87_ (UnityLauncherScrollerView* self) { + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda88__gsource_func, g_object_ref (self), g_object_unref); +} + + +static void __lambda87__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) { + _lambda87_ (self); +} + + +static void _unity_launcher_scroller_view_on_autoscroll_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self) { + unity_launcher_scroller_view_on_autoscroll_frame (self, _sender, msecs); +} + + +static void _lambda89_ (UnityLauncherScrollerView* self) { + ctk_effect_cache_invalidate_texture_cache (self->priv->_cache); } -static void __lambda88__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) { - _lambda88_ (self); +static void __lambda89__clutter_timeline_started (ClutterTimeline* _sender, gpointer self) { + _lambda89_ (self); +} + + +static gboolean _lambda91_ (UnityLauncherScrollerView* self) { + gboolean result = FALSE; + ctk_effect_cache_update_texture_cache (self->priv->_cache); + result = FALSE; + return result; +} + + +static gboolean __lambda91__gsource_func (gpointer self) { + gboolean result; + result = _lambda91_ (self); + return result; } static void _lambda90_ (UnityLauncherScrollerView* self) { + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda91__gsource_func, g_object_ref (self), g_object_unref); +} + + +static void __lambda90__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) { + _lambda90_ (self); +} + + +static void _lambda92_ (UnityLauncherScrollerView* self) { guint _tmp0_; + unity_shell_remove_fullscreen_request (unity_global_shell, (GObject*) self); self->priv->is_scrolling = FALSE; self->priv->button_down = FALSE; unity_launcher_disable_quicklists = TRUE; @@ -3153,25 +3228,25 @@ static void _lambda90_ (UnityLauncherScrollerView* self) { } -static void __lambda90__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { - _lambda90_ (self); +static void __lambda92__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self) { + _lambda92_ (self); } -static gboolean _lambda92_ (UnityLauncherScrollerView* self) { +static gboolean _lambda94_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; unity_launcher_scroller_view_order_children (self, FALSE); } -static gboolean __lambda92__gsource_func (gpointer self) { +static gboolean __lambda94__gsource_func (gpointer self) { gboolean result; - result = _lambda92_ (self); + result = _lambda94_ (self); return result; } -static void _lambda91_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self) { +static void _lambda93_ (UnityDragModel* drag_model, float x, float y, UnityLauncherScrollerView* self) { g_return_if_fail (drag_model != NULL); unity_launcher_disable_quicklists = FALSE; { @@ -3191,18 +3266,18 @@ static void _lambda91_ (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, __lambda92__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda94__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 __lambda91__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { - _lambda91_ (model, x, y, self); +static void __lambda93__unity_drag_controller_drag_drop (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { + _lambda93_ (model, x, y, self); } -static void _lambda93_ (UnityDragModel* model, float x, float y, UnityLauncherScrollerView* self) { +static void _lambda95_ (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))) { @@ -3213,21 +3288,21 @@ static void _lambda93_ (UnityDragModel* model, float x, float y, UnityLauncherSc } -static void __lambda93__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { - _lambda93_ (model, x, y, self); +static void __lambda95__unity_drag_controller_drag_motion (UnityDragController* _sender, UnityDragModel* model, float x, float y, gpointer self) { + _lambda95_ (model, x, y, self); } -static gboolean _lambda94_ (UnityLauncherScrollerView* self) { +static gboolean _lambda96_ (UnityLauncherScrollerView* self) { gboolean result = FALSE; unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); } -static gboolean __lambda94__gsource_func (gpointer self) { +static gboolean __lambda96__gsource_func (gpointer self) { gboolean result; - result = _lambda94_ (self); + result = _lambda96_ (self); return result; } @@ -3247,8 +3322,9 @@ static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_c ClutterColor _tmp3_ = {0}; ClutterColor color; ClutterTimeline* _tmp4_; + ClutterTimeline* _tmp5_; UnityDragController* drag_controller; - GeeArrayList* _tmp5_; + GeeArrayList* _tmp6_; g_signal_connect_object ((ClutterActor*) self, "motion-event", (GCallback) _unity_launcher_scroller_view_passthrough_motion_event_clutter_actor_motion_event, self, 0); g_signal_connect_object ((ClutterActor*) self, "button-press-event", (GCallback) _unity_launcher_scroller_view_passthrough_button_press_event_clutter_actor_button_press_event, self, 0); g_signal_connect_object ((ClutterActor*) self, "button-release-event", (GCallback) _unity_launcher_scroller_view_passthrough_button_release_event_clutter_actor_button_release_event, self, 0); @@ -3294,17 +3370,22 @@ 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) __lambda87__clutter_timeline_started, self, 0); - g_signal_connect_object (self->fling_timeline, "completed", (GCallback) __lambda88__clutter_timeline_completed, self, 0); + g_signal_connect_object (self->fling_timeline, "started", (GCallback) __lambda86__clutter_timeline_started, self, 0); + g_signal_connect_object (self->fling_timeline, "completed", (GCallback) __lambda87__clutter_timeline_completed, self, 0); + self->autoscroll_timeline = (_tmp5_ = clutter_timeline_new ((guint) 1000), _g_object_unref0 (self->autoscroll_timeline), _tmp5_); + clutter_timeline_set_loop (self->autoscroll_timeline, TRUE); + g_signal_connect_object (self->autoscroll_timeline, "new-frame", (GCallback) _unity_launcher_scroller_view_on_autoscroll_frame_clutter_timeline_new_frame, self, 0); + g_signal_connect_object (self->autoscroll_timeline, "started", (GCallback) __lambda89__clutter_timeline_started, self, 0); + g_signal_connect_object (self->autoscroll_timeline, "completed", (GCallback) __lambda90__clutter_timeline_completed, self, 0); drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); - g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda90__unity_drag_controller_drag_start, self, 0); - g_signal_connect_object (drag_controller, "drag-drop", (GCallback) __lambda91__unity_drag_controller_drag_drop, self, 0); - g_signal_connect_object (drag_controller, "drag-motion", (GCallback) __lambda93__unity_drag_controller_drag_motion, self, 0); + g_signal_connect_object (drag_controller, "drag-start", (GCallback) __lambda92__unity_drag_controller_drag_start, self, 0); + g_signal_connect_object (drag_controller, "drag-drop", (GCallback) __lambda93__unity_drag_controller_drag_drop, self, 0); + g_signal_connect_object (drag_controller, "drag-motion", (GCallback) __lambda95__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_); + self->priv->child_refs = (_tmp6_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->child_refs), _tmp6_); unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda94__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda96__gsource_func, g_object_ref (self), g_object_unref); unity_launcher_scroller_view_set_drag_indicator_space (self, FALSE); _g_object_unref0 (drag_controller); } @@ -3367,6 +3448,7 @@ static void unity_launcher_scroller_view_instance_init (UnityLauncherScrollerVie self->priv->focused_launcher = 0; self->priv->last_picked_actor = NULL; self->priv->last_scroll_position = 0.0f; + self->priv->autoscroll_stored_delta = (guint) 0; self->priv->queue_contract_launcher = (guint) 0; self->priv->attached_menu = NULL; self->priv->autoscroll_mouse_pos_cache = 0.0f; @@ -3382,6 +3464,7 @@ static void unity_launcher_scroller_view_finalize (GObject* obj) { _g_object_unref0 (self->priv->bgtex); _g_object_unref0 (self->priv->top_shadow); _g_object_unref0 (self->fling_timeline); + _g_object_unref0 (self->autoscroll_timeline); _g_object_unref0 (self->priv->draw_ftb); _g_object_unref0 (self->priv->draw_btf); _g_object_unref0 (self->priv->keyboard_indicators); diff --git a/unity-private/launcher/scroller-view.vala b/unity-private/launcher/scroller-view.vala index 89e1a6dff..28dc8625f 100644 --- a/unity-private/launcher/scroller-view.vala +++ b/unity-private/launcher/scroller-view.vala @@ -100,6 +100,8 @@ namespace Unity.Launcher public Clutter.Timeline fling_timeline; + public Clutter.Timeline autoscroll_timeline; + private float previous_y_position = 0.0f; // the last known y position of the pointer private uint previous_y_time = 0; // the time (ms) that previous_y_position was set private uint stored_delta = 0; @@ -191,9 +193,25 @@ namespace Unity.Launcher }); }); + // set a timeline for our auto-scroll animation + autoscroll_timeline = new Clutter.Timeline (1000); + autoscroll_timeline.loop = true; + autoscroll_timeline.new_frame.connect (this.on_autoscroll_frame); + autoscroll_timeline.started.connect (() => { + cache.invalidate_texture_cache (); + }); + + autoscroll_timeline.completed.connect (() => { + Timeout.add (0, () => { + cache.update_texture_cache (); + return false; + }); + }); + //on drag start we need to disengage our own drag attempts var drag_controller = Drag.Controller.get_default (); drag_controller.drag_start.connect (() => { + Unity.global_shell.remove_fullscreen_request (this); is_scrolling = false; button_down = false; Unity.Launcher.disable_quicklists = true; @@ -838,6 +856,9 @@ namespace Unity.Launcher private void model_child_removed (ScrollerChild child) { + if (child in draw_btf) draw_btf.remove (child); + if (child in draw_ftb) draw_ftb.remove (child); + var drag_controller = Drag.Controller.get_default (); if (drag_controller.is_dragging) { @@ -870,29 +891,57 @@ namespace Unity.Launcher queue_relayout (); } - private void on_auto_scrolling_state_change () + private uint autoscroll_stored_delta = 0; + private void on_autoscroll_frame (Clutter.Timeline timeline, int msecs) { - if (autoscroll_anim_active == false && is_autoscrolling) - { - Timeout.add (33, () => { - float speed = 12.0f - Math.fabsf (autoscroll_mouse_pos_cache); + /* using a clutter animation to handle auto-scroll now + * doesn't fit the formula from design properly but thats just a fact + * of the animation systems being different + */ + uint delta = timeline.get_delta (); + delta += autoscroll_stored_delta; + if (delta <= 16) + { + autoscroll_stored_delta = delta; + return; + } + + while (delta > 33) + { + delta -= 33; + float speed = 0.0f; + if (autoscroll_mouse_pos_cache < 0) + speed = Math.fabsf (-12 - autoscroll_mouse_pos_cache); + else + speed = 12.0f - Math.fabsf (autoscroll_mouse_pos_cache); + speed /= 12.0f; speed *= 30; speed *= autoscroll_direction; move_scroll_position (speed, true); - autoscroll_anim_active = is_autoscrolling; + } - Clutter.Event motion_event = { 0 }; - motion_event.type = Clutter.EventType.MOTION; - motion_event.motion.x = last_known_x; - motion_event.motion.y = last_known_y; - motion_event.motion.stage = get_stage () as Clutter.Stage; - motion_event.motion.flags = Clutter.EventFlags.FLAG_SYNTHETIC; - passthrough_motion_event (motion_event); + Clutter.Event motion_event = { 0 }; + motion_event.type = Clutter.EventType.MOTION; + motion_event.motion.x = last_known_x; + motion_event.motion.y = last_known_y; + motion_event.motion.stage = get_stage () as Clutter.Stage; + motion_event.motion.flags = Clutter.EventFlags.FLAG_SYNTHETIC; + passthrough_motion_event (motion_event); - return is_autoscrolling; - }); - } + autoscroll_stored_delta = delta; + } + + private void on_auto_scrolling_state_change () + { + if (autoscroll_timeline.is_playing () == false && is_autoscrolling) + { + autoscroll_timeline.start (); + } + else if (autoscroll_timeline.is_playing () && is_autoscrolling == false) + { + autoscroll_timeline.stop (); + } } /* diff --git a/unity-private/launcher/scrollerchild.c b/unity-private/launcher/scrollerchild.c index ee3d29b9e..bc1563734 100644 --- a/unity-private/launcher/scrollerchild.c +++ b/unity-private/launcher/scrollerchild.c @@ -209,6 +209,7 @@ static gboolean _unity_launcher_scroller_child_check_continue_wiggle_gsource_fun GdkPixbuf* unity_launcher_scroller_child_get_icon (UnityLauncherScrollerChild* self); float unity_launcher_scroller_child_get_rotation (UnityLauncherScrollerChild* self); gboolean unity_launcher_scroller_child_get_activating (UnityLauncherScrollerChild* self); +void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value); static void unity_launcher_scroller_child_real_get_preferred_width (ClutterActor* base, float for_height, float* minimum_width, float* natural_width); static void unity_launcher_scroller_child_real_get_preferred_height (ClutterActor* base, float for_width, float* minimum_height, float* natural_height); static void unity_launcher_scroller_child_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); @@ -221,7 +222,6 @@ void unity_launcher_scroller_child_set_position (UnityLauncherScrollerChild* sel void unity_launcher_scroller_child_set_running (UnityLauncherScrollerChild* self, gboolean value); void unity_launcher_scroller_child_set_active (UnityLauncherScrollerChild* self, gboolean value); void unity_launcher_scroller_child_set_needs_attention (UnityLauncherScrollerChild* self, gboolean value); -void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value); void unity_launcher_scroller_child_set_enable_close_state (UnityLauncherScrollerChild* self, gboolean value); UnityLauncherScrollerChildGroupType unity_launcher_scroller_child_get_group_type (UnityLauncherScrollerChild* self); void unity_launcher_scroller_child_set_group_type (UnityLauncherScrollerChild* self, UnityLauncherScrollerChildGroupType value); @@ -806,6 +806,10 @@ static void unity_launcher_scroller_child_on_rotation_changed (UnityLauncherScro clutter_actor_animate ((ClutterActor*) self->processed_icon, (gulong) CLUTTER_EASE_IN_OUT_QUAD, (guint) 300, "rotation", self->priv->_rotation, NULL); } else { clutter_actor_animate ((ClutterActor*) self->processed_icon, (gulong) CLUTTER_EASE_OUT_QUINT, (guint) 300, "rotation", self->priv->_rotation, NULL); + if (self->priv->_activating) { + g_debug ("scrollerchild.vala:536: stopping glow "); + unity_launcher_scroller_child_set_activating (self, FALSE); + } } } diff --git a/unity-private/launcher/scrollerchild.vala b/unity-private/launcher/scrollerchild.vala index 41a8613d3..d99a6c0b6 100644 --- a/unity-private/launcher/scrollerchild.vala +++ b/unity-private/launcher/scrollerchild.vala @@ -523,11 +523,20 @@ namespace Unity.Launcher processed_icon.rotation = old_rotate_value; if (rotation <= 1.0 && rotation >= 0.0) - processed_icon.animate (Clutter.AnimationMode.EASE_IN_OUT_QUAD, 300, - "rotation", rotation); + { + processed_icon.animate (Clutter.AnimationMode.EASE_IN_OUT_QUAD, 300, + "rotation", rotation); + } else - processed_icon.animate (Clutter.AnimationMode.EASE_OUT_QUINT, 300, - "rotation", rotation); + { + processed_icon.animate (Clutter.AnimationMode.EASE_OUT_QUINT, 300, + "rotation", rotation); + if (activating) + { + debug ("stopping glow "); + activating = false; + } + } } private void on_activating_changed () diff --git a/unity-private/panel/panel-indicator-object-entry-view.c b/unity-private/panel/panel-indicator-object-entry-view.c index a93bdc061..f9027b673 100644 --- a/unity-private/panel/panel-indicator-object-entry-view.c +++ b/unity-private/panel/panel-indicator-object-entry-view.c @@ -108,9 +108,9 @@ enum { }; UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_object_entry_view_new (IndicatorObjectEntry* _entry); UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_object_entry_view_construct (GType object_type, IndicatorObjectEntry* _entry); +IndicatorObjectEntry* unity_panel_indicators_indicator_object_entry_view_get_entry (UnityPanelIndicatorsIndicatorObjectEntryView* self); static void unity_panel_indicators_indicator_object_entry_view_position_menu (UnityPanelIndicatorsIndicatorObjectEntryView* self, GtkMenu* menu, gint* x, gint* y, gboolean* push_in); void unity_panel_indicators_indicator_object_entry_view_show_menu (UnityPanelIndicatorsIndicatorObjectEntryView* self); -IndicatorObjectEntry* unity_panel_indicators_indicator_object_entry_view_get_entry (UnityPanelIndicatorsIndicatorObjectEntryView* self); GType menu_manager_get_type (void) G_GNUC_CONST; MenuManager* menu_manager_get_default (void); void menu_manager_register_visible_menu (MenuManager* self, GtkMenu* menu); @@ -166,6 +166,24 @@ UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_o UnityPanelIndicatorsIndicatorObjectEntryView * self; g_return_val_if_fail (_entry != NULL, NULL); self = (UnityPanelIndicatorsIndicatorObjectEntryView*) g_object_new (object_type, "entry", _entry, "orientation", CTK_ORIENTATION_HORIZONTAL, "spacing", 3, "homogeneous", FALSE, "reactive", TRUE, NULL); + if (self->priv->_entry->label != NULL) { + if ((GTK_WIDGET_FLAGS ((GtkWidget*) self->priv->_entry->label) & GTK_SENSITIVE) != 0) { + clutter_actor_set_reactive ((ClutterActor*) self, TRUE); + self->skip = FALSE; + } else { + clutter_actor_set_reactive ((ClutterActor*) self, FALSE); + self->skip = TRUE; + } + } + if (self->priv->_entry->image != NULL) { + if ((GTK_WIDGET_FLAGS ((GtkWidget*) self->priv->_entry->image) & GTK_SENSITIVE) != 0) { + clutter_actor_set_reactive ((ClutterActor*) self, TRUE); + self->skip = FALSE; + } else { + clutter_actor_set_reactive ((ClutterActor*) self, FALSE); + self->skip = TRUE; + } + } return self; } @@ -289,6 +307,7 @@ void unity_panel_indicators_indicator_object_entry_view_menu_shown (UnityPanelIn g_signal_connect_object ((GtkMenuShell*) self->priv->_entry->menu, "move-current", (GCallback) _unity_panel_indicators_indicator_object_entry_view_menu_key_moved_gtk_menu_shell_move_current, self, 0); g_signal_connect_object ((GObject*) self->priv->_entry->menu, "notify::visible", (GCallback) _unity_panel_indicators_indicator_object_entry_view_menu_vis_changed_g_object_notify, self, 0); clutter_actor_set_opacity ((ClutterActor*) self->priv->bg, (guint8) 255); + g_signal_emit_by_name (self, "entry-shown"); } } @@ -418,12 +437,26 @@ static gboolean unity_panel_indicators_indicator_object_entry_view_update_bg (Un cairo_t* cr; gint width; gint height; + gint radius; + double x; + double y; + double xos; + double yos; + double mpi; cairo_t* _tmp0_; cairo_pattern_t* pat; + cairo_pattern_t* _tmp1_; + cairo_pattern_t* _tmp2_; g_return_val_if_fail (self != NULL, FALSE); cr = NULL; width = (gint) self->priv->last_width; height = (gint) self->priv->last_height; + radius = 4; + x = (double) 0; + y = (double) 0; + xos = 1.5; + yos = 1.5; + mpi = 3.14159265358979323846; clutter_cairo_texture_set_surface_size (self->priv->bg, (guint) width, (guint) height); cr = (_tmp0_ = clutter_cairo_texture_create (self->priv->bg), _cairo_destroy0 (cr), _tmp0_); cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); @@ -431,18 +464,33 @@ static gboolean unity_panel_indicators_indicator_object_entry_view_update_bg (Un cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_line_width (cr, 1.0); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.2); - cairo_move_to (cr, (double) 1, (double) height); - cairo_line_to (cr, (double) 1, (double) 7); - cairo_curve_to (cr, (double) 1, (double) 2, (double) 1, (double) 2, (double) 10, (double) 2); - cairo_line_to (cr, (double) (width - 10), (double) 2); - cairo_curve_to (cr, (double) width, (double) 2, (double) width, (double) 2, (double) width, (double) 7); - cairo_line_to (cr, (double) width, (double) height); - cairo_line_to (cr, (double) 1, (double) height); - pat = cairo_pattern_create_linear ((double) 1, (double) 0, (double) 1, (double) height); - cairo_pattern_add_color_stop_rgba (pat, 0.0, (double) (248 / 255.0f), (double) (134 / 255.0f), (double) (87 / 255.0f), (double) 1.0f); - cairo_pattern_add_color_stop_rgba (pat, 1.0, (double) (236 / 255.0f), (double) (113 / 255.0f), (double) (63 / 255.0f), (double) 1.0f); + cairo_move_to (cr, (x + xos) + radius, y + yos); + cairo_arc (cr, (((x + xos) + width) - (xos * 2)) - radius, (y + yos) + radius, (double) radius, mpi * 1.5, mpi * 2); + cairo_line_to (cr, ((x + xos) + width) - (xos * 2), (((y + yos) + height) - (yos * 2)) + 2); + cairo_line_to (cr, x + xos, (((y + yos) + height) - (yos * 2)) + 2); + cairo_arc (cr, (x + xos) + radius, (y + yos) + radius, (double) radius, mpi, mpi * 1.5); + pat = cairo_pattern_create_linear (x + xos, y, x + xos, ((y + height) - (yos * 2)) + 2); + cairo_pattern_add_color_stop_rgba (pat, 0.0, (double) (83 / 255.0f), (double) (82 / 255.0f), (double) (78 / 255.0f), (double) 1.0f); + cairo_pattern_add_color_stop_rgba (pat, 1.0, (double) (66 / 255.0f), (double) (65 / 255.0f), (double) (63 / 255.0f), (double) 1.0f); + cairo_set_source (cr, pat); + cairo_fill_preserve (cr); + pat = (_tmp1_ = cairo_pattern_create_linear (x + xos, y, x + xos, ((y + height) - (yos * 2)) + 2), _cairo_pattern_destroy0 (pat), _tmp1_); + cairo_pattern_add_color_stop_rgba (pat, 0.0, (double) (62 / 255.0f), (double) (61 / 255.0f), (double) (58 / 255.0f), (double) 1.0f); + cairo_pattern_add_color_stop_rgba (pat, 1.0, (double) (54 / 255.0f), (double) (54 / 255.0f), (double) (52 / 255.0f), (double) 1.0f); + cairo_set_source (cr, pat); + cairo_stroke (cr); + xos++; + yos++; + cairo_move_to (cr, (x + radius) + xos, y + yos); + cairo_arc (cr, (((x + xos) + width) - (xos * 2)) - radius, (y + yos) + radius, (double) radius, mpi * 1.5, mpi * 2); + cairo_line_to (cr, ((x + xos) + width) - (xos * 2), (((y + yos) + height) - (yos * 2)) + 3); + cairo_line_to (cr, x + xos, (((y + yos) + height) - (yos * 2)) + 3); + cairo_arc (cr, (x + xos) + radius, (y + yos) + radius, (double) radius, mpi, mpi * 1.5); + pat = (_tmp2_ = cairo_pattern_create_linear (x + xos, y, x + xos, ((y + height) - (yos * 2)) + 3), _cairo_pattern_destroy0 (pat), _tmp2_); + cairo_pattern_add_color_stop_rgba (pat, 0.0, (double) (92 / 255.0f), (double) (90 / 255.0f), (double) (85 / 255.0f), (double) 1.0f); + cairo_pattern_add_color_stop_rgba (pat, 1.0, (double) (70 / 255.0f), (double) (69 / 255.0f), (double) (66 / 255.0f), (double) 1.0f); cairo_set_source (cr, pat); - cairo_fill (cr); + cairo_stroke (cr); result = FALSE; _cairo_pattern_destroy0 (pat); _cairo_destroy0 (cr); @@ -832,7 +880,7 @@ static GObject * unity_panel_indicators_indicator_object_entry_view_constructor ClutterColor _tmp23_; char* _tmp24_; self->text = (_tmp21_ = g_object_ref_sink ((CtkText*) ctk_text_new ("")), _g_object_unref0 (self->text), _tmp21_); - clutter_text_set_color ((ClutterText*) self->text, (_tmp23_ = (_tmp22_.red = (guint8) 233, _tmp22_.green = (guint8) 216, _tmp22_.blue = (guint8) 200, _tmp22_.alpha = (guint8) 255, _tmp22_), &_tmp23_)); + clutter_text_set_color ((ClutterText*) self->text, (_tmp23_ = (_tmp22_.red = (guint8) 223, _tmp22_.green = (guint8) 219, _tmp22_.blue = (guint8) 210, _tmp22_.alpha = (guint8) 255, _tmp22_), &_tmp23_)); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->text); clutter_text_set_text ((ClutterText*) self->text, _tmp24_ = string_replace (gtk_label_get_label (self->priv->_entry->label), "_", "")); _g_free0 (_tmp24_); @@ -888,6 +936,7 @@ static void unity_panel_indicators_indicator_object_entry_view_class_init (Unity G_OBJECT_CLASS (klass)->finalize = unity_panel_indicators_indicator_object_entry_view_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PANEL_INDICATORS_INDICATOR_OBJECT_ENTRY_VIEW_ENTRY, g_param_spec_pointer ("entry", "entry", "entry", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_signal_new ("menu_moved", UNITY_PANEL_INDICATORS_TYPE_INDICATOR_OBJECT_ENTRY_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, GTK_TYPE_MENU_DIRECTION_TYPE); + g_signal_new ("entry_shown", UNITY_PANEL_INDICATORS_TYPE_INDICATOR_OBJECT_ENTRY_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } diff --git a/unity-private/panel/panel-indicator-object-entry-view.vala b/unity-private/panel/panel-indicator-object-entry-view.vala index c8cf03c08..2829ef4fe 100644 --- a/unity-private/panel/panel-indicator-object-entry-view.vala +++ b/unity-private/panel/panel-indicator-object-entry-view.vala @@ -23,6 +23,7 @@ namespace Unity.Panel.Indicators { public unowned Indicator.ObjectEntry entry { get; construct; } public signal void menu_moved (Gtk.MenuDirectionType type); + public signal void entry_shown (); private Clutter.CairoTexture bg; public Ctk.Image image; @@ -43,6 +44,34 @@ namespace Unity.Panel.Indicators spacing:3, homogeneous:false, reactive:true); + + if (entry.label != null) + { + if ((entry.label.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0) + { + this.reactive = true; + this.skip = false; + } + else + { + this.reactive = false; + this.skip = true; + } + } + + if (entry.image != null) + { + if ((entry.image.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0) + { + this.reactive = true; + this.skip = false; + } + else + { + this.reactive = false; + this.skip = true; + } + } } ~IndicatorObjectEntryView () @@ -237,7 +266,7 @@ namespace Unity.Panel.Indicators if (entry.label is Gtk.Label) { text = new Ctk.Text (""); - text.color = { 233, 216, 200, 255 }; + text.color = { 223, 219, 210, 255 }; add_actor (text); /* FIXME: What about the __ case? Well, should that me in a menu? */ @@ -441,6 +470,8 @@ namespace Unity.Panel.Indicators entry.menu.move_current.connect (menu_key_moved); entry.menu.notify["visible"].connect (menu_vis_changed); bg.opacity = 255; + + entry_shown (); } } @@ -533,6 +564,13 @@ namespace Unity.Panel.Indicators Cairo.Context cr; int width = (int)last_width; int height = (int)last_height; + int radius = 4; + double x = 0; + double y = 0; + double xos = 1.5; + double yos = 1.5; + /* FIXME */ + double mpi = 3.14159265358979323846; bg.set_surface_size (width, height); @@ -547,29 +585,39 @@ namespace Unity.Panel.Indicators cr.set_source_rgba (1.0, 1.0, 1.0, 0.2); - cr.move_to (1, height); - - cr.line_to (1, 7); + cr.move_to (x+xos+radius, y+yos); + cr.arc (x+xos+width-xos*2-radius, y+yos+radius, radius, mpi*1.5, mpi*2); + cr.line_to (x+xos+width-xos*2, y+yos+height-yos*2+2); + cr.line_to (x+xos, y+yos+height-yos*2+2); + cr.arc (x+xos+radius, y+yos+radius, radius, mpi, mpi*1.5); - cr.curve_to (1, 2, - 1, 2, - 10, 2); - - cr.line_to (width-10, 2); + var pat = new Cairo.Pattern.linear (x+xos, y, x+xos, y+height-yos*2+2); + pat.add_color_stop_rgba (0.0, 83/255.0f, 82/255.0f, 78/255.0f, 1.0f); + pat.add_color_stop_rgba (1.0, 66/255.0f, 65/255.0f, 63/255.0f, 1.0f); + cr.set_source (pat); + cr.fill_preserve (); - cr.curve_to (width, 2, - width, 2, - width, 7); + pat = new Cairo.Pattern.linear (x+xos, y, x+xos, y+height-yos*2+2); + pat.add_color_stop_rgba (0.0, 62/255.0f, 61/255.0f, 58/255.0f, 1.0f); + pat.add_color_stop_rgba (1.0, 54/255.0f, 54/255.0f, 52/255.0f, 1.0f); + cr.set_source (pat); + cr.stroke (); - cr.line_to (width, height); + xos++; + yos++; - cr.line_to (1, height); + /* enlarging the area to not draw the lightborder at bottom, ugly trick :P */ + cr.move_to (x+radius+xos, y+yos); + cr.arc (x+xos+width-xos*2-radius, y+yos+radius, radius, mpi*1.5, mpi*2); + cr.line_to (x+xos+width-xos*2, y+yos+height-yos*2+3); + cr.line_to (x+xos, y+yos+height-yos*2+3); + cr.arc (x+xos+radius, y+yos+radius, radius, mpi, mpi*1.5); - var pat = new Cairo.Pattern.linear (1, 0, 1, height); - pat.add_color_stop_rgba (0.0, 248/255.0f, 134/255.0f, 87/255.0f, 1.0f); - pat.add_color_stop_rgba (1.0, 236/255.0f, 113/255.0f, 63/255.0f, 1.0f); + pat = new Cairo.Pattern.linear (x+xos, y, x+xos, y+height-yos*2+3); + pat.add_color_stop_rgba (0.0, 92/255.0f, 90/255.0f, 85/255.0f, 1.0f); + pat.add_color_stop_rgba (1.0, 70/255.0f, 69/255.0f, 66/255.0f, 1.0f); cr.set_source (pat); - cr.fill (); + cr.stroke (); return false; } diff --git a/unity-private/panel/panel-indicator-object-view.c b/unity-private/panel/panel-indicator-object-view.c index 856515f38..c10895281 100644 --- a/unity-private/panel/panel-indicator-object-view.c +++ b/unity-private/panel/panel-indicator-object-view.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <string.h> #include <clutter/clutter.h> +#include <unity.h> #include <unity-utils.h> @@ -106,13 +107,15 @@ static void unity_panel_indicators_indicator_object_view_on_entry_added (UnityPa UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_object_entry_view_new (IndicatorObjectEntry* _entry); UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_object_entry_view_construct (GType object_type, IndicatorObjectEntry* _entry); static void _unity_panel_indicators_indicator_object_view_on_menu_moved_unity_panel_indicators_indicator_object_entry_view_menu_moved (UnityPanelIndicatorsIndicatorObjectEntryView* _sender, GtkMenuDirectionType type, gpointer self); +static void unity_panel_indicators_indicator_object_view_on_entry_shown (UnityPanelIndicatorsIndicatorObjectView* self, UnityPanelIndicatorsIndicatorObjectEntryView* view); +static void _unity_panel_indicators_indicator_object_view_on_entry_shown_unity_panel_indicators_indicator_object_entry_view_entry_shown (UnityPanelIndicatorsIndicatorObjectEntryView* _sender, gpointer self); +IndicatorObject* unity_panel_indicators_indicator_object_view_get_indicator_object (UnityPanelIndicatorsIndicatorObjectView* self); static void unity_panel_indicators_indicator_object_view_remove_entry (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObjectEntry* entry); void unity_panel_indicators_indicator_object_view_open_first_menu_entry (UnityPanelIndicatorsIndicatorObjectView* self); void unity_panel_indicators_indicator_object_view_open_last_menu_entry (UnityPanelIndicatorsIndicatorObjectView* self); gboolean unity_panel_indicators_indicator_object_view_find_entry (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObjectEntry* entry); UnityPanelIndicatorsIndicatorObjectEntryView* unity_panel_indicators_indicator_object_view_get_entry_view (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObjectEntry* entry); void unity_panel_indicators_indicator_object_view_remove_first_entry (UnityPanelIndicatorsIndicatorObjectView* self); -IndicatorObject* unity_panel_indicators_indicator_object_view_get_indicator_object (UnityPanelIndicatorsIndicatorObjectView* self); static void unity_panel_indicators_indicator_object_view_set_indicator_object (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObject* value); static void _unity_panel_indicators_indicator_object_view_on_entry_added_indicator_object_entry_added (IndicatorObject* _sender, IndicatorObjectEntry* entry, gpointer self); static void _unity_panel_indicators_indicator_object_view_remove_entry_indicator_object_entry_removed (IndicatorObject* _sender, IndicatorObjectEntry* entry, gpointer self); @@ -242,6 +245,11 @@ static void _unity_panel_indicators_indicator_object_view_on_menu_moved_unity_pa } +static void _unity_panel_indicators_indicator_object_view_on_entry_shown_unity_panel_indicators_indicator_object_entry_view_entry_shown (UnityPanelIndicatorsIndicatorObjectEntryView* _sender, gpointer self) { + unity_panel_indicators_indicator_object_view_on_entry_shown (self, _sender); +} + + static void unity_panel_indicators_indicator_object_view_on_entry_added (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObject* object, IndicatorObjectEntry* indicator_object_entry) { UnityPanelIndicatorsIndicatorObjectEntryView* object_entry_view; g_return_if_fail (self != NULL); @@ -274,12 +282,21 @@ static void unity_panel_indicators_indicator_object_view_on_entry_added (UnityPa } object_entry_view = g_object_ref_sink (unity_panel_indicators_indicator_object_entry_view_new (indicator_object_entry)); g_signal_connect_object (object_entry_view, "menu-moved", (GCallback) _unity_panel_indicators_indicator_object_view_on_menu_moved_unity_panel_indicators_indicator_object_entry_view_menu_moved, self, 0); + g_signal_connect_object (object_entry_view, "entry-shown", (GCallback) _unity_panel_indicators_indicator_object_view_on_entry_shown_unity_panel_indicators_indicator_object_entry_view_entry_shown, self, 0); gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->indicator_entry_array, object_entry_view); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) object_entry_view); _g_object_unref0 (object_entry_view); } +static void unity_panel_indicators_indicator_object_view_on_entry_shown (UnityPanelIndicatorsIndicatorObjectView* self, UnityPanelIndicatorsIndicatorObjectEntryView* view) { + IndicatorObject* _tmp0_; + g_return_if_fail (self != NULL); + g_return_if_fail (view != NULL); + INDICATOR_OBJECT_GET_CLASS (_tmp0_ = self->priv->_indicator_object)->entry_activate (_tmp0_, unity_panel_indicators_indicator_object_entry_view_get_entry (view), (guint) unity_shell_get_current_time (unity_global_shell)); +} + + static void unity_panel_indicators_indicator_object_view_remove_entry (UnityPanelIndicatorsIndicatorObjectView* self, IndicatorObjectEntry* entry) { g_return_if_fail (self != NULL); g_return_if_fail (entry != NULL); @@ -484,6 +501,7 @@ static GObject * unity_panel_indicators_indicator_object_view_constructor (GType indicator_object_entry = (IndicatorObjectEntry*) ((IndicatorObjectEntry*) g_list_nth_data (list, (guint) i)); object_entry_view = g_object_ref_sink (unity_panel_indicators_indicator_object_entry_view_new (indicator_object_entry)); g_signal_connect_object (object_entry_view, "menu-moved", (GCallback) _unity_panel_indicators_indicator_object_view_on_menu_moved_unity_panel_indicators_indicator_object_entry_view_menu_moved, self, 0); + g_signal_connect_object (object_entry_view, "entry-shown", (GCallback) _unity_panel_indicators_indicator_object_view_on_entry_shown_unity_panel_indicators_indicator_object_entry_view_entry_shown, self, 0); gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->indicator_entry_array, object_entry_view); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) object_entry_view); _g_object_unref0 (object_entry_view); diff --git a/unity-private/panel/panel-indicator-object-view.vala b/unity-private/panel/panel-indicator-object-view.vala index 0816efc89..c102bb248 100644 --- a/unity-private/panel/panel-indicator-object-view.vala +++ b/unity-private/panel/panel-indicator-object-view.vala @@ -68,6 +68,7 @@ namespace Unity.Panel.Indicators IndicatorObjectEntryView object_entry_view = new IndicatorObjectEntryView (indicator_object_entry); object_entry_view.menu_moved.connect (this.on_menu_moved); + object_entry_view.entry_shown.connect (on_entry_shown); this.indicator_entry_array.add (object_entry_view); this.add_actor (object_entry_view); @@ -167,12 +168,19 @@ namespace Unity.Panel.Indicators IndicatorObjectEntryView object_entry_view = new IndicatorObjectEntryView (indicator_object_entry); object_entry_view.menu_moved.connect (this.on_menu_moved); + object_entry_view.entry_shown.connect (on_entry_shown); this.indicator_entry_array.add (object_entry_view); this.add_actor (object_entry_view); } + private void on_entry_shown (IndicatorObjectEntryView view) + { + indicator_object.entry_activate (view.entry, + global_shell.get_current_time ()); + } + private void remove_entry (Indicator.ObjectEntry entry) { for (int i = 0; i < indicator_entry_array.size; i++) diff --git a/unity-private/panel/panel-window-buttons.c b/unity-private/panel/panel-window-buttons.c index 43f88c3cd..15f89ad92 100644 --- a/unity-private/panel/panel-window-buttons.c +++ b/unity-private/panel/panel-window-buttons.c @@ -31,7 +31,6 @@ #include <gio/gio.h> #include <float.h> #include <math.h> -#include <glib/gstdio.h> #define UNITY_PANEL_TYPE_WINDOW_BUTTONS (unity_panel_window_buttons_get_type ()) @@ -91,7 +90,6 @@ struct _UnityPanelWindowButtonClass { struct _UnityPanelWindowButtonPrivate { char* _filename; - gboolean using_beta; gint icon_size; char* directory; }; @@ -136,7 +134,6 @@ enum { UNITY_PANEL_WINDOW_BUTTON_FILENAME }; #define UNITY_PANEL_WINDOW_BUTTON_AMBIANCE "/usr/share/themes/Ambiance/metacity-1" -#define UNITY_PANEL_WINDOW_BUTTON_AMBIANCE_BETA "/usr/share/themes/Ambiance-maverick-beta/metacity-1" static void unity_panel_window_button_real_get_preferred_width (ClutterActor* base, float for_height, float* min_width, float* nat_width); static void unity_panel_window_button_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height); const char* unity_panel_window_button_get_filename (UnityPanelWindowButton* self); @@ -500,40 +497,35 @@ static GObject * unity_panel_window_button_constructor (GType type, guint n_cons self = UNITY_PANEL_WINDOW_BUTTON (obj); _inner_error_ = NULL; { - if (self->priv->using_beta = g_file_test (UNITY_PANEL_WINDOW_BUTTON_AMBIANCE_BETA, G_FILE_TEST_EXISTS)) { - char* _tmp0_; - self->priv->icon_size = 19; - self->priv->directory = (_tmp0_ = g_strdup (UNITY_PANEL_WINDOW_BUTTON_AMBIANCE_BETA), _g_free0 (self->priv->directory), _tmp0_); - } { + char* _tmp0_; char* _tmp1_; char* _tmp2_; - char* _tmp3_; - ClutterActor* _tmp4_; + ClutterActor* _tmp3_; + char* _tmp4_; char* _tmp5_; char* _tmp6_; - char* _tmp7_; - ClutterActor* _tmp8_; + ClutterActor* _tmp7_; + char* _tmp8_; char* _tmp9_; char* _tmp10_; - char* _tmp11_; - ClutterActor* _tmp12_; - self->bg = (_tmp4_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp3_ = g_strconcat (_tmp2_ = g_strconcat (_tmp1_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), ".png", NULL))), _g_object_unref0 (self->bg), _tmp4_); - _g_free0 (_tmp3_); + ClutterActor* _tmp11_; + self->bg = (_tmp3_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp2_ = g_strconcat (_tmp1_ = g_strconcat (_tmp0_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), ".png", NULL))), _g_object_unref0 (self->bg), _tmp3_); _g_free0 (_tmp2_); _g_free0 (_tmp1_); + _g_free0 (_tmp0_); ctk_actor_set_background_for_state ((CtkActor*) self, CTK_STATE_NORMAL, self->bg); clutter_actor_show (self->bg); - self->bg = (_tmp8_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp7_ = g_strconcat (_tmp6_ = g_strconcat (_tmp5_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), "_focused_prelight.png", NULL))), _g_object_unref0 (self->bg), _tmp8_); - _g_free0 (_tmp7_); + self->bg = (_tmp7_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp6_ = g_strconcat (_tmp5_ = g_strconcat (_tmp4_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), "_focused_prelight.png", NULL))), _g_object_unref0 (self->bg), _tmp7_); _g_free0 (_tmp6_); _g_free0 (_tmp5_); + _g_free0 (_tmp4_); ctk_actor_set_background_for_state ((CtkActor*) self, CTK_STATE_PRELIGHT, self->bg); clutter_actor_show (self->bg); - self->bg = (_tmp12_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp11_ = g_strconcat (_tmp10_ = g_strconcat (_tmp9_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), "_focused_pressed.png", NULL))), _g_object_unref0 (self->bg), _tmp12_); - _g_free0 (_tmp11_); + self->bg = (_tmp11_ = (ClutterActor*) g_object_ref_sink ((CtkImage*) ctk_image_new_from_filename ((guint) self->priv->icon_size, _tmp10_ = g_strconcat (_tmp9_ = g_strconcat (_tmp8_ = g_strconcat (self->priv->directory, "/", NULL), self->priv->_filename, NULL), "_focused_pressed.png", NULL))), _g_object_unref0 (self->bg), _tmp11_); _g_free0 (_tmp10_); _g_free0 (_tmp9_); + _g_free0 (_tmp8_); ctk_actor_set_background_for_state ((CtkActor*) self, CTK_STATE_ACTIVE, self->bg); clutter_actor_show (self->bg); } @@ -544,9 +536,9 @@ static GObject * unity_panel_window_button_constructor (GType type, guint n_cons e = _inner_error_; _inner_error_ = NULL; { - char* _tmp13_; - g_warning ("panel-window-buttons.vala:247: %s", _tmp13_ = g_strconcat ("Unable to load window button theme: You need Ambiance installed: ", string_to_string (e->message), NULL)); - _g_free0 (_tmp13_); + char* _tmp12_; + g_warning ("panel-window-buttons.vala:240: %s", _tmp12_ = g_strconcat ("Unable to load window button theme: You need Ambiance installed: ", string_to_string (e->message), NULL)); + _g_free0 (_tmp12_); _g_error_free0 (e); } } @@ -575,8 +567,7 @@ static void unity_panel_window_button_class_init (UnityPanelWindowButtonClass * static void unity_panel_window_button_instance_init (UnityPanelWindowButton * self) { self->priv = UNITY_PANEL_WINDOW_BUTTON_GET_PRIVATE (self); - self->priv->using_beta = FALSE; - self->priv->icon_size = 18; + self->priv->icon_size = 19; self->priv->directory = g_strdup (UNITY_PANEL_WINDOW_BUTTON_AMBIANCE); } diff --git a/unity-private/panel/panel-window-buttons.vala b/unity-private/panel/panel-window-buttons.vala index 72e142ad3..00846d6a2 100644 --- a/unity-private/panel/panel-window-buttons.vala +++ b/unity-private/panel/panel-window-buttons.vala @@ -197,13 +197,11 @@ namespace Unity.Panel public class WindowButton : Ctk.Button { public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1"; - public static const string AMBIANCE_BETA = "/usr/share/themes/Ambiance-maverick-beta/metacity-1"; public string filename { get; construct; } public Clutter.Actor bg; - private bool using_beta = false; - private int icon_size = 18; + private int icon_size = 19; private string directory = AMBIANCE; public WindowButton (string filename) @@ -213,11 +211,6 @@ namespace Unity.Panel construct { - if (using_beta = FileUtils.test (AMBIANCE_BETA, FileTest.EXISTS)) - { - icon_size = 19; - directory = AMBIANCE_BETA; - } try { bg = new Ctk.Image.from_filename (icon_size, directory + diff --git a/unity-private/places/places-button.c b/unity-private/places/places-button.c index 441d5da85..88578f72f 100644 --- a/unity-private/places/places-button.c +++ b/unity-private/places/places-button.c @@ -181,12 +181,11 @@ static void unity_places_button_paint_bg (UnityPlacesButton* self, cairo_t* cr, cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); - cairo_set_line_width (cr, 1.5); - cairo_translate (cr, 0.5, 0.5); + cairo_set_line_width (cr, 1.0); if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_NORMAL) { if (self->priv->_normal_state == UNITY_PLACES_BUTTON_NORMAL_STATE_UNDERLINE) { - cairo_move_to (cr, (double) x, (double) (height - 1)); - cairo_line_to (cr, (double) (x + width), (double) (height - 1)); + cairo_move_to (cr, (double) (x + 3), height - 1.5); + cairo_line_to (cr, (double) ((x + width) - 4), height - 1.5); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.3); cairo_stroke (cr); } @@ -199,16 +198,15 @@ static void unity_places_button_paint_bg (UnityPlacesButton* self, cairo_t* cr, _tmp0_ = FALSE; } if (_tmp0_) { - cairo_move_to (cr, (double) x, (double) (height - 1)); - cairo_line_to (cr, (double) (x + width), (double) (height - 1)); + cairo_move_to (cr, (double) (x + 3), height - 1.5); + cairo_line_to (cr, (double) ((x + width) - 4), height - 1.5); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.3); cairo_stroke (cr); return; } } - self->outline_func (cr, width, height, self->outline_func_target); + self->outline_func (cr, width + 1, height + 1, self->outline_func_target); if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_NORMAL) { - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); } else { if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_PRELIGHT) { cairo_surface_t* pattern; @@ -216,25 +214,30 @@ static void unity_places_button_paint_bg (UnityPlacesButton* self, cairo_t* cr, cairo_pattern_t* pat; pattern = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 4, 4); context = cairo_create (pattern); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.1); + cairo_fill_preserve (cr); cairo_set_operator (context, CAIRO_OPERATOR_CLEAR); cairo_paint (context); cairo_set_line_width (context, 0.2); cairo_set_operator (context, CAIRO_OPERATOR_OVER); - cairo_set_source_rgba (context, 1.0, 1.0, 1.0, 0.85); + cairo_set_source_rgba (context, 1.0, 1.0, 1.0, 0.4); cairo_move_to (context, (double) 0, (double) 0); cairo_line_to (context, (double) 4, (double) 4); cairo_stroke (context); pat = cairo_pattern_create_for_surface (pattern); cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); cairo_set_source (cr, pat); + cairo_fill (cr); _cairo_pattern_destroy0 (pat); _cairo_destroy0 (context); _cairo_surface_destroy0 (pattern); } else { cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); + cairo_fill (cr); } } - cairo_fill_preserve (cr); + cairo_translate (cr, 0.5, 0.5); + self->outline_func (cr, width, height, self->outline_func_target); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.5); cairo_stroke (cr); } diff --git a/unity-private/places/places-button.vala b/unity-private/places/places-button.vala index e58050b5f..48873aa9c 100644 --- a/unity-private/places/places-button.vala +++ b/unity-private/places/places-button.vala @@ -136,15 +136,14 @@ namespace Unity.Places cr.paint (); cr.set_operator (Cairo.Operator.OVER); - cr.set_line_width (1.5); - cr.translate (0.5, 0.5); + cr.set_line_width (1.0); if (state == Ctk.ActorState.STATE_NORMAL) { if (_normal_state == NormalState.UNDERLINE) { - cr.move_to (x, height - 1); - cr.line_to (x + width, height - 1); + cr.move_to (x + 3, height - 1.5); + cr.line_to (x + width - 4, height - 1.5); cr.set_source_rgba (1.0, 1.0, 1.0, 0.3); cr.stroke (); } @@ -153,18 +152,18 @@ namespace Unity.Places else if (state == Ctk.ActorState.STATE_PRELIGHT && _prelight_state == PrelightState.UNDERLINE) { - cr.move_to (x, height - 1); - cr.line_to (x + width, height - 1); + cr.move_to (x + 3, height - 1.5); + cr.line_to (x + width - 4, height - 1.5); cr.set_source_rgba (1.0, 1.0, 1.0, 0.3); cr.stroke (); return; } - outline_func (cr, width, height); + outline_func (cr, width+1, height+1); if (state == Ctk.ActorState.STATE_NORMAL) { - cr.set_source_rgba (1.0, 1.0, 1.0, 0.0); + } else if (state == Ctk.ActorState.STATE_PRELIGHT) { @@ -173,12 +172,15 @@ namespace Unity.Places 4, 4); var context = new Cairo.Context (pattern); + cr.set_source_rgba (1.0, 1.0, 1.0, 0.1); + cr.fill_preserve (); + context.set_operator (Cairo.Operator.CLEAR); context.paint (); context.set_line_width (0.2); context.set_operator (Cairo.Operator.OVER); - context.set_source_rgba (1.0, 1.0, 1.0, 0.85); + context.set_source_rgba (1.0, 1.0, 1.0, 0.4); context.move_to (0, 0); context.line_to (4, 4); @@ -188,12 +190,19 @@ namespace Unity.Places var pat = new Cairo.Pattern.for_surface (pattern); pat.set_extend (Cairo.Extend.REPEAT); cr.set_source (pat); + + cr.fill (); } else { - cr.set_source_rgba (1.0, 1.0, 1.0, 1.0); + cr.set_source_rgba (1.0, 1.0, 1.0, 1.0); + + cr.fill (); } - cr.fill_preserve (); + + cr.translate (0.5, 0.5); + + outline_func (cr, width, height); cr.set_source_rgba (1.0, 1.0, 1.0, 0.5); cr.stroke (); diff --git a/unity-private/places/places-controller.c b/unity-private/places/places-controller.c index 76fb7aa4f..bad9bc44c 100644 --- a/unity-private/places/places-controller.c +++ b/unity-private/places/places-controller.c @@ -151,6 +151,27 @@ typedef struct _UnityPlacesPlaceEntryScrollerChildControllerClass UnityPlacesPla typedef struct _UnityLauncherScrollerChild UnityLauncherScrollerChild; typedef struct _UnityLauncherScrollerChildClass UnityLauncherScrollerChildClass; +typedef struct _UnityPlacesViewPrivate UnityPlacesViewPrivate; + +#define UNITY_PLACES_TYPE_PLACE_HOME_ENTRY (unity_places_place_home_entry_get_type ()) +#define UNITY_PLACES_PLACE_HOME_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntry)) +#define UNITY_PLACES_PLACE_HOME_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntryClass)) +#define UNITY_PLACES_IS_PLACE_HOME_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY)) +#define UNITY_PLACES_IS_PLACE_HOME_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY)) +#define UNITY_PLACES_PLACE_HOME_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntryClass)) + +typedef struct _UnityPlacesPlaceHomeEntry UnityPlacesPlaceHomeEntry; +typedef struct _UnityPlacesPlaceHomeEntryClass UnityPlacesPlaceHomeEntryClass; + +#define UNITY_PLACES_TYPE_PLACE_SEARCH_BAR (unity_places_place_search_bar_get_type ()) +#define UNITY_PLACES_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBar)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) + +typedef struct _UnityPlacesPlaceSearchBar UnityPlacesPlaceSearchBar; +typedef struct _UnityPlacesPlaceSearchBarClass UnityPlacesPlaceSearchBarClass; #define UNITY_PLACES_TYPE_PLACE_FILE_MODEL (unity_places_place_file_model_get_type ()) #define UNITY_PLACES_PLACE_FILE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_FILE_MODEL, UnityPlacesPlaceFileModel)) @@ -234,6 +255,17 @@ struct _UnityPlacesPlaceEntryIface { void (*set_parent) (UnityPlacesPlaceEntry* self, UnityPlacesPlace* value); }; +struct _UnityPlacesView { + CtkBox parent_instance; + UnityPlacesViewPrivate * priv; + UnityPlacesPlaceHomeEntry* home_entry; + UnityPlacesPlaceSearchBar* search_bar; +}; + +struct _UnityPlacesViewClass { + CtkBoxClass parent_class; +}; + static gpointer unity_places_controller_parent_class = NULL; @@ -284,6 +316,9 @@ static void unity_places_controller_on_entry_clicked (UnityPlacesController* sel static void _unity_places_controller_on_entry_clicked_unity_places_place_entry_scroller_child_controller_clicked (UnityPlacesPlaceEntryScrollerChildController* _sender, guint section_id, gpointer self); UnityShell* unity_places_controller_get_shell (UnityPlacesController* self); UnityPlacesPlaceEntry* unity_places_place_entry_scroller_child_controller_get_entry (UnityPlacesPlaceEntryScrollerChildController* self); +GType unity_places_place_home_entry_get_type (void) G_GNUC_CONST; +GType unity_places_place_search_bar_get_type (void) G_GNUC_CONST; +void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); static void unity_places_controller_set_shell (UnityPlacesController* self, UnityShell* value); void unity_places_controller_set_model (UnityPlacesController* self, UnityPlacesPlaceModel* value); UnityPlacesVolumeController* unity_places_controller_get_volumes (UnityPlacesController* self); @@ -446,6 +481,7 @@ static void unity_places_controller_on_entry_clicked (UnityPlacesController* sel unity_shell_show_unity (self->priv->_shell); } unity_places_view_on_entry_view_activated (self->priv->view, unity_places_place_entry_scroller_child_controller_get_entry (cont), section_id); + unity_places_place_search_bar_reset (self->priv->view->search_bar); } diff --git a/unity-private/places/places-controller.vala b/unity-private/places/places-controller.vala index 415fb90b9..be211819e 100644 --- a/unity-private/places/places-controller.vala +++ b/unity-private/places/places-controller.vala @@ -119,6 +119,7 @@ namespace Unity.Places shell.show_unity (); } view.on_entry_view_activated (cont.entry, section_id); + view.search_bar.reset (); } } } diff --git a/unity-private/places/places-default-renderer-group.c b/unity-private/places/places-default-renderer-group.c index ff33b0cdb..500fd6514 100644 --- a/unity-private/places/places-default-renderer-group.c +++ b/unity-private/places/places-default-renderer-group.c @@ -679,11 +679,6 @@ 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->n_results == 1) { - UnityPixbufCache* _tmp0_; - unity_pixbuf_cache_load_iteration (_tmp0_ = unity_pixbuf_cache_get_default ()); - _g_object_unref0 (_tmp0_); - } } diff --git a/unity-private/places/places-default-renderer-group.vala b/unity-private/places/places-default-renderer-group.vala index 8c900854c..99c36ee94 100644 --- a/unity-private/places/places-default-renderer-group.vala +++ b/unity-private/places/places-default-renderer-group.vala @@ -72,7 +72,7 @@ namespace Unity.Places private bool last_result_timeout = false; public signal void activated (string uri, string mimetype); - + private GLib.List<Tile?> cleanup_tiles = new GLib.List<Tile?> (); private uint cleanup_operation = 0; @@ -426,9 +426,6 @@ 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.c b/unity-private/places/places-default-renderer.c index 1b37b76f0..fa23fe52a 100644 --- a/unity-private/places/places-default-renderer.c +++ b/unity-private/places/places-default-renderer.c @@ -64,11 +64,42 @@ typedef struct _UnityPlacesEmptySearchGroupClass UnityPlacesEmptySearchGroupClas typedef struct _UnityPlacesEmptySectionGroup UnityPlacesEmptySectionGroup; typedef struct _UnityPlacesEmptySectionGroupClass UnityPlacesEmptySectionGroupClass; + +#define UNITY_PLACES_TYPE_VIEW (unity_places_view_get_type ()) +#define UNITY_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_VIEW, UnityPlacesView)) +#define UNITY_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_VIEW, UnityPlacesViewClass)) +#define UNITY_PLACES_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_VIEW)) +#define UNITY_PLACES_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_VIEW)) +#define UNITY_PLACES_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_VIEW, UnityPlacesViewClass)) + +typedef struct _UnityPlacesView UnityPlacesView; +typedef struct _UnityPlacesViewClass UnityPlacesViewClass; #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)) +typedef struct _UnityPlacesViewPrivate UnityPlacesViewPrivate; + +#define UNITY_PLACES_TYPE_PLACE_HOME_ENTRY (unity_places_place_home_entry_get_type ()) +#define UNITY_PLACES_PLACE_HOME_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntry)) +#define UNITY_PLACES_PLACE_HOME_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntryClass)) +#define UNITY_PLACES_IS_PLACE_HOME_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY)) +#define UNITY_PLACES_IS_PLACE_HOME_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY)) +#define UNITY_PLACES_PLACE_HOME_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntryClass)) + +typedef struct _UnityPlacesPlaceHomeEntry UnityPlacesPlaceHomeEntry; +typedef struct _UnityPlacesPlaceHomeEntryClass UnityPlacesPlaceHomeEntryClass; + +#define UNITY_PLACES_TYPE_PLACE_SEARCH_BAR (unity_places_place_search_bar_get_type ()) +#define UNITY_PLACES_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBar)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) + +typedef struct _UnityPlacesPlaceSearchBar UnityPlacesPlaceSearchBar; +typedef struct _UnityPlacesPlaceSearchBarClass UnityPlacesPlaceSearchBarClass; #define UNITY_PLACES_TYPE_DEFAULT_RENDERER_GROUP (unity_places_default_renderer_group_get_type ()) #define UNITY_PLACES_DEFAULT_RENDERER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_DEFAULT_RENDERER_GROUP, UnityPlacesDefaultRendererGroup)) @@ -82,6 +113,17 @@ typedef struct _UnityPlacesDefaultRendererGroupClass UnityPlacesDefaultRendererG typedef struct _UnityPlacesDefaultRendererGroupPrivate UnityPlacesDefaultRendererGroupPrivate; #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) #define __g_list_free_g_object_unref0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref (var), NULL))) + +#define UNITY_TESTING_TYPE_OBJECT_REGISTRY (unity_testing_object_registry_get_type ()) +#define UNITY_TESTING_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistry)) +#define UNITY_TESTING_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_OBJECT_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) + +typedef struct _UnityTestingObjectRegistry UnityTestingObjectRegistry; +typedef struct _UnityTestingObjectRegistryClass UnityTestingObjectRegistryClass; +#define _unity_testing_object_registry_unref0(var) ((var == NULL) ? NULL : (var = (unity_testing_object_registry_unref (var), NULL))) typedef struct _UnityPlacesEmptySearchGroupPrivate UnityPlacesEmptySearchGroupPrivate; typedef struct _Block2Data Block2Data; typedef struct _UnityPlacesEmptySectionGroupPrivate UnityPlacesEmptySectionGroupPrivate; @@ -107,11 +149,23 @@ struct _UnityPlacesDefaultRendererPrivate { CtkVBox* box; DeeModel* groups_model; DeeModel* results_model; + UnityPlacesView* place_view; char** expanded; gint expanded_length1; gint _expanded_size_; }; +struct _UnityPlacesView { + CtkBox parent_instance; + UnityPlacesViewPrivate * priv; + UnityPlacesPlaceHomeEntry* home_entry; + UnityPlacesPlaceSearchBar* search_bar; +}; + +struct _UnityPlacesViewClass { + CtkBoxClass parent_class; +}; + struct _UnityPlacesDefaultRendererGroup { UnityExpandingBin parent_instance; UnityPlacesDefaultRendererGroupPrivate * priv; @@ -172,6 +226,7 @@ static gpointer unity_places_empty_section_group_parent_class = NULL; GType unity_places_default_renderer_get_type (void) G_GNUC_CONST; GType unity_places_empty_search_group_get_type (void) G_GNUC_CONST; GType unity_places_empty_section_group_get_type (void) G_GNUC_CONST; +GType unity_places_view_get_type (void) G_GNUC_CONST; #define UNITY_PLACES_DEFAULT_RENDERER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_DEFAULT_RENDERER, UnityPlacesDefaultRendererPrivate)) enum { UNITY_PLACES_DEFAULT_RENDERER_DUMMY_PROPERTY @@ -199,6 +254,9 @@ static void _unity_places_default_renderer_on_group_removed_dee_model_row_remove static void unity_places_default_renderer_update_views (UnityPlacesDefaultRenderer* self); gboolean unity_places_empty_search_group_get_active (UnityPlacesEmptySearchGroup* self); gboolean unity_places_empty_section_group_get_active (UnityPlacesEmptySectionGroup* self); +GType unity_places_place_home_entry_get_type (void) G_GNUC_CONST; +GType unity_places_place_search_bar_get_type (void) G_GNUC_CONST; +void unity_places_place_search_bar_set_search_fail (UnityPlacesPlaceSearchBar* self, gboolean value); static void unity_places_default_renderer_real_activate_default (UnityPlaceRenderer* base); GType unity_places_default_renderer_group_get_type (void) G_GNUC_CONST; guint unity_places_default_renderer_group_get_group_id (UnityPlacesDefaultRendererGroup* self); @@ -221,6 +279,15 @@ static gboolean _unity_places_default_renderer_on_slider_enter_clutter_actor_ent 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); +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); +void unity_testing_value_set_object_registry (GValue* value, gpointer v_object); +void unity_testing_value_take_object_registry (GValue* value, gpointer v_object); +gpointer unity_testing_value_get_object_registry (const GValue* value); +GType unity_testing_object_registry_get_type (void) G_GNUC_CONST; +UnityTestingObjectRegistry* unity_testing_object_registry_get_default (void); +GeeArrayList* unity_testing_object_registry_lookup (UnityTestingObjectRegistry* self, const char* name); 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)) @@ -391,11 +458,13 @@ static void unity_places_default_renderer_slider_paint (UnityPlacesDefaultRender } else { if (self->priv->slider_state == UNITY_PLACES_DEFAULT_RENDERER_SLIDER_STATE_PRELIGHT) { cairo_pattern_t* _tmp0_; + cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.1f); + cairo_fill_preserve (cr); 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_set_source_rgba (cr_stripes, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.15f); 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); @@ -548,6 +617,7 @@ static void unity_places_default_renderer_update_views (UnityPlacesDefaultRender gint search_empty_opacity; gint section_empty_opacity; gint groups_box_opacity; + gboolean _tmp0_ = FALSE; g_return_if_fail (self != NULL); search_empty_opacity = 0; section_empty_opacity = 0; @@ -566,6 +636,12 @@ static void unity_places_default_renderer_update_views (UnityPlacesDefaultRender clutter_actor_animate ((ClutterActor*) self->priv->search_empty, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 300, "opacity", search_empty_opacity, NULL); clutter_actor_animate ((ClutterActor*) self->priv->section_empty, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 300, "opacity", section_empty_opacity, NULL); clutter_actor_animate ((ClutterActor*) self->priv->scroll, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 300, "opacity", groups_box_opacity, NULL); + if (unity_places_empty_section_group_get_active (self->priv->section_empty)) { + _tmp0_ = TRUE; + } else { + _tmp0_ = unity_places_empty_search_group_get_active (self->priv->search_empty); + } + unity_places_place_search_bar_set_search_fail (self->priv->place_view->search_bar, _tmp0_); } @@ -780,6 +856,10 @@ static GObject * unity_places_default_renderer_constructor (GType type, guint n_ UnityCairoCanvas* _tmp6_; CtkScrollView* _tmp7_; CtkVBox* _tmp8_; + UnityTestingObjectRegistry* _tmp9_; + GeeArrayList* _tmp10_; + GObject* _tmp11_; + UnityPlacesView* _tmp12_; 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->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_)); @@ -804,6 +884,9 @@ static GObject * unity_places_default_renderer_constructor (GType type, guint n_ 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); + self->priv->place_view = (_tmp12_ = (_tmp11_ = (GObject*) gee_abstract_list_get ((GeeAbstractList*) (_tmp10_ = unity_testing_object_registry_lookup (_tmp9_ = unity_testing_object_registry_get_default (), "UnityPlacesView")), 0), UNITY_PLACES_IS_VIEW (_tmp11_) ? ((UnityPlacesView*) _tmp11_) : NULL), _g_object_unref0 (self->priv->place_view), _tmp12_); + _g_object_unref0 (_tmp10_); + _unity_testing_object_registry_unref0 (_tmp9_); } return obj; } @@ -844,6 +927,7 @@ static void unity_places_default_renderer_finalize (GObject* obj) { _g_object_unref0 (self->priv->box); _g_object_unref0 (self->priv->groups_model); _g_object_unref0 (self->priv->results_model); + _g_object_unref0 (self->priv->place_view); self->priv->expanded = (_vala_array_free (self->priv->expanded, self->priv->expanded_length1, (GDestroyNotify) g_free), NULL); G_OBJECT_CLASS (unity_places_default_renderer_parent_class)->finalize (obj); } @@ -1243,8 +1327,7 @@ static void unity_places_empty_section_group_paint_bg (UnityPlacesEmptySectionGr cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); - cairo_translate (cr, 0.5, 0.5); - cairo_set_line_width (cr, 1.5); + cairo_set_line_width (cr, 1.0); radius = 7; clutter_actor_get_preferred_size ((ClutterActor*) self->priv->text, &twidth, &theight, NULL, NULL); padding = 35; @@ -1262,7 +1345,17 @@ static void unity_places_empty_section_group_paint_bg (UnityPlacesEmptySectionGr cairo_curve_to (cr, (double) x, (double) (y + h), (double) x, (double) (y + h), (double) x, (double) ((y + h) - radius)); cairo_close_path (cr); cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.1f); - cairo_fill_preserve (cr); + cairo_fill (cr); + cairo_translate (cr, 0.5, 0.5); + cairo_move_to (cr, (double) x, (double) (y + radius)); + cairo_curve_to (cr, (double) x, (double) y, (double) x, (double) y, (double) (x + radius), (double) y); + cairo_line_to (cr, (double) ((x + w) - radius), (double) y); + cairo_curve_to (cr, (double) (x + w), (double) y, (double) (x + w), (double) y, (double) (x + w), (double) (y + radius)); + cairo_line_to (cr, (double) (x + w), (double) ((y + h) - radius)); + cairo_curve_to (cr, (double) (x + w), (double) (y + h), (double) (x + w), (double) (y + h), (double) ((x + w) - radius), (double) (y + h)); + cairo_line_to (cr, (double) (x + radius), (double) (y + h)); + cairo_curve_to (cr, (double) x, (double) (y + h), (double) x, (double) (y + h), (double) x, (double) ((y + h) - radius)); + cairo_close_path (cr); cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.5f); cairo_stroke (cr); cairo_rectangle (cr, (double) x, (double) y, (double) (w / 4), (double) h); diff --git a/unity-private/places/places-default-renderer.vala b/unity-private/places/places-default-renderer.vala index cd0e7ec42..69810992d 100644 --- a/unity-private/places/places-default-renderer.vala +++ b/unity-private/places/places-default-renderer.vala @@ -17,6 +17,8 @@ * */ +using Unity.Testing; + namespace Unity.Places { public class DefaultRenderer : LayeredBin, Unity.Place.Renderer @@ -40,6 +42,7 @@ namespace Unity.Places private Ctk.VBox box; private Dee.Model groups_model; private Dee.Model results_model; + private Places.View place_view; private string[] expanded = null; @@ -162,11 +165,14 @@ namespace Unity.Places } else if (slider_state == SLIDER_STATE_PRELIGHT) { + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.1f); + cr.fill_preserve (); + 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.set_source_rgba (1.0f, 1.0f, 1.0f, 0.15f); 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); @@ -282,6 +288,8 @@ namespace Unity.Places box.homogeneous = false; scroll.add_actor (box); box.show (); + + place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View; } /* @@ -339,6 +347,8 @@ namespace Unity.Places 300, "opacity", groups_box_opacity); + place_view.search_bar.search_fail = section_empty.active + || search_empty.active; } private void activate_default () @@ -609,8 +619,7 @@ namespace Unity.Places cr.paint (); cr.set_operator (Cairo.Operator.OVER); - cr.translate (0.5, 0.5); - cr.set_line_width (1.5); + cr.set_line_width (1.0); var radius = 7; float twidth, theight; @@ -641,7 +650,27 @@ namespace Unity.Places cr.close_path (); cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.1f); - cr.fill_preserve (); + cr.fill (); + + cr.translate (0.5, 0.5); + + cr.move_to (x, y + radius); + cr.curve_to (x, y, + x, y, + x + radius, y); + cr.line_to (x + w - radius, y); + cr.curve_to (x + w, y, + x + w, y, + x + w, y + radius); + cr.line_to (x + w, y + h - radius); + cr.curve_to (x + w, y + h, + x + w, y + h, + x + w - radius, y + h); + cr.line_to (x + radius, y + h); + cr.curve_to (x, y + h, + x, y + h, + x, y + h - radius); + cr.close_path (); cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.5f); cr.stroke (); @@ -665,4 +694,3 @@ namespace Unity.Places } } } - diff --git a/unity-private/places/places-place-entry-scroller-child.c b/unity-private/places/places-place-entry-scroller-child.c index a73292d9b..d5911e598 100644 --- a/unity-private/places/places-place-entry-scroller-child.c +++ b/unity-private/places/places-place-entry-scroller-child.c @@ -401,7 +401,7 @@ static gboolean unity_places_place_entry_scroller_child_controller_real_can_drag UnityPlacesPlaceEntryScrollerChildController * self; gboolean result = FALSE; self = (UnityPlacesPlaceEntryScrollerChildController*) base; - result = TRUE; + result = FALSE; return result; } diff --git a/unity-private/places/places-place-entry-scroller-child.vala b/unity-private/places/places-place-entry-scroller-child.vala index 1743be515..a683c6b90 100644 --- a/unity-private/places/places-place-entry-scroller-child.vala +++ b/unity-private/places/places-place-entry-scroller-child.vala @@ -16,12 +16,12 @@ * Authored by Neil Jagdish Patel <neil.patel@canonical.com> * */ - + using Unity.Launcher; - + namespace Unity.Places { - + public class PlaceEntryScrollerChildController : ScrollerChildController { public PlaceEntry entry { get; construct; } @@ -49,7 +49,7 @@ namespace Unity.Places private bool get_sections () { Dee.Model sections; - + /* We do this so the sections model actually populates with something * before we show it */ @@ -59,7 +59,7 @@ namespace Unity.Places return false; } - + public override void activate () { clicked (0); @@ -77,7 +77,7 @@ namespace Unity.Places Dee.Model sections = entry.sections_model; unowned Dee.ModelIter iter = sections.get_first_iter (); - + while (iter != null && !sections.is_last (iter)) { var name = sections.get_string (iter, 0); @@ -91,7 +91,7 @@ namespace Unity.Places clicked (item.property_get_int ("section-id")); }); root.child_append (item); - + iter = sections.next (iter); } @@ -100,7 +100,7 @@ namespace Unity.Places public override bool can_drag () { - return true; + return false; } } } diff --git a/unity-private/places/places-place-home-renderer.c b/unity-private/places/places-place-home-renderer.c index 6da580522..7fc63460b 100644 --- a/unity-private/places/places-place-home-renderer.c +++ b/unity-private/places/places-place-home-renderer.c @@ -34,6 +34,7 @@ #include <math.h> #include <glib/gi18n-lib.h> #include <gconf/gconf-client.h> +#include <cairo.h> #define UNITY_PLACES_TYPE_HOME_RENDERER (unity_places_home_renderer_get_type ()) @@ -71,6 +72,16 @@ typedef struct _UnityPlacesControllerClass UnityPlacesControllerClass; #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) +#define UNITY_PLACES_TYPE_BUTTON (unity_places_button_get_type ()) +#define UNITY_PLACES_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_BUTTON, UnityPlacesButton)) +#define UNITY_PLACES_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_BUTTON, UnityPlacesButtonClass)) +#define UNITY_PLACES_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_BUTTON)) +#define UNITY_PLACES_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_BUTTON)) +#define UNITY_PLACES_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_BUTTON, UnityPlacesButtonClass)) + +typedef struct _UnityPlacesButton UnityPlacesButton; +typedef struct _UnityPlacesButtonClass UnityPlacesButtonClass; + #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)) #define UNITY_PLACES_HOME_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_HOME_BUTTON, UnityPlacesHomeButtonClass)) @@ -81,6 +92,7 @@ typedef struct _UnityPlacesControllerClass UnityPlacesControllerClass; typedef struct _UnityPlacesHomeButton UnityPlacesHomeButton; typedef struct _UnityPlacesHomeButtonClass UnityPlacesHomeButtonClass; #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _UnityPlacesButtonPrivate UnityPlacesButtonPrivate; typedef struct _UnityPlacesHomeButtonPrivate UnityPlacesHomeButtonPrivate; struct _UnityPlacesHomeRenderer { @@ -97,13 +109,26 @@ struct _UnityPlacesHomeRendererPrivate { CtkIconView* icon_view; }; -struct _UnityPlacesHomeButton { +typedef void (*UnityPlacesButtonButtonOutlineFunc) (cairo_t* cr, gint width, gint height, void* user_data); +struct _UnityPlacesButton { CtkButton parent_instance; + UnityPlacesButtonPrivate * priv; + UnityPlacesButtonButtonOutlineFunc outline_func; + gpointer outline_func_target; + GDestroyNotify outline_func_target_destroy_notify; +}; + +struct _UnityPlacesButtonClass { + CtkButtonClass parent_class; +}; + +struct _UnityPlacesHomeButton { + UnityPlacesButton parent_instance; UnityPlacesHomeButtonPrivate * priv; }; struct _UnityPlacesHomeButtonClass { - CtkButtonClass parent_class; + UnityPlacesButtonClass parent_class; }; struct _UnityPlacesHomeButtonPrivate { @@ -145,6 +170,7 @@ 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); 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_button_get_type (void) G_GNUC_CONST; GType unity_places_home_button_get_type (void) G_GNUC_CONST; static void _lambda60_ (UnityPlacesHomeRenderer* self); static void __lambda60__ctk_button_clicked (CtkButton* _sender, gpointer self); @@ -631,6 +657,9 @@ static GObject * unity_places_home_button_constructor (GType type, guint n_const obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = UNITY_PLACES_HOME_BUTTON (obj); { + CtkPadding _tmp0_ = {0}; + CtkPadding _tmp1_; + ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = 0.0f, _tmp0_.right = 0.0f, _tmp0_.bottom = 8.0f, _tmp0_.left = 0.0f, _tmp0_), &_tmp1_)); ctk_image_set_size (ctk_button_get_image ((CtkButton*) self), 128); g_object_set (ctk_button_get_image ((CtkButton*) self), "filename", self->priv->_icon, NULL); clutter_text_set_text ((ClutterText*) ctk_button_get_text ((CtkButton*) self), self->priv->_name); @@ -673,7 +702,7 @@ GType unity_places_home_button_get_type (void) { if (g_once_init_enter (&unity_places_home_button_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (UnityPlacesHomeButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_places_home_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityPlacesHomeButton), 0, (GInstanceInitFunc) unity_places_home_button_instance_init, NULL }; GType unity_places_home_button_type_id; - unity_places_home_button_type_id = g_type_register_static (CTK_TYPE_BUTTON, "UnityPlacesHomeButton", &g_define_type_info, 0); + unity_places_home_button_type_id = g_type_register_static (UNITY_PLACES_TYPE_BUTTON, "UnityPlacesHomeButton", &g_define_type_info, 0); g_once_init_leave (&unity_places_home_button_type_id__volatile, unity_places_home_button_type_id); } return unity_places_home_button_type_id__volatile; diff --git a/unity-private/places/places-place-home-renderer.vala b/unity-private/places/places-place-home-renderer.vala index 81d676b18..df6129838 100644 --- a/unity-private/places/places-place-home-renderer.vala +++ b/unity-private/places/places-place-home-renderer.vala @@ -183,7 +183,7 @@ namespace Unity.Places } } - public class HomeButton : Ctk.Button + public class HomeButton : Button { static const int ICON_SIZE = 128; @@ -201,6 +201,7 @@ namespace Unity.Places construct { + padding = { 0.0f, 0.0f, 8.0f, 0.0f }; get_image ().size = 128; get_image ().filename = icon; get_text ().text = name; diff --git a/unity-private/places/places-place-home.c b/unity-private/places/places-place-home.c index 1ce157d6e..5e92eb7d4 100644 --- a/unity-private/places/places-place-home.c +++ b/unity-private/places/places-place-home.c @@ -27,6 +27,7 @@ #include <gee.h> #include <dee.h> #include <unity.h> +#include <clutk/clutk.h> #define UNITY_PLACES_TYPE_PLACE_ENTRY (unity_places_place_entry_get_type ()) @@ -67,10 +68,42 @@ typedef struct _UnityPlacesPlaceHomeEntryPrivate UnityPlacesPlaceHomeEntryPrivat typedef struct _UnityPlacesPlaceModel UnityPlacesPlaceModel; typedef struct _UnityPlacesPlaceModelClass UnityPlacesPlaceModelClass; + +#define UNITY_PLACES_TYPE_VIEW (unity_places_view_get_type ()) +#define UNITY_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_VIEW, UnityPlacesView)) +#define UNITY_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_VIEW, UnityPlacesViewClass)) +#define UNITY_PLACES_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_VIEW)) +#define UNITY_PLACES_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_VIEW)) +#define UNITY_PLACES_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_VIEW, UnityPlacesViewClass)) + +typedef struct _UnityPlacesView UnityPlacesView; +typedef struct _UnityPlacesViewClass UnityPlacesViewClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _Block4Data Block4Data; +#define UNITY_TESTING_TYPE_OBJECT_REGISTRY (unity_testing_object_registry_get_type ()) +#define UNITY_TESTING_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistry)) +#define UNITY_TESTING_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_OBJECT_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) + +typedef struct _UnityTestingObjectRegistry UnityTestingObjectRegistry; +typedef struct _UnityTestingObjectRegistryClass UnityTestingObjectRegistryClass; +#define _unity_testing_object_registry_unref0(var) ((var == NULL) ? NULL : (var = (unity_testing_object_registry_unref (var), NULL))) +typedef struct _UnityPlacesViewPrivate UnityPlacesViewPrivate; + +#define UNITY_PLACES_TYPE_PLACE_SEARCH_BAR (unity_places_place_search_bar_get_type ()) +#define UNITY_PLACES_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBar)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_IS_PLACE_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR)) +#define UNITY_PLACES_PLACE_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarClass)) + +typedef struct _UnityPlacesPlaceSearchBar UnityPlacesPlaceSearchBar; +typedef struct _UnityPlacesPlaceSearchBarClass UnityPlacesPlaceSearchBarClass; + struct _UnityPlacesPlaceEntryIface { GTypeInterface parent_iface; void (*connect) (UnityPlacesPlaceEntry* self); @@ -151,6 +184,7 @@ struct _UnityPlacesPlaceHomeEntryPrivate { GeeHashMap* _global_renderer_hints; UnityPlacesPlaceModel* _place_model; GeeHashMap* entry_group_map; + UnityPlacesView* place_view; }; struct _Block4Data { @@ -159,6 +193,17 @@ struct _Block4Data { UnityPlacesPlaceEntry* entry; }; +struct _UnityPlacesView { + CtkBox parent_instance; + UnityPlacesViewPrivate * priv; + UnityPlacesPlaceHomeEntry* home_entry; + UnityPlacesPlaceSearchBar* search_bar; +}; + +struct _UnityPlacesViewClass { + CtkBoxClass parent_class; +}; + static gpointer unity_places_place_home_entry_parent_class = NULL; static UnityPlacesPlaceEntryIface* unity_places_place_home_entry_unity_places_place_entry_parent_iface = NULL; @@ -167,6 +212,7 @@ GType unity_places_place_get_type (void) G_GNUC_CONST; GType unity_places_place_entry_get_type (void) G_GNUC_CONST; GType unity_places_place_home_entry_get_type (void) G_GNUC_CONST; GType unity_places_place_model_get_type (void) G_GNUC_CONST; +GType unity_places_view_get_type (void) G_GNUC_CONST; #define UNITY_PLACES_PLACE_HOME_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_PLACE_HOME_ENTRY, UnityPlacesPlaceHomeEntryPrivate)) enum { UNITY_PLACES_PLACE_HOME_ENTRY_DUMMY_PROPERTY, @@ -203,12 +249,24 @@ static void _lambda35_ (Block4Data* _data4_); DeeModel* unity_places_place_entry_get_global_results_model (UnityPlacesPlaceEntry* self); static void _lambda36_ (DeeModelIter* it, Block4Data* _data4_); DeeModel* unity_places_place_entry_get_entry_results_model (UnityPlacesPlaceEntry* self); +static void unity_places_place_home_entry_update_search_failed (UnityPlacesPlaceHomeEntry* self); static void __lambda36__dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self); -static void _lambda37_ (DeeModelIter* it, Block4Data* _data4_); -static void __lambda37__dee_model_row_removed (DeeModel* _sender, DeeModelIter* iter, gpointer self); +static void _lambda43_ (DeeModelIter* it, Block4Data* _data4_); +static void __lambda43__dee_model_row_removed (DeeModel* _sender, DeeModelIter* iter, gpointer self); static void __lambda35__unity_places_place_entry_updated (UnityPlacesPlaceEntry* _sender, gpointer self); static Block4Data* block4_data_ref (Block4Data* _data4_); static void block4_data_unref (Block4Data* _data4_); +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); +void unity_testing_value_set_object_registry (GValue* value, gpointer v_object); +void unity_testing_value_take_object_registry (GValue* value, gpointer v_object); +gpointer unity_testing_value_get_object_registry (const GValue* value); +GType unity_testing_object_registry_get_type (void) G_GNUC_CONST; +UnityTestingObjectRegistry* unity_testing_object_registry_get_default (void); +GeeArrayList* unity_testing_object_registry_lookup (UnityTestingObjectRegistry* self, const char* name); +GType unity_places_place_search_bar_get_type (void) G_GNUC_CONST; +void unity_places_place_search_bar_set_search_fail (UnityPlacesPlaceSearchBar* self, gboolean value); static void unity_places_place_home_entry_real_connect (UnityPlacesPlaceEntry* base); void unity_places_place_entry_set_online (UnityPlacesPlaceEntry* self, gboolean value); static void unity_places_place_home_entry_real_set_search (UnityPlacesPlaceEntry* base, const char* search, GHashTable* hints); @@ -217,6 +275,7 @@ void unity_places_place_entry_set_entry_renderer_name (UnityPlacesPlaceEntry* se void unity_places_place_entry_set_global_search (UnityPlacesPlaceEntry* self, const char* search, GHashTable* hints); static void unity_places_place_home_entry_real_set_active_section (UnityPlacesPlaceEntry* base, guint section_id); static void unity_places_place_home_entry_real_set_global_search (UnityPlacesPlaceEntry* base, const char* search, GHashTable* hints); +UnityPlacesPlaceEntry* unity_places_place_home_entry_get_entry_for_uri (UnityPlacesPlaceHomeEntry* self, const char* uri); UnityShell* unity_places_place_home_entry_get_shell (UnityPlacesPlaceHomeEntry* self); static void unity_places_place_home_entry_set_shell (UnityPlacesPlaceHomeEntry* self, UnityShell* value); static char** _vala_array_dup3 (char** self, int length); @@ -295,6 +354,7 @@ static void _lambda36_ (DeeModelIter* it, Block4Data* _data4_) { return; } dee_model_append (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self), 0, dee_model_get_string (_model, it, (guint) 0), 1, dee_model_get_string (_model, it, (guint) 1), 2, GPOINTER_TO_UINT (gee_abstract_map_get ((GeeAbstractMap*) self->priv->entry_group_map, _data4_->entry)), 3, dee_model_get_string (_model, it, (guint) 3), 4, dee_model_get_string (_model, it, (guint) 4), 5, dee_model_get_string (_model, it, (guint) 5), -1, NULL); + unity_places_place_home_entry_update_search_failed (self); _g_object_unref0 (_model); } @@ -304,7 +364,7 @@ static void __lambda36__dee_model_row_added (DeeModel* _sender, DeeModelIter* it } -static void _lambda37_ (DeeModelIter* it, Block4Data* _data4_) { +static void _lambda43_ (DeeModelIter* it, Block4Data* _data4_) { UnityPlacesPlaceHomeEntry * self; DeeModel* _model; char* uri; @@ -330,13 +390,14 @@ static void _lambda37_ (DeeModelIter* it, Block4Data* _data4_) { } i = dee_model_next (_model, i); } + unity_places_place_home_entry_update_search_failed (self); _g_free0 (uri); _g_object_unref0 (_model); } -static void __lambda37__dee_model_row_removed (DeeModel* _sender, DeeModelIter* iter, gpointer self) { - _lambda37_ (iter, self); +static void __lambda43__dee_model_row_removed (DeeModel* _sender, DeeModelIter* iter, gpointer self) { + _lambda43_ (iter, self); } @@ -344,7 +405,7 @@ static void _lambda35_ (Block4Data* _data4_) { UnityPlacesPlaceHomeEntry * self; self = _data4_->self; g_signal_connect_data (unity_places_place_entry_get_global_results_model (_data4_->entry), "row-added", (GCallback) __lambda36__dee_model_row_added, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0); - g_signal_connect_data (unity_places_place_entry_get_global_results_model (_data4_->entry), "row-removed", (GCallback) __lambda37__dee_model_row_removed, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0); + g_signal_connect_data (unity_places_place_entry_get_global_results_model (_data4_->entry), "row-removed", (GCallback) __lambda43__dee_model_row_removed, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0); } @@ -396,6 +457,25 @@ static void unity_places_place_home_entry_on_place_added (UnityPlacesPlaceHomeEn } +static void unity_places_place_home_entry_update_search_failed (UnityPlacesPlaceHomeEntry* self) { + g_return_if_fail (self != NULL); + if (self->priv->place_view == NULL) { + UnityTestingObjectRegistry* _tmp0_; + GeeArrayList* _tmp1_; + GObject* _tmp2_; + UnityPlacesView* _tmp3_; + self->priv->place_view = (_tmp3_ = (_tmp2_ = (GObject*) gee_abstract_list_get ((GeeAbstractList*) (_tmp1_ = unity_testing_object_registry_lookup (_tmp0_ = unity_testing_object_registry_get_default (), "UnityPlacesView")), 0), UNITY_PLACES_IS_VIEW (_tmp2_) ? ((UnityPlacesView*) _tmp2_) : NULL), _g_object_unref0 (self->priv->place_view), _tmp3_); + _g_object_unref0 (_tmp1_); + _unity_testing_object_registry_unref0 (_tmp0_); + } + if (dee_model_get_n_rows (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self)) > 0) { + unity_places_place_search_bar_set_search_fail (self->priv->place_view->search_bar, FALSE); + } else { + unity_places_place_search_bar_set_search_fail (self->priv->place_view->search_bar, TRUE); + } +} + + static void unity_places_place_home_entry_real_connect (UnityPlacesPlaceEntry* base) { UnityPlacesPlaceHomeEntry * self; self = (UnityPlacesPlaceHomeEntry*) base; @@ -417,14 +497,24 @@ static void unity_places_place_home_entry_real_set_search (UnityPlacesPlaceEntry _tmp0_ = search == NULL; } if (_tmp0_) { + if (self->priv->place_view == NULL) { + UnityTestingObjectRegistry* _tmp1_; + GeeArrayList* _tmp2_; + GObject* _tmp3_; + UnityPlacesView* _tmp4_; + self->priv->place_view = (_tmp4_ = (_tmp3_ = (GObject*) gee_abstract_list_get ((GeeAbstractList*) (_tmp2_ = unity_testing_object_registry_lookup (_tmp1_ = unity_testing_object_registry_get_default (), "UnityPlacesView")), 0), UNITY_PLACES_IS_VIEW (_tmp3_) ? ((UnityPlacesView*) _tmp3_) : NULL), _g_object_unref0 (self->priv->place_view), _tmp4_); + _g_object_unref0 (_tmp2_); + _unity_testing_object_registry_unref0 (_tmp1_); + } unity_places_place_entry_set_entry_renderer_name ((UnityPlacesPlaceEntry*) self, "UnityHomeScreen"); + unity_places_place_search_bar_set_search_fail (self->priv->place_view->search_bar, FALSE); } else { unity_places_place_entry_set_entry_renderer_name ((UnityPlacesPlaceEntry*) self, "UnityHomeResultsRenderer"); { - GeeSet* _tmp1_; - GeeIterator* _tmp2_; + GeeSet* _tmp5_; + GeeIterator* _tmp6_; GeeIterator* _e_it; - _e_it = (_tmp2_ = gee_iterable_iterator ((GeeIterable*) (_tmp1_ = gee_map_get_entries ((GeeMap*) self->priv->entry_group_map))), _g_object_unref0 (_tmp1_), _tmp2_); + _e_it = (_tmp6_ = gee_iterable_iterator ((GeeIterable*) (_tmp5_ = gee_map_get_entries ((GeeMap*) self->priv->entry_group_map))), _g_object_unref0 (_tmp5_), _tmp6_); while (TRUE) { GeeMapEntry* e; UnityPlacesPlaceEntry* entry; @@ -464,6 +554,67 @@ static void unity_places_place_home_entry_real_set_global_search (UnityPlacesPla } +UnityPlacesPlaceEntry* unity_places_place_home_entry_get_entry_for_uri (UnityPlacesPlaceHomeEntry* self, const char* uri) { + UnityPlacesPlaceEntry* result = NULL; + gint entry_id; + DeeModelIter* iter; + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (uri != NULL, NULL); + entry_id = -1; + iter = dee_model_get_first_iter (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self)); + while (TRUE) { + if (!(!dee_model_is_last (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self), iter))) { + break; + } + if (_vala_strcmp0 (uri, dee_model_get_string (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self), iter, (guint) 0)) == 0) { + entry_id = (gint) dee_model_get_uint (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self), iter, (guint) 2); + break; + } + iter = dee_model_next (unity_places_place_entry_get_entry_results_model ((UnityPlacesPlaceEntry*) self), iter); + } + if (entry_id >= 0) { + UnityPlacesPlaceEntry* ent; + ent = NULL; + { + GeeSet* _tmp0_; + GeeIterator* _tmp1_; + GeeIterator* _e_it; + _e_it = (_tmp1_ = gee_iterable_iterator ((GeeIterable*) (_tmp0_ = gee_map_get_entries ((GeeMap*) self->priv->entry_group_map))), _g_object_unref0 (_tmp0_), _tmp1_); + while (TRUE) { + GeeMapEntry* e; + UnityPlacesPlaceEntry* entry; + gboolean _tmp2_ = FALSE; + if (!gee_iterator_next (_e_it)) { + break; + } + e = (GeeMapEntry*) gee_iterator_get (_e_it); + entry = _g_object_ref0 ((UnityPlacesPlaceEntry*) gee_map_entry_get_key (e)); + if (entry != NULL) { + _tmp2_ = entry_id == GPOINTER_TO_UINT (gee_map_entry_get_value (e)); + } else { + _tmp2_ = FALSE; + } + if (_tmp2_) { + ent = entry; + _g_object_unref0 (entry); + _g_object_unref0 (e); + break; + } + _g_object_unref0 (entry); + _g_object_unref0 (e); + } + _g_object_unref0 (_e_it); + } + if (UNITY_PLACES_IS_PLACE_ENTRY (ent)) { + result = ent; + return result; + } + } + result = NULL; + return result; +} + + UnityShell* unity_places_place_home_entry_get_shell (UnityPlacesPlaceHomeEntry* self) { UnityShell* result; g_return_val_if_fail (self != NULL, NULL); @@ -973,6 +1124,7 @@ static void unity_places_place_home_entry_unity_places_place_entry_interface_ini static void unity_places_place_home_entry_instance_init (UnityPlacesPlaceHomeEntry * self) { self->priv = UNITY_PLACES_PLACE_HOME_ENTRY_GET_PRIVATE (self); + self->priv->place_view = NULL; } @@ -996,6 +1148,7 @@ static void unity_places_place_home_entry_finalize (GObject* obj) { _g_object_unref0 (self->priv->_global_renderer_hints); _g_object_unref0 (self->priv->_place_model); _g_object_unref0 (self->priv->entry_group_map); + _g_object_unref0 (self->priv->place_view); G_OBJECT_CLASS (unity_places_place_home_entry_parent_class)->finalize (obj); } diff --git a/unity-private/places/places-place-home.vala b/unity-private/places/places-place-home.vala index 3312b7902..18727e8e7 100644 --- a/unity-private/places/places-place-home.vala +++ b/unity-private/places/places-place-home.vala @@ -17,6 +17,7 @@ * */ using Unity; +using Unity.Testing; namespace Unity.Places { @@ -62,6 +63,7 @@ namespace Unity.Places public PlaceModel place_model { get; set construct; } private Gee.HashMap<PlaceEntry?, uint> entry_group_map; + private Places.View place_view = null; public PlaceHomeEntry (Shell shell, PlaceModel model) { @@ -131,6 +133,7 @@ namespace Unity.Places 5, _model.get_string (it, 5), -1); + update_search_failed (); }); entry.global_results_model.row_removed.connect ((it) => { @@ -149,11 +152,28 @@ namespace Unity.Places i = _model.next (i); } + + update_search_failed (); }); }); } } + private void update_search_failed () + { + if (place_view == null) + place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View; + + if (entry_results_model.get_n_rows () > 0) + { + place_view.search_bar.search_fail = false; + } + else + { + place_view.search_bar.search_fail = true; + } + } + /* * Public Methods */ @@ -168,7 +188,10 @@ namespace Unity.Places if (search == "" || search == null) { + if (place_view == null) + place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View; entry_renderer_name = "UnityHomeScreen"; + place_view.search_bar.search_fail = false; } else { @@ -202,6 +225,43 @@ namespace Unity.Places { } + + public unowned PlaceEntry? get_entry_for_uri (string uri) + { + int entry_id = -1; + + unowned Dee.ModelIter iter = entry_results_model.get_first_iter (); + while (!entry_results_model.is_last (iter)) + { + if (uri == entry_results_model.get_string (iter, 0)) + { + entry_id = (int) entry_results_model.get_uint (iter, 2); + break; + } + + iter = entry_results_model.next (iter); + } + + if (entry_id >= 0) + { + unowned PlaceEntry? ent = null; + + foreach (Gee.Map.Entry<PlaceEntry, uint> e in entry_group_map.entries) + { + PlaceEntry? entry = e.key; + + if (entry != null && entry_id == e.value) + { + ent = entry; + break; + } + } + + if (ent is PlaceEntry) + return ent; + } + + return null; + } } } - diff --git a/unity-private/places/places-place-search-bar.c b/unity-private/places/places-place-search-bar.c index 3cf0acef1..64a07119b 100644 --- a/unity-private/places/places-place-search-bar.c +++ b/unity-private/places/places-place-search-bar.c @@ -130,6 +130,8 @@ typedef struct _UnityPlacesPlaceSearchEntryPrivate UnityPlacesPlaceSearchEntryPr #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) #define UNITY_PLACES_TYPE_ACTIVATION_STATUS (unity_places_activation_status_get_type ()) + +#define UNITY_PLACES_TYPE_SECTION_STYLE (unity_places_section_style_get_type ()) #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _Block5Data Block5Data; typedef struct _UnityPlacesPlaceSearchBarBackgroundPrivate UnityPlacesPlaceSearchBarBackgroundPrivate; @@ -199,6 +201,7 @@ struct _UnityPlacesPlaceSearchBarPrivate { UnityPlacesPlaceEntry* active_entry; UnityPlacesPlaceSearchBarBackground* bg; UnityPlacesPlaceSearchNavigation* navigation; + gboolean _search_fail; }; struct _UnityPlacesPlaceSearchEntry { @@ -221,6 +224,11 @@ typedef enum { UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_HIDE_DASH } UnityPlacesActivationStatus; +typedef enum { + UNITY_PLACES_SECTION_STYLE_BUTTONS, + UNITY_PLACES_SECTION_STYLE_BREADCRUMB +} UnityPlacesSectionStyle; + struct _Block5Data { int _ref_count_; UnityPlacesPlaceSearchBar * self; @@ -243,6 +251,7 @@ struct _UnityPlacesPlaceSearchBarBackgroundPrivate { gint _entry_position; ClutterCairoTexture* texture; CtkEffectGlow* glow; + gboolean _search_empty; UnityPlacesPlaceSearchNavigation* _navigation; UnityPlacesPlaceSearchEntry* _search_entry; }; @@ -261,7 +270,8 @@ GType unity_places_place_search_bar_background_get_type (void) G_GNUC_CONST; GType unity_places_place_search_navigation_get_type (void) G_GNUC_CONST; #define UNITY_PLACES_PLACE_SEARCH_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR, UnityPlacesPlaceSearchBarPrivate)) enum { - UNITY_PLACES_PLACE_SEARCH_BAR_DUMMY_PROPERTY + UNITY_PLACES_PLACE_SEARCH_BAR_DUMMY_PROPERTY, + UNITY_PLACES_PLACE_SEARCH_BAR_SEARCH_FAIL }; #define UNITY_PLACES_PLACE_SEARCH_BAR_SPACING 8 #define UNITY_PLACES_PLACE_SEARCH_BAR_RANDOM_TEXT_WIDTH 400 @@ -277,6 +287,7 @@ GType unity_testing_object_registry_get_type (void) G_GNUC_CONST; UnityTestingObjectRegistry* unity_testing_object_registry_get_default (void); void unity_testing_object_registry_register (UnityTestingObjectRegistry* self, const char* name, GObject* object); void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); +void unity_places_place_search_bar_set_search_fail (UnityPlacesPlaceSearchBar* self, gboolean value); void unity_places_place_search_entry_reset (UnityPlacesPlaceSearchEntry* self); void unity_places_place_search_bar_search (UnityPlacesPlaceSearchBar* self, const char* text); static void unity_places_place_search_bar_on_search_text_changed (UnityPlacesPlaceSearchBar* self, const char* text); @@ -293,15 +304,19 @@ UnityPlacesActivationStatus unity_places_place_activate (UnityPlacesPlace* self, void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section); void unity_places_place_search_bar_background_set_entry_position (UnityPlacesPlaceSearchBarBackground* self, gint value); void unity_places_place_search_sections_bar_set_active_entry (UnityPlacesPlaceSearchSectionsBar* self, UnityPlacesPlaceEntry* entry); -static gboolean _lambda43_ (Block5Data* _data5_); +GType unity_places_section_style_get_type (void) G_GNUC_CONST; +UnityPlacesSectionStyle unity_places_place_search_sections_bar_get_style (UnityPlacesPlaceSearchSectionsBar* self); +static gboolean _lambda42_ (Block5Data* _data5_); void unity_places_place_search_sections_bar_set_active_section (UnityPlacesPlaceSearchSectionsBar* self, guint section_id); -static gboolean __lambda43__gsource_func (gpointer self); +static gboolean __lambda42__gsource_func (gpointer self); void unity_places_place_search_navigation_set_active_entry (UnityPlacesPlaceSearchNavigation* self, UnityPlacesPlaceEntry* entry); void unity_places_place_search_entry_set_active_entry (UnityPlacesPlaceSearchEntry* self, UnityPlacesPlaceEntry* entry); GeeHashMap* unity_places_place_entry_get_hints (UnityPlacesPlaceEntry* self); void unity_places_place_search_extra_action_set_icon_from_gicon_string (UnityPlacesPlaceSearchExtraAction* self, const char* icon_string); static Block5Data* block5_data_ref (Block5Data* _data5_); static void block5_data_unref (Block5Data* _data5_); +gboolean unity_places_place_search_bar_get_search_fail (UnityPlacesPlaceSearchBar* self); +void unity_places_place_search_bar_background_set_search_empty (UnityPlacesPlaceSearchBarBackground* self, gboolean value); UnityPlacesPlaceSearchNavigation* unity_places_place_search_navigation_new (void); UnityPlacesPlaceSearchNavigation* unity_places_place_search_navigation_construct (GType object_type); UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_new (void); @@ -316,10 +331,13 @@ UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_ne UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_construct (GType object_type, UnityPlacesPlaceSearchNavigation* nav, UnityPlacesPlaceSearchEntry* search_entry); static GObject * unity_places_place_search_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_place_search_bar_finalize (GObject* obj); +static void unity_places_place_search_bar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void unity_places_place_search_bar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); #define UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_PLACES_TYPE_PLACE_SEARCH_BAR_BACKGROUND, UnityPlacesPlaceSearchBarBackgroundPrivate)) enum { UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_DUMMY_PROPERTY, UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_ENTRY_POSITION, + UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_EMPTY, UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_NAVIGATION, UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_ENTRY }; @@ -328,6 +346,7 @@ static void unity_places_place_search_bar_background_real_allocate (ClutterActor gint unity_places_place_search_bar_background_get_entry_position (UnityPlacesPlaceSearchBarBackground* self); UnityPlacesPlaceSearchNavigation* unity_places_place_search_bar_background_get_navigation (UnityPlacesPlaceSearchBarBackground* self); UnityPlacesPlaceSearchEntry* unity_places_place_search_bar_background_get_search_entry (UnityPlacesPlaceSearchBarBackground* self); +gboolean unity_places_place_search_bar_background_get_search_empty (UnityPlacesPlaceSearchBarBackground* self); static void unity_places_place_search_bar_background_set_navigation (UnityPlacesPlaceSearchBarBackground* self, UnityPlacesPlaceSearchNavigation* value); static void unity_places_place_search_bar_background_set_search_entry (UnityPlacesPlaceSearchBarBackground* self, UnityPlacesPlaceSearchEntry* value); static GObject * unity_places_place_search_bar_background_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); @@ -354,6 +373,7 @@ UnityPlacesPlaceSearchBar* unity_places_place_search_bar_new (void) { void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self) { g_return_if_fail (self != NULL); + unity_places_place_search_bar_set_search_fail (self, FALSE); unity_places_place_search_entry_reset (self->entry); } @@ -442,7 +462,7 @@ static void unity_places_place_search_bar_on_extra_action_activated (UnityPlaces } default: { - g_warning ("places-place-search-bar.vala:159: Unexpected activation status: %u", (guint) _result_); + g_warning ("places-place-search-bar.vala:173: Unexpected activation status: %u", (guint) _result_); break; } } @@ -455,7 +475,7 @@ static gpointer _g_object_ref0 (gpointer self) { } -static gboolean _lambda43_ (Block5Data* _data5_) { +static gboolean _lambda42_ (Block5Data* _data5_) { UnityPlacesPlaceSearchBar * self; gboolean result = FALSE; self = _data5_->self; @@ -465,9 +485,9 @@ static gboolean _lambda43_ (Block5Data* _data5_) { } -static gboolean __lambda43__gsource_func (gpointer self) { +static gboolean __lambda42__gsource_func (gpointer self) { gboolean result; - result = _lambda43_ (self); + result = _lambda42_ (self); return result; } @@ -489,6 +509,7 @@ static void block5_data_unref (Block5Data* _data5_) { void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section) { Block5Data* _data5_; UnityPlacesPlaceEntry* _tmp0_; + gboolean _tmp1_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (entry != NULL); _data5_ = g_slice_new0 (Block5Data); @@ -498,19 +519,24 @@ void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearch self->priv->active_entry = (_tmp0_ = _g_object_ref0 (entry), _g_object_unref0 (self->priv->active_entry), _tmp0_); unity_places_place_search_bar_background_set_entry_position (self->priv->bg, x); unity_places_place_search_sections_bar_set_active_entry (self->sections, entry); - if (_data5_->section != 0) { - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda43__gsource_func, block5_data_ref (_data5_), block5_data_unref); + if (unity_places_place_search_sections_bar_get_style (self->sections) == UNITY_PLACES_SECTION_STYLE_BREADCRUMB) { + _tmp1_ = _data5_->section == 0; + } else { + _tmp1_ = FALSE; + } + if (!_tmp1_) { + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda42__gsource_func, block5_data_ref (_data5_), block5_data_unref); } unity_places_place_search_navigation_set_active_entry (self->priv->navigation, entry); unity_places_place_search_entry_set_active_entry (self->entry, entry); clutter_actor_grab_key_focus ((ClutterActor*) self->entry->text); if (unity_places_place_entry_get_hints (entry) != NULL) { - char* _tmp1_; - gboolean _tmp2_; - if ((_tmp2_ = (_tmp1_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")) != NULL, _g_free0 (_tmp1_), _tmp2_)) { - char* _tmp3_; - unity_places_place_search_extra_action_set_icon_from_gicon_string (self->extra_action, _tmp3_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")); - _g_free0 (_tmp3_); + char* _tmp2_; + gboolean _tmp3_; + if ((_tmp3_ = (_tmp2_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")) != NULL, _g_free0 (_tmp2_), _tmp3_)) { + char* _tmp4_; + unity_places_place_search_extra_action_set_icon_from_gicon_string (self->extra_action, _tmp4_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")); + _g_free0 (_tmp4_); clutter_actor_show ((ClutterActor*) self->extra_action); } else { clutter_actor_hide ((ClutterActor*) self->extra_action); @@ -520,6 +546,25 @@ void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearch } +gboolean unity_places_place_search_bar_get_search_fail (UnityPlacesPlaceSearchBar* self) { + gboolean result; + g_return_val_if_fail (self != NULL, FALSE); + result = self->priv->_search_fail; + return result; +} + + +void unity_places_place_search_bar_set_search_fail (UnityPlacesPlaceSearchBar* self, gboolean value) { + g_return_if_fail (self != NULL); + if (self->priv->_search_fail != value) { + self->priv->_search_fail = value; + unity_places_place_search_bar_background_set_search_empty (self->priv->bg, self->priv->_search_fail); + unity_places_place_search_bar_background_update_background (self->priv->bg); + } + g_object_notify ((GObject *) self, "search-fail"); +} + + static void _unity_places_place_search_bar_on_search_text_changed_unity_places_place_search_entry_text_changed (UnityPlacesPlaceSearchEntry* _sender, const char* text, gpointer self) { unity_places_place_search_bar_on_search_text_changed (self, text); } @@ -580,14 +625,18 @@ static void unity_places_place_search_bar_class_init (UnityPlacesPlaceSearchBarC g_type_class_add_private (klass, sizeof (UnityPlacesPlaceSearchBarPrivate)); CLUTTER_ACTOR_CLASS (klass)->allocate = unity_places_place_search_bar_real_allocate; CLUTTER_ACTOR_CLASS (klass)->get_preferred_height = unity_places_place_search_bar_real_get_preferred_height; + G_OBJECT_CLASS (klass)->get_property = unity_places_place_search_bar_get_property; + G_OBJECT_CLASS (klass)->set_property = unity_places_place_search_bar_set_property; G_OBJECT_CLASS (klass)->constructor = unity_places_place_search_bar_constructor; G_OBJECT_CLASS (klass)->finalize = unity_places_place_search_bar_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_PLACE_SEARCH_BAR_SEARCH_FAIL, g_param_spec_boolean ("search-fail", "search-fail", "search-fail", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); } static void unity_places_place_search_bar_instance_init (UnityPlacesPlaceSearchBar * self) { self->priv = UNITY_PLACES_PLACE_SEARCH_BAR_GET_PRIVATE (self); self->priv->active_entry = NULL; + self->priv->_search_fail = FALSE; } @@ -616,6 +665,34 @@ GType unity_places_place_search_bar_get_type (void) { } +static void unity_places_place_search_bar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + UnityPlacesPlaceSearchBar * self; + self = UNITY_PLACES_PLACE_SEARCH_BAR (object); + switch (property_id) { + case UNITY_PLACES_PLACE_SEARCH_BAR_SEARCH_FAIL: + g_value_set_boolean (value, unity_places_place_search_bar_get_search_fail (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void unity_places_place_search_bar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + UnityPlacesPlaceSearchBar * self; + self = UNITY_PLACES_PLACE_SEARCH_BAR (object); + switch (property_id) { + case UNITY_PLACES_PLACE_SEARCH_BAR_SEARCH_FAIL: + unity_places_place_search_bar_set_search_fail (self, g_value_get_boolean (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_construct (GType object_type, UnityPlacesPlaceSearchNavigation* nav, UnityPlacesPlaceSearchEntry* search_entry) { UnityPlacesPlaceSearchBarBackground * self; g_return_val_if_fail (nav != NULL, NULL); @@ -743,6 +820,10 @@ gboolean unity_places_place_search_bar_background_update_background (UnityPlaces cairo_close_path (cr); cairo_fill_preserve (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + if (self->priv->_search_empty) { + cairo_set_source_rgba (cr, (double) 1.0f, (double) 0.0f, (double) 0.0f, (double) 0.3f); + cairo_fill_preserve (cr); + } cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) 0.6f); cairo_stroke (cr); ctk_effect_set_invalidate_effect_cache ((CtkEffect*) self->priv->glow, TRUE); @@ -770,6 +851,21 @@ void unity_places_place_search_bar_background_set_entry_position (UnityPlacesPla } +gboolean unity_places_place_search_bar_background_get_search_empty (UnityPlacesPlaceSearchBarBackground* self) { + gboolean result; + g_return_val_if_fail (self != NULL, FALSE); + result = self->priv->_search_empty; + return result; +} + + +void unity_places_place_search_bar_background_set_search_empty (UnityPlacesPlaceSearchBarBackground* self, gboolean value) { + g_return_if_fail (self != NULL); + self->priv->_search_empty = value; + g_object_notify ((GObject *) self, "search-empty"); +} + + UnityPlacesPlaceSearchNavigation* unity_places_place_search_bar_background_get_navigation (UnityPlacesPlaceSearchBarBackground* self) { UnityPlacesPlaceSearchNavigation* result; g_return_val_if_fail (self != NULL, NULL); @@ -832,7 +928,7 @@ static GObject * unity_places_place_search_bar_background_constructor (GType typ e = _inner_error_; _inner_error_ = NULL; { - g_warning ("places-place-search-bar.vala:247: Unable to load dash background"); + g_warning ("places-place-search-bar.vala:264: Unable to load dash background"); _g_error_free0 (e); } } @@ -849,6 +945,7 @@ static GObject * unity_places_place_search_bar_background_constructor (GType typ ctk_effect_glow_set_factor (self->priv->glow, 1.0f); ctk_effect_set_margin ((CtkEffect*) self->priv->glow, 5); ctk_actor_add_effect ((CtkActor*) self, (CtkEffect*) self->priv->glow); + unity_places_place_search_bar_background_set_search_empty (self, FALSE); } return obj; } @@ -863,6 +960,7 @@ static void unity_places_place_search_bar_background_class_init (UnityPlacesPlac G_OBJECT_CLASS (klass)->constructor = unity_places_place_search_bar_background_constructor; G_OBJECT_CLASS (klass)->finalize = unity_places_place_search_bar_background_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_ENTRY_POSITION, g_param_spec_int ("entry-position", "entry-position", "entry-position", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_EMPTY, g_param_spec_boolean ("search-empty", "search-empty", "search-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_NAVIGATION, g_param_spec_object ("navigation", "navigation", "navigation", UNITY_PLACES_TYPE_PLACE_SEARCH_NAVIGATION, 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_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_ENTRY, g_param_spec_object ("search-entry", "search-entry", "search-entry", UNITY_PLACES_TYPE_PLACE_SEARCH_ENTRY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); } @@ -908,6 +1006,9 @@ static void unity_places_place_search_bar_background_get_property (GObject * obj case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_ENTRY_POSITION: g_value_set_int (value, unity_places_place_search_bar_background_get_entry_position (self)); break; + case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_EMPTY: + g_value_set_boolean (value, unity_places_place_search_bar_background_get_search_empty (self)); + break; case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_NAVIGATION: g_value_set_object (value, unity_places_place_search_bar_background_get_navigation (self)); break; @@ -928,6 +1029,9 @@ static void unity_places_place_search_bar_background_set_property (GObject * obj case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_ENTRY_POSITION: unity_places_place_search_bar_background_set_entry_position (self, g_value_get_int (value)); break; + case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_SEARCH_EMPTY: + unity_places_place_search_bar_background_set_search_empty (self, g_value_get_boolean (value)); + break; case UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_NAVIGATION: unity_places_place_search_bar_background_set_navigation (self, g_value_get_object (value)); break; diff --git a/unity-private/places/places-place-search-bar.vala b/unity-private/places/places-place-search-bar.vala index a467bc064..cf38d474a 100644 --- a/unity-private/places/places-place-search-bar.vala +++ b/unity-private/places/places-place-search-bar.vala @@ -34,6 +34,19 @@ namespace Unity.Places public PlaceSearchSectionsBar sections; public PlaceSearchExtraAction extra_action; + private bool _search_fail = false; + public bool search_fail { + get { return _search_fail; } + set { + if (_search_fail != value) + { + _search_fail = value; + bg.search_empty = _search_fail; + bg.update_background (); + } + } + } + public PlaceSearchBar () { Object (orientation:Ctk.Orientation.HORIZONTAL, @@ -83,6 +96,7 @@ namespace Unity.Places public void reset () { + search_fail = false; entry.reset (); } @@ -170,9 +184,10 @@ namespace Unity.Places active_entry = entry; bg.entry_position = x; sections.set_active_entry (entry); - if (section != 0) + + if (!(sections.style == SectionStyle.BREADCRUMB && section ==0)) { - Idle.add (() => { + Timeout.add (0, () => { sections.set_active_section (section); return false; }); @@ -224,6 +239,8 @@ namespace Unity.Places private Clutter.CairoTexture texture; private Ctk.EffectGlow glow; + public bool search_empty { get; set; } + public PlaceSearchNavigation navigation { get; construct; } public PlaceSearchEntry search_entry { get; construct; } @@ -257,6 +274,8 @@ namespace Unity.Places glow.set_factor (1.0f); glow.set_margin (5); add_effect (glow); + + search_empty = false; } private override void allocate (Clutter.ActorBox box, @@ -407,6 +426,13 @@ namespace Unity.Places cr.fill_preserve (); cr.set_operator (Cairo.Operator.OVER); + + if (search_empty) + { + cr.set_source_rgba (1.0f, 0.0f, 0.0f, 0.3f); + cr.fill_preserve (); + } + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.6f); cr.stroke (); diff --git a/unity-private/places/places-place-search-entry.c b/unity-private/places/places-place-search-entry.c index 8d2fb8c0f..53e84e569 100644 --- a/unity-private/places/places-place-search-entry.c +++ b/unity-private/places/places-place-search-entry.c @@ -165,8 +165,8 @@ UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_construct (GType ob static void unity_places_place_search_entry_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height); static void unity_places_place_search_entry_real_get_preferred_width (ClutterActor* base, float for_height, float* min_width, float* nat_width); static void unity_places_place_search_entry_on_text_changed (UnityPlacesPlaceSearchEntry* self); -static gboolean _lambda40_ (UnityPlacesPlaceSearchEntry* self); -static gboolean __lambda40__gsource_func (gpointer self); +static gboolean _lambda39_ (UnityPlacesPlaceSearchEntry* self); +static gboolean __lambda39__gsource_func (gpointer self); static void unity_places_place_search_entry_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static void unity_places_place_search_entry_real_paint (ClutterActor* base); static void unity_places_place_search_entry_real_map (ClutterActor* base); @@ -186,8 +186,8 @@ static void _unity_places_place_search_entry_on_text_changed_clutter_text_text_c static void _unity_places_place_search_entry_on_key_focus_in_clutter_actor_key_focus_in (ClutterActor* _sender, gpointer self); static void _unity_places_place_search_entry_on_key_focus_out_clutter_actor_key_focus_out (ClutterActor* _sender, gpointer self); static void _unity_places_place_search_entry_paint_right_icon_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); -static gboolean _lambda41_ (UnityPlacesPlaceSearchEntry* self); -static gboolean __lambda41__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _lambda40_ (UnityPlacesPlaceSearchEntry* self); +static gboolean __lambda40__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static GObject * unity_places_place_search_entry_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_place_search_entry_finalize (GObject* obj); static void unity_places_place_search_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -241,7 +241,7 @@ static gpointer _g_object_ref0 (gpointer self) { } -static gboolean _lambda40_ (UnityPlacesPlaceSearchEntry* self) { +static gboolean _lambda39_ (UnityPlacesPlaceSearchEntry* self) { gboolean result = FALSE; g_signal_emit_by_name (self, "text-changed", clutter_text_get_text ((ClutterText*) self->text)); self->priv->live_search_timeout = (guint) 0; @@ -250,9 +250,9 @@ static gboolean _lambda40_ (UnityPlacesPlaceSearchEntry* self) { } -static gboolean __lambda40__gsource_func (gpointer self) { +static gboolean __lambda39__gsource_func (gpointer self) { gboolean result; - result = _lambda40_ (self); + result = _lambda39_ (self); return result; } @@ -282,7 +282,7 @@ static void unity_places_place_search_entry_on_text_changed (UnityPlacesPlaceSea if (self->priv->live_search_timeout != 0) { g_source_remove (self->priv->live_search_timeout); } - self->priv->live_search_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) UNITY_PLACES_PLACE_SEARCH_ENTRY_LIVE_SEARCH_TIMEOUT, __lambda40__gsource_func, g_object_ref (self), g_object_unref); + self->priv->live_search_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) UNITY_PLACES_PLACE_SEARCH_ENTRY_LIVE_SEARCH_TIMEOUT, __lambda39__gsource_func, g_object_ref (self), g_object_unref); } @@ -476,7 +476,7 @@ static void _unity_places_place_search_entry_paint_right_icon_unity_cairo_canvas } -static gboolean _lambda41_ (UnityPlacesPlaceSearchEntry* self) { +static gboolean _lambda40_ (UnityPlacesPlaceSearchEntry* self) { gboolean result = FALSE; clutter_text_set_text ((ClutterText*) self->text, ""); g_signal_emit_by_name (self, "text-changed", ""); @@ -485,9 +485,9 @@ static gboolean _lambda41_ (UnityPlacesPlaceSearchEntry* self) { } -static gboolean __lambda41__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { +static gboolean __lambda40__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { gboolean result; - result = _lambda41_ (self); + result = _lambda40_ (self); return result; } @@ -540,7 +540,7 @@ static GObject * unity_places_place_search_entry_constructor (GType type, guint ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->right_icon, FALSE, TRUE); clutter_actor_show ((ClutterActor*) self->right_icon); clutter_actor_set_reactive ((ClutterActor*) self->right_icon, TRUE); - g_signal_connect_object ((ClutterActor*) self->right_icon, "button-release-event", (GCallback) __lambda41__clutter_actor_button_release_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->right_icon, "button-release-event", (GCallback) __lambda40__clutter_actor_button_release_event, self, 0); } return obj; } diff --git a/unity-private/places/places-place-search-navigation.c b/unity-private/places/places-place-search-navigation.c index 215323fd3..56b5353c9 100644 --- a/unity-private/places/places-place-search-navigation.c +++ b/unity-private/places/places-place-search-navigation.c @@ -324,11 +324,11 @@ static void unity_places_place_search_navigation_real_get_preferred_width (Clutt static void unity_places_place_search_navigation_draw_back_arrow (UnityPlacesPlaceSearchNavigation* self, cairo_t* cr, gint width, gint height); static void unity_places_place_search_navigation_draw_forward_arrow (UnityPlacesPlaceSearchNavigation* self, cairo_t* cr, gint width, gint height); static void _unity_places_place_search_navigation_draw_back_arrow_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); +static gboolean _lambda37_ (UnityPlacesPlaceSearchNavigation* self); +static gboolean __lambda37__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static void _unity_places_place_search_navigation_draw_forward_arrow_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); static gboolean _lambda38_ (UnityPlacesPlaceSearchNavigation* self); static gboolean __lambda38__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); -static void _unity_places_place_search_navigation_draw_forward_arrow_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); -static gboolean _lambda39_ (UnityPlacesPlaceSearchNavigation* self); -static gboolean __lambda39__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static GObject * unity_places_place_search_navigation_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_place_search_navigation_finalize (GObject* obj); @@ -1753,6 +1753,17 @@ static gboolean unity_places_place_search_navigation_refresh_states_co (UnityPla goto _state_3; } _state_0: + if (data->self->priv->remote == 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; + } + } { data->_state_ = 3; unity_places_place_browser_remote_get_state (data->self->priv->remote, unity_places_place_search_navigation_refresh_states_ready, data); @@ -1777,7 +1788,7 @@ static gboolean unity_places_place_search_navigation_refresh_states_co (UnityPla data->e = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-place-search-navigation.vala:146: %s", data->_tmp2_ = g_strconcat ("Unable to refresh browser navigation state: ", string_to_string (data->e->message), NULL)); + g_warning ("places-place-search-navigation.vala:150: %s", data->_tmp2_ = g_strconcat ("Unable to refresh browser navigation state: ", string_to_string (data->e->message), NULL)); _g_free0 (data->_tmp2_); _g_error_free0 (data->e); } @@ -1842,6 +1853,17 @@ static gboolean unity_places_place_search_navigation_go_forward_co (UnityPlacesP goto _state_4; } _state_0: + if (data->self->priv->remote == 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; + } + } { data->_state_ = 4; unity_places_place_browser_remote_go_forward (data->self->priv->remote, unity_places_place_search_navigation_go_forward_ready, data); @@ -1866,7 +1888,7 @@ static gboolean unity_places_place_search_navigation_go_forward_co (UnityPlacesP data->e = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-place-search-navigation.vala:157: %s", data->_tmp2_ = g_strconcat ("Unable to go forward in browser view: ", string_to_string (data->e->message), NULL)); + g_warning ("places-place-search-navigation.vala:164: %s", data->_tmp2_ = g_strconcat ("Unable to go forward in browser view: ", string_to_string (data->e->message), NULL)); _g_free0 (data->_tmp2_); _g_error_free0 (data->e); } @@ -1931,6 +1953,17 @@ static gboolean unity_places_place_search_navigation_go_back_co (UnityPlacesPlac goto _state_5; } _state_0: + if (data->self->priv->remote == 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; + } + } { data->_state_ = 5; unity_places_place_browser_remote_go_back (data->self->priv->remote, unity_places_place_search_navigation_go_back_ready, data); @@ -1955,7 +1988,7 @@ static gboolean unity_places_place_search_navigation_go_back_co (UnityPlacesPlac data->e = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("places-place-search-navigation.vala:168: %s", data->_tmp2_ = g_strconcat ("Unable to go back in browser view: ", string_to_string (data->e->message), NULL)); + g_warning ("places-place-search-navigation.vala:178: %s", data->_tmp2_ = g_strconcat ("Unable to go back in browser view: ", string_to_string (data->e->message), NULL)); _g_free0 (data->_tmp2_); _g_error_free0 (data->e); } @@ -1998,7 +2031,7 @@ static void unity_places_place_search_navigation_draw_back_arrow (UnityPlacesPla if (self->priv->back_sensitive) { _tmp0_ = 1.0f; } else { - _tmp0_ = 0.5f; + _tmp0_ = 0.125f; } cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) _tmp0_); cairo_move_to (cr, (double) ((width / 2) - UNITY_PLACES_PLACE_SEARCH_NAVIGATION_ARROW_SIZE), (double) (height / 2)); @@ -2021,7 +2054,7 @@ static void unity_places_place_search_navigation_draw_forward_arrow (UnityPlaces if (self->priv->forward_sensitive) { _tmp0_ = 1.0f; } else { - _tmp0_ = 0.5f; + _tmp0_ = 0.125f; } cairo_set_source_rgba (cr, (double) 1.0f, (double) 1.0f, (double) 1.0f, (double) _tmp0_); cairo_move_to (cr, (double) ((width / 2) + UNITY_PLACES_PLACE_SEARCH_NAVIGATION_ARROW_SIZE), (double) (height / 2)); @@ -2037,7 +2070,7 @@ static void _unity_places_place_search_navigation_draw_back_arrow_unity_cairo_ca } -static gboolean _lambda38_ (UnityPlacesPlaceSearchNavigation* self) { +static gboolean _lambda37_ (UnityPlacesPlaceSearchNavigation* self) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; if (self->priv->remote != NULL) { @@ -2053,9 +2086,9 @@ static gboolean _lambda38_ (UnityPlacesPlaceSearchNavigation* self) { } -static gboolean __lambda38__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { +static gboolean __lambda37__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { gboolean result; - result = _lambda38_ (self); + result = _lambda37_ (self); return result; } @@ -2065,7 +2098,7 @@ static void _unity_places_place_search_navigation_draw_forward_arrow_unity_cairo } -static gboolean _lambda39_ (UnityPlacesPlaceSearchNavigation* self) { +static gboolean _lambda38_ (UnityPlacesPlaceSearchNavigation* self) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; if (self->priv->remote != NULL) { @@ -2081,9 +2114,9 @@ static gboolean _lambda39_ (UnityPlacesPlaceSearchNavigation* self) { } -static gboolean __lambda39__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { +static gboolean __lambda38__clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { gboolean result; - result = _lambda39_ (self); + result = _lambda38_ (self); return result; } @@ -2103,11 +2136,11 @@ static GObject * unity_places_place_search_navigation_constructor (GType type, g ClutterColor _tmp4_; self->priv->back = (_tmp0_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_place_search_navigation_draw_back_arrow_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->back), _tmp0_); clutter_actor_set_reactive ((ClutterActor*) self->priv->back, TRUE); - g_signal_connect_object ((ClutterActor*) self->priv->back, "button-release-event", (GCallback) __lambda38__clutter_actor_button_release_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->back, "button-release-event", (GCallback) __lambda37__clutter_actor_button_release_event, self, 0); ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->priv->back, TRUE, TRUE); clutter_actor_show ((ClutterActor*) self->priv->back); self->priv->forward = (_tmp1_ = g_object_ref_sink (unity_cairo_canvas_new (_unity_places_place_search_navigation_draw_forward_arrow_unity_cairo_canvas_cairo_canvas_paint, self)), _g_object_unref0 (self->priv->forward), _tmp1_); - g_signal_connect_object ((ClutterActor*) self->priv->forward, "button-release-event", (GCallback) __lambda39__clutter_actor_button_release_event, self, 0); + g_signal_connect_object ((ClutterActor*) self->priv->forward, "button-release-event", (GCallback) __lambda38__clutter_actor_button_release_event, self, 0); ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->priv->forward, TRUE, TRUE); clutter_actor_show ((ClutterActor*) self->priv->forward); self->priv->glow = (_tmp2_ = g_object_ref_sink ((CtkEffectGlow*) ctk_effect_glow_new ()), _g_object_unref0 (self->priv->glow), _tmp2_); diff --git a/unity-private/places/places-place-search-navigation.vala b/unity-private/places/places-place-search-navigation.vala index adab1d125..00b4ff564 100644 --- a/unity-private/places/places-place-search-navigation.vala +++ b/unity-private/places/places-place-search-navigation.vala @@ -138,10 +138,14 @@ namespace Unity.Places private async void refresh_states () { + if (remote == null) + return; + try { var states = yield remote.get_state (); back_sensitive = states[0].sensitive; forward_sensitive = states[1].sensitive; + } catch (DBus.Error e) { warning (@"Unable to refresh browser navigation state: $(e.message)"); } @@ -149,6 +153,9 @@ namespace Unity.Places private async void go_forward () { + if (remote == null) + return; + try { var states = yield remote.go_forward (); back_sensitive = states[0].sensitive; @@ -160,6 +167,9 @@ namespace Unity.Places private async void go_back () { + if (remote == null) + return; + try { var states = yield remote.go_back (); back_sensitive = states[0].sensitive; @@ -188,7 +198,7 @@ namespace Unity.Places cr.set_line_width (1.0f); cr.translate (-0.5f, -0.5f); - cr.set_source_rgba (1.0f, 1.0f, 1.0f, back_sensitive ? 1.0f : 0.5f); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, back_sensitive ? 1.0f : 0.125f); cr.move_to (width/2 - ARROW_SIZE, height/2); cr.line_to (width/2 + ARROW_SIZE, height/2 - ARROW_SIZE); @@ -209,7 +219,7 @@ namespace Unity.Places cr.set_line_width (1.0f); cr.translate (0.5f, -0.5f); - cr.set_source_rgba (1.0f, 1.0f, 1.0f, forward_sensitive ? 1.0f : 0.5f); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, forward_sensitive ? 1.0f : 0.125f); cr.move_to (width/2 + ARROW_SIZE, height/2); cr.line_to (width/2 - ARROW_SIZE, height/2 - ARROW_SIZE); diff --git a/unity-private/places/places-place-search-sections-bar.c b/unity-private/places/places-place-search-sections-bar.c index ce5b94e49..c5ff16c2b 100644 --- a/unity-private/places/places-place-search-sections-bar.c +++ b/unity-private/places/places-place-search-sections-bar.c @@ -250,8 +250,8 @@ void unity_places_section_set_destroy_factor (UnityPlacesSection* self, float va float unity_places_section_get_resize_factor (UnityPlacesSection* self); void unity_places_section_set_resize_factor (UnityPlacesSection* self, float value); static void _unity_places_section_paint_bg_unity_cairo_canvas_cairo_canvas_paint (cairo_t* cr, gint width, gint height, gpointer self); -static void _lambda42_ (UnityPlacesSection* self); -static void __lambda42__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void _lambda41_ (UnityPlacesSection* self); +static void __lambda41__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static GObject * unity_places_section_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_places_section_finalize (GObject* obj); static void unity_places_section_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -692,8 +692,9 @@ static void unity_places_place_search_sections_bar_paint_bg (UnityPlacesPlaceSea cairo_line_to (cr, (double) (x + radius), (double) height); cairo_curve_to (cr, (double) x, (double) height, (double) x, (double) height, (double) x, (double) (height - radius)); cairo_close_path (cr); - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.5); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.25); cairo_fill_preserve (cr); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.25); cairo_stroke (cr); chevron = 5; children = clutter_container_get_children ((ClutterContainer*) self); @@ -711,7 +712,7 @@ static void unity_places_place_search_sections_bar_paint_bg (UnityPlacesPlaceSea cairo_move_to (cr, (double) (point - chevron), (double) y); cairo_line_to (cr, (double) (point + chevron), (double) (y + (height / 2))); cairo_line_to (cr, (double) (point - chevron), (double) (y + height)); - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.5); cairo_stroke (cr); } point = point + (UNITY_PLACES_PLACE_SEARCH_SECTIONS_BAR_SPACING / 2); @@ -946,17 +947,15 @@ static void unity_places_section_paint_bg (UnityPlacesSection* self, cairo_t* cr cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); - cairo_set_line_width (cr, 1.5); + cairo_set_line_width (cr, 1.0); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); - cairo_translate (cr, 0.5, 0.5); x = 0; y = 0; - width = width - 1; - height = height - 1; - radius = 10; + radius = 7; if (unity_places_place_search_sections_bar_get_style ((_tmp0_ = clutter_actor_get_parent ((ClutterActor*) self), UNITY_PLACES_IS_PLACE_SEARCH_SECTIONS_BAR (_tmp0_) ? ((UnityPlacesPlaceSearchSectionsBar*) _tmp0_) : NULL)) == UNITY_PLACES_SECTION_STYLE_BUTTONS) { gboolean _tmp1_ = FALSE; double _tmp2_ = 0.0; + gboolean _tmp3_ = FALSE; cairo_move_to (cr, (double) x, (double) (y + radius)); cairo_curve_to (cr, (double) x, (double) y, (double) x, (double) y, (double) (x + radius), (double) y); cairo_line_to (cr, (double) (width - radius), (double) y); @@ -973,6 +972,7 @@ static void unity_places_section_paint_bg (UnityPlacesSection* self, cairo_t* cr } if (_tmp1_) { cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); + cairo_fill (cr); } else { if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_PRELIGHT) { cairo_surface_t* pattern; @@ -980,6 +980,8 @@ static void unity_places_section_paint_bg (UnityPlacesSection* self, cairo_t* cr cairo_pattern_t* pat; pattern = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 4, 4); context = cairo_create (pattern); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.1); + cairo_fill_preserve (cr); cairo_set_operator (context, CAIRO_OPERATOR_CLEAR); cairo_paint (context); cairo_set_line_width (context, 0.2); @@ -991,15 +993,31 @@ static void unity_places_section_paint_bg (UnityPlacesSection* self, cairo_t* cr pat = cairo_pattern_create_for_surface (pattern); cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); cairo_set_source (cr, pat); + cairo_fill (cr); _cairo_pattern_destroy0 (pat); _cairo_destroy0 (context); _cairo_surface_destroy0 (pattern); } else { - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); } } - cairo_fill_preserve (cr); - if (ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_NORMAL) { + cairo_translate (cr, 0.5, 0.5); + width = width - 1; + height = height - 1; + cairo_move_to (cr, (double) x, (double) (y + radius)); + cairo_curve_to (cr, (double) x, (double) y, (double) x, (double) y, (double) (x + radius), (double) y); + cairo_line_to (cr, (double) (width - radius), (double) y); + cairo_curve_to (cr, (double) width, (double) y, (double) width, (double) y, (double) width, (double) (y + radius)); + cairo_line_to (cr, (double) width, (double) (height - radius)); + cairo_curve_to (cr, (double) width, (double) height, (double) width, (double) height, (double) (width - radius), (double) height); + cairo_line_to (cr, (double) (x + radius), (double) height); + cairo_curve_to (cr, (double) x, (double) height, (double) x, (double) height, (double) x, (double) (height - radius)); + cairo_close_path (cr); + if (!unity_places_section_get_active (self)) { + _tmp3_ = ctk_actor_get_state ((CtkActor*) self) == CTK_STATE_NORMAL; + } else { + _tmp3_ = FALSE; + } + if (_tmp3_) { _tmp2_ = 0.0; } else { _tmp2_ = 0.5; @@ -1121,7 +1139,7 @@ static void _unity_places_section_paint_bg_unity_cairo_canvas_cairo_canvas_paint } -static void _lambda42_ (UnityPlacesSection* self) { +static void _lambda41_ (UnityPlacesSection* self) { if (unity_places_section_get_active (self)) { return; } @@ -1137,8 +1155,8 @@ static void _lambda42_ (UnityPlacesSection* self) { } -static void __lambda42__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { - _lambda42_ (self); +static void __lambda41__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + _lambda41_ (self); } @@ -1169,7 +1187,7 @@ static GObject * unity_places_section_constructor (GType type, guint n_construct self->text = (_tmp6_ = g_object_ref_sink ((CtkText*) ctk_text_new (dee_model_get_string (self->priv->_model, self->priv->_iter, (guint) 0))), _g_object_unref0 (self->text), _tmp6_); clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->text); clutter_actor_show ((ClutterActor*) self->text); - g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) __lambda42__g_object_notify, self, 0); + g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) __lambda41__g_object_notify, self, 0); } return obj; } diff --git a/unity-private/places/places-place-search-sections-bar.vala b/unity-private/places/places-place-search-sections-bar.vala index 277d85836..f38b91d34 100644 --- a/unity-private/places/places-place-search-sections-bar.vala +++ b/unity-private/places/places-place-search-sections-bar.vala @@ -332,8 +332,9 @@ namespace Unity.Places x, height - radius); cr.close_path (); - cr.set_source_rgba (1.0, 1.0, 1.0, 0.5); + cr.set_source_rgba (1.0, 1.0, 1.0, 0.25); cr.fill_preserve (); + cr.set_source_rgba (1.0, 1.0, 1.0, 0.25); cr.stroke (); var chevron = 5; @@ -348,7 +349,7 @@ namespace Unity.Places cr.move_to (point - chevron, y); cr.line_to (point + chevron, y + height/2); cr.line_to (point - chevron, y + height); - cr.set_source_rgba (1.0, 1.0, 1.0, 1.0); + cr.set_source_rgba (1.0, 1.0, 1.0, 0.5); cr.stroke (); } point += SPACING/2; @@ -521,16 +522,12 @@ namespace Unity.Places cr.paint (); cr.set_operator (Cairo.Operator.OVER); - cr.set_line_width (1.5); + cr.set_line_width (1.0); cr.set_source_rgba (1.0, 1.0, 1.0, 0.0); - cr.translate (0.5, 0.5); - var x = 0; var y = 0; - width -= 1; - height -= 1; - var radius = 10; + var radius = 7; if ((get_parent () as PlaceSearchSectionsBar).style == SectionStyle.BUTTONS) { @@ -555,6 +552,8 @@ namespace Unity.Places if (active || state == Ctk.ActorState.STATE_SELECTED) { cr.set_source_rgba (1.0, 1.0, 1.0, 1.0); + + cr.fill (); } else if (state == Ctk.ActorState.STATE_PRELIGHT) { @@ -562,7 +561,10 @@ namespace Unity.Places Cairo.Content.COLOR_ALPHA, 4, 4); var context = new Cairo.Context (pattern); - + + cr.set_source_rgba (1.0, 1.0, 1.0, 0.1); + cr.fill_preserve (); + context.set_operator (Cairo.Operator.CLEAR); context.paint (); @@ -578,16 +580,39 @@ namespace Unity.Places var pat = new Cairo.Pattern.for_surface (pattern); pat.set_extend (Cairo.Extend.REPEAT); cr.set_source (pat); + + cr.fill (); } else { - cr.set_source_rgba (1.0, 1.0, 1.0, 0.0); + } - cr.fill_preserve (); + cr.translate (0.5, 0.5); + + width -= 1; + height -= 1; + + cr.move_to (x, y + radius); + cr.curve_to (x, y, + x, y, + x + radius, y); + cr.line_to (width - radius, y); + cr.curve_to (width, y, + width, y, + width, y + radius); + cr.line_to (width, height - radius); + cr.curve_to (width, height, + width, height, + width - radius, height); + cr.line_to (x + radius, height); + cr.curve_to (x, height, + x, height, + x, height - radius); + cr.close_path (); cr.set_source_rgba (1.0, 1.0, 1.0, - state == Ctk.ActorState.STATE_NORMAL ? 0.0 : 0.5); + !active && state == Ctk.ActorState.STATE_NORMAL ? 0.0 : 0.5); cr.stroke (); } else diff --git a/unity-private/places/places-place.c b/unity-private/places/places-place.c index 552320750..1ead7ce9d 100644 --- a/unity-private/places/places-place.c +++ b/unity-private/places/places-place.c @@ -1014,17 +1014,17 @@ static UnityPlacesPlaceEntry* unity_places_place_load_entry_from_keyfile (UnityP _g_free0 (path); return result; } - _tmp5_ = g_key_file_get_string (file, group, "Name", &_inner_error_); + _tmp5_ = g_key_file_get_locale_string (file, group, "Name", NULL, &_inner_error_); if (_inner_error_ != NULL) { goto __catch30_g_error; } name = (_tmp6_ = _tmp5_, _g_free0 (name), _tmp6_); - _tmp7_ = g_key_file_get_string (file, group, "Icon", &_inner_error_); + _tmp7_ = g_key_file_get_locale_string (file, group, "Icon", NULL, &_inner_error_); if (_inner_error_ != NULL) { goto __catch30_g_error; } icon = (_tmp8_ = _tmp7_, _g_free0 (icon), _tmp8_); - _tmp9_ = g_key_file_get_string (file, group, "Description", &_inner_error_); + _tmp9_ = g_key_file_get_locale_string (file, group, "Description", NULL, &_inner_error_); if (_inner_error_ != NULL) { goto __catch30_g_error; } diff --git a/unity-private/places/places-place.vala b/unity-private/places/places-place.vala index 75cdb65c8..cfafdd14f 100644 --- a/unity-private/places/places-place.vala +++ b/unity-private/places/places-place.vala @@ -377,9 +377,9 @@ namespace Unity.Places return null; } - name = file.get_string (group, "Name"); - icon = file.get_string (group, "Icon"); - desc = file.get_string (group, "Description"); + name = file.get_locale_string (group, "Name", null); + icon = file.get_locale_string (group, "Icon", null); + desc = file.get_locale_string (group, "Description", null); } catch (Error e) { warning (@"Cannot load entry '$group': %s", e.message); return null; diff --git a/unity-private/places/places-trash-controller.c b/unity-private/places/places-trash-controller.c index 96e8b4cfb..0ba44c84f 100644 --- a/unity-private/places/places-trash-controller.c +++ b/unity-private/places/places-trash-controller.c @@ -404,7 +404,7 @@ static void unity_places_trash_controller_real_get_menu_navigation (UnityLaunche dbusmenu_menuitem_set_root (root, TRUE); item = NULL; item = (_tmp0_ = dbusmenu_menuitem_new (), _g_object_unref0 (item), _tmp0_); - dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, "Open"); + dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, _ ("Open")); 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); @@ -412,7 +412,7 @@ static void unity_places_trash_controller_real_get_menu_navigation (UnityLaunche if (self->priv->n_items != 0) { DbusmenuMenuitem* _tmp1_; item = (_tmp1_ = dbusmenu_menuitem_new (), _g_object_unref0 (item), _tmp1_); - dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, "Empty Trash"); + dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, _ ("Empty Trash")); 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); @@ -588,7 +588,7 @@ static gboolean unity_places_trash_controller_real_can_drag (UnityLauncherScroll UnityPlacesTrashController * self; gboolean result = FALSE; self = (UnityPlacesTrashController*) base; - result = TRUE; + result = FALSE; return result; } diff --git a/unity-private/places/places-trash-controller.vala b/unity-private/places/places-trash-controller.vala index 2ab4bd340..32735fbc2 100644 --- a/unity-private/places/places-trash-controller.vala +++ b/unity-private/places/places-trash-controller.vala @@ -103,7 +103,7 @@ namespace Unity.Places Dbusmenu.Menuitem item; item = new Dbusmenu.Menuitem (); - item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Open"); + item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Open")); item.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, true); item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); root.child_append (item); @@ -118,7 +118,7 @@ namespace Unity.Places if (n_items != 0) { item = new Dbusmenu.Menuitem (); - item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Empty Trash"); + item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Empty Trash")); item.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, true); item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); root.child_append (item); @@ -191,7 +191,7 @@ namespace Unity.Places public override bool can_drag () { - return true; + return false; } } } diff --git a/unity-private/places/places-view.c b/unity-private/places/places-view.c index aef657bee..0aef8be0e 100644 --- a/unity-private/places/places-view.c +++ b/unity-private/places/places-view.c @@ -94,6 +94,17 @@ typedef struct _UnityPlacesPlaceEntryIface UnityPlacesPlaceEntryIface; typedef struct _UnityPlacesPlace UnityPlacesPlace; typedef struct _UnityPlacesPlaceClass UnityPlacesPlaceClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define UNITY_TESTING_TYPE_OBJECT_REGISTRY (unity_testing_object_registry_get_type ()) +#define UNITY_TESTING_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistry)) +#define UNITY_TESTING_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_IS_OBJECT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TESTING_TYPE_OBJECT_REGISTRY)) +#define UNITY_TESTING_OBJECT_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TESTING_TYPE_OBJECT_REGISTRY, UnityTestingObjectRegistryClass)) + +typedef struct _UnityTestingObjectRegistry UnityTestingObjectRegistry; +typedef struct _UnityTestingObjectRegistryClass UnityTestingObjectRegistryClass; +#define _unity_testing_object_registry_unref0(var) ((var == NULL) ? NULL : (var = (unity_testing_object_registry_unref (var), NULL))) typedef struct _UnityPlacesPlaceSearchBarPrivate UnityPlacesPlaceSearchBarPrivate; #define UNITY_PLACES_TYPE_PLACE_SEARCH_ENTRY (unity_places_place_search_entry_get_type ()) @@ -296,6 +307,15 @@ enum { #define UNITY_PLACES_VIEW_PADDING 8.0f UnityPlacesView* unity_places_view_new (UnityShell* shell, UnityPlacesPlaceModel* model); UnityPlacesView* unity_places_view_construct (GType object_type, UnityShell* shell, UnityPlacesPlaceModel* model); +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); +void unity_testing_value_set_object_registry (GValue* value, gpointer v_object); +void unity_testing_value_take_object_registry (GValue* value, gpointer v_object); +gpointer unity_testing_value_get_object_registry (const GValue* value); +GType unity_testing_object_registry_get_type (void) G_GNUC_CONST; +UnityTestingObjectRegistry* unity_testing_object_registry_get_default (void); +void unity_testing_object_registry_register (UnityTestingObjectRegistry* self, const char* name, GObject* object); void unity_places_view_about_to_show (UnityPlacesView* self); UnityShell* unity_places_view_get_shell (UnityPlacesView* self); UnityPlacesPlaceModel* unity_places_view_get_model (UnityPlacesView* self); @@ -318,6 +338,7 @@ void unity_places_place_entry_set_active (UnityPlacesPlaceEntry* self, gboolean static void unity_places_view_on_entry_renderer_info_changed (UnityPlacesView* self, UnityPlacesPlaceEntry* entry); static void _unity_places_view_on_entry_renderer_info_changed_unity_places_place_entry_renderer_info_changed (UnityPlacesPlaceEntry* _sender, gpointer self); static void unity_places_view_update_views (UnityPlacesView* self, UnityPlacesPlaceEntry* entry, guint section_id); +void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section); static void _lambda45_ (ClutterAnimation* a, UnityPlacesView* self); static void __lambda45__clutter_animation_completed (ClutterAnimation* _sender, gpointer self); static UnityPlaceRenderer* unity_places_view_lookup_renderer (UnityPlacesView* self, UnityPlacesPlaceEntry* entry); @@ -326,7 +347,6 @@ DeeModel* unity_places_place_entry_get_entry_results_model (UnityPlacesPlaceEntr GeeHashMap* unity_places_place_entry_get_entry_renderer_hints (UnityPlacesPlaceEntry* self); static void unity_places_view_on_result_activated (UnityPlacesView* self, const char* uri, const char* mimetype); static void _unity_places_view_on_result_activated_unity_place_renderer_activated (UnityPlaceRenderer* _sender, const char* uri, const char* mimetype, gpointer self); -void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section); GeeHashMap* unity_places_place_entry_get_hints (UnityPlacesPlaceEntry* self); UnityPlacesFolderBrowserRenderer* unity_places_folder_browser_renderer_new (void); UnityPlacesFolderBrowserRenderer* unity_places_folder_browser_renderer_construct (GType object_type); @@ -338,11 +358,12 @@ GType unity_places_home_renderer_get_type (void) G_GNUC_CONST; UnityPlacesDefaultRenderer* unity_places_default_renderer_new (void); UnityPlacesDefaultRenderer* unity_places_default_renderer_construct (GType object_type); GType unity_places_default_renderer_get_type (void) G_GNUC_CONST; +GType unity_places_activation_status_get_type (void) G_GNUC_CONST; +UnityPlacesPlaceEntry* unity_places_place_home_entry_get_entry_for_uri (UnityPlacesPlaceHomeEntry* self, const char* uri); UnityPlacesPlace* unity_places_place_entry_get_parent (UnityPlacesPlaceEntry* self); +UnityPlacesActivationStatus unity_places_place_activate (UnityPlacesPlace* self, const char* uri, const char* mimetype); void unity_places_place_activate_fallback (const char* uri, GAsyncReadyCallback _callback_, gpointer _user_data_); void unity_places_place_activate_fallback_finish (GAsyncResult* _res_); -GType unity_places_activation_status_get_type (void) G_GNUC_CONST; -UnityPlacesActivationStatus unity_places_place_activate (UnityPlacesPlace* self, const char* uri, const char* mimetype); GType unity_places_section_style_get_type (void) G_GNUC_CONST; void unity_places_place_search_sections_bar_set_active_section (UnityPlacesPlaceSearchSectionsBar* self, guint section_id); static void unity_places_view_set_shell (UnityPlacesView* self, UnityShell* value); @@ -357,9 +378,12 @@ static int _vala_strcmp0 (const char * str1, const char * str2); UnityPlacesView* unity_places_view_construct (GType object_type, UnityShell* shell, UnityPlacesPlaceModel* model) { UnityPlacesView * self; + UnityTestingObjectRegistry* _tmp0_; g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (model != NULL, NULL); self = (UnityPlacesView*) g_object_new (object_type, "shell", shell, "orientation", CTK_ORIENTATION_VERTICAL, "model", model, NULL); + unity_testing_object_registry_register (_tmp0_ = unity_testing_object_registry_get_default (), "UnityPlacesView", (GObject*) self); + _unity_testing_object_registry_unref0 (_tmp0_); return self; } @@ -481,6 +505,7 @@ static void unity_places_view_update_views (UnityPlacesView* self, UnityPlacesPl UnityPlaceRenderer* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (entry != NULL); + unity_places_place_search_bar_set_active_entry_view (self->search_bar, entry, 0, section_id); if (CLUTTER_IS_ACTOR (self->priv->renderer)) { ClutterAnimation* anim; anim = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->renderer, (gulong) CLUTTER_EASE_OUT_QUAD, (guint) 300, "opacity", 0, NULL)); @@ -496,7 +521,6 @@ static void unity_places_view_update_views (UnityPlacesView* self, UnityPlacesPl 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)); clutter_actor_show ((ClutterActor*) self->priv->renderer); g_signal_connect_object (self->priv->renderer, "activated", (GCallback) _unity_places_view_on_result_activated_unity_place_renderer_activated, self, 0); - unity_places_place_search_bar_set_active_entry_view (self->search_bar, entry, 0, section_id); } @@ -552,16 +576,35 @@ static UnityPlaceRenderer* unity_places_view_lookup_renderer (UnityPlacesView* s static void unity_places_view_on_result_activated (UnityPlacesView* self, const char* uri, const char* mimetype) { - UnityPlacesActivationStatus _result_; + UnityPlacesActivationStatus _result_ = 0; g_return_if_fail (self != NULL); g_return_if_fail (uri != NULL); g_return_if_fail (mimetype != NULL); - if (UNITY_PLACES_IS_PLACE (unity_places_place_entry_get_parent (self->priv->active_entry)) == FALSE) { - unity_places_place_activate_fallback (uri, NULL, NULL); - unity_shell_hide_unity (unity_global_shell); - return; + if (UNITY_PLACES_IS_PLACE_HOME_ENTRY (self->priv->active_entry)) { + UnityPlacesPlaceEntry* _tmp0_; + UnityPlacesPlaceEntry* e; + e = _g_object_ref0 (unity_places_place_home_entry_get_entry_for_uri ((_tmp0_ = self->priv->active_entry, UNITY_PLACES_IS_PLACE_HOME_ENTRY (_tmp0_) ? ((UnityPlacesPlaceHomeEntry*) _tmp0_) : NULL), uri)); + if (UNITY_PLACES_IS_PLACE_ENTRY (e)) { + _result_ = unity_places_place_activate (unity_places_place_entry_get_parent (e), uri, mimetype); + } else { + unity_places_place_activate_fallback (uri, NULL, NULL); + _result_ = UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_FALLBACK; + } + _g_object_unref0 (e); + } else { + gboolean _tmp1_ = FALSE; + if (self->priv->active_entry == NULL) { + _tmp1_ = TRUE; + } else { + _tmp1_ = unity_places_place_entry_get_parent (self->priv->active_entry) == NULL; + } + if (_tmp1_) { + unity_places_place_activate_fallback (uri, NULL, NULL); + _result_ = UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_FALLBACK; + } else { + _result_ = unity_places_place_activate (unity_places_place_entry_get_parent (self->priv->active_entry), uri, mimetype); + } } - _result_ = unity_places_place_activate (unity_places_place_entry_get_parent (self->priv->active_entry), uri, mimetype); switch (_result_) { case UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_SHOW_DASH: { @@ -576,7 +619,7 @@ static void unity_places_view_on_result_activated (UnityPlacesView* self, const } default: { - g_warning ("places-view.vala:205: Unexpected activation status: %u", (guint) _result_); + g_warning ("places-view.vala:225: Unexpected activation status: %u", (guint) _result_); break; } } diff --git a/unity-private/places/places-view.vala b/unity-private/places/places-view.vala index 9cc1fe518..0319f2c42 100644 --- a/unity-private/places/places-view.vala +++ b/unity-private/places/places-view.vala @@ -18,6 +18,7 @@ * */ using Unity; +using Unity.Testing; namespace Unity.Places { @@ -42,6 +43,8 @@ namespace Unity.Places public View (Shell shell, PlaceModel model) { Object (shell:shell, orientation:Ctk.Orientation.VERTICAL, model:model); + + Testing.ObjectRegistry.get_default ().register ("UnityPlacesView", this); } construct @@ -49,6 +52,8 @@ namespace Unity.Places about_to_show (); shell.get_stage ().captured_event.connect (on_stage_event_captured); + + } public void about_to_show () @@ -123,6 +128,8 @@ namespace Unity.Places private void update_views (PlaceEntry entry, uint section_id=0) { + search_bar.set_active_entry_view (entry, 0, section_id); + /* Create the correct results view */ if (renderer is Clutter.Actor) { @@ -148,8 +155,6 @@ namespace Unity.Places entry.entry_renderer_hints); renderer.show (); renderer.activated.connect (on_result_activated); - - search_bar.set_active_entry_view (entry, 0, section_id); } private void on_entry_renderer_info_changed (PlaceEntry entry) @@ -183,14 +188,29 @@ namespace Unity.Places private void on_result_activated (string uri, string mimetype) { - if (active_entry.parent is Place == false) + ActivationStatus result; + + if (active_entry is PlaceHomeEntry) + { + var e = (active_entry as PlaceHomeEntry).get_entry_for_uri (uri); + + if (e is PlaceEntry) + result = e.parent.activate (uri, mimetype); + else + { + Place.activate_fallback.begin (uri); + result = ActivationStatus.ACTIVATED_FALLBACK; + } + } + else if (active_entry == null || active_entry.parent == null) { Place.activate_fallback.begin (uri); - global_shell.hide_unity (); - return; + result = ActivationStatus.ACTIVATED_FALLBACK; + } + else + { + result = active_entry.parent.activate (uri, mimetype); } - - ActivationStatus result = active_entry.parent.activate (uri, mimetype); switch (result) { diff --git a/unity-private/places/places-volume-child-controller.c b/unity-private/places/places-volume-child-controller.c index ddce693d6..4d429321a 100644 --- a/unity-private/places/places-volume-child-controller.c +++ b/unity-private/places/places-volume-child-controller.c @@ -443,7 +443,7 @@ static gboolean unity_places_volume_child_controller_real_can_drag (UnityLaunche UnityPlacesVolumeChildController * self; gboolean result = FALSE; self = (UnityPlacesVolumeChildController*) base; - result = TRUE; + result = FALSE; return result; } diff --git a/unity-private/places/places-volume-child-controller.vala b/unity-private/places/places-volume-child-controller.vala index 0e46203d9..66adfdb49 100644 --- a/unity-private/places/places-volume-child-controller.vala +++ b/unity-private/places/places-volume-child-controller.vala @@ -16,10 +16,10 @@ * Authored by Neil Jagdish Patel <neil.patel@canonical.com> * */ - + using Unity.Launcher; using Unity.Testing; - + namespace Unity.Places { public class VolumeChildController : ScrollerChildController @@ -48,7 +48,7 @@ namespace Unity.Places private void on_volume_removed () { ScrollerModel s; - + s = ObjectRegistry.get_default ().lookup ("UnityScrollerModel")[0] as ScrollerModel; s.remove (this.child); @@ -116,7 +116,7 @@ namespace Unity.Places { Dbusmenu.Menuitem root = new Dbusmenu.Menuitem (); root.set_root (true); - + Dbusmenu.Menuitem item; item = new Dbusmenu.Menuitem (); @@ -151,7 +151,7 @@ namespace Unity.Places public override bool can_drag () { - return true; + return false; } } } diff --git a/unity-private/testing/background.c b/unity-private/testing/background.c index f57ebbebb..58ef9175d 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 _lambda98_ (UnityTestingBackground* self); +static gboolean _lambda100_ (UnityTestingBackground* self); static void _unity_testing_background_update_gradient (UnityTestingBackground* self); -static gboolean __lambda98__gsource_func (gpointer self); +static gboolean __lambda100__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 _lambda98_ (UnityTestingBackground* self) { +static gboolean _lambda100_ (UnityTestingBackground* self) { gboolean result = FALSE; _unity_testing_background_update_gradient (self); result = FALSE; @@ -126,16 +126,16 @@ static gboolean _lambda98_ (UnityTestingBackground* self) { } -static gboolean __lambda98__gsource_func (gpointer self) { +static gboolean __lambda100__gsource_func (gpointer self) { gboolean result; - result = _lambda98_ (self); + result = _lambda100_ (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, __lambda98__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, __lambda100__gsource_func, g_object_ref (self), g_object_unref); } @@ -148,8 +148,6 @@ static void _unity_testing_background_update_gradient (UnityTestingBackground* s clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) self->priv->bg_texture); clutter_actor_show ((ClutterActor*) self->priv->bg_texture); } - clutter_actor_set_x ((ClutterActor*) self, 0.0f); - clutter_actor_set_y ((ClutterActor*) self, 0.0f); gnome_bg_get_color (self->priv->gbg, &type, &primary, &secondary); clutter_cairo_texture_set_surface_size (self->priv->bg_texture, (guint) clutter_actor_get_width ((ClutterActor*) self), (guint) clutter_actor_get_height ((ClutterActor*) self)); { diff --git a/unity-private/testing/background.vala b/unity-private/testing/background.vala index 8ed43db09..5c4042277 100644 --- a/unity-private/testing/background.vala +++ b/unity-private/testing/background.vala @@ -156,9 +156,6 @@ namespace Unity.Testing this.bg_texture.show (); } - this.x = 0.0f; - this.y = 0.0f; - this.gbg.get_color (out type, out primary, out secondary); this.bg_texture.set_surface_size ((uint) this.width, diff --git a/unity-private/testing/test-director.c b/unity-private/testing/test-director.c index cc62141d3..6934af82f 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 _lambda99_ (UnityTestingDirector* self); -static gboolean __lambda99__gsource_func (gpointer self); +static gboolean _lambda101_ (UnityTestingDirector* self); +static gboolean __lambda101__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 _lambda99_ (UnityTestingDirector* self) { +static gboolean _lambda101_ (UnityTestingDirector* self) { gboolean result = FALSE; self->priv->break_loop = TRUE; result = FALSE; @@ -145,9 +145,9 @@ static gboolean _lambda99_ (UnityTestingDirector* self) { } -static gboolean __lambda99__gsource_func (gpointer self) { +static gboolean __lambda101__gsource_func (gpointer self) { gboolean result; - result = _lambda99_ (self); + result = _lambda101_ (self); return result; } @@ -155,7 +155,7 @@ static gboolean __lambda99__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, __lambda99__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda101__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 649525965..df2c7bd70 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 _lambda100_ (UnityTestingWindow* self); -static gboolean __lambda100__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static gboolean _lambda101_ (UnityTestingWindow* self); -static gboolean __lambda101__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _lambda102_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda102__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); -static void _lambda103_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda103__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); +static gboolean _lambda102_ (UnityTestingWindow* self); +static gboolean __lambda102__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); +static gboolean _lambda103_ (UnityTestingWindow* self); +static gboolean __lambda103__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); +static void _lambda104_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda104__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static void _lambda105_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda105__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 _lambda104_ (UnityTestingWindow* self); -static gboolean __lambda104__gsource_func (gpointer self); +static gboolean _lambda106_ (UnityTestingWindow* self); +static gboolean __lambda106__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 _lambda100_ (UnityTestingWindow* self) { +static gboolean _lambda102_ (UnityTestingWindow* self) { gboolean result = FALSE; gtk_main_quit (); result = FALSE; @@ -737,46 +737,46 @@ static gboolean _lambda100_ (UnityTestingWindow* self) { } -static gboolean __lambda100__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda102__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda100_ (self); + result = _lambda102_ (self); return result; } -static gboolean _lambda101_ (UnityTestingWindow* self) { +static gboolean _lambda103_ (UnityTestingWindow* self) { gboolean result = FALSE; result = TRUE; return result; } -static gboolean __lambda101__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { +static gboolean __lambda103__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { gboolean result; - result = _lambda101_ (self); + result = _lambda103_ (self); return result; } -static void _lambda102_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda104_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda102__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { - _lambda102_ (_sender, self); +static void __lambda104__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { + _lambda104_ (_sender, self); } -static void _lambda103_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda105_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda103__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { - _lambda103_ (_sender, self); +static void __lambda105__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { + _lambda105_ (_sender, self); } @@ -792,7 +792,7 @@ static void _unity_testing_window_on_active_window_changed_wnck_screen_active_wi } -static gboolean _lambda104_ (UnityTestingWindow* self) { +static gboolean _lambda106_ (UnityTestingWindow* self) { gboolean result = FALSE; unity_shell_set_is_starting ((UnityShell*) self, FALSE); result = FALSE; @@ -800,9 +800,9 @@ static gboolean _lambda104_ (UnityTestingWindow* self) { } -static gboolean __lambda104__gsource_func (gpointer self) { +static gboolean __lambda106__gsource_func (gpointer self) { gboolean result; - result = _lambda104_ (self); + result = _lambda106_ (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) __lambda100__gtk_widget_delete_event, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda102__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) __lambda101__gtk_widget_delete_event, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda102__gdk_screen_size_changed, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda103__gdk_screen_monitors_changed, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda103__gtk_widget_delete_event, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda104__gdk_screen_size_changed, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda105__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, __lambda104__gsource_func, g_object_ref (self), g_object_unref); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda106__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 6b708863a..145bf6d5d 100644 --- a/unity-private/unity-private.h +++ b/unity-private/unity-private.h @@ -1574,12 +1574,12 @@ struct _UnityPlacesHomeRendererClass { }; struct _UnityPlacesHomeButton { - CtkButton parent_instance; + UnityPlacesButton parent_instance; UnityPlacesHomeButtonPrivate * priv; }; struct _UnityPlacesHomeButtonClass { - CtkButtonClass parent_class; + UnityPlacesButtonClass parent_class; }; struct _UnityPlacesPlaceModel { @@ -2166,7 +2166,6 @@ UnityPanelWindowButtons* unity_panel_window_buttons_new (void); UnityPanelWindowButtons* unity_panel_window_buttons_construct (GType object_type); GType unity_panel_window_button_get_type (void) G_GNUC_CONST; #define UNITY_PANEL_WINDOW_BUTTON_AMBIANCE "/usr/share/themes/Ambiance/metacity-1" -#define UNITY_PANEL_WINDOW_BUTTON_AMBIANCE_BETA "/usr/share/themes/Ambiance-maverick-beta/metacity-1" UnityPanelWindowButton* unity_panel_window_button_new (const char* filename); UnityPanelWindowButton* unity_panel_window_button_construct (GType object_type, const char* filename); const char* unity_panel_window_button_get_filename (UnityPanelWindowButton* self); @@ -2373,6 +2372,7 @@ void unity_places_place_entry_dbus_place_entry_info_destroy (UnityPlacesPlaceEnt GType unity_places_place_home_entry_get_type (void) G_GNUC_CONST; UnityPlacesPlaceHomeEntry* unity_places_place_home_entry_new (UnityShell* shell, UnityPlacesPlaceModel* model); UnityPlacesPlaceHomeEntry* unity_places_place_home_entry_construct (GType object_type, UnityShell* shell, UnityPlacesPlaceModel* model); +UnityPlacesPlaceEntry* unity_places_place_home_entry_get_entry_for_uri (UnityPlacesPlaceHomeEntry* self, const char* uri); UnityShell* unity_places_place_home_entry_get_shell (UnityPlacesPlaceHomeEntry* self); UnityPlacesPlaceModel* unity_places_place_home_entry_get_place_model (UnityPlacesPlaceHomeEntry* self); void unity_places_place_home_entry_set_place_model (UnityPlacesPlaceHomeEntry* self, UnityPlacesPlaceModel* value); @@ -2422,6 +2422,8 @@ void unity_places_place_search_bar_reset (UnityPlacesPlaceSearchBar* self); void unity_places_place_search_bar_search (UnityPlacesPlaceSearchBar* self, const char* text); char* unity_places_place_search_bar_get_search_text (UnityPlacesPlaceSearchBar* self); void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section); +gboolean unity_places_place_search_bar_get_search_fail (UnityPlacesPlaceSearchBar* self); +void unity_places_place_search_bar_set_search_fail (UnityPlacesPlaceSearchBar* self, gboolean value); GType unity_places_place_search_bar_background_get_type (void) G_GNUC_CONST; #define UNITY_PLACES_PLACE_SEARCH_BAR_BACKGROUND_BG "/usr/share/unity/dash_background.png" GType unity_places_place_search_navigation_get_type (void) G_GNUC_CONST; @@ -2430,6 +2432,8 @@ UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_co gboolean unity_places_place_search_bar_background_update_background (UnityPlacesPlaceSearchBarBackground* self); gint unity_places_place_search_bar_background_get_entry_position (UnityPlacesPlaceSearchBarBackground* self); void unity_places_place_search_bar_background_set_entry_position (UnityPlacesPlaceSearchBarBackground* self, gint value); +gboolean unity_places_place_search_bar_background_get_search_empty (UnityPlacesPlaceSearchBarBackground* self); +void unity_places_place_search_bar_background_set_search_empty (UnityPlacesPlaceSearchBarBackground* self, gboolean value); UnityPlacesPlaceSearchNavigation* unity_places_place_search_bar_background_get_navigation (UnityPlacesPlaceSearchBarBackground* self); UnityPlacesPlaceSearchEntry* unity_places_place_search_bar_background_get_search_entry (UnityPlacesPlaceSearchBarBackground* self); UnityPlacesPlaceSearchEntry* unity_places_place_search_entry_new (void); diff --git a/unity-private/unity-private.vapi b/unity-private/unity-private.vapi index 7539b62d8..c57eea944 100644 --- a/unity-private/unity-private.vapi +++ b/unity-private/unity-private.vapi @@ -322,6 +322,7 @@ namespace Unity { public bool on_motion_event (Clutter.Event e); public void show_menu (); public Indicator.ObjectEntry entry { get; construct; } + public signal void entry_shown (); public signal void menu_moved (Gtk.MenuDirectionType type); } [CCode (cheader_filename = "unity-private.h")] @@ -401,7 +402,6 @@ namespace Unity { public class WindowButton : Ctk.Button { public Clutter.Actor bg; public const string AMBIANCE; - public const string AMBIANCE_BETA; public WindowButton (string filename); public string filename { get; construct; } } @@ -502,7 +502,7 @@ namespace Unity { public FolderBrowserRenderer (); } [CCode (cheader_filename = "unity-private.h")] - public class HomeButton : Ctk.Button { + public class HomeButton : Unity.Places.Button { public HomeButton (string name, string icon, string exec); public string exec { get; construct; } public string icon { get; construct; } @@ -609,6 +609,7 @@ namespace Unity { [CCode (cheader_filename = "unity-private.h")] public class PlaceHomeEntry : GLib.Object, Unity.Places.PlaceEntry { public PlaceHomeEntry (Unity.Shell shell, Unity.Places.PlaceModel model); + public unowned Unity.Places.PlaceEntry? get_entry_for_uri (string uri); public Unity.Places.PlaceModel place_model { get; set construct; } public Unity.Shell shell { get; construct; } } @@ -627,6 +628,7 @@ namespace Unity { public void reset (); public void search (string text); public void set_active_entry_view (Unity.Places.PlaceEntry entry, int x, uint section = 0); + public bool search_fail { get; set; } } [CCode (cheader_filename = "unity-private.h")] public class PlaceSearchBarBackground : Ctk.Bin { @@ -635,6 +637,7 @@ namespace Unity { public bool update_background (); public int entry_position { get; set; } public Unity.Places.PlaceSearchNavigation navigation { get; construct; } + public bool search_empty { get; set; } public Unity.Places.PlaceSearchEntry search_entry { get; construct; } } [CCode (cheader_filename = "unity-private.h")] diff --git a/unity-private/unity-utils.c b/unity-private/unity-utils.c index 56156af6d..5f0ea6249 100644 --- a/unity-private/unity-utils.c +++ b/unity-private/unity-utils.c @@ -240,6 +240,7 @@ utils_set_strut (GtkWindow *gtk_window, XChangeProperty (display, window, net_wm_strut_partial, XA_CARDINAL, 32, PropModeReplace, (guchar *) &struts, 12); + gdk_flush (); gdk_error_trap_pop (); } diff --git a/unity/theme.c b/unity/theme.c index cfa81828b..31710a0da 100644 --- a/unity/theme.c +++ b/unity/theme.c @@ -323,7 +323,7 @@ static gboolean unity_theme_file_path_path_from_theme_co (UnityThemeFilePathPath _state_2: ; if (gtk_icon_theme_has_icon (data->theme, data->icon_name)) { - data->info = gtk_icon_theme_lookup_icon (data->theme, data->icon_name, 48, 0); + data->info = gtk_icon_theme_lookup_icon (data->theme, data->icon_name, 32, 0); if (data->info != NULL) { data->filename = g_strdup (gtk_icon_info_get_filename (data->info)); if (g_file_test (data->filename, G_FILE_TEST_IS_REGULAR)) { diff --git a/unity/theme.vala b/unity/theme.vala index 0d242ea9d..c429dbf0b 100644 --- a/unity/theme.vala +++ b/unity/theme.vala @@ -66,7 +66,7 @@ namespace Unity if (theme.has_icon (icon_name)) { var info = theme.lookup_icon (icon_name, - 48, + 32, 0); if (info != null) { diff --git a/unity/unity-appinfo-manager.c b/unity/unity-appinfo-manager.c index 8becbd17b..4fb139f99 100644 --- a/unity/unity-appinfo-manager.c +++ b/unity/unity-appinfo-manager.c @@ -92,7 +92,6 @@ struct _UnityAppInfoManagerLookupAsyncData { char* path; GFileInputStream* _tmp2_; GFileInputStream* _tmp3_; - guchar* _tmp4_; GError * e; GKeyFile* keyfile; GError * ee; @@ -125,9 +124,8 @@ GAppInfo* unity_app_info_manager_lookup_finish (UnityAppInfoManager* self, GAsyn static gboolean unity_app_info_manager_lookup_async_co (UnityAppInfoManagerLookupAsyncData* data); void unity_io_open_from_data_dirs (const char* filename, GAsyncReadyCallback _callback_, gpointer _user_data_); GFileInputStream* unity_io_open_from_data_dirs_finish (GAsyncResult* _res_, GError** error); -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_async (GInputStream* input, void* buffer, 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_dup1 (guchar* self, int length); void unity_app_info_manager_clear (UnityAppInfoManager* self); static void unity_app_info_manager_finalize (GObject* obj); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); @@ -576,11 +574,6 @@ static void unity_app_info_manager_lookup_async_ready (GObject* source_object, G * If the AppInfo is not already cached this method will do asynchronous * IO to look it up. */ -static guchar* _vala_array_dup1 (guchar* self, int length) { - return g_memdup (self, length * sizeof (guchar)); -} - - static gboolean unity_app_info_manager_lookup_async_co (UnityAppInfoManagerLookupAsyncData* data) { switch (data->_state_) { case 0: @@ -726,7 +719,7 @@ static gboolean unity_app_info_manager_lookup_async_co (UnityAppInfoManagerLooku } { data->_state_ = 5; - unity_io_read_stream_async ((GInputStream*) data->input, (data->_tmp4_ = data->self->priv->buffer, (data->_tmp4_ == NULL) ? ((gpointer) data->_tmp4_) : _vala_array_dup1 (data->_tmp4_, data->self->priv->buffer_length1)), data->self->priv->buffer_length1, data->self->priv->buffer_size, G_PRIORITY_DEFAULT, NULL, unity_app_info_manager_lookup_async_ready, data); + unity_io_read_stream_async ((GInputStream*) data->input, data->self->priv->buffer, data->self->priv->buffer_size, G_PRIORITY_DEFAULT, NULL, unity_app_info_manager_lookup_async_ready, data); return FALSE; _state_5: unity_io_read_stream_finish (data->_res_, &data->data, &data->data_size, &data->_inner_error_); diff --git a/unity/unity-io.c b/unity/unity-io.c index 9b221dec0..88de9242b 100644 --- a/unity/unity-io.c +++ b/unity/unity-io.c @@ -46,8 +46,7 @@ struct _UnityIoReadStreamAsyncData { GAsyncResult* _res_; GSimpleAsyncResult* _async_result; GInputStream* input; - guchar* buffer; - gint buffer_length1; + void* buffer; gsize buffer_lenght; gint io_priority; GCancellable* cancellable; @@ -109,12 +108,12 @@ static gint _unity_io_system_data_dirs_size_ = 0; static void unity_io_read_stream_async_data_free (gpointer _data); static void unity_io_read_stream_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_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_async (GInputStream* input, void* buffer, 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 gboolean unity_io_read_stream_async_co (UnityIoReadStreamAsyncData* data); static void* _g_realloc_grealloc_func (void* data, gsize size); static void unity_io_open_from_dirs_data_free (gpointer _data); -static char** _vala_array_dup2 (char** self, int length); +static char** _vala_array_dup1 (char** self, int length); static void unity_io_open_from_dirs_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); void unity_io_open_from_dirs (const char* filename, char** dirs, int dirs_length1, GAsyncReadyCallback _callback_, gpointer _user_data_); GFileInputStream* unity_io_open_from_dirs_finish (GAsyncResult* _res_, GError** error); @@ -125,7 +124,7 @@ void unity_io_open_from_data_dirs (const char* filename, GAsyncReadyCallback _ca GFileInputStream* unity_io_open_from_data_dirs_finish (GAsyncResult* _res_, GError** error); static gboolean unity_io_open_from_data_dirs_co (UnityIoOpenFromDataDirsData* data); char** unity_io_get_system_data_dirs (int* result_length1); -static char** _vala_array_dup3 (char** self, int length); +static char** _vala_array_dup2 (char** self, int length); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); static gint _vala_array_length (gpointer array); @@ -136,7 +135,6 @@ static void unity_io_read_stream_async_data_free (gpointer _data) { UnityIoReadStreamAsyncData* data; data = _data; _g_object_unref0 (data->input); - data->buffer = (g_free (data->buffer), NULL); _g_object_unref0 (data->cancellable); g_slice_free (UnityIoReadStreamAsyncData, data); } @@ -147,14 +145,13 @@ static gpointer _g_object_ref0 (gpointer self) { } -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_async (GInputStream* input, void* buffer, gsize buffer_lenght, gint io_priority, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) { UnityIoReadStreamAsyncData* _data_; _data_ = g_slice_new0 (UnityIoReadStreamAsyncData); _data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, unity_io_read_stream_async); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_io_read_stream_async_data_free); _data_->input = _g_object_ref0 (input); _data_->buffer = buffer; - _data_->buffer_length1 = buffer_length1; _data_->buffer_lenght = buffer_lenght; _data_->io_priority = io_priority; _data_->cancellable = _g_object_ref0 (cancellable); @@ -216,7 +213,6 @@ static gboolean unity_io_read_stream_async_co (UnityIoReadStreamAsyncData* data) g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_); g_error_free (data->_inner_error_); _g_object_unref0 (data->output); - data->buffer = (g_free (data->buffer), NULL); { if (data->_state_ == 0) { g_simple_async_result_complete_in_idle (data->_async_result); @@ -236,7 +232,6 @@ static gboolean unity_io_read_stream_async_co (UnityIoReadStreamAsyncData* data) g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_); g_error_free (data->_inner_error_); _g_object_unref0 (data->output); - data->buffer = (g_free (data->buffer), NULL); { if (data->_state_ == 0) { g_simple_async_result_complete_in_idle (data->_async_result); @@ -256,7 +251,6 @@ static gboolean unity_io_read_stream_async_co (UnityIoReadStreamAsyncData* data) g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_); g_error_free (data->_inner_error_); _g_object_unref0 (data->output); - data->buffer = (g_free (data->buffer), NULL); { if (data->_state_ == 0) { g_simple_async_result_complete_in_idle (data->_async_result); @@ -268,7 +262,6 @@ static gboolean unity_io_read_stream_async_co (UnityIoReadStreamAsyncData* data) } } _g_object_unref0 (data->output); - data->buffer = (g_free (data->buffer), NULL); { if (data->_state_ == 0) { g_simple_async_result_complete_in_idle (data->_async_result); @@ -291,7 +284,7 @@ static void unity_io_open_from_dirs_data_free (gpointer _data) { } -static char** _vala_array_dup2 (char** self, int length) { +static char** _vala_array_dup1 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -309,7 +302,7 @@ void unity_io_open_from_dirs (const char* filename, char** dirs, int dirs_length _data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, unity_io_open_from_dirs); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_io_open_from_dirs_data_free); _data_->filename = g_strdup (filename); - _data_->dirs = (_tmp0_ = dirs, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup2 (_tmp0_, dirs_length1)); + _data_->dirs = (_tmp0_ = dirs, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup1 (_tmp0_, dirs_length1)); _data_->dirs_length1 = dirs_length1; unity_io_open_from_dirs_co (_data_); } @@ -618,7 +611,7 @@ static gboolean unity_io_open_from_data_dirs_co (UnityIoOpenFromDataDirsData* da } -static char** _vala_array_dup3 (char** self, int length) { +static char** _vala_array_dup2 (char** self, int length) { char** result; int i; result = g_new0 (char*, length + 1); @@ -638,7 +631,7 @@ char** unity_io_get_system_data_dirs (int* result_length1) { char** _tmp1_; unity_io_system_data_dirs = (_tmp1_ = _tmp0_ = g_strsplit (g_getenv ("XDG_DATA_DIRS"), ":", 0), unity_io_system_data_dirs = (_vala_array_free (unity_io_system_data_dirs, unity_io_system_data_dirs_length1, (GDestroyNotify) g_free), NULL), unity_io_system_data_dirs_length1 = _vala_array_length (_tmp0_), _unity_io_system_data_dirs_size_ = unity_io_system_data_dirs_length1, _tmp1_); } - result = (_tmp3_ = (_tmp2_ = unity_io_system_data_dirs, (_tmp2_ == NULL) ? ((gpointer) _tmp2_) : _vala_array_dup3 (_tmp2_, unity_io_system_data_dirs_length1)), *result_length1 = unity_io_system_data_dirs_length1, _tmp3_); + result = (_tmp3_ = (_tmp2_ = unity_io_system_data_dirs, (_tmp2_ == NULL) ? ((gpointer) _tmp2_) : _vala_array_dup2 (_tmp2_, unity_io_system_data_dirs_length1)), *result_length1 = unity_io_system_data_dirs_length1, _tmp3_); return result; } diff --git a/unity/unity-io.vala b/unity/unity-io.vala index 9e415f006..20d6938d1 100644 --- a/unity/unity-io.vala +++ b/unity/unity-io.vala @@ -41,7 +41,7 @@ namespace Unity.IO { * Important: The passed back data must be manually freed using g_free() */ public async void read_stream_async (InputStream input, - owned uchar[] buffer, + void* buffer, size_t buffer_lenght, int io_priority, Cancellable? cancellable, diff --git a/unity/unity-pixbuf-cache.c b/unity/unity-pixbuf-cache.c index d597c2be5..bb9a6eb39 100644 --- a/unity/unity-pixbuf-cache.c +++ b/unity/unity-pixbuf-cache.c @@ -72,6 +72,8 @@ typedef struct _UnityShellIface UnityShellIface; #define UNITY_TYPE_WINDOW_ACTION (unity_window_action_get_type ()) #define _unity_pixbuf_cache_task_unref0(var) ((var == NULL) ? NULL : (var = (unity_pixbuf_cache_task_unref (var), NULL))) +#define _g_timer_destroy0(var) ((var == NULL) ? NULL : (var = (g_timer_destroy (var), NULL))) +typedef struct _UnityPixbufCacheProcessIconQueueAsyncData UnityPixbufCacheProcessIconQueueAsyncData; #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; @@ -117,8 +119,8 @@ struct _UnityPixbufCachePrivate { GtkIconTheme* theme; GeeHashMap* cache; gboolean autodispose; - GeePriorityQueue* queue; - guint queue_timeout; + GeeQueue* queue; + guint queue_source; }; typedef enum { @@ -162,19 +164,34 @@ struct _UnityShellIface { void (*set_is_starting) (UnityShell* self, gboolean value); }; +struct _UnityPixbufCacheProcessIconQueueAsyncData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + UnityPixbufCache* self; + guchar* buf; + gint buf_length1; + gint _buf_size_; + guchar* _tmp0_; + gint count; + GTimer* timer; + UnityPixbufCacheTask* task; + UnityPixbufCacheTask* _tmp1_; +}; + struct _UnityPixbufCacheSetImageFromIconNameRealData { int _state_; GAsyncResult* _res_; GSimpleAsyncResult* _async_result; UnityPixbufCache* self; - CtkImage* image; - char* icon_name; - gint size; - char* key; + UnityPixbufCacheTask* task; + void* buf; + gsize buf_length; GdkPixbuf* ret; GtkIconInfo* info; char* filename; GdkPixbuf* _tmp0_; + GdkPixbuf* _tmp1_; GError * e; GError * _inner_error_; }; @@ -184,26 +201,28 @@ struct _UnityPixbufCacheSetImageFromGiconStringRealData { GAsyncResult* _res_; GSimpleAsyncResult* _async_result; UnityPixbufCache* self; - CtkImage* image; - char* gicon_as_string; - gint size; - char* key; + UnityPixbufCacheTask* task; + void* buf; + gsize buf_length; GdkPixbuf* ret; GdkPixbuf* _tmp0_; - char* _tmp1_; + GdkPixbuf* _tmp1_; + char* _tmp2_; GError * err; GIcon* icon; GtkIconInfo* info; char* filename; - GdkPixbuf* _tmp2_; - gboolean _tmp3_; - gboolean _tmp4_; + GdkPixbuf* _tmp3_; + GdkPixbuf* _tmp4_; gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; char* real_name; - GtkIconInfo* _tmp6_; + GtkIconInfo* _tmp8_; char* fname; - GdkPixbuf* _tmp7_; - char* _tmp8_; + GdkPixbuf* _tmp9_; + GdkPixbuf* _tmp10_; + char* _tmp11_; GError * e; GError * _inner_error_; }; @@ -226,18 +245,15 @@ struct _UnityPixbufCacheLoadFromFilepathData { UnityPixbufCache* self; char* filename; gint size; + void* buf; + gsize buf_length; GdkPixbuf* result; GFile* datafile; GFileInfo* info; char* mimetype; GFileInputStream* stream; - guchar* buf; - gint buf_length1; - gint _buf_size_; - guchar* _tmp0_; void* data; gsize data_size; - guchar* _tmp1_; GdkPixbufLoader* loader; GError * ee; GError * _inner_error_; @@ -282,19 +298,25 @@ 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); -static 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_); +static void unity_pixbuf_cache_process_icon_queue_async_data_free (gpointer _data); +static void unity_pixbuf_cache_process_icon_queue_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static void unity_pixbuf_cache_process_icon_queue_async (UnityPixbufCache* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +static void unity_pixbuf_cache_process_icon_queue_finish (UnityPixbufCache* self, GAsyncResult* _res_); +static gboolean unity_pixbuf_cache_process_icon_queue_async_co (UnityPixbufCacheProcessIconQueueAsyncData* data); +static void unity_pixbuf_cache_set_image_from_icon_name_real (UnityPixbufCache* self, UnityPixbufCacheTask* task, void* buf, gsize buf_length, GAsyncReadyCallback _callback_, gpointer _user_data_); static void unity_pixbuf_cache_set_image_from_icon_name_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); -static 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_); +static void unity_pixbuf_cache_set_image_from_gicon_string_real (UnityPixbufCache* self, UnityPixbufCacheTask* task, void* buf, gsize buf_length, GAsyncReadyCallback _callback_, gpointer _user_data_); static void unity_pixbuf_cache_set_image_from_gicon_string_real_finish (UnityPixbufCache* self, GAsyncResult* _res_); +static void unity_pixbuf_cache_process_icon_queue (UnityPixbufCache* self); +static gboolean unity_pixbuf_cache_dispatch_process_icon_queue_async (UnityPixbufCache* self); +static gboolean _unity_pixbuf_cache_dispatch_process_icon_queue_async_gsource_func (gpointer self); void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size); -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); -void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_); -GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_); -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size); +static void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, void* buf, gsize buf_length, GAsyncReadyCallback _callback_, gpointer _user_data_); +static GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_, GError** error); +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size); 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); @@ -306,9 +328,8 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_co (UnityPixbufCacheSetI 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_async (GInputStream* input, void* buffer, 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); @@ -578,55 +599,146 @@ 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; +static void unity_pixbuf_cache_process_icon_queue_async_data_free (gpointer _data) { + UnityPixbufCacheProcessIconQueueAsyncData* data; + data = _data; + g_object_unref (data->self); + g_slice_free (UnityPixbufCacheProcessIconQueueAsyncData, data); +} + + +static void unity_pixbuf_cache_process_icon_queue_async (UnityPixbufCache* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { + UnityPixbufCacheProcessIconQueueAsyncData* _data_; + _data_ = g_slice_new0 (UnityPixbufCacheProcessIconQueueAsyncData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_pixbuf_cache_process_icon_queue_async); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_pixbuf_cache_process_icon_queue_async_data_free); + _data_->self = g_object_ref (self); + unity_pixbuf_cache_process_icon_queue_async_co (_data_); +} + + +static void unity_pixbuf_cache_process_icon_queue_finish (UnityPixbufCache* self, GAsyncResult* _res_) { + UnityPixbufCacheProcessIconQueueAsyncData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +} + + +static void unity_pixbuf_cache_process_icon_queue_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + UnityPixbufCacheProcessIconQueueAsyncData* data; + data = _user_data_; + data->_res_ = _res_; + unity_pixbuf_cache_process_icon_queue_async_co (data); +} + + +static gboolean unity_pixbuf_cache_process_icon_queue_async_co (UnityPixbufCacheProcessIconQueueAsyncData* 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->buf = (data->_tmp0_ = g_new0 (guchar, 4096), data->buf_length1 = 4096, data->_buf_size_ = data->buf_length1, data->_tmp0_); + data->count = 0; + data->timer = g_timer_new (); 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_) { + if (!((data->task = (data->_tmp1_ = (UnityPixbufCacheTask*) gee_queue_poll (data->self->priv->queue), _unity_pixbuf_cache_task_unref0 (data->task), data->_tmp1_)) != NULL)) { 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); + if (CTK_IS_IMAGE (data->task->image)) { + switch (data->task->type) { + case UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME: + { + data->_state_ = 10; + unity_pixbuf_cache_set_image_from_icon_name_real (data->self, data->task, data->buf, (gsize) data->buf_length1, unity_pixbuf_cache_process_icon_queue_async_ready, data); + return FALSE; + _state_10: + unity_pixbuf_cache_set_image_from_icon_name_real_finish (data->self, data->_res_); + break; + } + case UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING: + { + data->_state_ = 11; + unity_pixbuf_cache_set_image_from_gicon_string_real (data->self, data->task, data->buf, (gsize) data->buf_length1, unity_pixbuf_cache_process_icon_queue_async_ready, data); + return FALSE; + _state_11: + unity_pixbuf_cache_set_image_from_gicon_string_real_finish (data->self, data->_res_); + break; + } + default: + { + g_critical ("unity-pixbuf-cache.vala:151: Internal error. Unknown PixbufRequestType" \ +": %u", (guint) data->task->type); + break; } } } - i++; - _unity_pixbuf_cache_task_unref0 (task); + data->count++; } - if (gee_collection_get_size ((GeeCollection*) self->priv->queue) == 0) { - self->priv->queue_timeout = (guint) 0; + g_timer_stop (data->timer); + g_debug ("unity-pixbuf-cache.vala:160: Loaded %i icons in %fms", data->count, g_timer_elapsed (data->timer, NULL) * 1000); + data->self->priv->queue_source = (guint) 0; + _unity_pixbuf_cache_task_unref0 (data->task); + _g_timer_destroy0 (data->timer); + data->buf = (g_free (data->buf), 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; } - result = gee_collection_get_size ((GeeCollection*) self->priv->queue) != 0; - return result; } -static gboolean _unity_pixbuf_cache_load_iteration_gsource_func (gpointer self) { +static gboolean _unity_pixbuf_cache_dispatch_process_icon_queue_async_gsource_func (gpointer self) { gboolean result; - result = unity_pixbuf_cache_load_iteration (self); + result = unity_pixbuf_cache_dispatch_process_icon_queue_async (self); return result; } +static void unity_pixbuf_cache_process_icon_queue (UnityPixbufCache* self) { + g_return_if_fail (self != NULL); + if (self->priv->queue_source == 0) { + self->priv->queue_source = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_dispatch_process_icon_queue_async_gsource_func, g_object_ref (self), g_object_unref); + } +} + + +static gboolean unity_pixbuf_cache_dispatch_process_icon_queue_async (UnityPixbufCache* self) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + unity_pixbuf_cache_process_icon_queue_async (self, NULL, NULL); + unity_pixbuf_cache_process_icon_queue_async (self, NULL, NULL); + unity_pixbuf_cache_process_icon_queue_async (self, NULL, NULL); + result = FALSE; + return result; +} + + +/** + * If the icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkImage* image, const char* icon_name, gint size) { char* key; GdkPixbuf* ret; UnityPixbufCacheTask* task; char* _tmp0_; + char* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (image != NULL); g_return_if_fail (icon_name != NULL); @@ -639,14 +751,13 @@ void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkIma return; } task = unity_pixbuf_cache_task_new (); - task->data = (_tmp0_ = g_strdup (icon_name), _g_free0 (task->data), _tmp0_); + task->key = (_tmp0_ = g_strdup (key), _g_free0 (task->key), _tmp0_); + task->data = (_tmp1_ = g_strdup (icon_name), _g_free0 (task->data), _tmp1_); task->image = image; task->size = size; task->type = UNITY_PIXBUF_REQUEST_TYPE_ICON_NAME; - gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->queue, task); - if (self->priv->queue_timeout == 0) { - self->priv->queue_timeout = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_load_iteration_gsource_func, g_object_ref (self), g_object_unref); - } + gee_queue_offer (self->priv->queue, task); + unity_pixbuf_cache_process_icon_queue (self); _unity_pixbuf_cache_task_unref0 (task); _g_object_unref0 (ret); _g_free0 (key); @@ -656,22 +767,26 @@ void unity_pixbuf_cache_set_image_from_icon_name (UnityPixbufCache* self, CtkIma 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); + _unity_pixbuf_cache_task_unref0 (data->task); g_object_unref (data->self); g_slice_free (UnityPixbufCacheSetImageFromIconNameRealData, data); } -static 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_) { +static gpointer _unity_pixbuf_cache_task_ref0 (gpointer self) { + return self ? unity_pixbuf_cache_task_ref (self) : NULL; +} + + +static void unity_pixbuf_cache_set_image_from_icon_name_real (UnityPixbufCache* self, UnityPixbufCacheTask* task, void* buf, gsize buf_length, 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; + _data_->task = _unity_pixbuf_cache_task_ref0 (task); + _data_->buf = buf; + _data_->buf_length = buf_length; unity_pixbuf_cache_set_image_from_icon_name_real_co (_data_); } @@ -696,16 +811,14 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_real_co (UnityPixbuf goto _state_0; default: g_assert_not_reached (); - case 10: - goto _state_10; + case 12: + goto _state_12; } _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); + data->ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->cache, data->task->key); if (GDK_IS_PIXBUF (data->ret)) { - ctk_image_set_from_pixbuf (data->image, data->ret); + ctk_image_set_from_pixbuf (data->task->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); @@ -716,47 +829,49 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_real_co (UnityPixbuf return FALSE; } } - if (data->ret == NULL) { - { - 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_ = 10; - unity_pixbuf_cache_load_from_filepath (data->self, data->filename, data->size, unity_pixbuf_cache_set_image_from_icon_name_real_ready, data); - return FALSE; - _state_10: - data->ret = (data->_tmp0_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp0_); + { + data->info = gtk_icon_theme_lookup_icon (data->self->priv->theme, data->task->data, data->task->size, 0); + if (data->info != NULL) { + data->filename = g_strdup (gtk_icon_info_get_filename (data->info)); + data->_state_ = 12; + unity_pixbuf_cache_load_from_filepath (data->self, data->filename, data->task->size, data->buf, data->buf_length, unity_pixbuf_cache_set_image_from_icon_name_real_ready, data); + return FALSE; + _state_12: + data->_tmp0_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_, &data->_inner_error_); + if (data->_inner_error_ != NULL) { _g_free0 (data->filename); + _gtk_icon_info_free0 (data->info); + goto __catch34_g_error; } - 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); + data->ret = (data->_tmp1_ = data->_tmp0_, _g_object_unref0 (data->ret), data->_tmp1_); + _g_free0 (data->filename); } - goto __finally34; - __catch34_g_error: - { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; - { - g_warning ("unity-pixbuf-cache.vala:211: Unable to load icon_name: %s", data->e->message); - _g_error_free0 (data->e); - } + if (GDK_IS_PIXBUF (data->ret)) { + gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->cache, data->task->key, data->ret); } - __finally34: - if (data->_inner_error_ != NULL) { - _g_object_unref0 (data->ret); - _g_free0 (data->key); - 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; + _gtk_icon_info_free0 (data->info); + } + goto __finally34; + __catch34_g_error: + { + data->e = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_warning ("unity-pixbuf-cache.vala:255: Unable to load icon_name: %s", data->e->message); + _g_error_free0 (data->e); } } + __finally34: + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->ret); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); + g_clear_error (&data->_inner_error_); + return FALSE; + } if (GDK_IS_PIXBUF (data->ret)) { - ctk_image_set_from_pixbuf (data->image, data->ret); + ctk_image_set_from_pixbuf (data->task->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); @@ -769,15 +884,25 @@ static gboolean unity_pixbuf_cache_set_image_from_icon_name_real_co (UnityPixbuf } -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size) { +/** + * If the icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size) { char* key; GdkPixbuf* ret; UnityPixbufCacheTask* task; char* _tmp0_; + char* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (image != NULL); - g_return_if_fail (data != NULL); - key = g_strdup_printf (UNITY_hash_template, data, size); + g_return_if_fail (gicon_as_string != NULL); + key = g_strdup_printf (UNITY_hash_template, gicon_as_string, size); ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->cache, key); if (GDK_IS_PIXBUF (ret)) { ctk_image_set_from_pixbuf (image, ret); @@ -786,14 +911,13 @@ void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, Ctk return; } task = unity_pixbuf_cache_task_new (); + task->key = (_tmp0_ = g_strdup (key), _g_free0 (task->key), _tmp0_); task->image = image; - task->data = (_tmp0_ = g_strdup (data), _g_free0 (task->data), _tmp0_); + task->data = (_tmp1_ = g_strdup (gicon_as_string), _g_free0 (task->data), _tmp1_); task->size = size; task->type = UNITY_PIXBUF_REQUEST_TYPE_GICON_STRING; - gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->queue, task); - if (self->priv->queue_timeout == 0) { - self->priv->queue_timeout = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_pixbuf_cache_load_iteration_gsource_func, g_object_ref (self), g_object_unref); - } + gee_queue_offer (self->priv->queue, task); + unity_pixbuf_cache_process_icon_queue (self); _unity_pixbuf_cache_task_unref0 (task); _g_object_unref0 (ret); _g_free0 (key); @@ -803,22 +927,21 @@ void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, Ctk 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); + _unity_pixbuf_cache_task_unref0 (data->task); g_object_unref (data->self); g_slice_free (UnityPixbufCacheSetImageFromGiconStringRealData, data); } -static 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_) { +static void unity_pixbuf_cache_set_image_from_gicon_string_real (UnityPixbufCache* self, UnityPixbufCacheTask* task, void* buf, gsize buf_length, 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; + _data_->task = _unity_pixbuf_cache_task_ref0 (task); + _data_->buf = buf; + _data_->buf_length = buf_length; unity_pixbuf_cache_set_image_from_gicon_string_real_co (_data_); } @@ -892,20 +1015,18 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_real_co (UnityPix 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); - data->ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->cache, data->key); + data->ret = (GdkPixbuf*) gee_abstract_map_get ((GeeAbstractMap*) data->self->priv->cache, data->task->key); if (GDK_IS_PIXBUF (data->ret)) { - ctk_image_set_from_pixbuf (data->image, data->ret); + ctk_image_set_from_pixbuf (data->task->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); @@ -916,113 +1037,123 @@ static gboolean unity_pixbuf_cache_set_image_from_gicon_string_real_co (UnityPix return FALSE; } } - if (data->ret == NULL) { - if (g_utf8_get_char (g_utf8_offset_to_pointer (data->gicon_as_string, 0)) == '/') { - { - data->_state_ = 11; - unity_pixbuf_cache_load_from_filepath (data->self, data->gicon_as_string, data->size, unity_pixbuf_cache_set_image_from_gicon_string_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_); + if (g_utf8_get_char (g_utf8_offset_to_pointer (data->task->data, 0)) == '/') { + { + data->_state_ = 13; + unity_pixbuf_cache_load_from_filepath (data->self, data->task->data, data->task->size, data->buf, data->buf_length, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_13: + data->_tmp0_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + goto __catch35_g_error; } - goto __finally35; - __catch35_g_error: + data->ret = (data->_tmp1_ = data->_tmp0_, _g_object_unref0 (data->ret), data->_tmp1_); + } + goto __finally35; + __catch35_g_error: + { + data->err = data->_inner_error_; + data->_inner_error_ = NULL; { - data->err = data->_inner_error_; - data->_inner_error_ = NULL; - { - 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); - } + g_message (data->_tmp2_ = g_strconcat ("Unable to load ", string_to_string (data->task->data), " as file: %s", NULL), data->err->message); + _g_free0 (data->_tmp2_); + _g_error_free0 (data->err); } - __finally35: + } + __finally35: + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->ret); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); + g_clear_error (&data->_inner_error_); + return FALSE; + } + } + if (data->ret == NULL) { + { + data->icon = g_icon_new_for_string (data->task->data, &data->_inner_error_); if (data->_inner_error_ != NULL) { - _g_object_unref0 (data->ret); - _g_free0 (data->key); - 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; + goto __catch36_g_error; } - } - if (data->ret == NULL) { - { - data->icon = g_icon_new_for_string (data->gicon_as_string, &data->_inner_error_); + data->info = gtk_icon_theme_lookup_by_gicon (data->self->priv->theme, data->icon, data->task->size, 0); + if (data->info != NULL) { + 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->task->size, data->buf, data->buf_length, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_14: + data->_tmp3_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { + _g_free0 (data->filename); + _gtk_icon_info_free0 (data->info); goto __catch36_g_error; } - data->info = gtk_icon_theme_lookup_by_gicon (data->self->priv->theme, data->icon, data->size, 0); - if (data->info != NULL) { - data->filename = g_strdup (gtk_icon_info_get_filename (data->info)); - data->_state_ = 12; - unity_pixbuf_cache_load_from_filepath (data->self, data->filename, data->size, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); - return FALSE; - _state_12: - 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); + data->ret = (data->_tmp4_ = data->_tmp3_, _g_object_unref0 (data->ret), data->_tmp4_); + _g_free0 (data->filename); + } + if (data->ret == NULL) { + if (g_str_has_suffix (data->task->data, ".png")) { + data->_tmp7_ = TRUE; + } else { + data->_tmp7_ = g_str_has_suffix (data->task->data, ".xpm"); } - if (data->ret == NULL) { - if (g_str_has_suffix (data->gicon_as_string, ".png")) { - data->_tmp5_ = TRUE; - } else { - data->_tmp5_ = g_str_has_suffix (data->gicon_as_string, ".xpm"); - } - if (data->_tmp5_) { - data->_tmp4_ = TRUE; - } else { - data->_tmp4_ = g_str_has_suffix (data->gicon_as_string, ".gif"); - } - if (data->_tmp4_) { - data->_tmp3_ = TRUE; - } else { - data->_tmp3_ = g_str_has_suffix (data->gicon_as_string, ".jpg"); - } - if (data->_tmp3_) { - data->real_name = string_slice (data->gicon_as_string, (glong) 0, string_get_length (data->gicon_as_string) - 4); - 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_ = 13; - unity_pixbuf_cache_load_from_filepath (data->self, data->fname, data->size, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); - return FALSE; - _state_13: - data->ret = (data->_tmp7_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_), _g_object_unref0 (data->ret), data->_tmp7_); + if (data->_tmp7_) { + data->_tmp6_ = TRUE; + } else { + data->_tmp6_ = g_str_has_suffix (data->task->data, ".gif"); + } + if (data->_tmp6_) { + data->_tmp5_ = TRUE; + } else { + data->_tmp5_ = g_str_has_suffix (data->task->data, ".jpg"); + } + if (data->_tmp5_) { + data->real_name = string_slice (data->task->data, (glong) 0, string_get_length (data->task->data) - 4); + data->info = (data->_tmp8_ = gtk_icon_theme_lookup_icon (data->self->priv->theme, data->real_name, data->task->size, 0), _gtk_icon_info_free0 (data->info), data->_tmp8_); + 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->task->size, data->buf, data->buf_length, unity_pixbuf_cache_set_image_from_gicon_string_real_ready, data); + return FALSE; + _state_15: + data->_tmp9_ = unity_pixbuf_cache_load_from_filepath_finish (data->self, data->_res_, &data->_inner_error_); + if (data->_inner_error_ != NULL) { _g_free0 (data->fname); + _g_free0 (data->real_name); + _gtk_icon_info_free0 (data->info); + goto __catch36_g_error; } - _g_free0 (data->real_name); + data->ret = (data->_tmp10_ = data->_tmp9_, _g_object_unref0 (data->ret), data->_tmp10_); + _g_free0 (data->fname); } + _g_free0 (data->real_name); } - _gtk_icon_info_free0 (data->info); } - goto __finally36; - __catch36_g_error: + _gtk_icon_info_free0 (data->info); + } + goto __finally36; + __catch36_g_error: + { + data->e = data->_inner_error_; + data->_inner_error_ = NULL; { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; - { - 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); - } - } - __finally36: - if (data->_inner_error_ != NULL) { - _g_object_unref0 (data->ret); - _g_free0 (data->key); - 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_warning (data->_tmp11_ = g_strconcat ("Unable to load icon ", string_to_string (data->task->data), ": '%s'", NULL), data->e->message); + _g_free0 (data->_tmp11_); + _g_error_free0 (data->e); } } - if (GDK_IS_PIXBUF (data->ret)) { - gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->cache, data->key, data->ret); + __finally36: + if (data->_inner_error_ != NULL) { + _g_object_unref0 (data->ret); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); + g_clear_error (&data->_inner_error_); + return FALSE; } } if (GDK_IS_PIXBUF (data->ret)) { - ctk_image_set_from_pixbuf (data->image, data->ret); + gee_abstract_map_set ((GeeAbstractMap*) data->self->priv->cache, data->task->key, data->ret); + ctk_image_set_from_pixbuf (data->task->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); @@ -1072,6 +1203,15 @@ static void unity_pixbuf_cache_set_image_from_gicon_ready (GObject* source_objec } +/** + * If @icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ static gboolean unity_pixbuf_cache_set_image_from_gicon_co (UnityPixbufCacheSetImageFromGiconData* data) { switch (data->_state_) { case 0: @@ -1104,7 +1244,7 @@ static void unity_pixbuf_cache_load_from_filepath_data_free (gpointer _data) { } -void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, GAsyncReadyCallback _callback_, gpointer _user_data_) { +static void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* filename, gint size, void* buf, gsize buf_length, 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); @@ -1112,13 +1252,18 @@ void unity_pixbuf_cache_load_from_filepath (UnityPixbufCache* self, const char* _data_->self = g_object_ref (self); _data_->filename = g_strdup (filename); _data_->size = size; + _data_->buf = buf; + _data_->buf_length = buf_length; unity_pixbuf_cache_load_from_filepath_co (_data_); } -GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_) { +static GdkPixbuf* unity_pixbuf_cache_load_from_filepath_finish (UnityPixbufCache* self, GAsyncResult* _res_, GError** error) { GdkPixbuf* result; UnityPixbufCacheLoadFromFilepathData* _data_; + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { + return NULL; + } _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); result = _data_->result; _data_->result = NULL; @@ -1134,84 +1279,81 @@ static void unity_pixbuf_cache_load_from_filepath_ready (GObject* source_object, } -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 14: - goto _state_14; - case 15: - goto _state_15; case 16: goto _state_16; + case 17: + goto _state_17; + case 18: + goto _state_18; } _state_0: if (data->filename != NULL) { data->datafile = g_file_new_for_path (data->filename); - data->_state_ = 14; + data->_state_ = 16; g_file_query_info_async (data->datafile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_LOW, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); return FALSE; - _state_14: + _state_16: data->info = g_file_query_info_finish (data->datafile, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { + g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_); + g_error_free (data->_inner_error_); _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; + { + 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->mimetype = g_strdup (g_file_info_get_content_type (data->info)); { - data->_state_ = 15; + data->_state_ = 17; g_file_read_async (data->datafile, G_PRIORITY_DEFAULT, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); return FALSE; - _state_15: + _state_17: data->stream = g_file_read_finish (data->datafile, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { goto __catch37_g_error; } if (G_IS_FILE_INPUT_STREAM (data->stream)) { - data->buf = (data->_tmp0_ = g_new0 (guchar, 1024), data->buf_length1 = 1024, data->_buf_size_ = data->buf_length1, data->_tmp0_); - data->_state_ = 16; - 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) data->buf_length1, G_PRIORITY_DEFAULT, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); + data->_state_ = 18; + unity_io_read_stream_async ((GInputStream*) data->stream, data->buf, data->buf_length, G_PRIORITY_DEFAULT, NULL, unity_pixbuf_cache_load_from_filepath_ready, data); return FALSE; - _state_16: + _state_18: 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 __catch37_g_error; } data->loader = gdk_pixbuf_loader_new_with_mime_type (data->mimetype, &data->_inner_error_); if (data->_inner_error_ != NULL) { - data->buf = (g_free (data->buf), NULL); _g_object_unref0 (data->stream); goto __catch37_g_error; } 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); - data->buf = (g_free (data->buf), NULL); _g_object_unref0 (data->stream); goto __catch37_g_error; } gdk_pixbuf_loader_close (data->loader, &data->_inner_error_); if (data->_inner_error_ != NULL) { _g_object_unref0 (data->loader); - data->buf = (g_free (data->buf), NULL); _g_object_unref0 (data->stream); goto __catch37_g_error; } g_free (data->data); data->result = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (data->loader)); _g_object_unref0 (data->loader); - data->buf = (g_free (data->buf), NULL); _g_object_unref0 (data->stream); _g_free0 (data->mimetype); _g_object_unref0 (data->info); @@ -1226,7 +1368,6 @@ static gboolean unity_pixbuf_cache_load_from_filepath_co (UnityPixbufCacheLoadFr return FALSE; } _g_object_unref0 (data->loader); - data->buf = (g_free (data->buf), NULL); } _g_object_unref0 (data->stream); } @@ -1236,18 +1377,26 @@ static gboolean unity_pixbuf_cache_load_from_filepath_co (UnityPixbufCacheLoadFr data->ee = data->_inner_error_; data->_inner_error_ = NULL; { - g_warning ("unity-pixbuf-cache.vala:371: Unable to load image file '%s': %s", data->filename, data->ee->message); + g_warning ("unity-pixbuf-cache.vala:422: Unable to load image file '%s': %s", data->filename, data->ee->message); _g_error_free0 (data->ee); } } __finally37: if (data->_inner_error_ != NULL) { + g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_); + g_error_free (data->_inner_error_); _g_free0 (data->mimetype); _g_object_unref0 (data->info); _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; + { + 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_free0 (data->mimetype); _g_object_unref0 (data->info); @@ -1291,9 +1440,9 @@ 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); { - GeePriorityQueue* _tmp0_; + GeeQueue* _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->queue = (_tmp0_ = (GeeQueue*) gee_linked_list_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 = (_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_); } @@ -1314,7 +1463,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; + self->priv->queue_source = (guint) 0; } diff --git a/unity/unity-pixbuf-cache.vala b/unity/unity-pixbuf-cache.vala index 83de824a6..5b1e630ed 100644 --- a/unity/unity-pixbuf-cache.vala +++ b/unity/unity-pixbuf-cache.vala @@ -23,7 +23,7 @@ using GLib; namespace Unity { - public class PixbufCacheTask + private class PixbufCacheTask { public string data; public unowned Ctk.Image image; @@ -36,7 +36,7 @@ namespace Unity } } - public enum PixbufRequestType + private enum PixbufRequestType { ICON_NAME, GICON_STRING @@ -62,9 +62,9 @@ namespace Unity public uint size { get { return cache.size; } } - private PriorityQueue<PixbufCacheTask> queue; + private Gee.Queue<PixbufCacheTask> queue; - private uint queue_timeout = 0; + private uint queue_source = 0; /* * Construction @@ -83,14 +83,13 @@ namespace Unity construct { - queue = new PriorityQueue<PixbufCacheTask> (); - + queue = new LinkedList<PixbufCacheTask> (); theme = Gtk.IconTheme.get_default (); cache = new HashMap<string, Gdk.Pixbuf> (); } private void on_shell_destroyed () - { + { if (_pixbuf_cache == this) { _pixbuf_cache = null; @@ -127,31 +126,79 @@ namespace Unity cache.clear (); } - public bool load_iteration () + private async void process_icon_queue_async () { - int i = 0; - - while (queue.size > 0 && i < 10) + /* Hardcoded numbers make gord cry - but so be it - we are taking + * a second guess of the inode size here, for the better of mankind */ + uchar[] buf = new uchar[4096]; + int count = 0; + var timer = new Timer (); + PixbufCacheTask task; + + while ((task = queue.poll()) != null) { - 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++; + switch (task.type) + { + case PixbufRequestType.ICON_NAME: + yield set_image_from_icon_name_real (task, buf, buf.length); + break; + case PixbufRequestType.GICON_STRING: + yield set_image_from_gicon_string_real (task, buf, buf.length); + break; + default: + critical ("Internal error. Unknown PixbufRequestType: %u", + task.type); + break; + } + } + count++; } + + timer.stop (); + debug ("Loaded %i icons in %fms", count, timer.elapsed()*1000); + + /* Queue depleted */ + queue_source = 0; + } - if (queue.size == 0) - queue_timeout = 0; - - return queue.size != 0; + private void process_icon_queue () + { + if (queue_source == 0) + { + /* queue_source is set to 0 by process_icon_queue_async() + * when the queue is depleted. + * It's important that we dispatch in an idle call here since + * it gives clients a chance to queue more icons before we + * hammer the IO */ + queue_source = Idle.add (dispatch_process_icon_queue_async); + } + } + + private bool dispatch_process_icon_queue_async () + { + /* Run three processings in "parallel". While we are not multithreaded, + * it still makes sense to do since one branch may be waiting in + * 'yield' for async IO, while the other can be parsing image data. + * The number of parallel workers has been chosen by best perceived + * responsiveness for bringing up the Applications place */ + process_icon_queue_async.begin (); + process_icon_queue_async.begin (); + process_icon_queue_async.begin (); + + return false; } + /** + * If the icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ public void set_image_from_icon_name (Ctk.Image image, string icon_name, int size) @@ -166,63 +213,68 @@ namespace Unity } var task = new PixbufCacheTask (); + task.key = key; task.data = icon_name; task.image = image; task.size = size; task.type = PixbufRequestType.ICON_NAME; - queue.add (task); + queue.offer (task); - if (queue_timeout == 0) - queue_timeout = Idle.add (load_iteration); + process_icon_queue (); } - private async void set_image_from_icon_name_real (Ctk.Image image, - string icon_name, - int size) + private async void set_image_from_icon_name_real (PixbufCacheTask task, + void* buf, + size_t buf_length) { - var key = hash_template.printf (icon_name, size); - Pixbuf? ret = cache[key]; + Pixbuf? ret = cache[task.key]; /* We need a secondary cache check because the icon may have * been cached while we where waiting in the queue */ if (ret is Pixbuf) { - image.set_from_pixbuf (ret); + task.image.set_from_pixbuf (ret); return; } - if (ret == null) - { - try { - var info = theme.lookup_icon (icon_name, size, 0); - if (info != null) - { - var filename = info.get_filename (); - ret = yield load_from_filepath (filename, size); - } - - if (ret is Pixbuf) - { - cache[key] = ret; - } + try { + var info = theme.lookup_icon (task.data, task.size, 0); + if (info != null) + { + var filename = info.get_filename (); + ret = yield load_from_filepath (filename, task.size, buf, buf_length); + } - } catch (Error e) { - warning ("Unable to load icon_name: %s", e.message); + if (ret is Pixbuf) + { + cache[task.key] = ret; } - } + + } catch (Error e) { + warning ("Unable to load icon_name: %s", e.message); + } if (ret is Pixbuf) { - image.set_from_pixbuf (ret); + task.image.set_from_pixbuf (ret); } } + /** + * If the icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ public void set_image_from_gicon_string (Ctk.Image image, - string data, - int size) + string gicon_as_string, + int size) { - var key = hash_template.printf (data, size); + var key = hash_template.printf (gicon_as_string, size); Pixbuf? ret = cache[key]; if (ret is Pixbuf) @@ -232,95 +284,94 @@ namespace Unity } var task = new PixbufCacheTask (); + task.key = key; task.image = image; - task.data = data; + task.data = gicon_as_string; task.size = size; task.type = PixbufRequestType.GICON_STRING; - queue.add (task); + queue.offer (task); - if (queue_timeout == 0) - queue_timeout = Idle.add (load_iteration); + process_icon_queue (); } - private async void set_image_from_gicon_string_real (Ctk.Image image, - string gicon_as_string, - int size) + private async void set_image_from_gicon_string_real (PixbufCacheTask task, + void* buf, + size_t buf_length) { - var key = hash_template.printf (gicon_as_string, size); - Pixbuf? ret = cache[key]; + Pixbuf? ret = cache[task.key]; /* We need a secondary cache check because the icon may have * been cached while we where waiting in the queue */ if (ret is Pixbuf) { - image.set_from_pixbuf (ret); + task.image.set_from_pixbuf (ret); return; } + if (task.data[0] == '/') + { + try { + ret = yield load_from_filepath (task.data, task.size, buf, buf_length); + } catch (Error err) { + message (@"Unable to load $(task.data) as file: %s", + err.message); + } + } + if (ret == null) { - if (gicon_as_string[0] == '/') - { - try { - ret = yield load_from_filepath (gicon_as_string, size); - } catch (Error err) { - message (@"Unable to load $gicon_as_string as file: %s", - err.message); + try { + unowned GLib.Icon icon = GLib.Icon.new_for_string (task.data); + var info = theme.lookup_by_gicon (icon, task.size, 0); + if (info != null) + { + var filename = info.get_filename (); + ret = yield load_from_filepath (filename, task.size, buf, buf_length); } - } - if (ret == null) - { - try { - unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string); - var info = theme.lookup_by_gicon (icon, size, 0); - if (info != null) - { - var filename = info.get_filename (); - - ret = yield load_from_filepath (filename, size); - } - - if (ret == null) - { - /* There is some funkiness in some programs where they install - * their icon to /usr/share/icons/hicolor/apps/, but they - * name the Icon= key as `foo.$extension` which breaks loading - * So we can try and work around that here. - */ - if (gicon_as_string.has_suffix (".png") - || gicon_as_string.has_suffix (".xpm") - || gicon_as_string.has_suffix (".gif") - || gicon_as_string.has_suffix (".jpg")) - { - string real_name = gicon_as_string[0:gicon_as_string.length-4]; - info = theme.lookup_icon (real_name, size, 0); - if (info != null) - { - var fname = info.get_filename (); - ret = yield load_from_filepath (fname, size); - } - } - } - - } catch (Error e) { - warning (@"Unable to load icon $gicon_as_string: '%s'", e.message); + if (ret == null) + { + /* There is some funkiness in some programs where they install + * their icon to /usr/share/icons/hicolor/apps/, but they + * name the Icon= key as `foo.$extension` which breaks loading + * So we can try and work around that here. + */ + if (task.data.has_suffix (".png") + || task.data.has_suffix (".xpm") + || task.data.has_suffix (".gif") + || task.data.has_suffix (".jpg")) + { + string real_name = task.data[0:task.data.length-4]; + info = theme.lookup_icon (real_name, task.size, 0); + if (info != null) + { + var fname = info.get_filename (); + ret = yield load_from_filepath (fname, task.size, buf, buf_length); + } + } } - } - - if (ret is Pixbuf) - { - cache[key] = ret; - } + } catch (Error e) { + warning (@"Unable to load icon $(task.data): '%s'", e.message); + } } if (ret is Pixbuf) { - image.set_from_pixbuf (ret); + cache[task.key] = ret; + task.image.set_from_pixbuf (ret); } } + /** + * If @icon is already cached then set it immediately on @image. Otherwise + * does async IO to load and cache the icon, then setting it on @image. + * + * Note that this means that you should treat this method as an async + * operation for all intents and purposes. You can not count on + * image.pixbuf != null when this method call returns. That may just as well + * happen in a subsequent idle call. + */ public async void set_image_from_gicon (Ctk.Image image, GLib.Icon icon, int size) @@ -328,7 +379,8 @@ namespace Unity set_image_from_gicon_string (image, icon.to_string (), size); } - public async Gdk.Pixbuf? load_from_filepath (string filename, int size) + private async Gdk.Pixbuf? load_from_filepath (string filename, int size, + void* buf, size_t buf_length) throws Error { if (filename != null) @@ -347,10 +399,9 @@ namespace Unity if (stream is FileInputStream) { /* TODO: Tweak buf size to optimize io */ - uchar[] buf = new uchar[1024]; void *data; size_t data_size; - yield IO.read_stream_async (stream, buf, buf.length, Priority.DEFAULT, + yield IO.read_stream_async (stream, buf, buf_length, Priority.DEFAULT, null, out data, out data_size); /* Construct a loader for a given mimetype so it doesn't @@ -374,6 +425,5 @@ namespace Unity return null; } - } } diff --git a/unity/unity-place-browser.c b/unity/unity-place-browser.c index fe599a0e3..ddd57f886 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_dup9 (UnityPlace_BrowsingState* self, int length); +static UnityPlace_BrowsingState* _vala_array_dup7 (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_dup10 (UnityPlace_BrowsingState* self, int length); +static UnityPlace_BrowsingState* _vala_array_dup8 (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* _vala_array_dup11 (UnityPlace_BrowsingState* self, int length); +static UnityPlace_BrowsingState* _vala_array_dup9 (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); +static UnityPlace_BrowsingState* _vala_array_dup10 (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_dup9 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup7 (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_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_dup7 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); return result; } -static UnityPlace_BrowsingState* _vala_array_dup10 (UnityPlace_BrowsingState* self, int length) { +static UnityPlace_BrowsingState* _vala_array_dup8 (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_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_dup8 (_tmp1_, _tmp0_)), *result_length1 = _tmp0_, _tmp2_); return result; } -static UnityPlace_BrowsingState* _vala_array_dup11 (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}; @@ -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_dup11 (_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; } @@ -1634,7 +1634,7 @@ UnityPlace_BrowsingState* unity_place_browser_service_impl_get_browsing_state (U } -static UnityPlace_BrowsingState* _vala_array_dup12 (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}; @@ -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_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_); + self->priv->_browsing_state = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup10 (_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 2bdc15a05..7634289d9 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_dup5 (char** self, int length); +static char** _vala_array_dup3 (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_dup6 (char** self, int length); +static char** _vala_array_dup4 (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_dup7 (char** self, int length); +static char** _vala_array_dup5 (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_dup8 (char** self, int length); +static char** _vala_array_dup6 (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_dup5 (char** self, int length) { +static char** _vala_array_dup3 (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_dup5 (_tmp0_, (*self).mimetypes_length1)); + dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup3 (_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_dup6 (char** self, int length) { +static char** _vala_array_dup4 (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_dup6 (_tmp0_, (*self).mimetypes_length1)); + dest->mimetypes = (_tmp0_ = self->mimetypes, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup4 (_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_dup7 (char** self, int length) { +static char** _vala_array_dup5 (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_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_); + self->priv->info.mimetypes = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup5 (_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"); } @@ -4888,8 +4888,8 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl goto _state_0; default: g_assert_not_reached (); - case 17: - goto _state_17; + case 19: + goto _state_19; } _state_0: if (data->self->priv->_activation == NULL) { @@ -4905,10 +4905,10 @@ static gboolean unity_place_service_impl_real_activate_co (UnityPlaceServiceImpl } } { - data->_state_ = 17; + data->_state_ = 19; unity_place_activation_activate (data->self->priv->_activation, data->uri, unity_place_service_impl_activate_ready, data); return FALSE; - _state_17: + _state_19: 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) { @@ -5397,7 +5397,7 @@ void unity_place_entry_service_impl_queue_place_entry_info_changed_signal (Unity } -static char** _vala_array_dup8 (char** self, int length) { +static char** _vala_array_dup6 (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_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.mimetypes = (_tmp5_ = (_tmp4_ = _entry.mimetypes, (_tmp4_ == NULL) ? ((gpointer) _tmp4_) : _vala_array_dup6 (_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 b00cb677b..bcf720711 100644 --- a/unity/unity.h +++ b/unity/unity.h @@ -246,19 +246,6 @@ 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)) @@ -634,27 +621,6 @@ 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; @@ -931,7 +897,7 @@ UnityFavorites* unity_favorites_construct (GType object_type); GType unity_gconf_favorites_get_type (void) G_GNUC_CONST; UnityGConfFavorites* unity_gconf_favorites_new (void); UnityGConfFavorites* unity_gconf_favorites_construct (GType object_type); -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_async (GInputStream* input, void* buffer, 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); void unity_io_open_from_dirs (const char* filename, char** dirs, int dirs_length1, GAsyncReadyCallback _callback_, gpointer _user_data_); GFileInputStream* unity_io_open_from_dirs_finish (GAsyncResult* _res_, GError** error); @@ -942,16 +908,6 @@ 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); @@ -959,13 +915,10 @@ 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); -void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* data, gint size); +void unity_pixbuf_cache_set_image_from_gicon_string (UnityPixbufCache* self, CtkImage* image, const char* gicon_as_string, gint size); 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, 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 ca81f0e6f..516f78d4d 100644 --- a/unity/unity.vapi +++ b/unity/unity.vapi @@ -32,7 +32,7 @@ namespace Unity { [CCode (cheader_filename = "unity.h")] public static async GLib.FileInputStream? open_from_dirs (string filename, string[] dirs) throws GLib.Error; [CCode (cheader_filename = "unity.h")] - public static async void read_stream_async (GLib.InputStream input, owned uchar[] buffer, size_t buffer_lenght, int io_priority, GLib.Cancellable? cancellable, out void* data, out size_t size) throws GLib.Error; + public static async void read_stream_async (GLib.InputStream input, void* buffer, size_t buffer_lenght, int io_priority, GLib.Cancellable? cancellable, out void* data, out size_t size) throws GLib.Error; } [CCode (cprefix = "UnityPlace", lower_case_cprefix = "unity_place_")] namespace Place { @@ -306,23 +306,12 @@ 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); - 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 void set_image_from_gicon_string (Ctk.Image image, string data, int size); + public void set_image_from_gicon_string (Ctk.Image image, string gicon_as_string, int size); public void set_image_from_icon_name (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")] @@ -401,11 +390,6 @@ 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 a83add43c..8dd1e1268 100644 --- a/unity/webapp-fetcher.c +++ b/unity/webapp-fetcher.c @@ -599,8 +599,8 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc goto _state_0; default: g_assert_not_reached (); - case 18: - goto _state_18; + case 20: + goto _state_20; } _state_0: data->size = (gssize) 1024; @@ -616,10 +616,10 @@ static gboolean unity_webapp_fetch_file_read_something_async_co (UnityWebappFetc } data->_tmp1_ = FALSE; { - data->_state_ = 18; + data->_state_ = 20; 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_18: + _state_20: data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { goto __catch47_g_error; diff --git a/vapi/indicator.vapi b/vapi/indicator.vapi index 448d85133..7a4b34d58 100644 --- a/vapi/indicator.vapi +++ b/vapi/indicator.vapi @@ -27,6 +27,7 @@ namespace Indicator { [NoWrapper] public virtual unowned Gtk.Menu get_menu (); [NoWrapper] + public virtual void entry_activate (Indicator.ObjectEntry entry, uint timestamp); public virtual void indicator_object_reserved_1 (); public virtual signal void entry_added (Indicator.ObjectEntry entry); public virtual signal void entry_moved (Indicator.ObjectEntry entry, uint old_pos, uint new_pos); |
