summaryrefslogtreecommitdiff
diff options
authorDidier Roche <didier.roche@canonical.com>2011-01-31 17:34:04 +0100
committerDidier Roche <didier.roche@canonical.com>2011-01-31 17:34:04 +0100
commitb97e278ac962e9e4aea2bdbbefea6ae6367a99d8 (patch)
tree2ac85c2baa72da1b71a34c615623c699b118784e
parente14f00498a05617397e23fe346c4cccf6d152e18 (diff)
parent1b0056cc2e45a2c9f3b174a55eb979a389d93182 (diff)
Import upstream version 3.4.0upstream-3.4.0
(bzr r55.4.41)
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/BamfLauncherIcon.cpp25
-rw-r--r--src/IconTexture.cpp148
-rw-r--r--src/Launcher.cpp179
-rw-r--r--src/Launcher.h16
-rw-r--r--src/LauncherModel.cpp28
-rw-r--r--src/LauncherModel.h2
-rw-r--r--src/PanelMenuView.cpp8
-rw-r--r--src/PlaceEntry.h20
-rw-r--r--src/PlaceEntryRemote.cpp18
-rw-r--r--src/PlaceFactoryFile.cpp4
-rw-r--r--src/PlaceLauncherIcon.cpp13
-rw-r--r--src/PlaceLauncherIcon.h1
-rw-r--r--src/PlacesController.cpp11
-rw-r--r--src/PlacesController.h1
-rw-r--r--src/PlacesGroup.cpp23
-rw-r--r--src/PlacesGroup.h5
-rw-r--r--src/PlacesResultsController.cpp91
-rw-r--r--src/PlacesResultsController.h4
-rw-r--r--src/PlacesResultsView.cpp29
-rw-r--r--src/PlacesResultsView.h4
-rw-r--r--src/PlacesSearchBar.cpp70
-rw-r--r--src/PlacesSearchBar.h13
-rw-r--r--src/PlacesSimpleTile.cpp30
-rw-r--r--src/PlacesSimpleTile.h12
-rw-r--r--src/PlacesView.cpp218
-rw-r--r--src/PlacesView.h31
-rw-r--r--src/PluginAdapter.cpp65
-rw-r--r--src/PluginAdapter.h10
-rw-r--r--src/StaticCairoText.cpp8
-rw-r--r--src/ubus-server.cpp5
-rw-r--r--src/unitya11y.cpp12
-rw-r--r--src/unitya11y.h1
-rw-r--r--src/unityshell.cpp19
-rw-r--r--tests/CMakeLists.txt6
-rw-r--r--tests/TestPlaces.cpp4
-rw-r--r--tests/TestPlacesGroup.cpp1
-rw-r--r--tests/TestPlacesResults.cpp75
38 files changed, 904 insertions, 310 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99a09174f..a922593a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,8 @@ subdirs (services tests tools doc)
#
set (PROJECT_NAME "unity")
set (UNITY_MAJOR 3)
-set (UNITY_MINOR 2)
-set (UNITY_MICRO 16)
+set (UNITY_MINOR 4)
+set (UNITY_MICRO 0)
set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
set (UNITY_API_VERSION "3.0")
diff --git a/src/BamfLauncherIcon.cpp b/src/BamfLauncherIcon.cpp
index c8865cc6e..7c7888335 100644
--- a/src/BamfLauncherIcon.cpp
+++ b/src/BamfLauncherIcon.cpp
@@ -346,17 +346,12 @@ BamfLauncherIcon::Spread ()
void
BamfLauncherIcon::OnMouseClick (int button)
{
- bool scaleWasActive = PluginAdapter::Default ()->IsScaleActive ();
- bool onlyOwnWasActive = PluginAdapter::Default ()->IsScaleActive (true);
-
if (button != 1)
return;
- if (!scaleWasActive || (scaleWasActive && !onlyOwnWasActive))
- _launcher->SetLastSpreadIcon (NULL);
+ bool scaleWasActive = PluginAdapter::Default ()->IsScaleActive ();
bool active, running;
-
active = bamf_view_is_active (BAMF_VIEW (m_App));
running = bamf_view_is_running (BAMF_VIEW (m_App));
@@ -377,23 +372,21 @@ BamfLauncherIcon::OnMouseClick (int button)
}
else if (scaleWasActive)
{
- if (_launcher->GetLastSpreadIcon () != this)
+ if (!Spread ())
{
- if (!Spread ())
- {
- PluginAdapter::Default ()->TerminateScale ();
- Focus ();
- _launcher->SetLastSpreadIcon (NULL);
- }
+ PluginAdapter::Default ()->TerminateScale ();
+ Focus ();
+ _launcher->SetLastSpreadIcon (NULL);
}
- else
- SimpleLauncherIcon::OnMouseClick (button);
}
else if (!active)
+ {
Focus ();
+ }
else if (active && !scaleWasActive)
+ {
Spread ();
-
+ }
}
void
diff --git a/src/IconTexture.cpp b/src/IconTexture.cpp
index e8b1d4efc..1293278bf 100644
--- a/src/IconTexture.cpp
+++ b/src/IconTexture.cpp
@@ -30,9 +30,14 @@
#define DEFAULT_ICON "application-default-icon"
IconTexture::IconTexture (const char *icon_name, unsigned int size)
-: TextureArea (NUX_TRACKER_LOCATION)
+: TextureArea (NUX_TRACKER_LOCATION),
+ _icon_name (NULL)
{
- _icon_name = g_strdup (icon_name);
+ if (_icon_name && strlen (_icon_name) > 3)
+ _icon_name = g_strdup ("folder");
+ else
+ _icon_name = g_strdup (icon_name);
+
_size = size;
Refresh ();
}
@@ -63,73 +68,110 @@ IconTexture::SetByFilePath (const char *file_path, unsigned int size)
void
IconTexture::Refresh ()
{
- char *file_path = NULL;
+ char *file_path = NULL;
GError *error = NULL;
+ GIcon *icon;
- if (g_file_test (_icon_name, G_FILE_TEST_EXISTS))
- {
- // we have a file path
- file_path = _icon_name;
- }
- else
+ icon = g_icon_new_for_string (_icon_name, &error);
+
+ if (G_IS_ICON (icon))
+ {
+ if (G_IS_THEMED_ICON (icon))
{
- GtkIconTheme *theme;
GtkIconInfo *info;
- theme = gtk_icon_theme_get_default ();
+ info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
+ icon,
+ _size,
+ (GtkIconLookupFlags)0);
+ if (info)
+ {
+ file_path = g_strdup (gtk_icon_info_get_filename (info));
- if (!_icon_name)
- _icon_name = g_strdup (DEFAULT_ICON);
- info = gtk_icon_theme_lookup_icon (theme,
- _icon_name,
- _size,
- (GtkIconLookupFlags) 0);
- if (!info || gtk_icon_info_get_filename (info) == NULL)
+ gtk_icon_info_free (info);
+ }
+ else
{
- g_warning ("Could not find icon %s: using default icon", _icon_name);
- info = gtk_icon_theme_lookup_icon (theme,
- DEFAULT_ICON,
- _size,
- (GtkIconLookupFlags) 0);
+ g_warning ("Cannot find themed icon %s", _icon_name);
+ return;
}
-
- file_path = g_strdup (gtk_icon_info_get_filename (info));
}
-
- _pixbuf = gdk_pixbuf_new_from_file_at_size (file_path, _size, _size, &error);
-
- if (error == NULL)
+ else if (G_IS_FILE_ICON (icon))
{
- nux::BaseTexture *texture2D = nux::CreateTextureFromPixbuf (_pixbuf);
- nux::TexCoordXForm texxform;
- texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_SCALE_COORD);
- texxform.SetWrap (nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
-
- nux::ROPConfig rop;
- rop.Blend = true; // Enable the blending. By default rop.Blend is false.
- rop.SrcBlend = GL_SRC_ALPHA; // Set the source blend factor.
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; // Set the destination blend factor.
- nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
- texxform, // The Oject that defines the texture wraping and coordinate transformation.
- nux::Color::White, // The color used to modulate the texture.
- true, // Write the alpha value of the texture to the destination buffer.
- rop // Use the given raster operation to set the blending when the layer is being rendered.
- );
-
- SetPaintLayer(texture_layer);
-
- //SetTexture (nux::CreateTextureFromPixbuf (_pixbuf));
- texture2D->UnReference ();
- g_object_unref (_pixbuf);
+ file_path = g_file_get_path (g_file_icon_get_file (G_FILE_ICON (icon)));
}
else
{
- g_warning ("Unable to load '%s' from icon theme: %s",
- _icon_name,
- error ? error->message : "unknown");
+ g_warning ("Unsupported GIcon: %s", _icon_name);
+ return;
+ }
+
+ g_object_unref (icon);
+ }
+ else if (g_file_test (_icon_name, G_FILE_TEST_EXISTS))
+ {
+ file_path = g_strdup (_icon_name);
+ }
+ else
+ {
+ if (error)
g_error_free (error);
+ error = NULL;
+
+ GtkIconTheme *theme;
+ GtkIconInfo *info;
+
+ theme = gtk_icon_theme_get_default ();
+
+ if (!_icon_name)
+ _icon_name = g_strdup (DEFAULT_ICON);
+ info = gtk_icon_theme_lookup_icon (theme,
+ _icon_name,
+ _size,
+ (GtkIconLookupFlags) 0);
+ if (!info || gtk_icon_info_get_filename (info) == NULL)
+ {
+ g_message ("Could not find icon %s: using default icon", _icon_name);
+ info = gtk_icon_theme_lookup_icon (theme,
+ DEFAULT_ICON,
+ _size,
+ (GtkIconLookupFlags) 0);
}
+ file_path = g_strdup (gtk_icon_info_get_filename (info));
+ }
+
+ _pixbuf = gdk_pixbuf_new_from_file_at_size (file_path, _size, _size, &error);
+
+ if (error == NULL)
+ {
+ nux::BaseTexture *texture2D = nux::CreateTextureFromPixbuf (_pixbuf);
+ nux::TexCoordXForm texxform;
+ texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_SCALE_COORD);
+ texxform.SetWrap (nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
+
+ nux::ROPConfig rop;
+ rop.Blend = true;
+ rop.SrcBlend = GL_SRC_ALPHA;
+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
+ nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
+ texxform,
+ nux::Color::White,
+ true,
+ rop);
+
+ SetPaintLayer(texture_layer);
+ texture2D->UnReference ();
+ g_object_unref (_pixbuf);
+ }
+ else
+ {
+ g_warning ("Unable to load '%s' from icon theme: %s",
+ _icon_name,
+ error ? error->message : "unknown");
+ g_error_free (error);
+ }
+
SetMinMaxSize (_size, _size);
NeedRedraw ();
diff --git a/src/Launcher.cpp b/src/Launcher.cpp
index 165c1d517..a5aceeb8c 100644
--- a/src/Launcher.cpp
+++ b/src/Launcher.cpp
@@ -270,6 +270,7 @@ Launcher::Launcher(nux::BaseWindow *parent, CompScreen *screen, NUX_FILE_LINE_DE
_dnd_delta_y = 0;
_dnd_delta_x = 0;
_autohide_handle = 0;
+ _autoscroll_handle = 0;
_floating = false;
_hovered = false;
_autohide = false;
@@ -281,6 +282,7 @@ Launcher::Launcher(nux::BaseWindow *parent, CompScreen *screen, NUX_FILE_LINE_DE
_window_over_launcher = false;
_render_drag_window = false;
_backlight_always_on = false;
+ _last_button_press = 0;
// 0 out timers to avoid wonky startups
@@ -348,6 +350,8 @@ void Launcher::SetMousePosition (int x, int y)
if (beyond_drag_threshold != MouseBeyondDragThreshold ())
SetTimeStruct (&_drag_threshold_time, &_drag_threshold_time, ANIM_DURATION_SHORT);
+
+ EnsureScrollTimer ();
}
bool Launcher::MouseBeyondDragThreshold ()
@@ -1031,7 +1035,8 @@ Launcher::EnsureHiddenState ()
_launcher_action_state == ACTION_NONE &&
!QuicklistManager::Default ()->Current() &&
!_autohide_handle &&
- _window_over_launcher)
+ _window_over_launcher &&
+ !PluginAdapter::Default ()->IsScaleActive ())
SetHidden (true);
else
SetHidden (false);
@@ -1075,7 +1080,11 @@ Launcher::OnWindowMaybeIntellihide (guint32 xid)
void Launcher::OnTriggerMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags)
{
_mouse_inside_trigger = true;
+ _trigger_mouse_position = nux::Point2 (x, y);
+
EnsureHiddenState ();
+ EnsureHoverState ();
+ EnsureScrollTimer ();
}
void Launcher::SetupAutohideTimer ()
@@ -1092,54 +1101,67 @@ void Launcher::OnTriggerMouseLeave (int x, int y, unsigned long button_flags, un
{
_mouse_inside_trigger = false;
SetupAutohideTimer ();
+ EnsureHoverState ();
+ EnsureScrollTimer ();
+}
+
+void Launcher::OnTriggerMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
+{
+ _trigger_mouse_position = nux::Point2 (x, y);
}
bool Launcher::AutohideEnabled ()
{
- return _autohide;
+ return _autohide;
}
/* End Launcher Show/Hide logic */
+// Hacks around compiz failing to see the struts because the window was just mapped.
gboolean Launcher::StrutHack (gpointer data)
{
- Launcher *self = (Launcher *) data;
- self->_parent->InputWindowEnableStruts(false);
- self->_parent->InputWindowEnableStruts(true);
+ Launcher *self = (Launcher *) data;
+ self->_parent->InputWindowEnableStruts(false);
+ self->_parent->InputWindowEnableStruts(true);
- return false;
+ return false;
}
-void Launcher::SetAutohide (bool autohide, nux::View *trigger)
+void Launcher::SetAutohideTrigger (nux::View *trigger)
{
- if (_autohide == autohide)
- return;
+ _autohide_trigger = trigger;
+ _autohide_trigger->OnMouseEnter.connect (sigc::mem_fun(this, &Launcher::OnTriggerMouseEnter));
+ _autohide_trigger->OnMouseLeave.connect (sigc::mem_fun(this, &Launcher::OnTriggerMouseLeave));
+ _autohide_trigger->OnMouseMove.connect (sigc::mem_fun(this, &Launcher::OnTriggerMouseMove));
+}
- if (autohide)
- {
- _parent->InputWindowEnableStruts(false);
- _autohide_trigger = trigger;
- _autohide_trigger->OnMouseEnter.connect (sigc::mem_fun(this, &Launcher::OnTriggerMouseEnter));
- _autohide_trigger->OnMouseLeave.connect (sigc::mem_fun(this, &Launcher::OnTriggerMouseLeave));
- }
- else
- {
- _parent->EnableInputWindow(true);
- g_timeout_add (1000, &Launcher::StrutHack, this);
- _parent->InputWindowEnableStruts(true);
- }
+void Launcher::SetAutohide (bool autohide)
+{
+ if (_autohide == autohide)
+ return;
- _autohide = autohide;
- EnsureAnimation ();
+ if (autohide)
+ {
+ _parent->InputWindowEnableStruts(false);
+ }
+ else
+ {
+ _parent->EnableInputWindow(true);
+ g_timeout_add (1000, &Launcher::StrutHack, this);
+ _parent->InputWindowEnableStruts(true);
+ }
+
+ _autohide = autohide;
+ EnsureAnimation ();
}
void Launcher::SetFloating (bool floating)
{
- if (_floating == floating)
- return;
+ if (_floating == floating)
+ return;
- _floating = floating;
- EnsureAnimation ();
+ _floating = floating;
+ EnsureAnimation ();
}
void Launcher::SetBacklightAlwaysOn (bool always_on)
@@ -1189,7 +1211,8 @@ Launcher::GetUrgentAnimation ()
void
Launcher::EnsureHoverState ()
{
- if (_mouse_inside_launcher || QuicklistManager::Default ()->Current() || _launcher_action_state != ACTION_NONE)
+ if (_mouse_inside_launcher || _mouse_inside_trigger ||
+ QuicklistManager::Default ()->Current() || _launcher_action_state != ACTION_NONE)
{
SetHover ();
}
@@ -1201,23 +1224,95 @@ Launcher::EnsureHoverState ()
void Launcher::SetHover ()
{
- if (_hovered)
- return;
+ if (_hovered)
+ return;
- _enter_y = (int) _mouse_position.y;
+ _enter_y = (int) _mouse_position.y;
- _hovered = true;
- SetTimeStruct (&_enter_time, &_exit_time, ANIM_DURATION);
+ _hovered = true;
+ SetTimeStruct (&_enter_time, &_exit_time, ANIM_DURATION);
+ EnsureAnimation ();
}
void Launcher::UnsetHover ()
{
- if (!_hovered)
- return;
+ if (!_hovered)
+ return;
- _hovered = false;
- SetTimeStruct (&_exit_time, &_enter_time, ANIM_DURATION);
- SetupAutohideTimer ();
+ _hovered = false;
+ SetTimeStruct (&_exit_time, &_enter_time, ANIM_DURATION);
+ SetupAutohideTimer ();
+ EnsureAnimation ();
+}
+
+bool Launcher::MouseOverTopScrollArea ()
+{
+ if (_launcher_action_state == ACTION_NONE)
+ return _mouse_inside_trigger;
+
+ return _mouse_position.y < 0;
+}
+
+bool Launcher::MouseOverTopScrollExtrema ()
+{
+ // since we are not dragging the trigger will pick up events
+ if (_launcher_action_state == ACTION_NONE)
+ return _trigger_mouse_position.y == 0;
+
+ return _mouse_position.y == 0 - _parent->GetGeometry ().y;
+}
+
+bool Launcher::MouseOverBottomScrollArea ()
+{
+ return _mouse_position.y > GetGeometry ().height - 24;
+}
+
+bool Launcher::MouseOverBottomScrollExtrema ()
+{
+ return _mouse_position.y == GetGeometry ().height - 1;
+}
+
+gboolean Launcher::OnScrollTimeout (gpointer data)
+{
+ Launcher *self = (Launcher*) data;
+ nux::Geometry geo = self->GetGeometry ();
+
+ if (!self->_hovered || self->_launcher_action_state != ACTION_DRAG_ICON)
+ return TRUE;
+
+ if (self->MouseOverTopScrollArea ())
+ {
+ if (self->MouseOverTopScrollExtrema ())
+ self->_launcher_drag_delta += 6;
+ else
+ self->_launcher_drag_delta += 3;
+ }
+ else if (self->MouseOverBottomScrollArea ())
+ {
+ if (self->MouseOverBottomScrollExtrema ())
+ self->_launcher_drag_delta -= 6;
+ else
+ self->_launcher_drag_delta -= 3;
+ }
+
+ self->EnsureAnimation ();
+
+ return TRUE;
+}
+
+void Launcher::EnsureScrollTimer ()
+{
+ bool needed = MouseOverTopScrollArea () || MouseOverBottomScrollArea ();
+
+ if (needed && !_autoscroll_handle)
+ {
+ _autoscroll_handle = g_timeout_add (15, &Launcher::OnScrollTimeout, this);
+ }
+ else if (!needed && _autoscroll_handle)
+ {
+ g_source_remove (_autoscroll_handle);
+ _autoscroll_handle = 0;
+ }
}
void Launcher::SetIconSize(int tile_size, int icon_size)
@@ -1825,6 +1920,7 @@ void Launcher::UpdateDragWindowPosition (int x, int y)
void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
+ _last_button_press = nux::GetEventButton (button_flags);
SetMousePosition (x, y);
MouseDownLogic (x, y, button_flags, key_flags);
@@ -1850,6 +1946,7 @@ void Launcher::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned lo
_launcher_action_state = ACTION_NONE;
_dnd_delta_x = 0;
_dnd_delta_y = 0;
+ _last_button_press = 0;
EnsureHoverState ();
EnsureAnimation ();
}
@@ -1886,7 +1983,9 @@ void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_
{
LauncherIcon *drag_icon = MouseIconIntersection ((int) (GetGeometry ().x / 2.0f), y);
- if (drag_icon)
+ // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
+ // on an internal Launcher property then
+ if (drag_icon && (_last_button_press == 1) && _model->IconHasSister (drag_icon))
{
StartIconDrag (drag_icon);
_launcher_action_state = ACTION_DRAG_ICON;
diff --git a/src/Launcher.h b/src/Launcher.h
index 12f3a64f6..3e0c337a4 100644
--- a/src/Launcher.h
+++ b/src/Launcher.h
@@ -81,7 +81,8 @@ public:
void SetFloating (bool floating);
- void SetAutohide (bool autohide, nux::View *show_trigger);
+ void SetAutohideTrigger (nux::View *trigger);
+ void SetAutohide (bool autohide);
bool AutohideEnabled ();
void StartKeyShowLauncher ();
@@ -163,6 +164,7 @@ private:
void OnDragWindowAnimCompleted ();
void OnTriggerMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags);
void OnTriggerMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags);
+ void OnTriggerMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
bool IconNeedsAnimation (LauncherIcon *icon, struct timespec const &current);
bool AnimationInProgress ();
@@ -170,7 +172,16 @@ private:
void EnsureHoverState ();
void EnsureHiddenState ();
void EnsureAnimation ();
+ void EnsureScrollTimer ();
void SetupAutohideTimer ();
+
+ bool MouseOverTopScrollArea ();
+ bool MouseOverTopScrollExtrema ();
+
+ bool MouseOverBottomScrollArea ();
+ bool MouseOverBottomScrollExtrema ();
+
+ static gboolean OnScrollTimeout (gpointer data);
void CheckWindowOverLauncher ();
@@ -304,6 +315,7 @@ private:
int _launcher_drag_delta;
int _dnd_security;
int _enter_y;
+ int _last_button_press;
nux::BaseTexture* _icon_bkg_texture;
nux::BaseTexture* _icon_shine_texture;
@@ -323,10 +335,12 @@ private:
nux::IntrusiveSP<nux::IOpenGLBaseTexture> _offscreen_progress_texture;
guint _autohide_handle;
+ guint _autoscroll_handle;
nux::Matrix4 _view_matrix;
nux::Matrix4 _projection_matrix;
nux::Point2 _mouse_position;
+ nux::Point2 _trigger_mouse_position;
nux::IntrusiveSP<nux::IOpenGLShaderProgram> _shader_program_uv_persp_correction;
nux::IntrusiveSP<nux::IOpenGLAsmShaderProgram> _AsmShaderProg;
nux::AbstractPaintLayer* m_BackgroundLayer;
diff --git a/src/LauncherModel.cpp b/src/LauncherModel.cpp
index 834a6e12e..6bb7676d9 100644
--- a/src/LauncherModel.cpp
+++ b/src/LauncherModel.cpp
@@ -119,6 +119,34 @@ LauncherModel::Sort (SortFunc func)
order_changed.emit ();
}
+bool
+LauncherModel::IconHasSister (LauncherIcon *icon)
+{
+ iterator (LauncherModel::*begin_it)(void);
+ iterator (LauncherModel::*end_it)(void);
+ iterator it;
+
+ if (IconShouldShelf (icon))
+ {
+ begin_it = &LauncherModel::shelf_begin;
+ end_it = &LauncherModel::shelf_end;
+ }
+ else
+ {
+ begin_it = &LauncherModel::main_begin;
+ end_it = &LauncherModel::main_end;
+ }
+
+ for (it = (this->*begin_it) (); it != (this->*end_it) (); it++)
+ {
+ if ((*it != icon)
+ && (*it)->Type () == icon->Type ())
+ return true;
+ }
+
+ return false;
+}
+
int
LauncherModel::Size ()
{
diff --git a/src/LauncherModel.h b/src/LauncherModel.h
index a63138e73..4a06b8c5e 100644
--- a/src/LauncherModel.h
+++ b/src/LauncherModel.h
@@ -43,6 +43,8 @@ public:
void OnIconRemove (LauncherIcon *icon);
+ bool IconHasSister (LauncherIcon *icon);
+
iterator begin ();
iterator end ();
reverse_iterator rbegin ();
diff --git a/src/PanelMenuView.cpp b/src/PanelMenuView.cpp
index 1e5637486..0cda090f5 100644
--- a/src/PanelMenuView.cpp
+++ b/src/PanelMenuView.cpp
@@ -623,21 +623,21 @@ PanelMenuView::OnActiveWindowChanged (BamfView *old_view,
void
PanelMenuView::OnSpreadInitiate (std::list <guint32> &windows)
{
- foreach (guint32 &xid, windows)
+ /*foreach (guint32 &xid, windows)
{
if (WindowManager::Default ()->IsWindowMaximized (xid))
WindowManager::Default ()->Decorate (xid);
- }
+ }*/
}
void
PanelMenuView::OnSpreadTerminate (std::list <guint32> &windows)
{
- foreach (guint32 &xid, windows)
+ /*foreach (guint32 &xid, windows)
{
if (WindowManager::Default ()->IsWindowMaximized (xid))
WindowManager::Default ()->Undecorate (xid);
- }
+ }*/
}
void
diff --git a/src/PlaceEntry.h b/src/PlaceEntry.h
index 5dfe74acf..5cec5f4e6 100644
--- a/src/PlaceEntry.h
+++ b/src/PlaceEntry.h
@@ -28,6 +28,24 @@
class PlaceEntry : public sigc::trackable
{
public:
+
+ enum
+ {
+ GROUP_RENDERER,
+ GROUP_NAME,
+ GROUP_ICON
+ };
+
+ enum
+ {
+ RESULT_URI,
+ RESULT_ICON,
+ RESULT_GROUP_ID,
+ RESULT_MIMETYPE,
+ RESULT_NAME,
+ RESULT_COMMENT
+ };
+
virtual const gchar * GetId () = 0;
virtual const gchar * GetName () = 0;
virtual const gchar * GetIcon () = 0;
@@ -68,6 +86,8 @@ public:
// Signals
+ sigc::signal<void, bool> active_changed;
+
// This covers: name, icon and description properties
sigc::signal<void> state_changed;
diff --git a/src/PlaceEntryRemote.cpp b/src/PlaceEntryRemote.cpp
index 43f034575..1c43df375 100644
--- a/src/PlaceEntryRemote.cpp
+++ b/src/PlaceEntryRemote.cpp
@@ -16,6 +16,8 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
+#include "config.h"
+
#include "PlaceEntryRemote.h"
#include <glib/gi18n-lib.h>
@@ -216,20 +218,27 @@ PlaceEntryRemote::SetActive (bool is_active)
NULL,
NULL);
_active = is_active;
+
+ active_changed.emit (is_active);
}
void
PlaceEntryRemote::SetSearch (const gchar *search, std::map<gchar*, gchar*>& hints)
{
+ GVariantBuilder *builder;
+
+ builder = g_variant_builder_new (G_VARIANT_TYPE ("a{ss}"));
+
/* FIXME: I'm ignoring hints because we don't use them currently */
g_dbus_proxy_call (_proxy,
"SetSearch",
- g_variant_new ("(sa{ss})", search, NULL),
+ g_variant_new ("(sa{ss})", search, builder),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
NULL,
NULL);
+ g_variant_builder_unref (builder);
}
void
@@ -237,7 +246,7 @@ PlaceEntryRemote::SetActiveSection (guint32 section_id)
{
g_dbus_proxy_call (_proxy,
"SetActiveSection",
- g_variant_new ("(u)", section_id),
+ g_variant_new ("(u)", (guint32)section_id),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
@@ -335,7 +344,7 @@ PlaceEntryRemote::Update (const gchar *dbus_path,
if (_state_changed)
state_changed.emit ();
-
+
if (_position != position)
{
_position = position;
@@ -362,7 +371,6 @@ PlaceEntryRemote::Update (const gchar *dbus_path,
sections_model_changed.emit ();
}
-
// FIXME: Handle place entry hints
// FIXME: Spec says if entry_renderer == "", then ShowInLauncher () == false, but currently
@@ -391,8 +399,6 @@ PlaceEntryRemote::Update (const gchar *dbus_path,
_entry_renderer_changed = true;
}
-
-
// FIXME: Handle entry renderer hints
diff --git a/src/PlaceFactoryFile.cpp b/src/PlaceFactoryFile.cpp
index fbd25d066..c4332127a 100644
--- a/src/PlaceFactoryFile.cpp
+++ b/src/PlaceFactoryFile.cpp
@@ -27,6 +27,10 @@ static void on_directory_enumeration_ready (GObject *source,
PlaceFactoryFile::PlaceFactoryFile (const char *directory)
{
+ //FIXME: This is a temporary Alpha 2 fix
+ g_spawn_command_line_async ("killall unity-files-daemon", NULL);
+ g_spawn_command_line_async ("killall unity-applications-daemon", NULL);
+
/* Use the default lookup location */
if (directory == NULL)
_directory = g_build_filename (DATADIR, "unity", "places", NULL);
diff --git a/src/PlaceLauncherIcon.cpp b/src/PlaceLauncherIcon.cpp
index 7c9dd8620..f9d798233 100644
--- a/src/PlaceLauncherIcon.cpp
+++ b/src/PlaceLauncherIcon.cpp
@@ -17,6 +17,8 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
+#include "config.h"
+
#include "PlaceLauncherIcon.h"
#include "ubus-server.h"
@@ -35,9 +37,12 @@ PlaceLauncherIcon::PlaceLauncherIcon (Launcher *launcher, PlaceEntry *entry)
SetTooltipText (escape);
SetIconName (entry->GetIcon ());
SetQuirk (QUIRK_VISIBLE, true);
- SetQuirk (QUIRK_RUNNING, false);
+ SetQuirk (QUIRK_RUNNING, true);
+ SetQuirk (QUIRK_ACTIVE, entry->IsActive ());
SetIconType (TYPE_PLACE);
+ entry->active_changed.connect (sigc::mem_fun (this, &PlaceLauncherIcon::OnActiveChanged));
+
g_free (escape);
}
@@ -111,3 +116,9 @@ PlaceLauncherIcon::OnOpen (DbusmenuMenuitem *item, int time, PlaceLauncherIcon *
{
self->Activate (0, "");
}
+
+void
+PlaceLauncherIcon::OnActiveChanged (bool is_active)
+{
+ SetQuirk (QUIRK_ACTIVE, is_active);
+}
diff --git a/src/PlaceLauncherIcon.h b/src/PlaceLauncherIcon.h
index f5f96ad50..1976e7413 100644
--- a/src/PlaceLauncherIcon.h
+++ b/src/PlaceLauncherIcon.h
@@ -42,6 +42,7 @@ protected:
private:
void Activate (guint section_id, const char *search_string);
+ void OnActiveChanged (bool is_active);
static void OnOpen (DbusmenuMenuitem *item, int time, PlaceLauncherIcon *self);
private:
diff --git a/src/PlacesController.cpp b/src/PlacesController.cpp
index 42988caee..1031360dd 100644
--- a/src/PlacesController.cpp
+++ b/src/PlacesController.cpp
@@ -63,6 +63,8 @@ PlacesController::PlacesController ()
_window_layout->SetHorizontalExternalMargin(0);
_window->SetLayout (_window_layout);
+
+ _view->entry_changed.connect (sigc::mem_fun (this, &PlacesController::OnActivePlaceEntryChanged));
}
PlacesController::~PlacesController ()
@@ -101,6 +103,8 @@ void PlacesController::Hide ()
_visible = false;
+ _view->SetActiveEntry (NULL, 0, "", false);
+
ubus_server_send_message (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN, NULL);
}
@@ -137,6 +141,13 @@ PlacesController::RecvMouseDownOutsideOfView (int x, int y, unsigned long butto
Hide ();
}
+void
+PlacesController::OnActivePlaceEntryChanged (PlaceEntry *entry)
+{
+ entry ? Show () : Hide ();
+}
+
+
/* Introspection */
const gchar *
PlacesController::GetName ()
diff --git a/src/PlacesController.h b/src/PlacesController.h
index ecc602dc9..9b550b2d3 100644
--- a/src/PlacesController.h
+++ b/src/PlacesController.h
@@ -51,6 +51,7 @@ protected:
nux::Geometry& geo, void *user_data);
void RecvMouseDownOutsideOfView (int x, int y, unsigned long button_flags, unsigned long key_flags);
+ void OnActivePlaceEntryChanged (PlaceEntry *entry);
private:
nux::BaseWindow *_window;
diff --git a/src/PlacesGroup.cpp b/src/PlacesGroup.cpp
index 76db84ade..bf85d89c3 100644
--- a/src/PlacesGroup.cpp
+++ b/src/PlacesGroup.cpp
@@ -71,7 +71,9 @@ View (NUX_FILE_LINE_PARAM)
_header_layout->AddView (_title, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
_header_layout->AddSpace (1, 1);
- _header_layout->AddView (_label, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
+
+ // FIXME: We don't want to show this as it does nothing right now
+ // _header_layout->AddView (_label, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
_group_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
_group_layout->SinkReference ();
@@ -189,11 +191,28 @@ PlacesGroup::UpdateLabel ()
NeedRedraw ();
}
+void
+PlacesGroup::SetVisible (bool visible)
+{
+ _is_visible = visible;
+ ComputeChildLayout ();
+ NeedRedraw ();
+}
+
+bool
+PlacesGroup::IsVisible ()
+{
+ return _is_visible;
+}
+
long PlacesGroup::ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
{
long ret = TraverseInfo;
- ret = PostProcessEvent2 (ievent, ret, ProcessEventInfo);
+
+ if (_group_layout)
+ ret = _group_layout->ProcessEvent (ievent, TraverseInfo, ProcessEventInfo);
+
return ret;
}
diff --git a/src/PlacesGroup.h b/src/PlacesGroup.h
index c1481eaab..c4afaa494 100644
--- a/src/PlacesGroup.h
+++ b/src/PlacesGroup.h
@@ -52,6 +52,9 @@ public:
void SetItemDetail (unsigned int total_items, unsigned int visible_items);
void SetExpanded (bool expanded);
+ void SetVisible (bool visible);
+ bool IsVisible ();
+
protected:
nux::StaticCairoText *_label;
nux::StaticCairoText *_title;
@@ -61,6 +64,8 @@ protected:
unsigned int _total_items;
unsigned int _visible_items;
+ bool _is_visible;
+
nux::Layout *_content;
nux::VLayout *_group_layout;
nux::HLayout *_header_layout;
diff --git a/src/PlacesResultsController.cpp b/src/PlacesResultsController.cpp
index af54a5571..e30678a87 100644
--- a/src/PlacesResultsController.cpp
+++ b/src/PlacesResultsController.cpp
@@ -63,73 +63,90 @@ PlacesResultsController::AddResultToGroup (const char *groupname,
PlacesTile *tile,
const char *_id)
{
- std::string *group_name = new std::string (groupname);
- std::string *id = new std::string (_id);
+ PlacesGroup *group = _groups[groupname];
- PlacesGroup *group = NULL;
-
- if (_groups.find (*group_name) == _groups.end ())
+ if (!group)
{
group = CreateGroup (groupname);
}
- else
- {
- group = _groups[*group_name];
- }
group->GetLayout ()->AddView (tile, 1, nux::eLeft, nux::eFull);
- _tiles[*id] = tile;
- _tile_group_relations[*id] = *(new std::string (groupname));
+ _tiles[_id] = tile;
+ _tile_group_relations[_id] = groupname;
// Should also catch the onclick signal here on each tile,
// so we can activate or do whatever it is we need to do
- delete group_name;
- delete id;
+ if (group->IsVisible () == false)
+ {
+ group->SetVisible (true);
+ _results_view->ReJiggyGroups ();
+ }
}
void
PlacesResultsController::RemoveResultFromGroup (const char *groupname,
const char *_id)
{
- std::string *group_name = new std::string (groupname);
- std::string *id = new std::string (_id);
-
- PlacesTile *tile = _tiles[*id];
- PlacesGroup *group = _groups[*group_name];
+ PlacesTile *tile = _tiles[_id];
+ PlacesGroup *group = _groups[groupname];
- group->GetLayout ()->RemoveChildObject (tile);
+ if (group)
+ {
+ if (tile)
+ {
+ group->GetLayout ()->RemoveChildObject (tile);
- if (group->GetLayout ()->GetChildren ().empty ())
+ if (group->GetLayout ()->GetChildren ().empty ())
+ {
+ group->SetVisible (false);
+ _results_view->ReJiggyGroups ();
+ }
+ }
+ else
+ {
+ g_warning ("Unable to remove '%s' from group '%s': Unable to find tile",
+ _id, groupname);
+ }
+ }
+ else
{
- _results_view->RemoveGroup (group);
- _groups.erase (*group_name);
- group->UnReference ();
+ g_warning ("Unable to remove '%s' from group '%s': Unable to find group",
+ _id, groupname);
}
- _tiles.erase (*id);
-
- _tile_group_relations.erase (*id);
-
- delete group_name;
- delete id;
+ _tiles.erase (_id);
+ _tile_group_relations.erase (_id);
}
void
PlacesResultsController::RemoveResult (const char *_id)
{
- std::string *id = new std::string (_id);
- RemoveResultFromGroup (_tile_group_relations [*id].c_str (), _id);
- delete id;
+ RemoveResultFromGroup (_tile_group_relations [_id].c_str (), _id);
}
+void
+PlacesResultsController::Clear ()
+{
+ std::map<std::string, PlacesGroup *>::iterator it;
+
+ for (it = _groups.begin (); it != _groups.end (); ++it)
+ {
+ PlacesGroup *group = static_cast <PlacesGroup *> (it->second);
+ _results_view->RemoveGroup (group);
+ group->UnReference ();
+ }
+
+ _groups.erase (_groups.begin (), _groups.end ());
+ _tiles.erase (_tiles.begin (), _tiles.end ());
+ _tile_group_relations.erase (_tile_group_relations.begin (), _tile_group_relations.end ());
+}
PlacesGroup *
PlacesResultsController::CreateGroup (const char *groupname)
{
- g_debug ("making a group for %s", groupname);
- std::string *group_name = new std::string (groupname);
+ g_debug ("CreateGroup: %s", groupname);
PlacesGroup *newgroup = new PlacesGroup (NUX_TRACKER_LOCATION);
newgroup->SinkReference ();
@@ -149,11 +166,11 @@ PlacesResultsController::CreateGroup (const char *groupname)
layout->SetHorizontalInternalMargin (4);
newgroup->SetLayout (layout);
+ newgroup->SetVisible (false);
- _groups[*group_name] = newgroup;
+ _groups[groupname] = newgroup;
_results_view->AddGroup (newgroup);
-
- delete group_name;
+ _results_view->ReJiggyGroups ();
return newgroup;
}
diff --git a/src/PlacesResultsController.h b/src/PlacesResultsController.h
index 3b297765e..5c691653d 100644
--- a/src/PlacesResultsController.h
+++ b/src/PlacesResultsController.h
@@ -45,9 +45,9 @@ public:
void RemoveResult (const char *id);
void RemoveResultFromGroup (const char *groupname,
const char *_id);
-
-protected:
+ void Clear ();
PlacesGroup *CreateGroup (const char *groupname);
+protected:
const gchar* GetName ();
void AddProperties (GVariantBuilder *builder);
diff --git a/src/PlacesResultsView.cpp b/src/PlacesResultsView.cpp
index 6aaef6c54..40ff21829 100644
--- a/src/PlacesResultsView.cpp
+++ b/src/PlacesResultsView.cpp
@@ -33,9 +33,9 @@ PlacesResultsView::PlacesResultsView (NUX_FILE_LINE_DECL)
m_vertical_scrollbar_enable = true;
_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
_layout->SinkReference ();
-
+
_layout->SetContentDistribution(nux::MAJOR_POSITION_TOP);
-
+
setBorder (12);
EnableVerticalScrollBar (true);
@@ -44,11 +44,32 @@ PlacesResultsView::PlacesResultsView (NUX_FILE_LINE_DECL)
PlacesResultsView::~PlacesResultsView ()
{
+ std::list<PlacesGroup *>::iterator it;
+ for (it = _groups.begin(); it != _groups.end(); it++)
+ {
+ (*it)->UnReference ();
+ }
+
_layout->Clear ();
_layout->UnReference ();
}
void
+PlacesResultsView::ReJiggyGroups ()
+{
+ _layout->Clear ();
+ std::list<PlacesGroup *>::iterator it;
+
+ for (it = _groups.begin(); it != _groups.end(); it++)
+ {
+ if ((*it)->IsVisible ())
+ {
+ _layout->AddView ((*it), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
+ }
+ }
+}
+
+void
PlacesResultsView::Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
{
GfxContext.PushClippingRectangle (GetGeometry() );
@@ -95,6 +116,8 @@ PlacesResultsView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw
void
PlacesResultsView::AddGroup (PlacesGroup *group)
{
+ group->Reference ();
+ _groups.push_back (group);
_layout->AddView (group, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
ComputeChildLayout ();
}
@@ -102,6 +125,8 @@ PlacesResultsView::AddGroup (PlacesGroup *group)
void
PlacesResultsView::RemoveGroup (PlacesGroup *group)
{
+ group->UnReference ();
+ _groups.remove (group);
_layout->RemoveChildObject (group);
ComputeChildLayout ();
}
diff --git a/src/PlacesResultsView.h b/src/PlacesResultsView.h
index 1f22f7c83..57ee25a46 100644
--- a/src/PlacesResultsView.h
+++ b/src/PlacesResultsView.h
@@ -49,6 +49,9 @@ public:
void AddGroup (PlacesGroup *group);
void RemoveGroup (PlacesGroup *group);
+ /* I am going to remove this API, its just temporary till nux is fixed */
+ void ReJiggyGroups ();
+
protected:
virtual void ScrollLeft (float stepx, int mousedx);
virtual void ScrollRight (float stepx, int mousedx);
@@ -57,6 +60,7 @@ protected:
private:
nux::Layout *_layout;
+ std::list<PlacesGroup *> _groups;
protected:
diff --git a/src/PlacesSearchBar.cpp b/src/PlacesSearchBar.cpp
index e9c52c443..9f810ceb2 100644
--- a/src/PlacesSearchBar.cpp
+++ b/src/PlacesSearchBar.cpp
@@ -17,6 +17,8 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
+#include "config.h"
+
#include <Nux/Nux.h>
#include <Nux/BaseWindow.h>
#include <Nux/HLayout.h>
@@ -34,10 +36,14 @@
#include "PlacesSearchBar.h"
+#define LIVE_SEARCH_TIMEOUT 250
+
NUX_IMPLEMENT_OBJECT_TYPE (PlacesSearchBar);
PlacesSearchBar::PlacesSearchBar (NUX_FILE_LINE_DECL)
-: View (NUX_FILE_LINE_PARAM)
+: View (NUX_FILE_LINE_PARAM),
+ _entry (NULL),
+ _live_search_timeout (0)
{
_bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);
@@ -45,8 +51,8 @@ PlacesSearchBar::PlacesSearchBar (NUX_FILE_LINE_DECL)
_pango_entry = new nux::TextEntry (_("Search"), NUX_TRACKER_LOCATION);
_pango_entry->SetMinimumWidth (200);
- // _entry->SetMinimumHeight (30);
- //_entry->SetTextBackgroundColor (nux::Color (0xFF000000));
+ _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));
+
_layout->AddView (_pango_entry, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
_layout->SetVerticalExternalMargin (14);
@@ -127,11 +133,65 @@ PlacesSearchBar::PreLayoutManagement ()
long
PlacesSearchBar::PostLayoutManagement (long LayoutResult)
{
- // I'm imagining this is a good as time as any to update the background
-
return nux::View::PostLayoutManagement (LayoutResult);
}
+void
+PlacesSearchBar::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string)
+{
+ std::map<gchar *, gchar *> hints;
+
+ _entry = entry;
+
+ if (_entry)
+ {
+ // i18n: This is for a dynamic place name i.e. "Search Files & Folders"
+ const gchar *search_template = _("Search %s");
+ gchar *res;
+
+ res = g_strdup_printf (search_template, _entry->GetName ());
+
+ _entry->SetActiveSection (section_id);
+ _entry->SetSearch (search_string ? search_string : "", hints);
+ g_free (res);
+ }
+ else
+ {
+ _pango_entry->SetText (_("Search"));
+ }
+}
+
+void
+PlacesSearchBar::OnSearchChanged (nux::TextEntry *text_entry)
+{
+ if (_live_search_timeout)
+ g_source_remove (_live_search_timeout);
+
+ _live_search_timeout = g_timeout_add (LIVE_SEARCH_TIMEOUT,
+ (GSourceFunc)&OnLiveSearchTimeout,
+ this);
+}
+
+bool
+PlacesSearchBar::OnLiveSearchTimeout (PlacesSearchBar *self)
+{
+ self->EmitLiveSearch ();
+
+ return FALSE;
+}
+
+void
+PlacesSearchBar::EmitLiveSearch ()
+{
+ if (_entry)
+ {
+ std::map<gchar *, gchar *> hints;
+
+ _entry->SetSearch (_pango_entry->GetText ().c_str (), hints);
+ }
+ _live_search_timeout = 0;
+}
+
static void
draw_rounded_rect (cairo_t* cr,
double aspect,
diff --git a/src/PlacesSearchBar.h b/src/PlacesSearchBar.h
index c90958407..fb3680ca1 100644
--- a/src/PlacesSearchBar.h
+++ b/src/PlacesSearchBar.h
@@ -29,6 +29,8 @@
#include "Nux/EditTextBox.h"
#include "Nux/TextEntry.h"
+#include "PlaceEntry.h"
+
class PlacesSearchBar : public Introspectable, public nux::View
{
NUX_DECLARE_OBJECT_TYPE (PlacesSearchBar, nux::View);
@@ -42,6 +44,8 @@ public:
virtual void PreLayoutManagement ();
virtual long PostLayoutManagement (long LayoutResult);
+
+ void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string);
protected:
// Introspectable methods
@@ -51,14 +55,19 @@ protected:
private:
void UpdateBackground ();
+ void OnSearchChanged (nux::TextEntry *text_entry);
+ void EmitLiveSearch ();
+
+ static bool OnLiveSearchTimeout (PlacesSearchBar *self);
private:
nux::AbstractPaintLayer *_bg_layer;
nux::HLayout *_layout;
- nux::EditTextBox *_entry;
- nux::TextEntry *_pango_entry;
+ nux::TextEntry *_pango_entry;
int _last_width;
int _last_height;
+ PlaceEntry *_entry;
+ guint _live_search_timeout;
};
#endif
diff --git a/src/PlacesSimpleTile.cpp b/src/PlacesSimpleTile.cpp
index 8f1671e03..7eae87ea3 100644
--- a/src/PlacesSimpleTile.cpp
+++ b/src/PlacesSimpleTile.cpp
@@ -24,8 +24,11 @@
#include "IconTexture.h"
-PlacesSimpleTile::PlacesSimpleTile (const char *icon_name, const char *label, int icon_size) :
-PlacesTile (NUX_TRACKER_LOCATION)
+PlacesSimpleTile::PlacesSimpleTile (const char *icon_name, const char *label, int icon_size)
+: PlacesTile (NUX_TRACKER_LOCATION),
+ _label (NULL),
+ _icon (NULL),
+ _uri (NULL)
{
_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
SetCompositionLayout (_layout);
@@ -66,8 +69,9 @@ PlacesSimpleTile::~PlacesSimpleTile ()
_icontex->UnReference ();
_cairotext->UnReference ();
- g_free ((void *)_label);
- g_free ((void *)_icon);
+ g_free (_label);
+ g_free (_icon);
+ g_free (_uri);
}
const char *
@@ -82,6 +86,24 @@ PlacesSimpleTile::GetIcon ()
return _icon;
}
+const char *
+PlacesSimpleTile::GetURI ()
+{
+ return _uri;
+}
+
+void
+PlacesSimpleTile::SetURI (const char *uri)
+{
+ if (_uri)
+ g_free (_uri);
+
+ _uri = NULL;
+
+ if (uri)
+ _uri = g_strdup (uri);
+}
+
const gchar*
PlacesSimpleTile::GetName ()
{
diff --git a/src/PlacesSimpleTile.h b/src/PlacesSimpleTile.h
index cefe0adb2..5141a1a95 100644
--- a/src/PlacesSimpleTile.h
+++ b/src/PlacesSimpleTile.h
@@ -51,8 +51,11 @@ public:
PlacesSimpleTile (const char *icon, const char *label, int icon_size=64);
~PlacesSimpleTile ();
- const char * GetLabel ();
- const char * GetIcon ();
+ const char * GetLabel ();
+ const char * GetIcon ();
+ const char * GetURI ();
+
+ void SetURI (const char *uri);
protected:
const gchar* GetName ();
@@ -60,8 +63,9 @@ protected:
void AddProperties (GVariantBuilder *builder);
private:
- const char* _label;
- const char* _icon;
+ char* _label;
+ char* _icon;
+ char* _uri;
IconTexture *_icontex;
nux::StaticCairoText *_cairotext;
diff --git a/src/PlacesView.cpp b/src/PlacesView.cpp
index cd3311071..24cbc4e6e 100644
--- a/src/PlacesView.cpp
+++ b/src/PlacesView.cpp
@@ -22,6 +22,9 @@
#include "NuxGraphics/GLThread.h"
#include "UBusMessages.h"
+#include <gtk/gtk.h>
+#include <gio/gdesktopappinfo.h>
+
#include "ubus-server.h"
#include "UBusMessages.h"
@@ -34,7 +37,8 @@ static void place_entry_activate_request (GVariant *payload, PlacesView *self);
NUX_IMPLEMENT_OBJECT_TYPE (PlacesView);
PlacesView::PlacesView (NUX_FILE_LINE_DECL)
-: nux::View (NUX_TRACKER_LOCATION)
+: nux::View (NUX_TRACKER_LOCATION),
+ _entry (NULL)
{
_layout = new nux::VLayout (NUX_TRACKER_LOCATION);
@@ -43,9 +47,14 @@ PlacesView::PlacesView (NUX_FILE_LINE_DECL)
AddChild (_search_bar);
_home_view = new PlacesHomeView ();
- _layout->AddView (_home_view, 1, nux::eCenter, nux::eFull);
+ //_layout->AddView (_home_view, 1, nux::eCenter, nux::eFull);
AddChild (_home_view);
+ _results_controller = new PlacesResultsController ();
+ _results_view = new PlacesResultsView ();
+ _results_controller->SetView (_results_view);
+ _layout->AddView (_results_view, 1, nux::eCenter, nux::eFull);
+
SetCompositionLayout (_layout);
// Register for all the events
@@ -53,6 +62,9 @@ PlacesView::PlacesView (NUX_FILE_LINE_DECL)
ubus_server_register_interest (ubus, UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
(UBusCallback)place_entry_activate_request,
this);
+ ubus_server_register_interest (ubus, UBUS_PLACE_VIEW_CLOSE_REQUEST,
+ (UBusCallback)&PlacesView::CloseRequest,
+ this);
}
PlacesView::~PlacesView ()
@@ -87,9 +99,201 @@ PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
// PlacesView Methods
//
void
-PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string)
+PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
+{
+ if (_entry)
+ {
+ _entry->SetActive (false);
+ g_signal_handler_disconnect (_entry->GetGroupsModel (), _group_added_id);
+ g_signal_handler_disconnect (_entry->GetGroupsModel (), _group_removed_id);
+ g_signal_handler_disconnect (_entry->GetResultsModel (), _result_added_id);
+ g_signal_handler_disconnect (_entry->GetResultsModel (), _result_removed_id);
+
+ _group_added_id = _group_removed_id = _result_added_id = _result_removed_id = 0;
+
+ _results_controller->Clear ();
+ }
+
+ _entry = entry;
+
+ if (_entry)
+ {
+ std::map <gchar*, gchar*> hints;
+ DeeModel *groups;
+ DeeModelIter *iter, *last;
+
+ _entry->SetActive (true);
+
+ groups = _entry->GetGroupsModel ();
+ iter = dee_model_get_first_iter (groups);
+ last = dee_model_get_last_iter (groups);
+ while (iter != last)
+ {
+ _results_controller->CreateGroup (dee_model_get_string (groups,
+ iter,
+ PlaceEntry::GROUP_NAME));
+ iter = dee_model_next (groups, iter);
+ }
+
+ _group_added_id = g_signal_connect (_entry->GetGroupsModel (), "row-added",
+ (GCallback)&PlacesView::OnGroupAdded, this);
+ _group_removed_id = g_signal_connect (_entry->GetGroupsModel (), "row-removed",
+ (GCallback)&PlacesView::OnGroupRemoved, this);
+ _result_added_id = g_signal_connect (_entry->GetResultsModel (), "row-added",
+ (GCallback)&PlacesView::OnResultAdded, this);
+ _result_removed_id = g_signal_connect (_entry->GetResultsModel (), "row-removed",
+ (GCallback)&PlacesView::OnResultRemoved, this);
+ }
+ _search_bar->SetActiveEntry (_entry, section_id, search_string);
+
+ if (signal)
+ entry_changed.emit (_entry);
+}
+
+PlaceEntry *
+PlacesView::GetActiveEntry ()
{
- g_debug ("%s: %s %d %s", G_STRFUNC, entry->GetName (), section_id, search_string);
+ return _entry;
+}
+
+PlacesResultsController *
+PlacesView::GetResultsController ()
+{
+ return _results_controller;
+}
+
+
+//
+// Model handlers
+//
+void
+PlacesView::OnGroupAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self)
+{
+ g_debug ("GroupAdded: %s", dee_model_get_string (model, iter, 1));
+}
+
+
+void
+PlacesView::OnGroupRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self)
+{
+ g_debug ("GroupRemoved: %s", dee_model_get_string (model, iter, 1));
+}
+
+void
+PlacesView::OnResultAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self)
+{
+ PlaceEntry *active;
+ DeeModel *groups;
+ DeeModelIter *git;
+ const gchar *group_id;
+ gchar *result_id;
+ gchar *result_name;
+ const gchar *result_icon;
+ PlacesSimpleTile *tile;
+
+ //g_debug ("ResultAdded: %s", dee_model_get_string (model, iter, 4));
+
+ //FIXME: We can't do anything with these do just ignore
+ if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI), "unity-install"))
+ return;
+
+ active = self->GetActiveEntry ();
+ groups = active->GetGroupsModel ();
+ git = dee_model_get_iter_at_row (groups, dee_model_get_uint32 (model,
+ iter,
+ PlaceEntry::RESULT_GROUP_ID));
+ group_id = dee_model_get_string (groups, git, PlaceEntry::GROUP_NAME);
+ result_name = g_markup_escape_text (dee_model_get_string (model, iter, PlaceEntry::RESULT_NAME),
+ -1);
+ result_id = g_strdup_printf ("%s:%s",
+ group_id,
+ dee_model_get_string (model, iter, PlaceEntry::RESULT_URI));
+ result_icon = dee_model_get_string (model, iter, PlaceEntry::RESULT_ICON);
+
+ tile = new PlacesSimpleTile (result_icon, result_name, 48);
+ tile->SetURI (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI));
+ tile->sigClick.connect (sigc::mem_fun (self, &PlacesView::OnResultClicked));
+ self->GetResultsController ()->AddResultToGroup (group_id, tile, result_id);
+
+ g_free (result_name);
+ g_free (result_id);
+}
+
+void
+PlacesView::OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self)
+{
+ PlaceEntry *active;
+ DeeModel *groups;
+ DeeModelIter *git;
+ const gchar *group_id;
+ gchar *result_id;
+
+ //g_debug ("ResultRemoved: %s", dee_model_get_string (model, iter, 4));
+
+ //FIXME: We can't do anything with these do just ignore
+ if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI), "unity-install"))
+ return;
+ active = self->GetActiveEntry ();
+ groups = active->GetGroupsModel ();
+ git = dee_model_get_iter_at_row (groups, dee_model_get_uint32 (model,
+ iter,
+ PlaceEntry::RESULT_GROUP_ID));
+ group_id = dee_model_get_string (groups, git, PlaceEntry::GROUP_NAME);
+ result_id = g_strdup_printf ("%s:%s",
+ group_id,
+ dee_model_get_string (model, iter, PlaceEntry::RESULT_URI));
+
+ self->GetResultsController ()->RemoveResultFromGroup (group_id, result_id);
+
+ g_free (result_id);
+}
+
+void
+PlacesView::OnResultClicked (PlacesTile *tile)
+{
+ PlacesSimpleTile *simple_tile = static_cast<PlacesSimpleTile *> (tile);
+ const char *uri;
+
+ if (!(uri = simple_tile->GetURI ()))
+ {
+ g_warning ("Unable to launch %s: does not have a URI", simple_tile->GetLabel ());
+ return;
+ }
+
+ if (g_str_has_prefix (uri, "application://"))
+ {
+ const char *id = &uri[14];
+ GDesktopAppInfo *info;
+
+ info = g_desktop_app_info_new (id);
+ if (G_IS_DESKTOP_APP_INFO (info))
+ {
+ GError *error = NULL;
+
+ g_app_info_launch (G_APP_INFO (info), NULL, NULL, &error);
+ if (error)
+ {
+ g_warning ("Unable to launch %s: %s", id, error->message);
+ g_error_free (error);
+ }
+ g_object_unref (info);
+ }
+ }
+ else
+ {
+ GError *error = NULL;
+ gtk_show_uri (NULL, uri, time (NULL), &error);
+
+ if (error)
+ {
+ g_warning ("Unable to show %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+ }
+
+ ubus_server_send_message (ubus_server_get_default (),
+ UBUS_PLACE_VIEW_CLOSE_REQUEST,
+ NULL);
}
//
@@ -128,6 +332,12 @@ PlacesView::PlaceEntryActivateRequest (const char *entry_id,
search_string);
}
+void
+PlacesView::CloseRequest (GVariant *data, PlacesView *self)
+{
+ self->SetActiveEntry (NULL, 0, "");
+}
+
//
// Introspection
//
diff --git a/src/PlacesView.h b/src/PlacesView.h
index 39f9f412e..b8ba431fa 100644
--- a/src/PlacesView.h
+++ b/src/PlacesView.h
@@ -34,6 +34,11 @@
#include "PlacesSearchBar.h"
#include "PlacesHomeView.h"
+#include "PlacesSimpleTile.h"
+#include "PlacesGroup.h"
+#include "PlacesResultsController.h"
+#include "PlacesResultsView.h"
+
class PlacesView : public nux::View, public Introspectable
{
NUX_DECLARE_OBJECT_TYPE (PlacesView, nux::View);
@@ -47,10 +52,16 @@ public:
void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
// Methods
- void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string);
+ void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal=true);
+ PlaceEntry * GetActiveEntry ();
// UBus handlers
void PlaceEntryActivateRequest (const char *entry_id, guint section, const gchar *search);
+
+ PlacesResultsController * GetResultsController ();
+
+ // Signals
+ sigc::signal<void, PlaceEntry *> entry_changed;
protected:
@@ -58,9 +69,27 @@ protected:
void AddProperties (GVariantBuilder *builder);
private:
+ static void CloseRequest (GVariant *data, PlacesView *self);
+
+ static void OnGroupAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self);
+ static void OnGroupRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self);
+ static void OnResultAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self);
+ static void OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self);
+
+ void OnResultClicked (PlacesTile *tile);
+
+private:
nux::VLayout *_layout;
PlacesSearchBar *_search_bar;
PlacesHomeView *_home_view;
+ PlaceEntry *_entry;
+ gulong _group_added_id;
+ gulong _group_removed_id;
+ gulong _result_added_id;
+ gulong _result_removed_id;
+
+ PlacesResultsController *_results_controller;
+ PlacesResultsView *_results_view;
};
#endif // PANEL_HOME_BUTTON_H
diff --git a/src/PluginAdapter.cpp b/src/PluginAdapter.cpp
index ef199c1e1..af8f9e9aa 100644
--- a/src/PluginAdapter.cpp
+++ b/src/PluginAdapter.cpp
@@ -23,7 +23,7 @@
PluginAdapter * PluginAdapter::_default = 0;
#define MAXIMIZABLE (CompWindowActionMaximizeHorzMask & CompWindowActionMaximizeVertMask & CompWindowActionResizeMask)
-#define COVERAGE_AREA_BEFORE_AUTOMAXIMIZE 0.6
+#define COVERAGE_AREA_BEFORE_AUTOMAXIMIZE 0.75
/* static */
PluginAdapter *
@@ -46,8 +46,6 @@ PluginAdapter::PluginAdapter(CompScreen *screen) :
m_ExpoActionList (0),
m_ScaleActionList (0)
{
- m_AnimationPluginLoaded =
- CompPlugin::find ("animation") ? true : false;
}
PluginAdapter::~PluginAdapter()
@@ -100,12 +98,10 @@ PluginAdapter::Notify (CompWindow *window, CompWindowNotify notify)
switch (notify)
{
case CompWindowNotifyMinimize:
- if (!m_AnimationPluginLoaded)
- window_minimized.emit (window->id ());
+ window_minimized.emit (window->id ());
break;
case CompWindowNotifyUnminimize:
- if (!m_AnimationPluginLoaded)
- window_unminimized.emit (window->id ());
+ window_unminimized.emit (window->id ());
break;
case CompWindowNotifyShade:
window_shaded.emit (window->id ());
@@ -134,10 +130,13 @@ PluginAdapter::Notify (CompWindow *window, CompWindowNotify notify)
}
void
-MultiActionList::AddNewAction (CompAction *a)
+MultiActionList::AddNewAction (CompAction *a, bool primary)
{
if (std::find (m_ActionList.begin (), m_ActionList.end (), a) == m_ActionList.end ())
m_ActionList.push_back (a);
+
+ if (primary)
+ _primary_action = a;
}
void
@@ -146,29 +145,6 @@ MultiActionList::RemoveAction (CompAction *a)
m_ActionList.remove (a);
}
-bool
-MultiActionList::IsAnyActive (bool onlyOwn)
-{
- if (onlyOwn)
- {
- if (m_ToggledAction)
- return true;
- else
- return false;
- }
-
- foreach (CompAction *action, m_ActionList)
- {
- if (action->state () & (CompAction::StateTermKey |
- CompAction::StateTermButton |
- CompAction::StateTermEdge |
- CompAction::StateTermEdgeDnd))
- return true;
- }
-
- return m_ToggledAction ? true : false;
-}
-
void
MultiActionList::InitiateAll (CompOption::Vector &extraArgs)
{
@@ -184,9 +160,15 @@ MultiActionList::InitiateAll (CompOption::Vector &extraArgs)
argument.push_back (arg);
}
+ CompAction *a;
+
+ if (_primary_action)
+ a = _primary_action;
+ else
+ a = m_ActionList.front ();
+
/* Initiate the first available action with the arguments */
- m_ToggledAction = m_ActionList.front ();
- m_ActionList.front ()->initiate () (m_ActionList.front (), 0, argument);
+ a->initiate () (a, 0, argument);
}
void
@@ -203,18 +185,21 @@ MultiActionList::TerminateAll (CompOption::Vector &extraArgs)
foreach (CompOption &a, extraArgs)
argument.push_back (a);
-
+
+ if (_primary_action)
+ {
+ _primary_action->terminate () (_primary_action, 0, argument);
+ return;
+ }
+
foreach (CompAction *action, m_ActionList)
{
if (action->state () & (CompAction::StateTermKey |
CompAction::StateTermButton |
CompAction::StateTermEdge |
- CompAction::StateTermEdgeDnd) ||
- m_ToggledAction == action)
+ CompAction::StateTermEdgeDnd))
{
action->terminate () (action, 0, argument);
- if (m_ToggledAction == action)
- m_ToggledAction = NULL;
}
}
}
@@ -289,9 +274,9 @@ PluginAdapter::TerminateScale ()
}
bool
-PluginAdapter::IsScaleActive (bool onlyOwn)
+PluginAdapter::IsScaleActive ()
{
- return m_ScaleActionList.IsAnyActive (onlyOwn);
+ return m_Screen->grabExist ("scale");
}
void
diff --git a/src/PluginAdapter.h b/src/PluginAdapter.h
index 937bcf9fd..ccf55c6ef 100644
--- a/src/PluginAdapter.h
+++ b/src/PluginAdapter.h
@@ -33,18 +33,17 @@ public:
MultiActionList (int n) :
m_ActionList (n),
- m_ToggledAction (NULL) {};
+ _primary_action (NULL) {};
void InitiateAll (CompOption::Vector &extraArgs);
void TerminateAll (CompOption::Vector &extraArgs);
- bool IsAnyActive (bool onlyOwn = false);
- void AddNewAction (CompAction *);
+ void AddNewAction (CompAction *, bool primary);
void RemoveAction (CompAction *);
private:
std::list <CompAction *> m_ActionList;
- CompAction * m_ToggledAction;
+ CompAction * _primary_action;
};
@@ -67,7 +66,7 @@ public:
void InitiateScale (std::string *match);
void TerminateScale ();
- bool IsScaleActive (bool onlyOwn = false);
+ bool IsScaleActive ();
void InitiateExpo ();
@@ -93,7 +92,6 @@ private:
MultiActionList m_ExpoActionList;
MultiActionList m_ScaleActionList;
std::list <guint32> m_SpreadedWindows;
- bool m_AnimationPluginLoaded;
static PluginAdapter *_default;
};
diff --git a/src/StaticCairoText.cpp b/src/StaticCairoText.cpp
index f2b5bdc5e..607a7b1da 100644
--- a/src/StaticCairoText.cpp
+++ b/src/StaticCairoText.cpp
@@ -32,7 +32,10 @@ namespace nux
{
StaticCairoText::StaticCairoText (const TCHAR* text,
NUX_FILE_LINE_DECL) :
- View (NUX_FILE_LINE_PARAM)
+ View (NUX_FILE_LINE_PARAM),
+ _fontstring (NULL),
+ _cairoGraphics (NULL),
+ _texture2D (NULL)
{
_textColor = Color(1.0f, 1.0f, 1.0f, 1.0f);
_text = TEXT (text);
@@ -50,7 +53,6 @@ StaticCairoText::~StaticCairoText ()
g_signal_handlers_disconnect_by_func (settings,
(void *) &StaticCairoText::OnFontChanged,
this);
-
if (_texture2D)
delete (_texture2D);
@@ -402,6 +404,8 @@ void StaticCairoText::UpdateTexture ()
DrawText (cr, GetBaseWidth (), GetBaseHeight (), _textColor);
+ cairo_destroy (cr);
+
NBitmapData* bitmap = _cairoGraphics->GetBitmap ();
// NTexture2D is the high level representation of an image that is backed by
diff --git a/src/ubus-server.cpp b/src/ubus-server.cpp
index 37f69b8db..8bc05d579 100644
--- a/src/ubus-server.cpp
+++ b/src/ubus-server.cpp
@@ -107,7 +107,7 @@ ubus_message_info_new (GVariant *data)
{
UBusMessageInfo *info;
- info = g_slice_new (UBusMessageInfo);
+ info = g_slice_new0 (UBusMessageInfo);
info->data = data;
if (data != NULL)
@@ -120,7 +120,10 @@ static void
ubus_message_info_free (UBusMessageInfo *info)
{
if (info->data != NULL)
+ {
g_variant_unref (info->data);
+ info->data = NULL;
+ }
g_slice_free (UBusMessageInfo, info);
}
diff --git a/src/unitya11y.cpp b/src/unitya11y.cpp
index aad3b5e80..358366ac0 100644
--- a/src/unitya11y.cpp
+++ b/src/unitya11y.cpp
@@ -38,6 +38,8 @@
static GHashTable *accessible_table = NULL;
/* FIXME: remove accessible objects when not required anymore */
+static gboolean a11y_initialized = FALSE;
+
static void
unity_a11y_restore_environment (void)
{
@@ -190,6 +192,7 @@ unity_a11y_init (void)
{
g_debug ("Unity accessibility started, using bridge on %s",
bridge_path);
+ a11y_initialized = TRUE;
}
g_free (bridge_path);
@@ -208,6 +211,7 @@ unity_a11y_finalize (void)
g_hash_table_unref (accessible_table);
accessible_table = NULL;
}
+ a11y_initialized = FALSE;
}
@@ -290,3 +294,11 @@ unity_a11y_get_accessible (nux::Object *object)
return accessible_object;
}
+
+/*
+ * Returns if the accessibility support is properly initialized
+ */
+gboolean unity_a11y_initialized (void)
+{
+ return a11y_initialized;
+}
diff --git a/src/unitya11y.h b/src/unitya11y.h
index a583fd1bd..7e0768407 100644
--- a/src/unitya11y.h
+++ b/src/unitya11y.h
@@ -28,5 +28,6 @@ void unity_a11y_preset_environment (void);
void unity_a11y_init (void);
void unity_a11y_finalize (void);
AtkObject *unity_a11y_get_accessible (nux::Object *object);
+gboolean unity_a11y_initialized (void);
#endif /* UNITY_A11Y_H */
diff --git a/src/unityshell.cpp b/src/unityshell.cpp
index a6d094ee2..7869fdcff 100644
--- a/src/unityshell.cpp
+++ b/src/unityshell.cpp
@@ -230,7 +230,7 @@ UnityScreen::initPluginActions (gpointer data)
option.name () == "expo_edge")
{
CompAction *action = &option.value ().action ();
- expoActions.AddNewAction (action);
+ expoActions.AddNewAction (action, false);
break;
}
}
@@ -247,7 +247,6 @@ UnityScreen::initPluginActions (gpointer data)
foreach (CompOption &option, p->vTable->getOptions ())
{
if (option.name () == "initiate_all_key" ||
- option.name () == "initiate_all_button" ||
option.name () == "initiate_all_edge" ||
option.name () == "initiate_key" ||
option.name () == "initiate_button" ||
@@ -260,7 +259,12 @@ UnityScreen::initPluginActions (gpointer data)
option.name () == "initiate_output_edge")
{
CompAction *action = &option.value ().action ();
- scaleActions.AddNewAction (action);
+ scaleActions.AddNewAction (action, false);
+ }
+ else if (option.name () == "initiate_all_button")
+ {
+ CompAction *action = &option.value ().action ();
+ scaleActions.AddNewAction (action, true);
}
}
@@ -415,8 +419,7 @@ UnityScreen::optionChanged (CompOption *opt,
switch (num)
{
case UnityshellOptions::LauncherAutohide:
- launcher->SetAutohide (optionGetLauncherAutohide (),
- (nux::View *) panelView->HomeButton ());
+ launcher->SetAutohide (optionGetLauncherAutohide ());
break;
case UnityshellOptions::BacklightAlwaysOn:
launcher->SetBacklightAlwaysOn (optionGetBacklightAlwaysOn ());
@@ -553,7 +556,8 @@ void UnityScreen::initLauncher (nux::NThread* thread, void* InitData)
/* FIXME: this should not be manual, should be managed with a
show/hide callback like in GAIL*/
- unity_util_accessible_add_window (self->launcherWindow);
+ if (unity_a11y_initialized () == TRUE)
+ unity_util_accessible_add_window (self->launcherWindow);
self->launcher->SetIconSize (54, 48);
self->launcher->SetBacklightAlwaysOn (true);
@@ -586,7 +590,8 @@ void UnityScreen::initLauncher (nux::NThread* thread, void* InitData)
/* Setup Places */
self->placesController = new PlacesController ();
- self->launcher->SetAutohide (true, (nux::View *) self->panelView->HomeButton ());
+ self->launcher->SetAutohideTrigger ((nux::View *) self->panelView->HomeButton ());
+ self->launcher->SetAutohide (true);
self->launcher->SetLaunchAnimation (Launcher::LAUNCH_ANIMATION_PULSE);
self->launcher->SetUrgentAnimation (Launcher::URGENT_ANIMATION_WIGGLE);
g_timeout_add (2000, &UnityScreen::strutHackTimeout, self);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e38f1c59a..8ff5761a6 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -122,6 +122,12 @@ add_executable (test-places
../src/PlacesSimpleTile.h
../src/PlacesTile.cpp
../src/PlacesTile.h
+ ../src/PlacesResultsController.cpp
+ ../src/PlacesResultsController.h
+ ../src/PlacesResultsView.h
+ ../src/PlacesResultsView.cpp
+ ../src/PlacesGroup.cpp
+ ../src/PlacesGroup.h
../src/PlacesView.cpp
../src/PlacesView.h
../src/UBusMessages.h
diff --git a/tests/TestPlaces.cpp b/tests/TestPlaces.cpp
index 59cd59e3d..55456b27d 100644
--- a/tests/TestPlaces.cpp
+++ b/tests/TestPlaces.cpp
@@ -49,7 +49,7 @@ public:
layout->AddView (_combo, 0, nux::eCenter, nux::eFix);
PlacesView *view = new PlacesView ();
- view->SetMinMaxSize(1024, 600);
+ view->SetMinMaxSize(938, 500);
layout->AddView(view, 1, nux::eCenter, nux::eFix);
_factory = PlaceFactory::GetDefault ();
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
nux::NuxInitialize(0);
nux::WindowThread* wt = nux::CreateGUIThread("Unity Places",
- 1024, 600, 0, &ThreadWidgetInit, 0);
+ 938, 500, 0, &ThreadWidgetInit, 0);
app = new TestApp ();
wt->Run(NULL);
diff --git a/tests/TestPlacesGroup.cpp b/tests/TestPlacesGroup.cpp
index dcbe3c880..46c712168 100644
--- a/tests/TestPlacesGroup.cpp
+++ b/tests/TestPlacesGroup.cpp
@@ -111,6 +111,7 @@ void TestRunner::Init ()
group_content->SetHorizontalInternalMargin (4);
group1->SetLayout (group_content);
+ group1->SetVisible (false);
layout->AddView (group1, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
diff --git a/tests/TestPlacesResults.cpp b/tests/TestPlacesResults.cpp
index 9f1e1a9b7..5f82aa584 100644
--- a/tests/TestPlacesResults.cpp
+++ b/tests/TestPlacesResults.cpp
@@ -75,85 +75,28 @@ void TestRunner::Init ()
layout = new nux::VLayout ();
layout->AddView (view, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
- //~ PlacesGroup *group1 = new PlacesGroup ();
- //~ group1->SetTitle ("Hello World!");
- //~ group1->SetItemDetail (100, 5);
-//~
- //~ nux::GridHLayout *group_content = new nux::GridHLayout (NUX_TRACKER_LOCATION);
- //~ for (int i = 0; i < 60; i++)
- //~ {
- //~ nux::ColorLayer color (nux::Color::RandomColor ());
- //~ nux::TextureArea* texture_area = new nux::TextureArea ();
- //~ texture_area->SetPaintLayer (&color);
-//~
- //~ group_content->AddView (texture_area, 1, nux::eLeft, nux::eFull);
- //~ }
-//~
- //~ group_content->ForceChildrenSize (true);
- //~ group_content->SetChildrenSize (64, 42);
- //~ group_content->EnablePartialVisibility (false);
-//~
- //~ group_content->SetVerticalExternalMargin (4);
- //~ group_content->SetHorizontalExternalMargin (4);
- //~ group_content->SetVerticalInternalMargin (4);
- //~ group_content->SetHorizontalInternalMargin (4);
-//~
- //~ group1->SetLayout (group_content);
-//~
- //~ view->AddGroup (group1);
-//~
-//~
- //~ PlacesGroup *group2 = new PlacesGroup ();
- //~ group2->SetTitle ("Group2!");
- //~ group2->SetItemDetail (100, 5);
-//~
- //~ nux::GridHLayout *group_content2 = new nux::GridHLayout (NUX_TRACKER_LOCATION);
- //~ for (int i = 0; i < 60; i++)
- //~ {
- //~ nux::ColorLayer color (nux::Color::RandomColor ());
- //~ nux::TextureArea* texture_area = new nux::TextureArea ();
- //~ texture_area->SetPaintLayer (&color);
-//~
- //~ group_content2->AddView (texture_area, 1, nux::eLeft, nux::eFull);
- //~ }
-//~
- //~ group_content2->ForceChildrenSize (true);
- //~ group_content2->SetChildrenSize (64, 42);
- //~ group_content2->EnablePartialVisibility (false);
-//~
- //~ group_content2->SetVerticalExternalMargin (4);
- //~ group_content2->SetHorizontalExternalMargin (4);
- //~ group_content2->SetVerticalInternalMargin (4);
- //~ group_content2->SetHorizontalInternalMargin (4);
-//~
- //~ group2->SetLayout (group_content2);
-//~
- //~ view->AddGroup (group2);
-
-
- //~ PlacesGroup *group2 = new PlacesGroup ();
- //~ group1->SetTitle ("Second Group");
- //~ group1->SetItemDetail (100, 5);
-//~
-//~
-//~
PlacesSimpleTile *tile11 = new PlacesSimpleTile ("/usr/share/icons/scalable/apps/deluge.svg", "Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund.", 50);
PlacesSimpleTile *tile12 = new PlacesSimpleTile ("/usr/share/icons/scalable/apps/deluge.svg", "Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund.", 50);
PlacesSimpleTile *tile13 = new PlacesSimpleTile ("firefox", "FooBar Fox", 50);
PlacesSimpleTile *tile14 = new PlacesSimpleTile ("THISISNOTAVALIDTEXTURE.NOTREAL", "this icon is not valid", 50);
-//~ //~
+
PlacesSimpleTile *tile21 = new PlacesSimpleTile ("/usr/share/icons/scalable/apps/deluge.svg", "Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund.", 50);
PlacesSimpleTile *tile22 = new PlacesSimpleTile ("/usr/share/icons/scalable/apps/deluge.svg", "Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund. Der schnelle braune Fuchs sprang über den faulen Hund.", 50);
PlacesSimpleTile *tile23 = new PlacesSimpleTile ("firefox", "FooBar Fox", 50);
PlacesSimpleTile *tile24 = new PlacesSimpleTile ("THISISNOTAVALIDTEXTURE.NOTREAL", "this icon is not valid", 50);
-//~
+
controller->SetView (view);
-//~ //~
+
+ controller->CreateGroup ("Group1");
+ controller->CreateGroup ("Group3");
+ controller->CreateGroup ("Group2");
+
+
controller->AddResultToGroup ("Group1", tile11, "tile1-1");
controller->AddResultToGroup ("Group1", tile12, "tile1-2");
controller->AddResultToGroup ("Group1", tile13, "tile1-3");
controller->AddResultToGroup ("Group1", tile14, "tile1-4");
-//~ //~
+
controller->AddResultToGroup ("Group2", tile21, "tile2-1");
controller->AddResultToGroup ("Group2", tile22, "tile2-2");
controller->AddResultToGroup ("Group2", tile23, "tile2-3");