static void update_header(void) { GdkPixbuf *image = NULL; const char *type, *info; GtkWidget *widget; gboolean favorite; type = connman_service_get_type(path); if (g_strcmp0(type, "wifi") == 0) { uint8_t strength; strength = connman_service_get_strength(path); cui_theme_get_signal_icone_and_info(strength, &image, &info); } else cui_theme_get_type_icone_and_info(type, &image, &info); set_image(builder, "service_type", image, info); set_label(builder, "service_name", connman_service_get_name(path), "- Hidden -"); if (connman_service_is_connected(path) == TRUE) cui_theme_get_state_icone_and_info( connman_service_get_state(path), &image, &info); else image = NULL; set_image(builder, "service_state", image, info); set_label(builder, "service_error", connman_service_get_error(path), ""); favorite = connman_service_is_favorite(path); set_button_toggle(builder, "service_autoconnect", connman_service_is_autoconnect(path)); widget = set_widget_sensitive(builder, "service_autoconnect", favorite); if (favorite == TRUE) { g_signal_connect(widget, "toggled", G_CALLBACK(autoconnect_button_toggled), NULL); } set_button_toggle(builder, "service_favorite", favorite); widget = set_widget_sensitive(builder, "service_favorite", favorite); if (favorite == TRUE) { g_signal_connect(widget, "toggled", G_CALLBACK(favorite_button_toggled), NULL); } }
void cui_trayicon_update_icon(void) { enum connman_state state; GdkPixbuf *image = NULL; const char *info = NULL; state = connman_manager_get_state(); cui_theme_get_state_icone_and_info(state, &image, &info); gtk_status_icon_set_from_pixbuf(cui_trayicon, image); gtk_status_icon_set_tooltip_text(cui_trayicon, info); gtk_status_icon_set_visible(cui_trayicon, TRUE); }
static void service_set_state(GtkService *service) { GtkServicePrivate *priv = service->priv; const struct connman_ipv4 *ipv4; enum connman_state state; GdkPixbuf *image = NULL; const char *ip = NULL; const char *info; if (connman_service_is_connected(service->path) == FALSE) { gtk_widget_set_tooltip_text((GtkWidget *)priv->name, ""); return; } ipv4 = connman_service_get_ipv4(service->path); if (ipv4 == NULL) { const struct connman_ipv6 *ipv6; ipv6 = connman_service_get_ipv6(service->path); if (ipv6 != NULL) ip = ipv6->address; } else ip = ipv4->address; if (ip == NULL) ip = ""; gtk_widget_set_tooltip_text((GtkWidget *)priv->name, ip); state = connman_service_get_state(service->path); cui_theme_get_state_icone_and_info(state, &image, &info); if (image == NULL) return; gtk_widget_set_visible((GtkWidget *)priv->state, TRUE); gtk_widget_set_tooltip_text((GtkWidget *)priv->state, info); gtk_image_set_from_pixbuf(priv->state, image); }