Merge lp:~mvo/libappindicator/fix-820080 into lp:libappindicator

Proposed by Michael Vogt
Status: Merged
Approved by: Ted Gould
Approved revision: 226
Merged at revision: 221
Proposed branch: lp:~mvo/libappindicator/fix-820080
Merge into: lp:libappindicator
Diff against target: 63 lines (+39/-7)
1 file modified
src/app-indicator.c (+39/-7)
To merge this branch: bzr merge lp:~mvo/libappindicator/fix-820080
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Michael Vogt (community) Needs Resubmitting
Review via email: mp+77676@code.launchpad.net

Description of the change

This checks for the long item name before using it to ensure that apps that do not provide a "-panel" fallback icon still work.

This probably needs a additional check for "icon_theme_path" to ensure its catching custom icon theme paths, I'm happy to add this once I get approval for the general approach.

(this is against the right branch this time)

To post a comment you must log in.
Revision history for this message
Javier Jardón (jjardon) wrote :

Tested in several configurations: XFce, GNOME Classic, Ubuntu and seems to work ok.

Revision history for this message
Ted Gould (ted) wrote :

The approach is fine. The problem is you pulled out the distinction in the case between get_icon() and get_attention_icon(). So the attention icon won't work. But I think the test is a good idea.

review: Needs Fixing
Revision history for this message
Michael Vogt (mvo) wrote :

Oh, indeed, a rather silly bug, I fix this right away.

lp:~mvo/libappindicator/fix-820080 updated
222. By Michael Vogt

unbreak attention_icon

223. By Michael Vogt

src/app-indicator.c: honor icon_theme_path in the fallback

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for the review, the attention icon issue is fixed now plus it should honor the custom_icon_path now too.
Please double check if the g_object_unref() at the end if good enough for not leaking the custom GtkIconTheme.

review: Needs Resubmitting
lp:~mvo/libappindicator/fix-820080 updated
224. By Michael Vogt

simplify

225. By Michael Vogt

src/app-indicator.c: do not add the same icon_theme_path again, gtk3 apparently does not check this

Revision history for this message
Michael Vogt (mvo) wrote :

I updated this again to avoid adding the same path multiple times. Gtk itself does not care it seems:

>>> theme = Gtk.IconTheme.get_default()
>>> print theme.get_search_path()
['/home/egon/.icons', '/home/egon/.local/share/icons', '/usr/share/ubuntu/icons', '/usr/share/gnome/icons', '/usr/local/share/icons', '/usr/share/icons', '/usr/share/ubuntu/pixmaps', '/usr/share/gnome/pixmaps', '/usr/local/share/pixmaps', '/usr/share/pixmaps']
>>> theme.append_search_path("foo")
>>> theme.append_search_path("foo")
>>> theme.append_search_path("foo")
>>> print theme.get_search_path()
['/home/egon/.icons', '/home/egon/.local/share/icons', '/usr/share/ubuntu/icons', '/usr/share/gnome/icons', '/usr/local/share/icons', '/usr/share/icons', '/usr/share/ubuntu/pixmaps', '/usr/share/gnome/pixmaps', '/usr/local/share/pixmaps', '/usr/share/pixmaps', 'foo', 'foo', 'foo']

lp:~mvo/libappindicator/fix-820080 updated
226. By Michael Vogt

src/app-indicator.c: hide first in passive mode and add comment about it

Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app-indicator.c'
--- src/app-indicator.c 2011-07-22 19:04:23 +0000
+++ src/app-indicator.c 2011-09-30 16:17:26 +0000
@@ -1523,20 +1523,52 @@
1523 GtkStatusIcon * icon = GTK_STATUS_ICON(data);1523 GtkStatusIcon * icon = GTK_STATUS_ICON(data);
1524 gchar *longname = NULL;1524 gchar *longname = NULL;
15251525
1526 /* add the icon_theme_path once if needed */
1527 GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
1528 if (self->priv->icon_theme_path != NULL)
1529 {
1530 gchar **path;
1531 gint n_elements, i;
1532 gboolean found=FALSE;
1533 gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
1534 for (i=0; i< n_elements || path[i] == NULL; i++)
1535 {
1536 if(g_strcmp0(path[i], self->priv->icon_theme_path) == 0)
1537 {
1538 found=TRUE;
1539 break;
1540 }
1541 }
1542 if(!found)
1543 gtk_icon_theme_append_search_path(icon_theme, self->priv->icon_theme_path);
1544 g_strfreev (path);
1545 }
1546
1526 switch (app_indicator_get_status(self)) {1547 switch (app_indicator_get_status(self)) {
1527 case APP_INDICATOR_STATUS_PASSIVE:1548 case APP_INDICATOR_STATUS_PASSIVE:
1528 longname = append_panel_icon_suffix(app_indicator_get_icon(self));1549 /* hide first to avoid that the change is visible to the user */
1529 gtk_status_icon_set_visible(icon, FALSE);1550 gtk_status_icon_set_visible(icon, FALSE);
1530 gtk_status_icon_set_from_icon_name(icon, longname);1551 longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1552 if (gtk_icon_theme_has_icon (icon_theme, longname))
1553 gtk_status_icon_set_from_icon_name(icon, longname);
1554 else
1555 gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1531 break;1556 break;
1532 case APP_INDICATOR_STATUS_ACTIVE:1557 case APP_INDICATOR_STATUS_ACTIVE:
1533 longname = append_panel_icon_suffix(app_indicator_get_icon(self));1558 longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1534 gtk_status_icon_set_from_icon_name(icon, longname);1559 if (gtk_icon_theme_has_icon (icon_theme, longname))
1560 gtk_status_icon_set_from_icon_name(icon, longname);
1561 else
1562 gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1535 gtk_status_icon_set_visible(icon, TRUE);1563 gtk_status_icon_set_visible(icon, TRUE);
1536 break;1564 break;
1537 case APP_INDICATOR_STATUS_ATTENTION:1565 case APP_INDICATOR_STATUS_ATTENTION:
1538 longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));1566 /* get the _attention_ icon here */
1539 gtk_status_icon_set_from_icon_name(icon, longname);1567 longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
1568 if (gtk_icon_theme_has_icon (icon_theme, longname))
1569 gtk_status_icon_set_from_icon_name(icon, longname);
1570 else
1571 gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1540 gtk_status_icon_set_visible(icon, TRUE);1572 gtk_status_icon_set_visible(icon, TRUE);
1541 break;1573 break;
1542 };1574 };

Subscribers

People subscribed via source and target branches