void reload_tray_icon() { if (pixbuf) { g_object_unref(pixbuf); pixbuf = NULL; } if (pixbuf_ch) { g_object_unref(pixbuf_ch); pixbuf_ch = NULL; } load_tray_icon(); }
void disp_tray_icon() { if (!hime_status_tray) return destroy_tray(); // dbg("disp_tray_icon\n"); if (hime_tray_display == HIME_TRAY_DISPLAY_SINGLE) load_tray_icon(); if (hime_tray_display == HIME_TRAY_DISPLAY_DOUBLE) load_tray_icon_double(); #if TRAY_UNITY if (hime_tray_display == HIME_TRAY_DISPLAY_APPINDICATOR) load_tray_appindicator(); #endif }
void disp_tray_icon() { // dbg("disp_tray_icon\n"); //dbg("disp_tray_icon %d %d\n", current_hime_win32_icon, hime_win32_icon); #if UNIX if (current_hime_win32_icon >= 0 && current_hime_win32_icon != hime_win32_icon) { destroy_tray(); } current_hime_win32_icon = hime_win32_icon; if (hime_win32_icon) #endif load_tray_icon_win32(); #if UNIX else load_tray_icon(); #endif }
gboolean create_tray(gpointer data) { if (tray_icon) return FALSE; destroy_other_tray(); tray_icon = gtk_status_icon_new(); g_signal_connect (G_OBJECT (tray_icon), "button-press-event", G_CALLBACK (tray_button_press_event_cb), NULL); g_signal_connect (G_OBJECT (tray_icon), "size-changed", G_CALLBACK (tray_size_changed_cb), NULL); g_signal_connect (G_OBJECT (tray_icon), "notify::embedded", G_CALLBACK (tray_embedded_cb), NULL); #if GTK_CHECK_VERSION(2,12,0) gtk_status_icon_set_tooltip_text (tray_icon, _("左:中英切換 中:小鍵盤 右:選項")); #else GtkTooltips *tips = gtk_tooltips_new (); gtk_status_icon_set_tooltip (GTK_TOOLTIPS (tips), tray_icon, _("左:中英切換 中:小鍵盤 右:選項"), NULL); #endif // Initiate Pango for drawing texts from default setting GtkWidget *wi = gtk_label_new (NULL); // for reference PangoContext *context = gtk_widget_get_pango_context(wi); PangoFontDescription* desc = pango_font_description_copy(pango_context_get_font_description(context)); // Copy one from wi for pango pango_font_description_set_size(desc, 9 * PANGO_SCALE); pango = gtk_widget_create_pango_layout(wi, NULL); pango_layout_set_font_description(pango, desc); gdk_color_parse("red", &red_color_fg); gdk_color_parse("blue", &blue_color_fg); gtk_widget_destroy(wi); load_tray_icon(); return FALSE; }