Merge lp:~cyphermox/libappindicator/lp708118 into lp:libappindicator

Proposed by Mathieu Trudel-Lapierre
Status: Rejected
Rejected by: Ted Gould
Proposed branch: lp:~cyphermox/libappindicator/lp708118
Merge into: lp:libappindicator
Diff against target: 96 lines (+16/-43)
1 file modified
src/app-indicator.c (+16/-43)
To merge this branch: bzr merge lp:~cyphermox/libappindicator/lp708118
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Needs Fixing
Ted Gould (community) Needs Fixing
Review via email: mp+53261@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

We really need to keep adding the -panel suffix on the icon name so that
an appindicator will look the same on the panel if it's using the status
area, or if it's using indicator-application. So, we can switch to
using icon-name if we can set the "use-fallback" property on the Image
in the GtkStatusIcon. I don't see a way to do that currently from the
GtkStatusIcon API though.

I think that we could patch the GtkStatusIcon implementation to set this
value on it's image always. It may change the behavior of some Status
Icons, but only so they don't have a broken image icon (which seems like
an improvement to me).

  review needsfixing

review: Needs Fixing
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Checking locally, I haven't been able to find any icons with a -panel suffix installed on my system. That along with creating the icons with fallbacks meant AFAICT that the suffix would get stripped out if no icon was found -- which yields the same result as not including the suffix.

I tested this with nm-applet and there doesn't seem to be any issues displaying the same icon in indicator mode or in the fallback to a GtkStatusIcon in the notification area.

As per the comments in bug 708118, another option might be to not unref the gicon immediately at the end of status_icon_changes, but that would likely mean leaking the icons to some amount.

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

On Tue, 2011-03-15 at 13:30 +0000, Mathieu Trudel-Lapierre wrote:
> Checking locally, I haven't been able to find any icons with a -panel
> suffix installed on my system. That along with creating the icons with
> fallbacks meant AFAICT that the suffix would get stripped out if no
> icon was found -- which yields the same result as not including the suffix.

I've got about 54:

$ locate panel.png | grep icons | wc -l

But the issue is more that this is what is going to happen in
indicator-application, so we want to match the same behavior. It's true
that there aren't a huge number of them, but I think it's important to
be consistent.

> As per the comments in bug 708118, another option might be to not unref
> the gicon immediately at the end of status_icon_changes, but that would
> likely mean leaking the icons to some amount.

Just to be curious, did you try unref'ing it in an idle function? I'm
curious if that would make things better.

In general, I think adding the "use-fallback" to the GtkImage in
GtkStatusIcon is the best solution. Are you against that?

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I'm not at all against it; however, as per the bug and further discussion with Sebastien Bacher on IRC, seems like there's indeed something rather weird happening directly at the GTK level. That's why the bug was reassigned.

Since it's not quite clear whether a fix should be in GTK or libappindicator, I'm resetting this to Work In Progress, to be reviewed again at a later time if necessary.

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

Don't know why I can't set superceeded, but that's my goal here:

 https://code.launchpad.net/~ted/libappindicator/lp708118v2/+merge/54570

Unmerged revisions

202. By Mathieu Trudel-Lapierre

fallback: set icons for the fallback GtkStatusIcon using icon names rather
than building a GThemedIcon.

Also drops the extra "-panel" suffix to the icons.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app-indicator.c'
2--- src/app-indicator.c 2011-03-08 21:58:16 +0000
3+++ src/app-indicator.c 2011-03-14 15:35:36 +0000
4@@ -48,8 +48,6 @@
5 #include "dbus-shared.h"
6 #include "generate-id.h"
7
8-#define PANEL_ICON_SUFFIX "panel"
9-
10 /**
11 AppIndicatorPrivate:
12
13@@ -182,7 +180,6 @@
14 static void status_icon_activate (GtkStatusIcon * icon, gpointer data);
15 static void status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data);
16 static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
17-static gchar * append_panel_icon_suffix (const gchar * icon_name);
18 static void watcher_owner_changed (GObject * obj, GParamSpec * pspec, gpointer user_data);
19 static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data);
20 static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data);
21@@ -1471,34 +1468,28 @@
22 status_icon_changes (AppIndicator * self, gpointer data)
23 {
24 GtkStatusIcon * icon = GTK_STATUS_ICON(data);
25- GIcon *themed_icon = NULL;
26 gchar *longname = NULL;
27-
28- switch (app_indicator_get_status(self)) {
29+ guint32 status;
30+
31+ status = app_indicator_get_status (self);
32+
33+ if (status == APP_INDICATOR_STATUS_ATTENTION)
34+ longname = g_strdup(app_indicator_get_attention_icon(self));
35+ else
36+ longname = g_strdup(app_indicator_get_icon(self));
37+
38+ gtk_status_icon_set_from_icon_name(icon, longname);
39+
40+ switch (status) {
41+ case APP_INDICATOR_STATUS_ACTIVE:
42+ case APP_INDICATOR_STATUS_ATTENTION:
43+ gtk_status_icon_set_visible(icon, TRUE);
44+ break;
45 case APP_INDICATOR_STATUS_PASSIVE:
46- longname = append_panel_icon_suffix(app_indicator_get_icon(self));
47- themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
48 gtk_status_icon_set_visible(icon, FALSE);
49- gtk_status_icon_set_from_gicon(icon, themed_icon);
50- break;
51- case APP_INDICATOR_STATUS_ACTIVE:
52- longname = append_panel_icon_suffix(app_indicator_get_icon(self));
53- themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
54- gtk_status_icon_set_from_gicon(icon, themed_icon);
55- gtk_status_icon_set_visible(icon, TRUE);
56- break;
57- case APP_INDICATOR_STATUS_ATTENTION:
58- longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
59- themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
60- gtk_status_icon_set_from_gicon(icon, themed_icon);
61- gtk_status_icon_set_visible(icon, TRUE);
62 break;
63 };
64
65- if (themed_icon) {
66- g_object_unref (themed_icon);
67- }
68-
69 if (longname) {
70 g_free(longname);
71 }
72@@ -1547,24 +1538,6 @@
73 return;
74 }
75
76-/* A helper function that appends PANEL_ICON_SUFFIX to the given icon name
77- if it's missing. */
78-static gchar *
79-append_panel_icon_suffix (const gchar *icon_name)
80-{
81- gchar * long_name = NULL;
82-
83- if (!g_str_has_suffix (icon_name, PANEL_ICON_SUFFIX)) {
84- long_name =
85- g_strdup_printf("%s-%s", icon_name, PANEL_ICON_SUFFIX);
86- } else {
87- long_name = g_strdup (icon_name);
88- }
89-
90- return long_name;
91-}
92-
93-
94 /* ************************* */
95 /* Public Functions */
96 /* ************************* */

Subscribers

People subscribed via source and target branches