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
=== modified file 'src/app-indicator.c'
--- src/app-indicator.c 2011-03-08 21:58:16 +0000
+++ src/app-indicator.c 2011-03-14 15:35:36 +0000
@@ -48,8 +48,6 @@
48#include "dbus-shared.h"48#include "dbus-shared.h"
49#include "generate-id.h"49#include "generate-id.h"
5050
51#define PANEL_ICON_SUFFIX "panel"
52
53/**51/**
54 AppIndicatorPrivate:52 AppIndicatorPrivate:
5553
@@ -182,7 +180,6 @@
182static void status_icon_activate (GtkStatusIcon * icon, gpointer data);180static void status_icon_activate (GtkStatusIcon * icon, gpointer data);
183static void status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data);181static void status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data);
184static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);182static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
185static gchar * append_panel_icon_suffix (const gchar * icon_name);
186static void watcher_owner_changed (GObject * obj, GParamSpec * pspec, gpointer user_data);183static void watcher_owner_changed (GObject * obj, GParamSpec * pspec, gpointer user_data);
187static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data);184static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data);
188static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data);185static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data);
@@ -1471,34 +1468,28 @@
1471status_icon_changes (AppIndicator * self, gpointer data)1468status_icon_changes (AppIndicator * self, gpointer data)
1472{1469{
1473 GtkStatusIcon * icon = GTK_STATUS_ICON(data);1470 GtkStatusIcon * icon = GTK_STATUS_ICON(data);
1474 GIcon *themed_icon = NULL;
1475 gchar *longname = NULL;1471 gchar *longname = NULL;
14761472 guint32 status;
1477 switch (app_indicator_get_status(self)) {1473
1474 status = app_indicator_get_status (self);
1475
1476 if (status == APP_INDICATOR_STATUS_ATTENTION)
1477 longname = g_strdup(app_indicator_get_attention_icon(self));
1478 else
1479 longname = g_strdup(app_indicator_get_icon(self));
1480
1481 gtk_status_icon_set_from_icon_name(icon, longname);
1482
1483 switch (status) {
1484 case APP_INDICATOR_STATUS_ACTIVE:
1485 case APP_INDICATOR_STATUS_ATTENTION:
1486 gtk_status_icon_set_visible(icon, TRUE);
1487 break;
1478 case APP_INDICATOR_STATUS_PASSIVE:1488 case APP_INDICATOR_STATUS_PASSIVE:
1479 longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1480 themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
1481 gtk_status_icon_set_visible(icon, FALSE);1489 gtk_status_icon_set_visible(icon, FALSE);
1482 gtk_status_icon_set_from_gicon(icon, themed_icon);
1483 break;
1484 case APP_INDICATOR_STATUS_ACTIVE:
1485 longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1486 themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
1487 gtk_status_icon_set_from_gicon(icon, themed_icon);
1488 gtk_status_icon_set_visible(icon, TRUE);
1489 break;
1490 case APP_INDICATOR_STATUS_ATTENTION:
1491 longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
1492 themed_icon = g_themed_icon_new_with_default_fallbacks (longname);
1493 gtk_status_icon_set_from_gicon(icon, themed_icon);
1494 gtk_status_icon_set_visible(icon, TRUE);
1495 break;1490 break;
1496 };1491 };
14971492
1498 if (themed_icon) {
1499 g_object_unref (themed_icon);
1500 }
1501
1502 if (longname) {1493 if (longname) {
1503 g_free(longname);1494 g_free(longname);
1504 }1495 }
@@ -1547,24 +1538,6 @@
1547 return;1538 return;
1548}1539}
15491540
1550/* A helper function that appends PANEL_ICON_SUFFIX to the given icon name
1551 if it's missing. */
1552static gchar *
1553append_panel_icon_suffix (const gchar *icon_name)
1554{
1555 gchar * long_name = NULL;
1556
1557 if (!g_str_has_suffix (icon_name, PANEL_ICON_SUFFIX)) {
1558 long_name =
1559 g_strdup_printf("%s-%s", icon_name, PANEL_ICON_SUFFIX);
1560 } else {
1561 long_name = g_strdup (icon_name);
1562 }
1563
1564 return long_name;
1565}
1566
1567
1568/* ************************* */1541/* ************************* */
1569/* Public Functions */1542/* Public Functions */
1570/* ************************* */1543/* ************************* */

Subscribers

People subscribed via source and target branches