Esempio n. 1
0
void TrayItemGtk::SetHint(std::string& hint)
{
    if (active) {
        if (hint.empty()) {
            gtk_status_icon_set_tooltip(this->item, NULL);
        } else {
            gtk_status_icon_set_tooltip(this->item, hint.c_str());
        }
    }
}
Esempio n. 2
0
static void
status_icon_enable(void)
{
	GdkPixbuf *icon_pixbuf;

	if (status_icon)
		return;

	/*
	 * Due to lazy binding it's possible that runtime version is older
	 * than the compile-time version. This is the only code which requires
	 * Gtk+ >= 2.10 currently.
	 */
	if (!check_gtk_version(2,10,0))
		return;

	/*
	 * Create an status so that gtk-gnutella can be minimized to a
	 * so-called "system tray" if supported by the window manager.
	 */

	icon_pixbuf = create_pixbuf("icon.16x16.xpm");
	status_icon = gtk_status_icon_new_from_pixbuf(icon_pixbuf);

	gtk_status_icon_set_tooltip(status_icon,
		_("gtk-gnutella: Click to minimize/restore"));
	status_icon_set_visible(TRUE);
	gui_signal_connect(status_icon, "activate",
		on_status_icon_activate, NULL);
	gui_signal_connect(status_icon, "size-changed",
		on_status_icon_size_changed, NULL);
	gui_signal_connect(status_icon, "popup-menu",
		on_status_icon_popup_menu, NULL);
}
Esempio n. 3
0
static void updateData(int sig) {
    sig=sig;
    
    strncpy(capname, syspath, PATH_MAX);
    strcat(capname, "energy_now");
    FILE* fp = fopen(capname, "r");
    if (fp == NULL) {
        strncpy(capname, syspath, PATH_MAX);
        strcat(capname, "charge_now");
        fp = fopen(capname, "r");
    }

    fscanf(fp, "%d", &currentcap);
    fclose(fp);

    strncpy(capname, syspath, PATH_MAX);
    strcat(capname, "status");
    fp = fopen(capname, "r");
    fscanf(fp, "%s", powerstate);
    fclose(fp);

    snprintf(capname, PATH_MAX, "%.1f %%",
             (float)currentcap/(float)lastfullcap*100.0);
    gtk_status_icon_set_tooltip(ico, capname);

    fillRect(CLEAR, 0, 0, 23, 23);
    drawFrame();
    drawFill((float)currentcap/(float)lastfullcap);
    if (strcmp(powerstate, "Charging")==0) drawFlash();
    
    gtk_status_icon_set_from_pixbuf(ico, pixbuf);
    alarm(2);
}
Esempio n. 4
0
// Operations
bool wxTaskBarIconEx::SetIcon(const wxIcon& icon, const wxString& message)
{
    if (!IsOK())
        return false;

    if (!icon.Ok())
        return false;

    wxBitmap bitmap = icon;

    if (!g_pStatusIcon)
    {
        g_pStatusIcon = gtk_status_icon_new_from_pixbuf(bitmap.GetPixbuf());
        g_signal_connect(g_pStatusIcon, "activate", G_CALLBACK(status_icon_activate), this);
        g_signal_connect(g_pStatusIcon, "popup_menu", G_CALLBACK(status_icon_popup_menu), this);
    }

    gtk_status_icon_set_from_pixbuf(g_pStatusIcon, bitmap.GetPixbuf());
    if (!message.empty())
    {
        gtk_status_icon_set_tooltip(g_pStatusIcon, message.mb_str());
    }
    gtk_status_icon_set_visible(g_pStatusIcon, TRUE);

    return true;
}
Esempio n. 5
0
void trayIcon_init()
{
    trayicon = gtk_status_icon_new_from_file(ICO_PATH);
    trayicon_menu = gtk_menu_new();
    //trayicon_menuitem_logoff = gtk_menu_item_new_with_label("断开链接");
    trayicon_menuitem_exit = gtk_menu_item_new_with_label("退出");
    trayicon_menuitem_severMsg = gtk_menu_item_new_with_label("服务器消息");
    // trayicon_menuitem_about=gtk_menu_item_new_with_label("关于");

    g_signal_connect(G_OBJECT(trayicon_menuitem_exit), "activate", G_CALLBACK(connect_exit), NULL);
    // g_signal_connect(G_OBJECT(trayicon_menuitem_logoff), "activate", G_CALLBACK(connect_logoff), NULL);
    g_signal_connect(G_OBJECT(trayicon_menuitem_severMsg), "activate", G_CALLBACK(showMesg), NULL);
    //  g_signal_connect(G_OBJECT(trayicon_menuitem_about),"activeate",G_CALLBACK(showMesg),NULL);

    gtk_menu_shell_append(GTK_MENU_SHELL(trayicon_menu), trayicon_menuitem_exit);
    //  gtk_menu_shell_append(GTK_MENU_SHELL(trayicon_menu), trayicon_menuitem_logoff);
    gtk_menu_shell_append(GTK_MENU_SHELL(trayicon_menu), trayicon_menuitem_severMsg);
    //  gtk_menu_shell_append(GTK_MENU_SHELL(trayicon_menu),trayicon_menuitem_about);
    gtk_widget_show_all(trayicon_menu);
    gtk_status_icon_set_tooltip (trayicon, "Birl");
    gtk_status_icon_set_visible(trayicon, FALSE);
    g_signal_connect(GTK_STATUS_ICON (trayicon), "activate", GTK_SIGNAL_FUNC (about), NULL);
    g_signal_connect(GTK_STATUS_ICON (trayicon), "popup-menu", GTK_SIGNAL_FUNC (trayIconPopup), trayicon_menu);

}
ADM_tray::ADM_tray(void* parent)
{
	_parent = parent;
	lastIcon = 0;
	int nb = sizeof(animated) / sizeof(char *);

	if (!pixbuf)
	{
		pixbuf = new GdkPixbuf*[nb];

		for (int i = 0; i < nb; i++)
		{
			pixbuf[i] = create_pixbuf(animated[i]);

			if (!pixbuf[i])
			{
				printf("Failed to create <%s>\n", animated[i]);
				ADM_assert(0);
			}
		}
	}

	sys = gtk_status_icon_new_from_pixbuf(pixbuf[0]);

	g_signal_connect(G_OBJECT(sys), "activate", G_CALLBACK(tray_icon_on_click), _parent);
	g_signal_connect(G_OBJECT(sys), "popup-menu", G_CALLBACK(tray_icon_popup_menu), _parent);
	gtk_status_icon_set_tooltip((GtkStatusIcon*)sys, "Avidemux");
	gtk_status_icon_set_visible((GtkStatusIcon*)sys, TRUE);
}
Esempio n. 7
0
/* Startup calls and initializations */
static void clipit_init() {
	/* Create clipboard */
	primary = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
	clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
	g_timeout_add(CHECK_INTERVAL, item_check, NULL);

	/* Read preferences */
	read_preferences();

	/* Read history */
	if (prefs.save_history)
		read_history();

	/* Bind global keys */
	keybinder_init();
	keybinder_bind(prefs.history_key, history_hotkey, NULL);
	keybinder_bind(prefs.actions_key, actions_hotkey, NULL);
	keybinder_bind(prefs.menu_key, menu_hotkey, NULL);
	keybinder_bind(prefs.search_key, search_hotkey, NULL);
	keybinder_bind(prefs.offline_key, offline_hotkey, NULL);

	/* Create status icon */
	if (!prefs.no_icon)
	{
#ifdef HAVE_APPINDICATOR
	create_app_indicator(1);
#else
	status_icon = gtk_status_icon_new_from_icon_name("clipit-trayicon");
	gtk_status_icon_set_tooltip((GtkStatusIcon*)status_icon, _("Clipboard Manager"));
	g_signal_connect((GObject*)status_icon, "button_press_event", (GCallback)status_icon_clicked, NULL);
#endif
	}
}
Esempio n. 8
0
File: na.c Progetto: inguin/nall
/* reap each script output and refresh the tooltip buffer */
void na_update_tooltip(void)
{
	gchar tooltip_buffer[BUFSIZ];
	gint status;

	status = 0;
	tooltip_buffer[0] = '\0';

	GtkTreeModel* tree = GTK_TREE_MODEL(nall_globals.script_list);
	GtkTreeIter iter;
	gboolean valid = gtk_tree_model_get_iter_first(tree, &iter);
	while (valid) {
		gboolean enabled;
		run_data_t* s;
		gtk_tree_model_get(tree, &iter,
			COLUMN_ENABLED, &enabled,
			COLUMN_RUN_DATA, &s,
			-1);
		if (s->initialized && enabled) {
			na_script_append_out(s, tooltip_buffer);
			na_script_collect_status(s, &status);
		}
		valid = gtk_tree_model_iter_next(tree, &iter);
	}

	int len = strlen(tooltip_buffer);
	if (len > 0 && tooltip_buffer[len - 1] == '\n')
		tooltip_buffer[len - 1]='\0';
	gtk_status_icon_set_tooltip(nall_globals.icon, tooltip_buffer);

	const gchar* icon = (status == 0) ? GTK_STOCK_INFO : GTK_STOCK_DIALOG_WARNING;
	gtk_status_icon_set_from_stock(nall_globals.icon, icon);
}
Esempio n. 9
0
File: ftmenu.c Progetto: taq/ftmenu
static GtkStatusIcon *create_icon() {
	GtkStatusIcon *icon;
	icon = gtk_status_icon_new();
	gtk_status_icon_set_from_icon_name(icon,GTK_STOCK_INDEX);
	gtk_status_icon_set_visible(icon,TRUE);
	gtk_status_icon_set_tooltip(icon,"Click here for the Fluxbox menu");
	return icon;
}
Esempio n. 10
0
void getnamepwd(GtkWidget *widget, gpointer data)
{
	LOGIN_DATA *info=(LOGIN_DATA *)data;
	const gchar  *str1=gtk_entry_get_text( (GtkEntry *)info->e1 );
	const gchar  *str2=gtk_entry_get_text( (GtkEntry *)info->e2 );
	char name[16]={0};
	char pwd[16]={0};
	strncpy(name,str1,strlen(str1));
	strncpy(pwd,str2,strlen(str2));

	/////通讯	
	int tcpfd,n;
	socklen_t len;
	len=sizeof(server_addr);

	char send_buff[33]={0};
	char recv_buff[64]={0};
	strcat(send_buff,name);
	strcat(send_buff,":");
	strcat(send_buff,pwd);
	
	tcpfd=socket(AF_INET,SOCK_STREAM,0);
	connect(tcpfd,(struct sockaddr *)&server_addr,len);
	write(tcpfd,send_buff,strlen(send_buff));
	n=read(tcpfd,recv_buff,64 );

	GtkWidget *dialog_info;
	if( !strncmp(recv_buff,"success@",8) )
	{
		PORT=atoi(recv_buff+8);
		g_thread_create( (GThreadFunc)initlisten,NULL,FALSE,NULL);
		recvuserList(tcpfd);		
		dialog_info=gtk_message_dialog_new(NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_INFO,GTK_BUTTONS_OK,"登陆成功");
		gtk_dialog_run(GTK_DIALOG(dialog_info));
		gtk_widget_destroy(dialog_info);
		flag=1;
		gtk_widget_set_sensitive(item_addfriends,TRUE);
		gtk_widget_set_sensitive(item_delfriends,TRUE);
		gtk_widget_set_sensitive(item_savechatlog,TRUE);
		gtk_widget_set_sensitive(item_login,FALSE);
		memset(currentname,0,16);
		strncpy(currentname,name,strlen(name));
		gtk_window_set_title(GTK_WINDOW(window), currentname);
		char traybuf[32]={0};
		sprintf(traybuf,"%s-GLchat",currentname);
		gtk_status_icon_set_tooltip (trayIcon, traybuf);
//		printf("currentname=%s\n",currentname);
		gtk_widget_destroy(info->e3);
	}
	else
	{
		dialog_info=gtk_message_dialog_new(NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_INFO,GTK_BUTTONS_OK,"登陆失败");
		gtk_dialog_run(GTK_DIALOG(dialog_info));
		gtk_widget_destroy(dialog_info);
	}	
	
}
Esempio n. 11
0
void NotifyUpdate() {
	if (Connected==1 && icon_s!=1) {
		icon_s=1;
		gtk_status_icon_set_from_file (Notify, icon_c);
	}
	if (Connected==0 && icon_s!=2) {
		icon_s=2;
		gtk_status_icon_set_from_file (Notify, icon_d);
	}
	if (Connected==2 && icon_s!=0) {
		icon_s=0;
		gtk_status_icon_set_from_file (Notify, icon_n);
	}
	
	if (Connected==0) gtk_status_icon_set_tooltip (Notify, "GVPN - Disconnected");
	if (Connected==1) gtk_status_icon_set_tooltip (Notify, "GVPN - Connected");	
	if (Connected==2) gtk_status_icon_set_tooltip (Notify, "GVPN - Connecting...");	
}
Esempio n. 12
0
File: gtunet.c Progetto: nefo/gtunet
/*
 * gtunet_create_tray_icon
 *
 * Create a tray icon on the system tray to represent current status
 */
GtkStatusIcon *
gtunet_create_tray_icon ()
{
  GtkStatusIcon *tray_icon;

  tray_icon = gtk_status_icon_new();
  gtk_status_icon_set_tooltip(tray_icon, "gTunet");

  return tray_icon;
}
Esempio n. 13
0
static void
on_state_changed(HippoConnection         *connection,
                 HippoStatusIcon         *icon)
{
    g_object_set(G_OBJECT(icon), 
                 "icon-name", get_icon_name(connection), 
                 NULL);
    
    gtk_status_icon_set_tooltip(GTK_STATUS_ICON(icon),
                                hippo_connection_get_tooltip(connection));
}
Esempio n. 14
0
void CUIHandler::UpdateOnConnected()
{
    gdk_threads_enter();
    gtk_status_icon_set_from_pixbuf(trayIcon, connectedTrayIcon);
    gtk_status_icon_set_tooltip(trayIcon, TRAY_TOOLTIP_CONNECTED);
    g_object_set(G_OBJECT(tbSettings), "sensitive", FALSE, NULL);    // disable settings
    g_object_set(G_OBJECT(miSettings), "sensitive", FALSE, NULL);
    g_object_set(G_OBJECT(tbDisconnect), "sensitive", TRUE, NULL);   // enable disconnect
    gtk_label_set_text(GTK_LABEL(statusbarLabelConnection), STATUS_MSG_CONNECTED);
    gdk_threads_leave();
}
Esempio n. 15
0
static void ui_create_status_icon(KIM * im)
{
    GtkStatusIcon *trayIcon;

    trayIcon = gtk_status_icon_new_from_file("/home/auv/right.png");
    gtk_status_icon_set_visible(trayIcon, TRUE);
    gtk_status_icon_set_blinking(trayIcon, TRUE);
    gtk_status_icon_set_tooltip(trayIcon, "auv is a good v!");

    g_signal_connect(trayIcon, "popup-menu", G_CALLBACK(status_icon_popup_menu_cb), NULL);
}
static GtkStatusIcon *create_tray_icon() {
    GtkStatusIcon *tray_icon;

    tray_icon = gtk_status_icon_new();
    g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "popup-menu",G_CALLBACK(tray_icon_on_menu), NULL);
    gtk_status_icon_set_from_icon_name(tray_icon, GTK_STOCK_REFRESH);
    gtk_status_icon_set_tooltip(tray_icon, "Fan control");
    gtk_status_icon_set_visible(tray_icon, TRUE);

    return tray_icon;
}
static gboolean
update_tooltip (DrWright *dr)
{
	gint   elapsed_time, min;
	gchar *str;

	if (!dr->enabled) {
		gtk_status_icon_set_tooltip (dr->icon,
					     _("Disabled"));
		return TRUE;
	}

	elapsed_time = g_timer_elapsed (dr->timer, NULL);

	switch (dr->state) {
	case STATE_WARN_TYPE:
	case STATE_WARN_IDLE:
		min = floor (0.5 + (dr->warn_time - elapsed_time) / 60.0);
		break;

	default:
		min = floor (0.5 + (dr->type_time - elapsed_time) / 60.0);
		break;
	}

	if (min >= 1) {
		str = g_strdup_printf (ngettext("%d minute until the next break",
						"%d minutes until the next break",
						min), min);
	} else {
		str = g_strdup_printf (_("Less than one minute until the next break"));
	}

	gtk_status_icon_set_tooltip (dr->icon,
				     str);

	g_free (str);

	return TRUE;
}
Esempio n. 18
0
void update_icon(void){
	E_RETURN is_wall_active;
	is_wall_active = torwall_client_status();
	if (is_wall_active == STATUS_RUNNING) {
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallActive");
		update_notify(TOOL_ACTIVE, "torwallActive");
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_ACTIVE);
		g_signal_handler_block(ch_toggle, ch_toggle_handler_id);
		gtk_check_menu_item_set_active(ch_toggle, 1);
		gtk_widget_set_sensitive((GtkWidget*)i_currentnode, 1);
		g_signal_handler_unblock(ch_toggle, ch_toggle_handler_id);
	} else {
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallInactive");
		update_notify(TOOL_INACTIVE, "torwallInactive");
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_INACTIVE);
		g_signal_handler_block(ch_toggle, ch_toggle_handler_id);
		gtk_check_menu_item_set_active(ch_toggle, 0);
		gtk_widget_set_sensitive((GtkWidget*)i_currentnode, 0);
		g_signal_handler_unblock(ch_toggle, ch_toggle_handler_id);
	}
}
Esempio n. 19
0
void create_tray_icon(){
	E_RETURN is_wall_active;
	is_wall_active = torwall_client_status();
	tray_icon = gtk_status_icon_new();
	create_menu(is_wall_active);
	g_signal_connect(G_OBJECT(tray_icon), "activate", 
			G_CALLBACK(on_click), NULL);
	g_signal_connect(G_OBJECT(tray_icon), 
			"popup-menu",
			G_CALLBACK(on_menu), NULL);
	gtk_status_icon_set_from_icon_name(tray_icon, 
			GTK_STOCK_MEDIA_STOP);
	create_notify(tray_icon, TOOL_INACTIVE);
	if (is_wall_active == STATUS_RUNNING) {
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_ACTIVE);
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallActive");
	} else {
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_INACTIVE);
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallInactive");
	}
	gtk_status_icon_set_visible(tray_icon, TRUE);
}
Esempio n. 20
0
void CUIHandler::UpdateOnDisconnected()
{
    gdk_threads_enter();
    printf("smartcam: disconnected\n");
    gtk_image_set_from_pixbuf(GTK_IMAGE(image), logoIcon);
    gtk_widget_queue_draw(image);
    gtk_status_icon_set_from_pixbuf(trayIcon, disconnectedTrayIcon);
    gtk_status_icon_set_tooltip(trayIcon, TRAY_TOOLTIP_DISCONNECTED);
    g_object_set(G_OBJECT(tbSettings), "sensitive", TRUE, NULL);    // enable settings
    g_object_set(G_OBJECT(miSettings), "sensitive", TRUE, NULL);
    g_object_set(G_OBJECT(tbDisconnect), "sensitive", FALSE, NULL); // disable disconnect
    gtk_label_set_text(GTK_LABEL(statusbarLabelConnection), STATUS_MSG_DISCONNECTED);
    gtk_label_set_text(GTK_LABEL(statusbarLabelFps), STATUS_LABEL_FPS);
    gtk_label_set_text(GTK_LABEL(statusbarLabelResolution), STATUS_LABEL_RESOLUTION);
    gdk_threads_leave();
}
Esempio n. 21
0
static int gtkDialogSetTrayTipAttrib(Ihandle *ih, const char *value)
{
  GtkStatusIcon* status_icon = gtkDialogGetStatusIcon(ih);
#if GTK_CHECK_VERSION(2, 16, 0)
  if (value)
  {
    gtk_status_icon_set_has_tooltip(status_icon, TRUE);
    gtk_status_icon_set_tooltip_text(status_icon, value);
  }
  else
    gtk_status_icon_set_has_tooltip(status_icon, FALSE);
#else
  gtk_status_icon_set_tooltip(status_icon, value);
#endif
  return 1;
}
static void
status_icon_update_tooltip (EmpathyStatusIcon *icon)
{
    EmpathyStatusIconPriv *priv = GET_PRIV (icon);
    const gchar           *tooltip = NULL;

    if (priv->event) {
        tooltip = priv->event->message;
    }

    if (!tooltip) {
        tooltip = empathy_idle_get_status (priv->idle);
    }

    gtk_status_icon_set_tooltip (priv->icon, tooltip);
}
Esempio n. 23
0
static gboolean
init_timeout (void)
{
    guint num_processes;
    gfloat cpu, memory, swap;
    guint64 swap_free, swap_total;
    gchar tooltip[1024];

    xtm_task_manager_get_system_info (task_manager, &num_processes, &cpu, &memory, &swap);
    xtm_process_window_set_system_info (XTM_PROCESS_WINDOW (window), num_processes, cpu, memory, swap);

    xtm_task_manager_get_swap_usage (task_manager, &swap_free, &swap_total);
    xtm_process_window_show_swap_usage (XTM_PROCESS_WINDOW (window), (swap_total > 0));

    if (gtk_status_icon_get_visible (status_icon))
    {
#if GTK_CHECK_VERSION (2,16,0)
        g_snprintf (tooltip, 1024,
                    _("<b>Processes:</b> %u\n"
                      "<b>CPU:</b> %.0f%%\n"
                      "<b>Memory:</b> %.0f%%\n"
                      "<b>Swap:</b> %.0f%%"),
                    num_processes, cpu, memory, swap);
        gtk_status_icon_set_tooltip_markup (GTK_STATUS_ICON (status_icon), tooltip);
#else
        g_snprintf (tooltip, 1024,
                    _("Processes: %u\n"
                      "CPU: %.0f%%\n"
                      "Memory: %.0f%%\n"
                      "Swap: %.0f%%"),
                    num_processes, cpu, memory, swap);
        gtk_status_icon_set_tooltip (GTK_STATUS_ICON (status_icon), tooltip);
#endif
    }

    xtm_task_manager_update_model (task_manager);

    if (timeout == 0)
    {
        guint refresh_rate;
        g_object_get (settings, "refresh-rate", &refresh_rate, NULL);
        timeout = g_timeout_add (refresh_rate, (GSourceFunc)init_timeout, NULL);
    }

    return TRUE;
}
Esempio n. 24
0
static GtkStatusIcon *create_tray_icon() 
{
  GtkStatusIcon *tray_icon;
  gchar* filename;
  tray_icon = gtk_status_icon_new();
      
  g_signal_connect(G_OBJECT(tray_icon), "popup-menu", 
                         G_CALLBACK(tray_icon_on_click), NULL);
  g_signal_connect(G_OBJECT(tray_icon), "activate",
                         G_CALLBACK(tray_icon_on_click), NULL);
		
  filename = g_build_filename (g_get_current_dir(), "moo.png", NULL);
  printf("PATH for sysIcon: %s\n",filename);		
  gtk_status_icon_set_from_file(tray_icon, filename);
        
  gtk_status_icon_set_tooltip(tray_icon, "Click to Hide/Show GtkMoo\n \302\251 Rohit Yadav, 2008-10");
  gtk_status_icon_set_visible(tray_icon, TRUE);
  return tray_icon;
}
Esempio n. 25
0
static void
update_status_icon_and_window (void)
{
    char *tooltip;

    tooltip = g_strdup_printf (ngettext ("%'d file operation active",
                                         "%'d file operations active",
                                         n_progress_ops),
                               n_progress_ops);
    gtk_status_icon_set_tooltip (status_icon, tooltip);
    g_free (tooltip);

    if (n_progress_ops == 0) {
        gtk_status_icon_set_visible (status_icon, FALSE);
        gtk_widget_hide (get_progress_window ());
    } else {
        gtk_status_icon_set_visible (status_icon, TRUE);
    }
}
uint8_t ADM_tray::setPercent(int percent)
{
	char percentS[40];

	sprintf(percentS, "Avidemux [%d%%]", percent);

	if (sys)
	{
		int maxIcons = sizeof(animated) / sizeof(char *);
		lastIcon++;

		if (lastIcon >= maxIcons)
			lastIcon = 0;

		gtk_status_icon_set_from_pixbuf((GtkStatusIcon*)sys, pixbuf[lastIcon]);
		gtk_status_icon_set_tooltip((GtkStatusIcon*)sys, percentS);
	}

	return 1;
}
Esempio n. 27
0
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;
}
Esempio n. 28
0
HippoStatusIcon*
hippo_status_icon_new(HippoDataCache *cache)
{
    HippoConnection *connection = hippo_data_cache_get_connection(cache);
    HippoStatusIcon *icon;
    
    icon = g_object_new(HIPPO_TYPE_STATUS_ICON,
                        "icon-name", get_icon_name(connection),
                        NULL);
    
    icon->cache = cache;
    g_object_ref(icon->cache);

    g_signal_connect(connection, "state-changed",
                     G_CALLBACK(on_state_changed), icon);

    gtk_status_icon_set_tooltip(GTK_STATUS_ICON(icon),
                                hippo_connection_get_tooltip(connection));

    return HIPPO_STATUS_ICON(icon);
}
Esempio n. 29
0
GtkWidget *fd_systray_create()
{
    GtkStatusIcon *status_icon = NULL;
    GdkPixbuf *pixbuf;

    pixbuf = create_pixbuf ("pixmaps/freedict.png");
    if (pixbuf) {
        status_icon = gtk_status_icon_new_from_pixbuf(pixbuf);
        gdk_pixbuf_unref(pixbuf);
    }

    g_signal_connect((gpointer)status_icon,
                     "activate", G_CALLBACK (status_icon_activate_cb), NULL);
    g_signal_connect((gpointer)status_icon,
                     "popup-menu", G_CALLBACK(status_icon_popup_menu_cb), NULL);

    gtk_status_icon_set_tooltip(status_icon, "Freedict");

    GLADE_HOOKUP_OBJECT_NO_REF(status_icon, status_icon, "status_icon");

    return (GtkWidget *)status_icon;
}
Esempio n. 30
0
static GtkStatusIcon *create_tray_icon() {
        GtkStatusIcon *tray_icon;

        tray_icon = gtk_status_icon_new();
        g_signal_connect(G_OBJECT(tray_icon), "activate", 
                         G_CALLBACK(tray_icon_on_click), NULL);
        g_signal_connect(G_OBJECT(tray_icon), 
                         "popup-menu",
                         G_CALLBACK(tray_icon_on_menu), NULL);

        /* GdkPixbuf *default_icon = gdk_pixbuf_new_from_xpm_data(firefox_xpm); */

        /* gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray_icon), */
        /*                                 GDK_PIXBUF(default_icon)); */
        const gchar *default_icon_filename = "firefox32.png";
        gtk_status_icon_set_from_file(tray_icon,
                                      default_icon_filename);
        gtk_status_icon_set_tooltip(tray_icon, 
                                    "Example Tray Icon");
        gtk_status_icon_set_visible(tray_icon, TRUE);

        return tray_icon;
}