Merge lp:~desrt/indicator-appmenu/hud-rewrite-wip into lp:indicator-appmenu/0.4

Proposed by Allison Karlitskaya
Status: Merged
Approved by: Charles Kerr
Approved revision: 242
Merge reported by: Charles Kerr
Merged at revision: not available
Proposed branch: lp:~desrt/indicator-appmenu/hud-rewrite-wip
Merge into: lp:indicator-appmenu/0.4
Diff against target: 493 lines (+106/-28)
12 files modified
src/hudappindicatorsource.c (+28/-2)
src/huddbusmenucollector.c (+37/-5)
src/huddbusmenucollector.h (+5/-1)
src/huddebugsource.c (+1/-1)
src/hudindicatorsource.c (+1/-0)
src/huditem.c (+10/-4)
src/huditem.h (+2/-0)
src/hudmenumodelcollector.c (+9/-4)
src/hudmenumodelcollector.h (+2/-1)
src/hudquery.c (+0/-8)
src/hudwindowsource.c (+7/-2)
tools-vala/hud-gtk.vala (+4/-0)
To merge this branch: bzr merge lp:~desrt/indicator-appmenu/hud-rewrite-wip
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+99046@code.launchpad.net

Description of the change

add back support for icons

also, remove some comments that no longer apply

To post a comment you must log in.
241. By Allison Karlitskaya

hud-gtk: close query if we have the empty string

242. By Allison Karlitskaya

hud: don't send duplicate OPENED events on property changes

Revision history for this message
Charles Kerr (charlesk) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/hudappindicatorsource.c'
--- src/hudappindicatorsource.c 2012-03-15 18:26:35 +0000
+++ src/hudappindicatorsource.c 2012-03-26 15:29:24 +0000
@@ -83,9 +83,11 @@
83 const gchar *dbus_path;83 const gchar *dbus_path;
84 GSequenceIter *iter;84 GSequenceIter *iter;
85 const gchar *id;85 const gchar *id;
86 const gchar *icon_name;
86 gint32 position;87 gint32 position;
87 gchar *title;88 gchar *title;
8889
90 g_variant_get_child (description, 0, "&s", &icon_name);
89 g_variant_get_child (description, 1, "i", &position);91 g_variant_get_child (description, 1, "i", &position);
90 g_variant_get_child (description, 2, "&s", &dbus_name);92 g_variant_get_child (description, 2, "&s", &dbus_name);
91 g_variant_get_child (description, 3, "&o", &dbus_path);93 g_variant_get_child (description, 3, "&o", &dbus_path);
@@ -102,9 +104,10 @@
102 for Network Manager would be 'nm-applet'. */104 for Network Manager would be 'nm-applet'. */
103 title = g_strdup_printf(_("Untitled Indicator (%s)"), id);105 title = g_strdup_printf(_("Untitled Indicator (%s)"), id);
104 }106 }
105 g_debug ("adding appindicator %s at %d ('%s', %s, %s)", id, position, title, dbus_name, dbus_path);107 g_debug ("adding appindicator %s at %d ('%s', %s, %s, %s)", id, position, title, icon_name, dbus_name, dbus_path);
106108
107 collector = hud_dbusmenu_collector_new_for_endpoint (id, title, hud_settings.indicator_penalty,109 collector = hud_dbusmenu_collector_new_for_endpoint (id, title, icon_name,
110 hud_settings.indicator_penalty,
108 dbus_name, dbus_path);111 dbus_name, dbus_path);
109 g_signal_connect (collector, "changed", G_CALLBACK (hud_app_indicator_source_collector_changed), source);112 g_signal_connect (collector, "changed", G_CALLBACK (hud_app_indicator_source_collector_changed), source);
110113
@@ -201,6 +204,29 @@
201 hud_dbusmenu_collector_set_prefix (collector, title);204 hud_dbusmenu_collector_set_prefix (collector, title);
202 }205 }
203 }206 }
207
208 else if (g_str_equal (signal_name, "ApplicationIconChanged"))
209 {
210 GSequenceIter *iter;
211 const gchar *icon;
212 gint32 position;
213
214 if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(iss)")))
215 return;
216
217 g_variant_get (parameters, "(i&ss)", &position, &icon, NULL);
218
219 g_debug ("changing icon of appindicator at %d to '%s'", position, icon);
220
221 iter = g_sequence_get_iter_at_pos (source->indicators, position);
222 if (!g_sequence_iter_is_end (iter))
223 {
224 HudDbusmenuCollector *collector;
225
226 collector = g_sequence_get (iter);
227 hud_dbusmenu_collector_set_icon (collector, icon);
228 }
229 }
204}230}
205231
206static void232static void
207233
=== modified file 'src/huddbusmenucollector.c'
--- src/huddbusmenucollector.c 2012-03-17 16:07:32 +0000
+++ src/huddbusmenucollector.c 2012-03-26 15:29:24 +0000
@@ -159,6 +159,7 @@
159static HudDbusmenuItem *159static HudDbusmenuItem *
160hud_dbusmenu_item_new (HudStringList *context,160hud_dbusmenu_item_new (HudStringList *context,
161 const gchar *desktop_file,161 const gchar *desktop_file,
162 const gchar *icon,
162 DbusmenuMenuitem *menuitem)163 DbusmenuMenuitem *menuitem)
163{164{
164 HudStringList *tokens;165 HudStringList *tokens;
@@ -195,7 +196,7 @@
195 if (enabled)196 if (enabled)
196 enabled &= !dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);197 enabled &= !dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY);
197198
198 item = hud_item_construct (hud_dbusmenu_item_get_type (), tokens, desktop_file, enabled);199 item = hud_item_construct (hud_dbusmenu_item_get_type (), tokens, desktop_file, icon, enabled);
199 item->menuitem = g_object_ref (menuitem);200 item->menuitem = g_object_ref (menuitem);
200201
201 hud_string_list_unref (tokens);202 hud_string_list_unref (tokens);
@@ -211,6 +212,7 @@
211 DbusmenuMenuitem *root;212 DbusmenuMenuitem *root;
212 gchar *application_id;213 gchar *application_id;
213 HudStringList *prefix;214 HudStringList *prefix;
215 gchar *icon;
214 GHashTable *items;216 GHashTable *items;
215 guint penalty;217 guint penalty;
216 guint xid;218 guint xid;
@@ -357,6 +359,7 @@
357 DbusmenuMenuitem *parent;359 DbusmenuMenuitem *parent;
358 HudStringList *context;360 HudStringList *context;
359 HudDbusmenuItem *item;361 HudDbusmenuItem *item;
362 gboolean was_open;
360363
361 g_assert (!collector->reentrance_check);364 g_assert (!collector->reentrance_check);
362365
@@ -372,10 +375,13 @@
372 else375 else
373 context = collector->prefix;376 context = collector->prefix;
374377
375 item = hud_dbusmenu_item_new (context, collector->application_id, menuitem);378 item = g_hash_table_lookup (collector->items, menuitem);
379 was_open = item->is_opened;
376 g_hash_table_remove (collector->items, menuitem);380 g_hash_table_remove (collector->items, menuitem);
377381
378 if (collector->use_count && dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY))382 item = hud_dbusmenu_item_new (context, collector->application_id, collector->icon, menuitem);
383
384 if (collector->use_count && !was_open && dbusmenu_menuitem_property_exist (menuitem, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY))
379 {385 {
380 dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, 0);386 dbusmenu_menuitem_handle_event (menuitem, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, 0);
381 item->is_opened = TRUE;387 item->is_opened = TRUE;
@@ -394,7 +400,7 @@
394 HudDbusmenuItem *item;400 HudDbusmenuItem *item;
395 GList *child;401 GList *child;
396402
397 item = hud_dbusmenu_item_new (context, NULL, menuitem);403 item = hud_dbusmenu_item_new (context, collector->application_id, collector->icon, menuitem);
398 context = hud_item_get_tokens (HUD_ITEM (item));404 context = hud_item_get_tokens (HUD_ITEM (item));
399405
400 g_signal_connect (menuitem, "property-changed", G_CALLBACK (hud_dbusmenu_collector_property_changed), collector);406 g_signal_connect (menuitem, "property-changed", G_CALLBACK (hud_dbusmenu_collector_property_changed), collector);
@@ -525,6 +531,7 @@
525 g_hash_table_unref (collector->items);531 g_hash_table_unref (collector->items);
526532
527 g_free (collector->application_id);533 g_free (collector->application_id);
534 g_free (collector->icon);
528535
529 hud_string_list_unref (collector->prefix);536 hud_string_list_unref (collector->prefix);
530 g_clear_object (&collector->client);537 g_clear_object (&collector->client);
@@ -555,7 +562,9 @@
555562
556/**563/**
557 * hud_dbusmenu_collector_new_for_endpoint:564 * hud_dbusmenu_collector_new_for_endpoint:
565 * @application_id: a unique identifier for the application
558 * @prefix: the title to prefix to all items566 * @prefix: the title to prefix to all items
567 * @icon: the icon for the appliction
559 * @penalty: the penalty to apply to all results568 * @penalty: the penalty to apply to all results
560 * @bus_name: a D-Bus bus name569 * @bus_name: a D-Bus bus name
561 * @object_path: an object path at the destination given by @bus_name570 * @object_path: an object path at the destination given by @bus_name
@@ -580,6 +589,7 @@
580HudDbusmenuCollector *589HudDbusmenuCollector *
581hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,590hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,
582 const gchar *prefix,591 const gchar *prefix,
592 const gchar *icon,
583 guint penalty,593 guint penalty,
584 const gchar *bus_name,594 const gchar *bus_name,
585 const gchar *object_path)595 const gchar *object_path)
@@ -588,6 +598,7 @@
588598
589 collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);599 collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);
590 collector->application_id = g_strdup (application_id);600 collector->application_id = g_strdup (application_id);
601 collector->icon = g_strdup (icon);
591 if (prefix)602 if (prefix)
592 collector->prefix = hud_string_list_cons (prefix, NULL);603 collector->prefix = hud_string_list_cons (prefix, NULL);
593 collector->penalty = penalty;604 collector->penalty = penalty;
@@ -611,12 +622,14 @@
611 **/622 **/
612HudDbusmenuCollector *623HudDbusmenuCollector *
613hud_dbusmenu_collector_new_for_window (BamfWindow *window,624hud_dbusmenu_collector_new_for_window (BamfWindow *window,
614 const gchar *desktop_file)625 const gchar *desktop_file,
626 const gchar *icon)
615{627{
616 HudDbusmenuCollector *collector;628 HudDbusmenuCollector *collector;
617629
618 collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);630 collector = g_object_new (HUD_TYPE_DBUSMENU_COLLECTOR, NULL);
619 collector->application_id = g_strdup (desktop_file);631 collector->application_id = g_strdup (desktop_file);
632 collector->icon = g_strdup (icon);
620 collector->xid = bamf_window_get_xid (window);633 collector->xid = bamf_window_get_xid (window);
621 g_debug ("dbusmenu on %d", collector->xid);634 g_debug ("dbusmenu on %d", collector->xid);
622 hud_app_menu_registrar_add_observer (hud_app_menu_registrar_get (), collector->xid,635 hud_app_menu_registrar_add_observer (hud_app_menu_registrar_get (), collector->xid,
@@ -645,3 +658,22 @@
645 collector->prefix = hud_string_list_cons (prefix, NULL);658 collector->prefix = hud_string_list_cons (prefix, NULL);
646 hud_dbusmenu_collector_setup_root (collector, collector->root);659 hud_dbusmenu_collector_setup_root (collector, collector->root);
647}660}
661
662/**
663 * hud_dbusmenu_collector_set_icon:
664 * @collector: a #HudDbusmenuCollector
665 * @icon: the application icon
666 *
667 * Changes the application icon used for all items of the collector.
668 *
669 * This will involve destroying all of the items and recreating them
670 * (since each item's icon has to be changed).
671 **/
672void
673hud_dbusmenu_collector_set_icon (HudDbusmenuCollector *collector,
674 const gchar *icon)
675{
676 g_free (collector->icon);
677 collector->icon = g_strdup (icon);
678 hud_dbusmenu_collector_setup_root (collector, collector->root);
679}
648680
=== modified file 'src/huddbusmenucollector.h'
--- src/huddbusmenucollector.h 2012-03-12 16:25:31 +0000
+++ src/huddbusmenucollector.h 2012-03-26 15:29:24 +0000
@@ -33,12 +33,16 @@
3333
34HudDbusmenuCollector * hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,34HudDbusmenuCollector * hud_dbusmenu_collector_new_for_endpoint (const gchar *application_id,
35 const gchar *prefix,35 const gchar *prefix,
36 const gchar *icon,
36 guint penalty,37 guint penalty,
37 const gchar *bus_name,38 const gchar *bus_name,
38 const gchar *object_path);39 const gchar *object_path);
39HudDbusmenuCollector * hud_dbusmenu_collector_new_for_window (BamfWindow *window,40HudDbusmenuCollector * hud_dbusmenu_collector_new_for_window (BamfWindow *window,
40 const gchar *desktop_file);41 const gchar *desktop_file,
42 const gchar *icon);
41void hud_dbusmenu_collector_set_prefix (HudDbusmenuCollector *collector,43void hud_dbusmenu_collector_set_prefix (HudDbusmenuCollector *collector,
42 const gchar *prefix);44 const gchar *prefix);
45void hud_dbusmenu_collector_set_icon (HudDbusmenuCollector *collector,
46 const gchar *icon);
4347
44#endif /* __HUD_DBUSMENU_COLLECTOR_H__ */48#endif /* __HUD_DBUSMENU_COLLECTOR_H__ */
4549
=== modified file 'src/huddebugsource.c'
--- src/huddebugsource.c 2012-03-15 22:30:20 +0000
+++ src/huddebugsource.c 2012-03-26 15:29:24 +0000
@@ -71,7 +71,7 @@
71 g_date_time_unref (now);71 g_date_time_unref (now);
72 g_free (time);72 g_free (time);
7373
74 source->item = hud_item_new (tokens, NULL, TRUE);74 source->item = hud_item_new (tokens, NULL, NULL, TRUE);
75 hud_string_list_unref (tokens);75 hud_string_list_unref (tokens);
7676
77 hud_source_changed (HUD_SOURCE (source));77 hud_source_changed (HUD_SOURCE (source));
7878
=== modified file 'src/hudindicatorsource.c'
--- src/hudindicatorsource.c 2012-03-16 12:16:40 +0000
+++ src/hudindicatorsource.c 2012-03-26 15:29:24 +0000
@@ -184,6 +184,7 @@
184184
185 collector = hud_dbusmenu_collector_new_for_endpoint (indicator->info->indicator_name,185 collector = hud_dbusmenu_collector_new_for_endpoint (indicator->info->indicator_name,
186 _(indicator->info->user_visible_name),186 _(indicator->info->user_visible_name),
187 indicator->info->icon,
187 hud_settings.indicator_penalty,188 hud_settings.indicator_penalty,
188 name_owner, indicator->info->dbus_menu_path);189 name_owner, indicator->info->dbus_menu_path);
189 g_signal_connect (collector, "changed", G_CALLBACK (hud_indicator_source_collector_changed), indicator);190 g_signal_connect (collector, "changed", G_CALLBACK (hud_indicator_source_collector_changed), indicator);
190191
=== modified file 'src/huditem.c'
--- src/huditem.c 2012-03-15 18:27:03 +0000
+++ src/huditem.c 2012-03-26 15:29:24 +0000
@@ -54,6 +54,7 @@
5454
55 HudStringList *tokens;55 HudStringList *tokens;
56 gchar *usage_tag;56 gchar *usage_tag;
57 gchar *app_icon;
57 gboolean enabled;58 gboolean enabled;
58 guint usage;59 guint usage;
59 guint64 id;60 guint64 id;
@@ -130,6 +131,7 @@
130 * @g_type: a #GType131 * @g_type: a #GType
131 * @tokens: the search tokens for the item132 * @tokens: the search tokens for the item
132 * @desktop_file: the desktop file of the provider of the item133 * @desktop_file: the desktop file of the provider of the item
134 * @app_icon: the icon name for the application that created this item
133 * @enabled: if the item is enabled135 * @enabled: if the item is enabled
134 *136 *
135 * This is the Vala-style chain-up constructor corresponding to137 * This is the Vala-style chain-up constructor corresponding to
@@ -143,6 +145,7 @@
143hud_item_construct (GType g_type,145hud_item_construct (GType g_type,
144 HudStringList *tokens,146 HudStringList *tokens,
145 const gchar *desktop_file,147 const gchar *desktop_file,
148 const gchar *app_icon,
146 gboolean enabled)149 gboolean enabled)
147{150{
148 HudItem *item;151 HudItem *item;
@@ -150,6 +153,7 @@
150 item = g_object_new (g_type, NULL);153 item = g_object_new (g_type, NULL);
151 item->priv->tokens = hud_string_list_ref (tokens);154 item->priv->tokens = hud_string_list_ref (tokens);
152 item->priv->desktop_file = g_strdup (desktop_file);155 item->priv->desktop_file = g_strdup (desktop_file);
156 item->priv->app_icon = g_strdup (app_icon);
153 item->priv->enabled = enabled;157 item->priv->enabled = enabled;
154 item->priv->id = hud_item_next_id++;158 item->priv->id = hud_item_next_id++;
155159
@@ -165,6 +169,7 @@
165 * hud_item_new:169 * hud_item_new:
166 * @tokens: the search tokens for the item170 * @tokens: the search tokens for the item
167 * @desktop_file: the desktop file of the provider of the item171 * @desktop_file: the desktop file of the provider of the item
172 * @app_icon: the icon name for the application that created this item
168 * @enabled: if the item is enabled173 * @enabled: if the item is enabled
169 *174 *
170 * Creates a new #HudItem.175 * Creates a new #HudItem.
@@ -177,9 +182,10 @@
177HudItem *182HudItem *
178hud_item_new (HudStringList *tokens,183hud_item_new (HudStringList *tokens,
179 const gchar *desktop_file,184 const gchar *desktop_file,
185 const gchar *app_icon,
180 gboolean enabled)186 gboolean enabled)
181{187{
182 return hud_item_construct (HUD_TYPE_ITEM, tokens, desktop_file, enabled);188 return hud_item_construct (HUD_TYPE_ITEM, tokens, desktop_file, app_icon, enabled);
183}189}
184190
185/**191/**
@@ -236,7 +242,7 @@
236 *242 *
237 * Gets the icon for the action represented by @item, if one exists.243 * Gets the icon for the action represented by @item, if one exists.
238 *244 *
239 * Returns: the icon name, or %NULL if there is no icon245 * Returns: the icon name, or "" if there is no icon
240 **/246 **/
241const gchar *247const gchar *
242hud_item_get_item_icon (HudItem *item)248hud_item_get_item_icon (HudItem *item)
@@ -250,12 +256,12 @@
250 *256 *
251 * Gets the icon of the application that @item lies within.257 * Gets the icon of the application that @item lies within.
252 *258 *
253 * Returns: the icon name, or %NULL if there is no icon259 * Returns: the icon name, or "" if there is no icon
254 **/260 **/
255const gchar *261const gchar *
256hud_item_get_app_icon (HudItem *item)262hud_item_get_app_icon (HudItem *item)
257{263{
258 return "";264 return item->priv->app_icon ? item->priv->app_icon : "";
259}265}
260266
261/**267/**
262268
=== modified file 'src/huditem.h'
--- src/huditem.h 2012-03-07 21:55:41 +0000
+++ src/huditem.h 2012-03-26 15:29:24 +0000
@@ -59,9 +59,11 @@
59gpointer hud_item_construct (GType g_type,59gpointer hud_item_construct (GType g_type,
60 HudStringList *tokens,60 HudStringList *tokens,
61 const gchar *desktop_file,61 const gchar *desktop_file,
62 const gchar *app_icon,
62 gboolean enabled);63 gboolean enabled);
63HudItem * hud_item_new (HudStringList *tokens,64HudItem * hud_item_new (HudStringList *tokens,
64 const gchar *desktop_file,65 const gchar *desktop_file,
66 const gchar *app_icon,
65 gboolean enabled);67 gboolean enabled);
66void hud_item_activate (HudItem *item,68void hud_item_activate (HudItem *item,
67 GVariant *platform_data);69 GVariant *platform_data);
6870
=== modified file 'src/hudmenumodelcollector.c'
--- src/hudmenumodelcollector.c 2012-03-15 18:25:50 +0000
+++ src/hudmenumodelcollector.c 2012-03-26 15:29:24 +0000
@@ -60,6 +60,7 @@
60 GDBusActionGroup *window;60 GDBusActionGroup *window;
6161
62 gchar *desktop_file;62 gchar *desktop_file;
63 gchar *icon;
63 GPtrArray *items;64 GPtrArray *items;
64 gint use_count;65 gint use_count;
65};66};
@@ -119,13 +120,14 @@
119static HudItem *120static HudItem *
120hud_model_item_new (HudStringList *tokens,121hud_model_item_new (HudStringList *tokens,
121 const gchar *desktop_file,122 const gchar *desktop_file,
123 const gchar *icon,
122 GRemoteActionGroup *action_group,124 GRemoteActionGroup *action_group,
123 const gchar *action_name,125 const gchar *action_name,
124 GVariant *target)126 GVariant *target)
125{127{
126 HudModelItem *item;128 HudModelItem *item;
127129
128 item = hud_item_construct (hud_model_item_get_type (), tokens, desktop_file, TRUE);130 item = hud_item_construct (hud_model_item_get_type (), tokens, desktop_file, icon, TRUE);
129 item->group = g_object_ref (action_group);131 item->group = g_object_ref (action_group);
130 item->action_name = g_strdup (action_name);132 item->action_name = g_strdup (action_name);
131 item->target = target ? g_variant_ref_sink (target) : NULL;133 item->target = target ? g_variant_ref_sink (target) : NULL;
@@ -262,8 +264,7 @@
262264
263 target = g_menu_model_get_item_attribute_value (model, i, G_MENU_ATTRIBUTE_TARGET, NULL);265 target = g_menu_model_get_item_attribute_value (model, i, G_MENU_ATTRIBUTE_TARGET, NULL);
264266
265 /* XXX: todo: target */267 item = hud_model_item_new (tokens, collector->desktop_file, collector->icon,
266 item = hud_model_item_new (tokens, collector->desktop_file,
267 G_REMOTE_ACTION_GROUP (action_group),268 G_REMOTE_ACTION_GROUP (action_group),
268 value + 4, target);269 value + 4, target);
269 g_ptr_array_add (collector->items, item);270 g_ptr_array_add (collector->items, item);
@@ -381,6 +382,7 @@
381 g_clear_object (&collector->window);382 g_clear_object (&collector->window);
382383
383 g_free (collector->desktop_file);384 g_free (collector->desktop_file);
385 g_free (collector->icon);
384386
385 g_ptr_array_unref (collector->items);387 g_ptr_array_unref (collector->items);
386388
@@ -412,6 +414,7 @@
412 * hud_menu_model_collector_get:414 * hud_menu_model_collector_get:
413 * @window: a #BamfWindow415 * @window: a #BamfWindow
414 * @desktop_file: the desktop file of the application of @window416 * @desktop_file: the desktop file of the application of @window
417 * @icon: the application icon's name
415 *418 *
416 * If the given @window has #GMenuModel-style menus then returns a419 * If the given @window has #GMenuModel-style menus then returns a
417 * collector for them, otherwise returns %NULL.420 * collector for them, otherwise returns %NULL.
@@ -422,7 +425,8 @@
422 **/425 **/
423HudMenuModelCollector *426HudMenuModelCollector *
424hud_menu_model_collector_get (BamfWindow *window,427hud_menu_model_collector_get (BamfWindow *window,
425 const gchar *desktop_file)428 const gchar *desktop_file,
429 const gchar *icon)
426{430{
427 HudMenuModelCollector *collector;431 HudMenuModelCollector *collector;
428 gchar *unique_bus_name;432 gchar *unique_bus_name;
@@ -466,6 +470,7 @@
466 collector->window = g_dbus_action_group_get (session, unique_bus_name, window_object_path);470 collector->window = g_dbus_action_group_get (session, unique_bus_name, window_object_path);
467471
468 collector->desktop_file = g_strdup (desktop_file);472 collector->desktop_file = g_strdup (desktop_file);
473 collector->icon = g_strdup (icon);
469474
470 /* when the action groups change, we could end up having items475 /* when the action groups change, we could end up having items
471 * enabled/disabled. how to deal with that?476 * enabled/disabled. how to deal with that?
472477
=== modified file 'src/hudmenumodelcollector.h'
--- src/hudmenumodelcollector.h 2012-03-12 16:25:31 +0000
+++ src/hudmenumodelcollector.h 2012-03-26 15:29:24 +0000
@@ -33,6 +33,7 @@
33GType hud_menu_model_collector_get_type (void);33GType hud_menu_model_collector_get_type (void);
3434
35HudMenuModelCollector * hud_menu_model_collector_get (BamfWindow *window,35HudMenuModelCollector * hud_menu_model_collector_get (BamfWindow *window,
36 const gchar *desktop_file);36 const gchar *desktop_file,
37 const gchar *icon);
3738
38#endif /* __HUD_MENU_MODEL_COLLECTOR_H__ */39#endif /* __HUD_MENU_MODEL_COLLECTOR_H__ */
3940
=== modified file 'src/hudquery.c'
--- src/hudquery.c 2012-03-15 19:32:27 +0000
+++ src/hudquery.c 2012-03-26 15:29:24 +0000
@@ -106,14 +106,6 @@
106 if (query->search_string[0] != '\0')106 if (query->search_string[0] != '\0')
107 hud_source_search (query->source, query->results, query->search_string);107 hud_source_search (query->source, query->results, query->search_string);
108108
109 /* XXX: The old code queried, sorted, truncated to 15, got usage data,
110 * then sorted again.
111 *
112 * We try to do it only once.
113 *
114 * This may change the results...
115 */
116
117 g_ptr_array_foreach (query->results, hud_query_find_max_usage, &max_usage);109 g_ptr_array_foreach (query->results, hud_query_find_max_usage, &max_usage);
118 g_ptr_array_sort_with_data (query->results, hud_query_compare_results, GINT_TO_POINTER (max_usage));110 g_ptr_array_sort_with_data (query->results, hud_query_compare_results, GINT_TO_POINTER (max_usage));
119 if (query->results->len > query->num_results)111 if (query->results->len > query->num_results)
120112
=== modified file 'src/hudwindowsource.c'
--- src/hudwindowsource.c 2012-03-15 21:06:48 +0000
+++ src/hudwindowsource.c 2012-03-26 15:29:24 +0000
@@ -67,6 +67,7 @@
67 BamfWindow *active_window;67 BamfWindow *active_window;
68 BamfApplication *active_application;68 BamfApplication *active_application;
69 const gchar *active_desktop_file;69 const gchar *active_desktop_file;
70 const gchar *active_icon;
70 HudSource *active_collector;71 HudSource *active_collector;
71 gint use_count;72 gint use_count;
72};73};
@@ -167,12 +168,15 @@
167 * For that reason, we check first for GMenuModel and assume if it168 * For that reason, we check first for GMenuModel and assume if it
168 * doesn't exist then it must be dbusmenu.169 * doesn't exist then it must be dbusmenu.
169 */170 */
170 menumodel_collector = hud_menu_model_collector_get (source->active_window, source->active_desktop_file);171 menumodel_collector = hud_menu_model_collector_get (source->active_window,
172 source->active_desktop_file,
173 source->active_icon);
171 if (menumodel_collector)174 if (menumodel_collector)
172 collector = HUD_SOURCE (menumodel_collector);175 collector = HUD_SOURCE (menumodel_collector);
173 else176 else
174 collector = HUD_SOURCE (hud_dbusmenu_collector_new_for_window (source->active_window,177 collector = HUD_SOURCE (hud_dbusmenu_collector_new_for_window (source->active_window,
175 source->active_desktop_file));178 source->active_desktop_file,
179 source->active_icon));
176180
177 g_object_set_qdata_full (G_OBJECT (source->active_window), menu_collector_quark, collector, g_object_unref);181 g_object_set_qdata_full (G_OBJECT (source->active_window), menu_collector_quark, collector, g_object_unref);
178 }182 }
@@ -254,6 +258,7 @@
254 source->active_window = g_object_ref (window);258 source->active_window = g_object_ref (window);
255 source->active_application = g_object_ref (application);259 source->active_application = g_object_ref (application);
256 source->active_desktop_file = desktop_file;260 source->active_desktop_file = desktop_file;
261 source->active_icon = bamf_view_get_icon (BAMF_VIEW (application));
257 source->active_collector = g_object_ref (hud_window_source_get_collector (source));262 source->active_collector = g_object_ref (hud_window_source_get_collector (source));
258263
259 if (source->use_count)264 if (source->use_count)
260265
=== modified file 'tools-vala/hud-gtk.vala'
--- tools-vala/hud-gtk.vala 2012-03-21 17:16:38 +0000
+++ tools-vala/hud-gtk.vala 2012-03-26 15:29:24 +0000
@@ -53,6 +53,10 @@
53 query_key = null;53 query_key = null;
54 model.clear ();54 model.clear ();
5555
56 if (entry.text == "") {
57 return;
58 }
59
56 try {60 try {
57 var session = Bus.get_sync (BusType.SESSION, null);61 var session = Bus.get_sync (BusType.SESSION, null);
58 var reply = session.call_sync ("com.canonical.hud", "/com/canonical/hud", "com.canonical.hud",62 var reply = session.call_sync ("com.canonical.hud", "/com/canonical/hud", "com.canonical.hud",

Subscribers

People subscribed via source and target branches