Codebase list xapp / cb65f3a
xapp-status-icon.c: Sync the visible state of the fallback GtkStatusIcon when it is first created. It was only being updated when an explicit xapp_status_icon_set_visible was called - refactor a bit so all relevant state is updated correctly, as well as hiding the icon if no icon name has been set. Michael Webster 4 years ago
1 changed file(s) with 30 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
787787 }
788788
789789 static void
790 update_fallback_icon (XAppStatusIcon *self,
791 const gchar *icon_name)
792 {
793 if (g_path_is_absolute (icon_name))
794 {
795 gtk_status_icon_set_from_file (self->priv->gtk_status_icon, icon_name);
790 update_fallback_icon (XAppStatusIcon *self)
791 {
792 XAppStatusIconPrivate *priv = self->priv;
793
794 if (!priv->gtk_status_icon)
795 {
796 return;
797 }
798
799 gtk_status_icon_set_tooltip_text (priv->gtk_status_icon, priv->tooltip_text);
800 gtk_status_icon_set_name (priv->gtk_status_icon, priv->name);
801
802 if (priv->icon_name)
803 {
804 gtk_status_icon_set_visible (priv->gtk_status_icon, priv->visible);
805
806 if (g_path_is_absolute (priv->icon_name))
807 {
808 gtk_status_icon_set_from_file (priv->gtk_status_icon, priv->icon_name);
809 }
810 else
811 {
812 gtk_status_icon_set_from_icon_name (priv->gtk_status_icon, priv->icon_name);
813 }
796814 }
797815 else
798816 {
799 gtk_status_icon_set_from_icon_name (self->priv->gtk_status_icon, icon_name);
817 gtk_status_icon_set_visible (priv->gtk_status_icon, FALSE);
800818 }
801819 }
802820
851869 G_CALLBACK (on_gtk_status_icon_embedded_changed),
852870 self);
853871
854 update_fallback_icon (self, priv->icon_name ? priv->icon_name : "");
855 gtk_status_icon_set_tooltip_text (self->priv->gtk_status_icon, priv->tooltip_text);
872 update_fallback_icon (self);
856873 }
857874
858875 static void
13191336 xapp_status_icon_interface_set_name (icon->priv->skeleton, name);
13201337 }
13211338
1322 if (icon->priv->gtk_status_icon != NULL)
1323 {
1324 gtk_status_icon_set_name (icon->priv->gtk_status_icon, name);
1325 }
1339 update_fallback_icon (icon);
13261340 }
13271341
13281342 /**
13481362 xapp_status_icon_interface_set_icon_name (icon->priv->skeleton, icon_name);
13491363 }
13501364
1351 if (icon->priv->gtk_status_icon != NULL)
1352 {
1353 update_fallback_icon (icon, icon_name);
1354 }
1365 update_fallback_icon (icon);
13551366 }
13561367
13571368 /**
13771388 xapp_status_icon_interface_set_tooltip_text (icon->priv->skeleton, tooltip_text);
13781389 }
13791390
1380 if (icon->priv->gtk_status_icon != NULL)
1381 {
1382 gtk_status_icon_set_tooltip_text (icon->priv->gtk_status_icon, tooltip_text);
1383 }
1391 update_fallback_icon (icon);
13841392 }
13851393
13861394 /**
14291437 xapp_status_icon_interface_set_visible (icon->priv->skeleton, visible);
14301438 }
14311439
1432 if (icon->priv->gtk_status_icon != NULL)
1433 {
1434 gtk_status_icon_set_visible (icon->priv->gtk_status_icon, visible);
1435 }
1440 update_fallback_icon (icon);
14361441 }
14371442
14381443 /**