1582
1582
status_icon_changes (AppIndicator * self, gpointer data)
1584
1584
GtkStatusIcon * icon = GTK_STATUS_ICON(data);
1585
gchar *longname = NULL;
1587
/* add the icon_theme_path once if needed */
1588
GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
1589
if (self->priv->icon_theme_path != NULL)
1593
gboolean found=FALSE;
1594
gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
1595
for (i=0; i< n_elements || path[i] == NULL; i++)
1597
if(g_strcmp0(path[i], self->priv->icon_theme_path) == 0)
1604
gtk_icon_theme_append_search_path(icon_theme, self->priv->icon_theme_path);
1586
/* add the icon_theme_path once if needed */
1587
GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
1588
if (self->priv->icon_theme_path != NULL) {
1591
gboolean found=FALSE;
1592
gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
1593
for (i=0; i< n_elements || path[i] == NULL; i++) {
1594
if(g_strcmp0(path[i], self->priv->icon_theme_path) == 0) {
1600
gtk_icon_theme_append_search_path(icon_theme, self->priv->icon_theme_path);
1605
const gchar * icon_name = NULL;
1608
1606
switch (app_indicator_get_status(self)) {
1609
1607
case APP_INDICATOR_STATUS_PASSIVE:
1610
/* hide first to avoid that the change is visible to the user */
1611
gtk_status_icon_set_visible(icon, FALSE);
1612
longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1613
if (gtk_icon_theme_has_icon (icon_theme, longname))
1614
gtk_status_icon_set_from_icon_name(icon, longname);
1616
gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1608
/* hide first to avoid that the change is visible to the user */
1609
gtk_status_icon_set_visible(icon, FALSE);
1610
icon_name = app_indicator_get_icon(self);
1618
1612
case APP_INDICATOR_STATUS_ACTIVE:
1619
longname = append_panel_icon_suffix(app_indicator_get_icon(self));
1620
if (gtk_icon_theme_has_icon (icon_theme, longname))
1621
gtk_status_icon_set_from_icon_name(icon, longname);
1623
gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1613
icon_name = app_indicator_get_icon(self);
1624
1614
gtk_status_icon_set_visible(icon, TRUE);
1626
1616
case APP_INDICATOR_STATUS_ATTENTION:
1627
/* get the _attention_ icon here */
1628
longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
1629
if (gtk_icon_theme_has_icon (icon_theme, longname))
1630
gtk_status_icon_set_from_icon_name(icon, longname);
1632
gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
1617
/* get the _attention_ icon here */
1618
icon_name = app_indicator_get_attention_icon(self);
1633
1619
gtk_status_icon_set_visible(icon, TRUE);
1623
if (icon_name != NULL) {
1624
if (g_file_test(icon_name, G_FILE_TEST_EXISTS)) {
1625
gtk_status_icon_set_from_file(icon, icon_name);
1627
gchar *longname = append_panel_icon_suffix(icon_name);
1629
if (longname != NULL && gtk_icon_theme_has_icon (icon_theme, longname)) {
1630
gtk_status_icon_set_from_icon_name(icon, longname);
1632
gtk_status_icon_set_from_icon_name(icon, icon_name);