Merge lp:~unity-team/unity/fixes-2011-04-11 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Merged at revision: 1105
Proposed branch: lp:~unity-team/unity/fixes-2011-04-11
Merge into: lp:unity
Diff against target: 1011 lines (+315/-196)
18 files modified
services/panel-service.c (+39/-35)
src/IndicatorObjectFactoryRemote.cpp (+46/-17)
src/IndicatorObjectFactoryRemote.h (+26/-1)
src/PanelMenuView.cpp (+8/-5)
src/PanelMenuView.h (+3/-0)
src/PlacesGroupController.cpp (+2/-1)
src/PlacesSearchBar.cpp (+1/-1)
src/PlacesSearchBarSpinner.cpp (+72/-42)
src/PlacesSearchBarSpinner.h (+5/-4)
src/PlacesSimpleTile.cpp (+2/-7)
src/PlacesStyle.cpp (+50/-41)
src/PlacesStyle.h (+10/-8)
src/PlacesView.cpp (+10/-2)
src/PlacesView.h (+2/-0)
src/QuicklistView.cpp (+9/-4)
src/StaticCairoText.cpp (+1/-1)
src/UScreen.cpp (+7/-0)
tests/TestPlacesBackend.cpp (+22/-27)
To merge this branch: bzr merge lp:~unity-team/unity/fixes-2011-04-11
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+57092@code.launchpad.net

Description of the change

Bugs attached, there are some other changes too, largest being the spinner (which isn't really a large change)

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1 looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'resources/search_clear_alone.png'
0Binary files resources/search_clear_alone.png 2011-03-23 22:33:25 +0000 and resources/search_clear_alone.png 1970-01-01 00:00:00 +0000 differ0Binary files resources/search_clear_alone.png 2011-03-23 22:33:25 +0000 and resources/search_clear_alone.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'resources/search_clear_icon.png'
1Binary files resources/search_clear_icon.png 2011-02-28 11:24:48 +0000 and resources/search_clear_icon.png 1970-01-01 00:00:00 +0000 differ1Binary files resources/search_clear_icon.png 2011-02-28 11:24:48 +0000 and resources/search_clear_icon.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'resources/search_clear_spinner.png'
2Binary files resources/search_clear_spinner.png 2011-03-23 23:18:03 +0000 and resources/search_clear_spinner.png 1970-01-01 00:00:00 +0000 differ2Binary files resources/search_clear_spinner.png 2011-03-23 23:18:03 +0000 and resources/search_clear_spinner.png 1970-01-01 00:00:00 +0000 differ
=== added file 'resources/search_close.png'
3Binary files resources/search_close.png 1970-01-01 00:00:00 +0000 and resources/search_close.png 2011-04-10 23:52:24 +0000 differ3Binary files resources/search_close.png 1970-01-01 00:00:00 +0000 and resources/search_close.png 2011-04-10 23:52:24 +0000 differ
=== added file 'resources/search_close_glow.png'
4Binary files resources/search_close_glow.png 1970-01-01 00:00:00 +0000 and resources/search_close_glow.png 2011-04-10 23:52:24 +0000 differ4Binary files resources/search_close_glow.png 1970-01-01 00:00:00 +0000 and resources/search_close_glow.png 2011-04-10 23:52:24 +0000 differ
=== added file 'resources/search_magnify.png'
5Binary files resources/search_magnify.png 1970-01-01 00:00:00 +0000 and resources/search_magnify.png 2011-04-10 23:52:24 +0000 differ5Binary files resources/search_magnify.png 1970-01-01 00:00:00 +0000 and resources/search_magnify.png 2011-04-10 23:52:24 +0000 differ
=== removed file 'resources/search_ready_icon.png'
6Binary files resources/search_ready_icon.png 2011-02-28 11:24:48 +0000 and resources/search_ready_icon.png 1970-01-01 00:00:00 +0000 differ6Binary files resources/search_ready_icon.png 2011-02-28 11:24:48 +0000 and resources/search_ready_icon.png 1970-01-01 00:00:00 +0000 differ
=== added file 'resources/search_spin.png'
7Binary files resources/search_spin.png 1970-01-01 00:00:00 +0000 and resources/search_spin.png 2011-04-10 23:52:24 +0000 differ7Binary files resources/search_spin.png 1970-01-01 00:00:00 +0000 and resources/search_spin.png 2011-04-10 23:52:24 +0000 differ
=== added file 'resources/search_spin_glow.png'
8Binary files resources/search_spin_glow.png 1970-01-01 00:00:00 +0000 and resources/search_spin_glow.png 2011-04-10 23:52:24 +0000 differ8Binary files resources/search_spin_glow.png 1970-01-01 00:00:00 +0000 and resources/search_spin_glow.png 2011-04-10 23:52:24 +0000 differ
=== modified file 'services/panel-service.c'
--- services/panel-service.c 2011-04-05 14:09:03 +0000
+++ services/panel-service.c 2011-04-10 23:52:24 +0000
@@ -1,4 +1,4 @@
1/*1 /*
2 * Copyright (C) 2010 Canonical Ltd2 * Copyright (C) 2010 Canonical Ltd
3 *3 *
4 * This program is free software: you can redistribute it and/or modify4 * This program is free software: you can redistribute it and/or modify
@@ -186,14 +186,14 @@
186 G_TYPE_NONE, 1, G_TYPE_STRING);186 G_TYPE_NONE, 1, G_TYPE_STRING);
187 _service_signals[GEOMETRIES_CHANGED] =187 _service_signals[GEOMETRIES_CHANGED] =
188 g_signal_new ("geometries-changed",188 g_signal_new ("geometries-changed",
189 G_OBJECT_CLASS_TYPE (obj_class),189 G_OBJECT_CLASS_TYPE (obj_class),
190 G_SIGNAL_RUN_LAST,190 G_SIGNAL_RUN_LAST,
191 0,191 0,
192 NULL, NULL,192 NULL, NULL,
193 panel_marshal_VOID__OBJECT_POINTER_INT_INT_INT_INT,193 panel_marshal_VOID__OBJECT_POINTER_INT_INT_INT_INT,
194 G_TYPE_NONE, 6,194 G_TYPE_NONE, 6,
195 G_TYPE_OBJECT, G_TYPE_POINTER,195 G_TYPE_OBJECT, G_TYPE_POINTER,
196 G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);196 G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
197197
198 _service_signals[ENTRY_SHOW_NOW_CHANGED] =198 _service_signals[ENTRY_SHOW_NOW_CHANGED] =
199 g_signal_new ("entry-show-now-changed",199 g_signal_new ("entry-show-now-changed",
@@ -569,10 +569,10 @@
569}569}
570570
571static const gchar * indicator_environment[] = {571static const gchar * indicator_environment[] = {
572 "unity",572 "unity",
573 "unity-3d",573 "unity-3d",
574 "unity-panel-service",574 "unity-panel-service",
575 NULL575 NULL
576};576};
577577
578static void578static void
@@ -657,16 +657,16 @@
657static gint657static gint
658name2order (const gchar * name)658name2order (const gchar * name)
659{659{
660 int i;660 int i;
661661
662 for (i = 0; indicator_order[i] != NULL; i++)662 for (i = 0; indicator_order[i] != NULL; i++)
663 {663 {
664 if (g_strcmp0(name, indicator_order[i]) == 0)664 if (g_strcmp0(name, indicator_order[i]) == 0)
665 {665 {
666 return i;666 return i;
667 }667 }
668 }668 }
669 return -1;669 return -1;
670}670}
671671
672static int672static int
@@ -915,12 +915,12 @@
915915
916void916void
917panel_service_sync_geometry (PanelService *self,917panel_service_sync_geometry (PanelService *self,
918 const gchar *indicator_id,918 const gchar *indicator_id,
919 const gchar *entry_id,919 const gchar *entry_id,
920 gint x,920 gint x,
921 gint y,921 gint y,
922 gint width,922 gint width,
923 gint height)923 gint height)
924{924{
925 PanelServicePrivate *priv = self->priv;925 PanelServicePrivate *priv = self->priv;
926 IndicatorObjectEntry *entry = g_hash_table_lookup (priv->id2entry_hash, entry_id);926 IndicatorObjectEntry *entry = g_hash_table_lookup (priv->id2entry_hash, entry_id);
@@ -940,13 +940,13 @@
940 if (GTK_IS_LABEL (entry->label))940 if (GTK_IS_LABEL (entry->label))
941 {941 {
942 label_ok = gtk_widget_get_visible (GTK_WIDGET (entry->label))942 label_ok = gtk_widget_get_visible (GTK_WIDGET (entry->label))
943 && gtk_widget_is_sensitive (GTK_WIDGET (entry->label));943 && gtk_widget_is_sensitive (GTK_WIDGET (entry->label));
944 }944 }
945945
946 if (GTK_IS_IMAGE (entry->image))946 if (GTK_IS_IMAGE (entry->image))
947 {947 {
948 image_ok = gtk_widget_get_visible (GTK_WIDGET (entry->image))948 image_ok = gtk_widget_get_visible (GTK_WIDGET (entry->image))
949 && gtk_widget_is_sensitive (GTK_WIDGET (entry->image));949 && gtk_widget_is_sensitive (GTK_WIDGET (entry->image));
950 }950 }
951951
952 return !label_ok && !image_ok;952 return !label_ok && !image_ok;
@@ -996,6 +996,8 @@
996 new_object = g_slist_nth_data (indicators, new_object_index);996 new_object = g_slist_nth_data (indicators, new_object_index);
997 }997 }
998998
999 if (!INDICATOR_IS_OBJECT (new_object))
1000 return;
999 new_entries = indicator_object_get_entries (new_object);1001 new_entries = indicator_object_get_entries (new_object);
1000 // if the indicator has no entries, move to the next/prev one until we find one with entries1002 // if the indicator has no entries, move to the next/prev one until we find one with entries
1001 while (new_entries == NULL)1003 while (new_entries == NULL)
@@ -1003,8 +1005,10 @@
1003 gint cur_object_index = g_slist_index (indicators, new_object);1005 gint cur_object_index = g_slist_index (indicators, new_object);
1004 gint new_object_index = cur_object_index + (direction == GTK_MENU_DIR_CHILD ? 1 : -1);1006 gint new_object_index = cur_object_index + (direction == GTK_MENU_DIR_CHILD ? 1 : -1);
1005 new_object = g_slist_nth_data (indicators, new_object_index);1007 new_object = g_slist_nth_data (indicators, new_object_index);
1008 if (!INDICATOR_IS_OBJECT (new_object))
1009 return;
1006 new_entries = indicator_object_get_entries (new_object);1010 new_entries = indicator_object_get_entries (new_object);
1007 }1011 }
10081012
1009 new_entry = g_list_nth_data (new_entries, direction == GTK_MENU_DIR_PARENT ? g_list_length (new_entries) - 1 : 0);1013 new_entry = g_list_nth_data (new_entries, direction == GTK_MENU_DIR_PARENT ? g_list_length (new_entries) - 1 : 0);
10101014
@@ -1013,9 +1017,9 @@
10131017
1014 if (should_skip_menu (new_entry))1018 if (should_skip_menu (new_entry))
1015 { 1019 {
1016 activate_next_prev_menu (self, new_object, new_entry, direction);1020 activate_next_prev_menu (self, new_object, new_entry, direction);
1017 return;1021 return;
1018 }1022 }
1019 }1023 }
1020 // changing within a group of indicators (for example, entries within appmenu)1024 // changing within a group of indicators (for example, entries within appmenu)
1021 else1025 else
@@ -1025,9 +1029,9 @@
10251029
1026 if (should_skip_menu (new_entry))1030 if (should_skip_menu (new_entry))
1027 { 1031 {
1028 activate_next_prev_menu (self, object, new_entry, direction);1032 activate_next_prev_menu (self, object, new_entry, direction);
1029 return;1033 return;
1030 }1034 }
1031 }1035 }
10321036
1033 id = g_strdup_printf ("%p", new_entry);1037 id = g_strdup_printf ("%p", new_entry);
10341038
=== modified file 'src/IndicatorObjectFactoryRemote.cpp'
--- src/IndicatorObjectFactoryRemote.cpp 2011-04-08 07:53:45 +0000
+++ src/IndicatorObjectFactoryRemote.cpp 2011-04-10 23:52:24 +0000
@@ -29,6 +29,7 @@
29#include "Nux/WindowThread.h"29#include "Nux/WindowThread.h"
30#include "NuxGraphics/GLWindowManager.h"30#include "NuxGraphics/GLWindowManager.h"
31#include <X11/Xlib.h>31#include <X11/Xlib.h>
32#include <algorithm>
3233
33#define S_NAME "com.canonical.Unity.Panel.Service"34#define S_NAME "com.canonical.Unity.Panel.Service"
34#define S_PATH "/com/canonical/Unity/Panel/Service"35#define S_PATH "/com/canonical/Unity/Panel/Service"
@@ -78,18 +79,33 @@
78IndicatorObjectFactoryRemote::~IndicatorObjectFactoryRemote ()79IndicatorObjectFactoryRemote::~IndicatorObjectFactoryRemote ()
79{80{
80 if (G_IS_OBJECT (_proxy))81 if (G_IS_OBJECT (_proxy))
82 {
83 g_signal_handler_disconnect (_proxy, _proxy_signal_id);
84 g_signal_handler_disconnect (_proxy, _proxy_name_id);
81 g_object_unref (_proxy);85 g_object_unref (_proxy);
86 }
82 _proxy = NULL;87 _proxy = NULL;
8388
84 std::vector<IndicatorObjectProxy*>::iterator it;
85
86 for (it = _indicators.begin(); it != _indicators.end(); it++)
87 {89 {
88 IndicatorObjectProxyRemote *remote = static_cast<IndicatorObjectProxyRemote *> (*it);90 std::vector<IndicatorObjectProxy*>::iterator it;
89 delete remote;91 for (it = _indicators.begin(); it != _indicators.end(); it++)
92 {
93 IndicatorObjectProxyRemote *remote = static_cast<IndicatorObjectProxyRemote *> (*it);
94 delete remote;
95 }
96 _indicators.erase (_indicators.begin (), _indicators.end ());
90 }97 }
9198
92 _indicators.erase (_indicators.begin (), _indicators.end ());99 { // We cancel all our async callbacks from pending Sync() calls
100 std::vector<SyncData *>::iterator it, eit = _sync_cancellables.end ();
101 for (it = _sync_cancellables.begin (); it != eit; ++it)
102 {
103 SyncData *data = (*it);
104 g_cancellable_cancel (data->_cancel);
105 delete data;
106 }
107 _sync_cancellables.erase (_sync_cancellables.begin (), _sync_cancellables.end ());
108 }
93}109}
94110
95std::vector<IndicatorObjectProxy *>&111std::vector<IndicatorObjectProxy *>&
@@ -134,20 +150,22 @@
134 _proxy = proxy;150 _proxy = proxy;
135151
136 // Connect to interesting signals152 // Connect to interesting signals
137 g_signal_connect (_proxy, "g-signal",153 _proxy_signal_id = g_signal_connect (_proxy, "g-signal",
138 G_CALLBACK (on_proxy_signal_received), this);154 G_CALLBACK (on_proxy_signal_received), this);
139 g_signal_connect (_proxy, "notify::g-name-owner",155 _proxy_name_id = g_signal_connect (_proxy, "notify::g-name-owner",
140 G_CALLBACK (on_proxy_name_owner_changed), this);156 G_CALLBACK (on_proxy_name_owner_changed), this);
141 }157 }
142158
159 SyncData * data = new SyncData (this);
160 _sync_cancellables.push_back (data);
143 g_dbus_proxy_call (_proxy,161 g_dbus_proxy_call (_proxy,
144 "Sync",162 "Sync",
145 NULL,163 NULL,
146 G_DBUS_CALL_FLAGS_NONE,164 G_DBUS_CALL_FLAGS_NONE,
147 -1,165 -1,
148 NULL,166 data->_cancel,
149 on_sync_ready_cb,167 on_sync_ready_cb,
150 this);168 data);
151}169}
152170
153static gboolean171static gboolean
@@ -518,17 +536,20 @@
518 }536 }
519 else if (g_strcmp0 (signal_name, "ReSync") == 0)537 else if (g_strcmp0 (signal_name, "ReSync") == 0)
520 {538 {
521 const gchar *id = g_variant_get_string (g_variant_get_child_value (parameters, 0), NULL);539 const gchar *id = g_variant_get_string (g_variant_get_child_value (parameters, 0), NULL);
522 bool sync_one = !g_strcmp0 (id, "") == 0;540 bool sync_one = !g_strcmp0 (id, "") == 0;
523541
542 SyncData *data = new SyncData (remote);
543 remote->_sync_cancellables.push_back (data);
544
524 g_dbus_proxy_call (proxy,545 g_dbus_proxy_call (proxy,
525 sync_one ? "SyncOne" : "Sync", 546 sync_one ? "SyncOne" : "Sync",
526 sync_one ? g_variant_new ("(s)", id) : NULL,547 sync_one ? g_variant_new ("(s)", id) : NULL,
527 G_DBUS_CALL_FLAGS_NONE,548 G_DBUS_CALL_FLAGS_NONE,
528 -1,549 -1,
529 NULL,550 data->_cancel,
530 on_sync_ready_cb,551 on_sync_ready_cb,
531 remote);552 data);
532 }553 }
533 else if (g_strcmp0 (signal_name, "ActiveMenuPointerMotion") == 0)554 else if (g_strcmp0 (signal_name, "ActiveMenuPointerMotion") == 0)
534 {555 {
@@ -575,7 +596,8 @@
575 GAsyncResult *res,596 GAsyncResult *res,
576 gpointer data)597 gpointer data)
577{598{
578 IndicatorObjectFactoryRemote *remote = static_cast<IndicatorObjectFactoryRemote *> (data);599 SyncData *sync_data = (SyncData *)data;
600 IndicatorObjectFactoryRemote *remote = (IndicatorObjectFactoryRemote*)sync_data->_self;
579 GVariant *args;601 GVariant *args;
580 GError *error = NULL;602 GError *error = NULL;
581603
@@ -590,5 +612,12 @@
590612
591 remote->Sync (args);613 remote->Sync (args);
592614
615 std::vector<SyncData *>::iterator it = std::find (remote->_sync_cancellables.begin (),
616 remote->_sync_cancellables.end (),
617 sync_data);
618 if (it != remote->_sync_cancellables.end ())
619 remote->_sync_cancellables.erase (it);
620
593 g_variant_unref (args);621 g_variant_unref (args);
622 delete sync_data;
594}623}
595624
=== modified file 'src/IndicatorObjectFactoryRemote.h'
--- src/IndicatorObjectFactoryRemote.h 2011-03-31 17:04:36 +0000
+++ src/IndicatorObjectFactoryRemote.h 2011-04-10 23:52:24 +0000
@@ -27,6 +27,27 @@
27#include "IndicatorObjectFactory.h"27#include "IndicatorObjectFactory.h"
28#include "IndicatorObjectProxyRemote.h"28#include "IndicatorObjectProxyRemote.h"
2929
30class SyncData
31{
32public:
33 SyncData (IndicatorObjectFactory *self)
34 : _self (self),
35 _cancel (g_cancellable_new ())
36 {
37 }
38
39 ~SyncData ()
40 {
41 g_object_unref (_cancel);
42 _cancel = NULL;
43 _self = NULL;
44 }
45
46 IndicatorObjectFactory *_self;
47 GCancellable *_cancel;
48};
49
50
30// Connects to the remote panel service (unity-panel-service) and translates51// Connects to the remote panel service (unity-panel-service) and translates
31// that into something that the panel can show52// that into something that the panel can show
32class IndicatorObjectFactoryRemote : public IndicatorObjectFactory53class IndicatorObjectFactoryRemote : public IndicatorObjectFactory
@@ -52,10 +73,14 @@
5273
53 GDBusProxy * GetRemoteProxy ();74 GDBusProxy * GetRemoteProxy ();
5475
76 std::vector<SyncData*> _sync_cancellables;
77
55private:78private:
56 IndicatorObjectProxyRemote* IndicatorForID (const char *id);79 IndicatorObjectProxyRemote* IndicatorForID (const char *id);
57private:80private:
58 GDBusProxy *_proxy;81 GDBusProxy *_proxy;
82 guint32 _proxy_signal_id;
83 guint32 _proxy_name_id;
59};84};
6085
61#endif // INDICATOR_OBJECT_FACTORY_REMOTE_H86#endif // INDICATOR_OBJECT_FACTORY_REMOTE_H
6287
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-04-07 10:22:48 +0000
+++ src/PanelMenuView.cpp 2011-04-10 23:52:24 +0000
@@ -121,10 +121,10 @@
121121
122 // Register for all the interesting events122 // Register for all the interesting events
123 UBusServer *ubus = ubus_server_get_default ();123 UBusServer *ubus = ubus_server_get_default ();
124 ubus_server_register_interest (ubus, UBUS_PLACE_VIEW_SHOWN,124 _place_shown_interest = ubus_server_register_interest (ubus, UBUS_PLACE_VIEW_SHOWN,
125 (UBusCallback)PanelMenuView::OnPlaceViewShown,125 (UBusCallback)PanelMenuView::OnPlaceViewShown,
126 this);126 this);
127 ubus_server_register_interest (ubus, UBUS_PLACE_VIEW_HIDDEN,127 _place_hidden_interest = ubus_server_register_interest (ubus, UBUS_PLACE_VIEW_HIDDEN,
128 (UBusCallback)PanelMenuView::OnPlaceViewHidden,128 (UBusCallback)PanelMenuView::OnPlaceViewHidden,
129 this);129 this);
130130
@@ -169,6 +169,8 @@
169 _window_buttons->UnReference ();169 _window_buttons->UnReference ();
170 _panel_titlebar_grab_area->UnReference ();170 _panel_titlebar_grab_area->UnReference ();
171171
172 ubus_server_unregister_interest (ubus_server_get_default (), _place_shown_interest);
173 ubus_server_unregister_interest (ubus_server_get_default (), _place_hidden_interest);
172}174}
173175
174void176void
@@ -372,9 +374,10 @@
372 }374 }
373 else375 else
374 {376 {
375 gPainter.PushDrawLayer (GfxContext,377 if (_title_layer)
376 geo,378 gPainter.PushDrawLayer (GfxContext,
377 _title_layer);379 geo,
380 _title_layer);
378 }381 }
379 }382 }
380383
381384
=== modified file 'src/PanelMenuView.h'
--- src/PanelMenuView.h 2011-03-29 17:51:28 +0000
+++ src/PanelMenuView.h 2011-04-10 23:52:24 +0000
@@ -161,5 +161,8 @@
161 sigc::connection _on_panelstyle_changed_connection;161 sigc::connection _on_panelstyle_changed_connection;
162 162
163 gulong _activate_window_changed_id;163 gulong _activate_window_changed_id;
164
165 guint32 _place_shown_interest;
166 guint32 _place_hidden_interest;
164};167};
165#endif168#endif
166169
=== modified file 'src/PlacesGroupController.cpp'
--- src/PlacesGroupController.cpp 2011-03-31 21:38:40 +0000
+++ src/PlacesGroupController.cpp 2011-04-10 23:52:24 +0000
@@ -214,7 +214,8 @@
214void214void
215PlacesGroupController::Clear ()215PlacesGroupController::Clear ()
216{216{
217217 if (_group->GetChildLayout ())
218 _group->GetChildLayout ()->Clear ();
218}219}
219220
220void221void
221222
=== modified file 'src/PlacesSearchBar.cpp'
--- src/PlacesSearchBar.cpp 2011-04-06 17:53:41 +0000
+++ src/PlacesSearchBar.cpp 2011-04-10 23:52:24 +0000
@@ -53,7 +53,7 @@
53 _live_search_timeout (0)53 _live_search_timeout (0)
54{54{
55 PlacesStyle *style = PlacesStyle::GetDefault ();55 PlacesStyle *style = PlacesStyle::GetDefault ();
56 nux::BaseTexture *icon = style->GetSearchReadyIcon ();56 nux::BaseTexture *icon = style->GetSearchMagnifyIcon ();
5757
58 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);58 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);
5959
6060
=== modified file 'src/PlacesSearchBarSpinner.cpp'
--- src/PlacesSearchBarSpinner.cpp 2011-04-06 17:53:41 +0000
+++ src/PlacesSearchBarSpinner.cpp 2011-04-10 23:52:24 +0000
@@ -33,10 +33,11 @@
33{33{
34 PlacesStyle *style = PlacesStyle::GetDefault ();34 PlacesStyle *style = PlacesStyle::GetDefault ();
3535
36 _search_ready = style->GetSearchReadyIcon ();36 _magnify = style->GetSearchMagnifyIcon ();
37 _clear_full = style->GetSearchClearIcon ();37 _close = style->GetSearchCloseIcon ();
38 _clear_alone = style->GetSearchClearAloneIcon ();38 _close_glow = style->GetSearchCloseGlowIcon ();
39 _clear_spinner = style->GetSearchClearSpinnerIcon ();39 _spin = style->GetSearchSpinIcon ();
40 _spin_glow = style->GetSearchSpinGlowIcon ();
4041
41 _2d_rotate.Identity ();42 _2d_rotate.Identity ();
42 _2d_rotate.Rotate_z (0.0);43 _2d_rotate.Rotate_z (0.0);
@@ -69,56 +70,85 @@
69 texxform.min_filter = nux::TEXFILTER_LINEAR;70 texxform.min_filter = nux::TEXFILTER_LINEAR;
70 texxform.mag_filter = nux::TEXFILTER_LINEAR;71 texxform.mag_filter = nux::TEXFILTER_LINEAR;
7172
73 GfxContext.QRP_1Tex (geo.x + ((geo.width - _spin_glow->GetWidth ())/2),
74 geo.y + ((geo.height - _spin_glow->GetHeight ())/2),
75 _spin_glow->GetWidth (),
76 _spin_glow->GetHeight (),
77 _spin_glow->GetDeviceTexture (),
78 texxform,
79 nux::Colors::White);
80
72 if (_state == STATE_READY)81 if (_state == STATE_READY)
73 {82 {
74 GfxContext.QRP_1Tex (geo.x + ((geo.width - _search_ready->GetWidth ())/2),83 GfxContext.QRP_1Tex (geo.x + ((geo.width - _magnify->GetWidth ())/2),
75 geo.y + ((geo.height - _search_ready->GetHeight ())/2),84 geo.y + ((geo.height - _magnify->GetHeight ())/2),
76 _search_ready->GetWidth (),85 _magnify->GetWidth (),
77 _search_ready->GetHeight (),86 _magnify->GetHeight (),
78 _search_ready->GetDeviceTexture (),87 _magnify->GetDeviceTexture (),
79 texxform,88 texxform,
80 nux::Colors::White);89 nux::Colors::White);
81 }90 }
82 else if (_state == STATE_SEARCHING)91 else if (_state == STATE_SEARCHING)
83 {92 {
84 nux::Geometry clear_geo (geo.x + ((geo.width - _clear_spinner->GetWidth ())/2),93 nux::Geometry spin_geo (geo.x + ((geo.width - _spin->GetWidth ())/2),
85 geo.y + ((geo.height - _clear_spinner->GetHeight ())/2),94 geo.y + ((geo.height - _spin->GetHeight ())/2),
86 _clear_spinner->GetWidth (),95 _spin->GetWidth (),
87 _clear_spinner->GetHeight ());96 _spin->GetHeight ());
97 int spin_offset_w = (geo.width % 2) ? 0 : 1;
98 int spin_offset_h = (geo.height % 2) ? 0 : 1;
8899
89 GfxContext.PushModelViewMatrix (nux::Matrix4::TRANSLATE(-clear_geo.x - clear_geo.width / 2,100 GfxContext.PushModelViewMatrix (nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
90 -clear_geo.y - clear_geo.height / 2, 0));101 -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0));
91 GfxContext.PushModelViewMatrix (_2d_rotate); 102 GfxContext.PushModelViewMatrix (_2d_rotate);
92 GfxContext.PushModelViewMatrix (nux::Matrix4::TRANSLATE(clear_geo.x + clear_geo.width/ 2,103 GfxContext.PushModelViewMatrix (nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w)/ 2.0f,
93 clear_geo.y + clear_geo.height / 2, 0));104 spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0));
94105
95 GfxContext.QRP_1Tex (clear_geo.x,106 GfxContext.QRP_1Tex (spin_geo.x,
96 clear_geo.y,107 spin_geo.y,
97 clear_geo.width,108 spin_geo.width,
98 clear_geo.height,109 spin_geo.height,
99 _clear_spinner->GetDeviceTexture (),110 _spin->GetDeviceTexture (),
100 texxform,111 texxform,
101 nux::Colors::White);112 nux::Colors::White);
102113
103 GfxContext.PopModelViewMatrix ();114 GfxContext.PopModelViewMatrix ();
104 GfxContext.PopModelViewMatrix ();115 GfxContext.PopModelViewMatrix ();
105 GfxContext.PopModelViewMatrix ();116 GfxContext.PopModelViewMatrix ();
106
107 GfxContext.QRP_1Tex (geo.x + ((geo.width - _clear_alone->GetWidth ())/2),
108 geo.y + ((geo.height - _clear_alone->GetHeight ())/2),
109 _clear_alone->GetWidth (),
110 _clear_alone->GetHeight (),
111 _clear_alone->GetDeviceTexture (),
112 texxform,
113 nux::Colors::White);
114 }117 }
115 else118 else
116 {119 {
117 GfxContext.QRP_1Tex (geo.x + ((geo.width - _clear_full->GetWidth ())/2),120 texxform.FlipVCoord (true);
118 geo.y + ((geo.height - _clear_full->GetHeight ())/2),121 GfxContext.QRP_1Tex (geo.x + ((geo.width - _spin->GetWidth ())/2),
119 _clear_full->GetWidth (),122 geo.y + ((geo.height - _spin->GetHeight ())/2),
120 _clear_full->GetHeight (),123 _spin->GetWidth (),
121 _clear_full->GetDeviceTexture (),124 _spin->GetHeight (),
125 _spin->GetDeviceTexture (),
126 texxform,
127 nux::Colors::White);
128 texxform.FlipVCoord (false);
129
130 GfxContext.QRP_1Tex (geo.x + ((geo.width - _spin->GetWidth ())/2),
131 geo.y + ((geo.height - _spin->GetHeight ())/2),
132 _spin->GetWidth (),
133 _spin->GetHeight (),
134 _spin->GetDeviceTexture (),
135 texxform,
136 nux::Colors::White);
137
138
139 GfxContext.QRP_1Tex (geo.x + ((geo.width - _close_glow->GetWidth ())/2),
140 geo.y + ((geo.height - _close_glow->GetHeight ())/2),
141 _close_glow->GetWidth (),
142 _close_glow->GetHeight (),
143 _close_glow->GetDeviceTexture (),
144 texxform,
145 nux::Colors::White);
146
147 GfxContext.QRP_1Tex (geo.x + ((geo.width - _close->GetWidth ())/2),
148 geo.y + ((geo.height - _close->GetHeight ())/2),
149 _close->GetWidth (),
150 _close->GetHeight (),
151 _close->GetDeviceTexture (),
122 texxform,152 texxform,
123 nux::Colors::White);153 nux::Colors::White);
124 }154 }
125155
=== modified file 'src/PlacesSearchBarSpinner.h'
--- src/PlacesSearchBarSpinner.h 2011-03-23 23:18:03 +0000
+++ src/PlacesSearchBarSpinner.h 2011-04-10 23:52:24 +0000
@@ -58,10 +58,11 @@
58private:58private:
59 SpinnerState _state;59 SpinnerState _state;
6060
61 nux::BaseTexture *_search_ready;61 nux::BaseTexture *_magnify;
62 nux::BaseTexture *_clear_full;62 nux::BaseTexture *_close;
63 nux::BaseTexture *_clear_alone;63 nux::BaseTexture *_close_glow;
64 nux::BaseTexture *_clear_spinner;64 nux::BaseTexture *_spin;
65 nux::BaseTexture *_spin_glow;
6566
66 nux::Matrix4 _2d_rotate;67 nux::Matrix4 _2d_rotate;
67 float _rotation;68 float _rotation;
6869
=== modified file 'src/PlacesSimpleTile.cpp'
--- src/PlacesSimpleTile.cpp 2011-04-07 12:36:20 +0000
+++ src/PlacesSimpleTile.cpp 2011-04-10 23:52:24 +0000
@@ -48,16 +48,16 @@
4848
49 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);49 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);
50 _icontex->SetMinMaxSize (style->GetTileWidth (), icon_size);50 _icontex->SetMinMaxSize (style->GetTileWidth (), icon_size);
51 _icontex->SinkReference ();
52 AddChild (_icontex);51 AddChild (_icontex);
5352
53
54 _cairotext = new nux::StaticCairoText ("");54 _cairotext = new nux::StaticCairoText ("");
55 _cairotext->SetMaximumWidth (style->GetTileWidth ());55 _cairotext->SetMaximumWidth (style->GetTileWidth ());
56 _cairotext->SinkReference ();56 _cairotext->SinkReference ();
57 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);57 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);
58 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);58 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);
59 _cairotext->SetText (_label);59 _cairotext->SetText (_label);
60 60
61 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));61 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
62 layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);62 layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);
63 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));63 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
@@ -73,11 +73,6 @@
7373
74PlacesSimpleTile::~PlacesSimpleTile ()74PlacesSimpleTile::~PlacesSimpleTile ()
75{75{
76 _icontex->UnReference ();
77 _icontex = NULL;
78 _cairotext->UnReference ();
79 _cairotext = NULL;
80
81 g_free (_label);76 g_free (_label);
82 g_free (_icon);77 g_free (_icon);
83 g_free (_uri);78 g_free (_uri);
8479
=== modified file 'src/PlacesStyle.cpp'
--- src/PlacesStyle.cpp 2011-04-10 15:08:29 +0000
+++ src/PlacesStyle.cpp 2011-04-10 23:52:24 +0000
@@ -38,10 +38,11 @@
38 _dash_right_texture (NULL),38 _dash_right_texture (NULL),
39 _dash_corner_texture (NULL),39 _dash_corner_texture (NULL),
40 _dash_fullscreen_icon (NULL),40 _dash_fullscreen_icon (NULL),
41 _search_ready_texture (NULL),41 _search_magnify_texture (NULL),
42 _search_clear_texture (NULL),42 _search_close_texture (NULL),
43 _search_clear_alone_texture (NULL),43 _search_close_glow_texture (NULL),
44 _search_clear_spinner_texture (NULL),44 _search_spin_texture (NULL),
45 _search_spin_glow_texture (NULL),
45 _group_unexpand_texture (NULL),46 _group_unexpand_texture (NULL),
46 _group_expand_texture (NULL)47 _group_expand_texture (NULL)
47{48{
@@ -63,14 +64,14 @@
63 _dash_corner_texture->UnReference ();64 _dash_corner_texture->UnReference ();
64 if (_dash_fullscreen_icon)65 if (_dash_fullscreen_icon)
65 _dash_fullscreen_icon->UnReference ();66 _dash_fullscreen_icon->UnReference ();
66 if (_search_ready_texture)67 if (_search_magnify_texture)
67 _search_ready_texture->UnReference ();68 _search_magnify_texture->UnReference ();
68 if (_search_clear_texture)69 if (_search_close_texture)
69 _search_clear_texture->UnReference ();70 _search_close_texture->UnReference ();
70 if (_search_clear_alone_texture)71 if (_search_close_glow_texture)
71 _search_clear_alone_texture->UnReference ();72 _search_close_glow_texture->UnReference ();
72 if (_search_clear_spinner_texture)73 if (_search_spin_texture)
73 _search_clear_spinner_texture->UnReference ();74 _search_spin_texture->UnReference ();
74 if (_group_unexpand_texture)75 if (_group_unexpand_texture)
75 _group_unexpand_texture->UnReference ();76 _group_unexpand_texture->UnReference ();
76 if (_group_expand_texture)77 if (_group_expand_texture)
@@ -176,35 +177,43 @@
176}177}
177178
178nux::BaseTexture *179nux::BaseTexture *
179PlacesStyle::GetSearchReadyIcon ()180PlacesStyle::GetSearchMagnifyIcon ()
180{181{
181 if (!_search_ready_texture)182 if (!_search_magnify_texture)
182 _search_ready_texture = TextureFromFilename (PKGDATADIR"/search_ready_icon.png");183 _search_magnify_texture = TextureFromFilename (PKGDATADIR"/search_magnify.png");
183 return _search_ready_texture;184 return _search_magnify_texture;
184}185}
185186
186nux::BaseTexture *187nux::BaseTexture *
187PlacesStyle::GetSearchClearIcon ()188PlacesStyle::GetSearchCloseIcon ()
188{189{
189 if (!_search_clear_texture)190 if (!_search_close_texture)
190 _search_clear_texture = TextureFromFilename (PKGDATADIR"/search_clear_icon.png");191 _search_close_texture = TextureFromFilename (PKGDATADIR"/search_close.png");
191 return _search_clear_texture;192 return _search_close_texture;
192}193}
193194
194nux::BaseTexture *195nux::BaseTexture *
195PlacesStyle::GetSearchClearAloneIcon ()196PlacesStyle::GetSearchCloseGlowIcon ()
196{197{
197 if (!_search_clear_alone_texture)198 if (!_search_close_glow_texture)
198 _search_clear_alone_texture = TextureFromFilename (PKGDATADIR"/search_clear_alone.png");199 _search_close_glow_texture = TextureFromFilename (PKGDATADIR"/search_close_glow.png");
199 return _search_clear_alone_texture;200 return _search_close_glow_texture;
200}201}
201202
202nux::BaseTexture *203nux::BaseTexture *
203PlacesStyle::GetSearchClearSpinnerIcon ()204PlacesStyle::GetSearchSpinIcon ()
204{205{
205 if (!_search_clear_spinner_texture)206 if (!_search_spin_texture)
206 _search_clear_spinner_texture = TextureFromFilename (PKGDATADIR"/search_clear_spinner.png");207 _search_spin_texture = TextureFromFilename (PKGDATADIR"/search_spin.png");
207 return _search_clear_spinner_texture;208 return _search_spin_texture;
209}
210
211nux::BaseTexture *
212PlacesStyle::GetSearchSpinGlowIcon ()
213{
214 if (!_search_spin_glow_texture)
215 _search_spin_glow_texture = TextureFromFilename (PKGDATADIR"/search_spin_glow.png");
216 return _search_spin_glow_texture;
208}217}
209218
210nux::BaseTexture *219nux::BaseTexture *
211220
=== modified file 'src/PlacesStyle.h'
--- src/PlacesStyle.h 2011-03-23 22:33:25 +0000
+++ src/PlacesStyle.h 2011-04-10 23:52:24 +0000
@@ -50,10 +50,11 @@
50 nux::BaseTexture * GetDashCorner ();50 nux::BaseTexture * GetDashCorner ();
51 nux::BaseTexture * GetDashFullscreenIcon ();51 nux::BaseTexture * GetDashFullscreenIcon ();
5252
53 nux::BaseTexture * GetSearchReadyIcon ();53 nux::BaseTexture * GetSearchMagnifyIcon ();
54 nux::BaseTexture * GetSearchClearIcon ();54 nux::BaseTexture * GetSearchCloseIcon ();
55 nux::BaseTexture * GetSearchClearAloneIcon ();55 nux::BaseTexture * GetSearchCloseGlowIcon ();
56 nux::BaseTexture * GetSearchClearSpinnerIcon ();56 nux::BaseTexture * GetSearchSpinIcon ();
57 nux::BaseTexture * GetSearchSpinGlowIcon ();
5758
58 nux::BaseTexture * GetGroupUnexpandIcon ();59 nux::BaseTexture * GetGroupUnexpandIcon ();
59 nux::BaseTexture * GetGroupExpandIcon ();60 nux::BaseTexture * GetGroupExpandIcon ();
@@ -80,10 +81,11 @@
80 nux::BaseTexture *_dash_corner_texture;81 nux::BaseTexture *_dash_corner_texture;
81 nux::BaseTexture *_dash_fullscreen_icon;82 nux::BaseTexture *_dash_fullscreen_icon;
8283
83 nux::BaseTexture *_search_ready_texture;84 nux::BaseTexture *_search_magnify_texture;
84 nux::BaseTexture *_search_clear_texture;85 nux::BaseTexture *_search_close_texture;
85 nux::BaseTexture *_search_clear_alone_texture;86 nux::BaseTexture *_search_close_glow_texture;
86 nux::BaseTexture *_search_clear_spinner_texture;87 nux::BaseTexture *_search_spin_texture;
88 nux::BaseTexture *_search_spin_glow_texture;
8789
88 nux::BaseTexture *_group_unexpand_texture;90 nux::BaseTexture *_group_unexpand_texture;
89 nux::BaseTexture *_group_expand_texture;91 nux::BaseTexture *_group_expand_texture;
9092
=== modified file 'src/PlacesView.cpp'
--- src/PlacesView.cpp 2011-04-06 17:53:41 +0000
+++ src/PlacesView.cpp 2011-04-10 23:52:24 +0000
@@ -51,7 +51,8 @@
51 _resize_id (0),51 _resize_id (0),
52 _alt_f2_entry (NULL),52 _alt_f2_entry (NULL),
53 _searching_timeout (0),53 _searching_timeout (0),
54 _pending_activation (false)54 _pending_activation (false),
55 _search_empty (false)
55{56{
56 LoadPlaces ();57 LoadPlaces ();
57 _factory->place_added.connect (sigc::mem_fun (this, &PlacesView::OnPlaceAdded));58 _factory->place_added.connect (sigc::mem_fun (this, &PlacesView::OnPlaceAdded));
@@ -424,7 +425,6 @@
424void425void
425PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)426PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
426{427{
427
428 if (signal)428 if (signal)
429 entry_changed.emit (entry);429 entry_changed.emit (entry);
430430
@@ -452,6 +452,7 @@
452452
453 _entry->SetActive (true);453 _entry->SetActive (true);
454 _search_bar->SetActiveEntry (_entry, section_id, search_string);454 _search_bar->SetActiveEntry (_entry, section_id, search_string);
455 _search_empty = (g_strcmp0 (search_string, "") == 0 && _entry == _home_entry);
455456
456 _entry->ForeachGroup (sigc::mem_fun (this, &PlacesView::OnGroupAdded));457 _entry->ForeachGroup (sigc::mem_fun (this, &PlacesView::OnGroupAdded));
457 _entry->ForeachResult (sigc::mem_fun (this, &PlacesView::OnResultAdded));458 _entry->ForeachResult (sigc::mem_fun (this, &PlacesView::OnResultAdded));
@@ -619,6 +620,10 @@
619void620void
620PlacesView::OnResultAdded (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result)621PlacesView::OnResultAdded (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result)
621{622{
623 // We never show these so ignore them
624 if (_search_empty)
625 return;
626
622 _n_results++;627 _n_results++;
623628
624 if (_n_results <= 2629 if (_n_results <= 2
@@ -729,12 +734,15 @@
729void734void
730PlacesView::OnSearchChanged (const char *search_string)735PlacesView::OnSearchChanged (const char *search_string)
731{736{
737 _search_empty = false;
738
732 if (_entry == _home_entry)739 if (_entry == _home_entry)
733 {740 {
734 if (g_strcmp0 (search_string, "") == 0)741 if (g_strcmp0 (search_string, "") == 0)
735 {742 {
736 _layered_layout->SetActiveLayer (_home_view);743 _layered_layout->SetActiveLayer (_home_view);
737 _home_view->QueueDraw ();744 _home_view->QueueDraw ();
745 _search_empty = true;
738 }746 }
739 else747 else
740 {748 {
741749
=== modified file 'src/PlacesView.h'
--- src/PlacesView.h 2011-03-31 14:26:00 +0000
+++ src/PlacesView.h 2011-04-10 23:52:24 +0000
@@ -170,6 +170,8 @@
170 guint _n_results;170 guint _n_results;
171 guint _searching_timeout;171 guint _searching_timeout;
172 bool _pending_activation;172 bool _pending_activation;
173
174 bool _search_empty;
173};175};
174176
175#endif // PANEL_HOME_BUTTON_H177#endif // PANEL_HOME_BUTTON_H
176178
=== modified file 'src/QuicklistView.cpp'
--- src/QuicklistView.cpp 2011-04-06 17:53:41 +0000
+++ src/QuicklistView.cpp 2011-04-10 23:52:24 +0000
@@ -126,14 +126,19 @@
126bool126bool
127QuicklistView::IsMenuItemSeperator (int index)127QuicklistView::IsMenuItemSeperator (int index)
128{128{
129 DbusmenuMenuitem* item = NULL;129 QuicklistMenuItem* menu_item = NULL;
130 const gchar* label = NULL;130 DbusmenuMenuitem* item = NULL;
131 bool result = false;131 const gchar* label = NULL;
132 bool result = false;
132133
133 if (index < 0)134 if (index < 0)
134 return false;135 return false;
135136
136 item = GetNthItems (index)->_menuItem;137 menu_item = GetNthItems (index);
138 if (!menu_item)
139 return false;
140
141 item = menu_item->_menuItem;
137 if (!item)142 if (!item)
138 return false;143 return false;
139144
140145
=== modified file 'src/StaticCairoText.cpp'
--- src/StaticCairoText.cpp 2011-04-10 22:12:26 +0000
+++ src/StaticCairoText.cpp 2011-04-10 23:52:24 +0000
@@ -490,7 +490,7 @@
490490
491 _texture2D = GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();491 _texture2D = GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
492 _texture2D->Update (bitmap);492 _texture2D->Update (bitmap);
493 493
494 delete bitmap;494 delete bitmap;
495495
496 cairo_destroy (cr);496 cairo_destroy (cr);
497497
=== modified file 'src/UScreen.cpp'
--- src/UScreen.cpp 2011-03-22 16:44:47 +0000
+++ src/UScreen.cpp 2011-04-10 23:52:24 +0000
@@ -94,6 +94,7 @@
94{94{
95 GdkScreen *screen;95 GdkScreen *screen;
96 int primary;96 int primary;
97 nux::Geometry last_geo (0, 0, 1, 1);
97 98
98 screen = gdk_screen_get_default ();99 screen = gdk_screen_get_default ();
99 primary = GetPrimaryMonitor ();100 primary = GetPrimaryMonitor ();
@@ -109,6 +110,12 @@
109 gdk_screen_get_monitor_geometry (screen, i, &rect);110 gdk_screen_get_monitor_geometry (screen, i, &rect);
110111
111 nux::Geometry geo (rect.x, rect.y, rect.width, rect.height);112 nux::Geometry geo (rect.x, rect.y, rect.width, rect.height);
113
114 // Check for mirrored displays
115 if (geo == last_geo)
116 continue;
117 last_geo = geo;
118
112 _monitors.push_back (geo);119 _monitors.push_back (geo);
113120
114 g_print (" Monitor %d%s\n", i, i == primary ? "(primary)" : "");121 g_print (" Monitor %d%s\n", i, i == primary ? "(primary)" : "");
115122
=== modified file 'tests/TestPlacesBackend.cpp'
--- tests/TestPlacesBackend.cpp 2011-02-26 16:48:18 +0000
+++ tests/TestPlacesBackend.cpp 2011-04-10 23:52:24 +0000
@@ -36,6 +36,10 @@
3636
37 _vbox = gtk_vbox_new (FALSE, 12);37 _vbox = gtk_vbox_new (FALSE, 12);
38 gtk_container_add (GTK_CONTAINER (_window), _vbox);38 gtk_container_add (GTK_CONTAINER (_window), _vbox);
39
40 _entry = gtk_entry_new ();
41 gtk_box_pack_start (GTK_BOX (_vbox), _entry, FALSE, FALSE, 0);
42 g_signal_connect (_entry, "changed", G_CALLBACK (OnEntryChanged), this);
39 43
40 _combo = gtk_combo_box_text_new ();44 _combo = gtk_combo_box_text_new ();
41 gtk_box_pack_start (GTK_BOX (_vbox), _combo, FALSE, FALSE, 0);45 gtk_box_pack_start (GTK_BOX (_vbox), _combo, FALSE, FALSE, 0);
@@ -48,6 +52,8 @@
48 PopulateEntries ();52 PopulateEntries ();
49 _factory->place_added.connect (sigc::mem_fun (this, &TestApp::OnPlaceAdded));53 _factory->place_added.connect (sigc::mem_fun (this, &TestApp::OnPlaceAdded));
5054
55 gtk_combo_box_set_active (GTK_COMBO_BOX (_combo), 0);
56
51 gtk_widget_show_all (_window);57 gtk_widget_show_all (_window);
52 }58 }
5359
@@ -66,6 +72,8 @@
66 PlaceEntry *entry = static_cast<PlaceEntry *> (*i);72 PlaceEntry *entry = static_cast<PlaceEntry *> (*i);
67 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (_combo), entry->GetName ());73 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (_combo), entry->GetName ());
68 }74 }
75
76 gtk_combo_box_set_active (GTK_COMBO_BOX (_combo), 0);
69 }77 }
7078
71 void PopulateEntries ()79 void PopulateEntries ()
@@ -87,6 +95,16 @@
87 }95 }
88 }96 }
8997
98 static void OnEntryChanged (GtkEditable *editable, TestApp *self)
99 {
100 if (self->_active)
101 {
102 std::map<gchar*, gchar*> hints;
103 self->_active->SetSearch (gtk_entry_get_text (GTK_ENTRY (self->_entry)),
104 hints);
105 }
106 }
107
90 static void OnComboChanged (GtkWidget *combo, TestApp *self)108 static void OnComboChanged (GtkWidget *combo, TestApp *self)
91 {109 {
92 self->OnComboChangedFoRealz ();110 self->OnComboChangedFoRealz ();
@@ -110,33 +128,7 @@
110 for (i = entries.begin (); i != entries.end (); ++i)128 for (i = entries.begin (); i != entries.end (); ++i)
111 {129 {
112 PlaceEntry *entry = static_cast<PlaceEntry *> (*i);130 PlaceEntry *entry = static_cast<PlaceEntry *> (*i);
113131 _active = entry;
114 if (g_strcmp0 (txt, entry->GetName ()) == 0)
115 {
116 //FIXME : Update when we have sections support
117#if 0
118 DeeModel *sections = entry->GetSectionsModel ();
119 DeeModelIter *iter;
120
121 // Update the sections
122
123 for (gint i = 0; i < _n_secs; i++)
124 {
125 gtk_combo_box_remove_text (GTK_COMBO_BOX (_seccombo), 0);
126 }
127
128 iter = dee_model_get_first_iter (sections);
129 while (!dee_model_is_last(sections, iter))
130 {
131 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (_seccombo), dee_model_get_string (sections, iter, 0));
132 _n_secs++;
133
134 iter = dee_model_next (sections, iter);
135 }
136
137 gtk_combo_box_set_active (GTK_COMBO_BOX (_seccombo), 0);
138#endif
139 }
140 }132 }
141 }133 }
142134
@@ -147,9 +139,12 @@
147139
148 GtkWidget *_window;140 GtkWidget *_window;
149 GtkWidget *_vbox;141 GtkWidget *_vbox;
142 GtkWidget *_entry;
150 GtkWidget *_combo;143 GtkWidget *_combo;
151 GtkWidget *_seccombo;144 GtkWidget *_seccombo;
152 gint _n_secs;145 gint _n_secs;
146
147 PlaceEntry *_active;
153};148};
154149
155150