Exemplo n.º 1
0
static void
status_icon_update_tooltip (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);

	if (priv->event) {
		gchar *tooltip = NULL;

		if (priv->event->message != NULL)
				tooltip = g_markup_printf_escaped ("<i>%s</i>\n%s",
								   priv->event->header,
								   priv->event->message);
		else
				tooltip = g_markup_printf_escaped ("<i>%s</i>",
								   priv->event->header);
		gtk_status_icon_set_tooltip_markup (priv->icon, tooltip);
		g_free (tooltip);
	} else {
		TpConnectionPresenceType type;
		gchar *msg;

		type = tp_account_manager_get_most_available_presence (
			priv->account_manager, NULL, &msg);

		if (!EMP_STR_EMPTY (msg)) {
			gtk_status_icon_set_tooltip_text (priv->icon, msg);
		}
		else {
			gtk_status_icon_set_tooltip_text (priv->icon,
						empathy_presence_get_default_message (type));
		}

		g_free (msg);
	}
}
Exemplo n.º 2
0
static void
unread_count_cb (G_GNUC_UNUSED GtkWidget *widget,
		 guint messages,
		 gpointer data)
{
  StatusIcon *self = STATUSICON (data);

  gchar *message = NULL;

  if (messages > 0)
    statusicon_start_blinking (self, "im-message");
  else
    statusicon_stop_blinking (self);

  if (messages > 0) {

    message = g_strdup_printf (ngettext ("You have %d message",
					 "You have %d messages",
					 messages), messages);
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), message);
    g_free (message);
  }
  else
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), NULL);

  self->priv->unread_messages = (messages > 0);
}
Exemplo n.º 3
0
/*
  Read data and update tooltip
*/
gboolean
temp_notifier_timeout_func (temp_notifier_s *core)
{
  FILE *file;
  char string[50];
  char temperature[6];
  int i = 0, j = 0;

  /* Read CPU0's temperature */
  file = fopen (core->thermal_file_cpu0, "r");
  if (file != NULL)
  {
    fread (&string, sizeof (string), 1, file);
    snprintf (temperature, 3, "%c%c\0", string[25], string[26]);
    fclose (file);

    core->cpu0_temp = atoi (temperature);

    /* Check temperature */
    i = temp_notifier_check_temp (core->cpu0_temp, core->critical_temp);
	}
  else
    core->cpu0_temp = -1;
	
  /* Read CPU0's temperature */
  file = fopen (core->thermal_file_cpu1, "r");
  if (file != NULL)
  {
    fread (&string, sizeof (string), 1, file);
    snprintf (temperature, 3, "%c%c\0", string[25], string[26]);
    fclose (file);

    core->cpu1_temp = atoi (temperature);

    /* Check temperature */
    j = temp_notifier_check_temp (core->cpu1_temp, core->critical_temp);
  }
  else
    core->cpu1_temp = -1;
	
  /* Check GtkStatusIcon */
  if ((i == -1) || (j == -1))
    gtk_status_icon_set_blinking (GTK_STATUS_ICON(core->icon), TRUE);
  else
    gtk_status_icon_set_blinking (GTK_STATUS_ICON(core->icon), FALSE);

  /* Update GtkTooltip */
  if ((core->cpu0_temp == -1) && (core->cpu1_temp == -1))
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: ERROR\n- CPU2: ERROR"));
  else if (core->cpu0_temp == -1)
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: ERROR\n- CPU2: %d C", core->cpu1_temp));
  else if (core->cpu1_temp == -1)
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: %d C\n- CPU2: ERROR", core->cpu0_temp));
  else
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: %d C\n- CPU2: %d C", core->cpu0_temp, core->cpu1_temp));

  return TRUE;
}
NS_IMETHODIMP Icon::Init(nsIDOMWindow *aWindow, const nsString& aTitle)
{
  nsresult rv;
  nsCOMPtr<nsIBaseWindow> baseWindow;
  rv = GetBaseWindow(aWindow, getter_AddRefs(baseWindow));
  NS_ENSURE_SUCCESS(rv, rv);

  nativeWindow native = 0;
  rv = baseWindow->GetParentNativeWindow(&native);
  NS_ENSURE_SUCCESS(rv, rv);

  // Get the window
  mGdkWindow = gdk_window_get_toplevel(reinterpret_cast<GdkWindow*>(native));
  if (!mGdkWindow) {
    return NS_ERROR_UNEXPECTED;
  }

  // Get the widget and gtk window
  GtkWidget *widget;
  gdk_window_get_user_data(mGdkWindow, reinterpret_cast<gpointer*>(&widget));
  widget = gtk_widget_get_toplevel(widget);
  mGtkWindow = reinterpret_cast<GtkWindow*>(widget);

  // Set up tray icon
  mStatusIcon = gtk_status_icon_new();

  // Get the window icon and set it
  GdkPixbuf *buf = gtk_window_get_icon(mGtkWindow);
  if (buf) {
    gtk_status_icon_set_from_pixbuf(mStatusIcon, buf);
  } else {
    const gchar *iconname = gtk_window_get_icon_name(mGtkWindow);
    if (iconname)
      gtk_status_icon_set_from_icon_name(mStatusIcon, iconname);
  }

  // Get and set the title
  if (aTitle.IsEmpty()) {
    gtk_status_icon_set_tooltip_text(mStatusIcon, gtk_window_get_title(mGtkWindow));
    gtk_widget_add_events(widget, GDK_PROPERTY_CHANGE_MASK);
    propertyEventId = g_signal_connect(mGtkWindow, "property-notify-event", G_CALLBACK(gtkPropertyEvent), this);
  }
  else {
    NS_ConvertUTF16toUTF8 titleUTF8(aTitle);
    gtk_status_icon_set_tooltip_text(mStatusIcon, reinterpret_cast<const char*>(titleUTF8.get()));
    propertyEventId = 0;
  }

  // Add signals
  g_signal_connect(G_OBJECT(mStatusIcon), "button-press-event", G_CALLBACK(gtkButtonEvent), this);
  g_signal_connect(G_OBJECT(mStatusIcon), "button-release-event", G_CALLBACK(gtkButtonEvent), this);

  // Make visible
  gtk_status_icon_set_visible(mStatusIcon, 1);
  return NS_OK;
}
Exemplo n.º 5
0
gint
yad_notification_run ()
{
  GIOChannel *channel = NULL;

  status_icon = gtk_status_icon_new ();
  g_signal_connect (status_icon, "size-changed", G_CALLBACK (icon_size_changed_cb), NULL);

  if (options.data.dialog_text)
    {
      if (!options.data.no_markup)
        gtk_status_icon_set_tooltip_markup (status_icon, options.data.dialog_text);
      else
        gtk_status_icon_set_tooltip_text (status_icon, options.data.dialog_text);
    }
  else
    gtk_status_icon_set_tooltip_text (status_icon, _("Yad notification"));

  if (options.data.dialog_image)
    icon = g_strdup (options.data.dialog_image);
  if (options.common_data.command)
    action = g_strdup (options.common_data.command);

  set_icon ();

  g_signal_connect (status_icon, "activate", G_CALLBACK (activate_cb), NULL);
  g_signal_connect (status_icon, "popup_menu", G_CALLBACK (popup_menu_cb), NULL);

  if (options.notification_data.menu)
    parse_menu_str (options.notification_data.menu);

  /* quit on middle click (like press Esc) */
  if (options.notification_data.middle)
    g_signal_connect (status_icon, "button-press-event", G_CALLBACK (middle_quit_cb), NULL);

  if (options.common_data.listen)
    {
      channel = g_io_channel_unix_new (0);
      if (channel)
        {
          g_io_channel_set_encoding (channel, NULL, NULL);
          g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
          g_io_add_watch (channel, G_IO_IN | G_IO_HUP, handle_stdin, NULL);
        }
    }

  /* Show icon and wait */
  gtk_status_icon_set_visible (status_icon, !options.notification_data.hidden);

  if (options.data.timeout > 0)
    g_timeout_add_seconds (options.data.timeout, (GSourceFunc) timeout_cb, NULL);

  gtk_main ();

  return exit_code;
}
static gboolean
update_status (DrWright *dr)
{
    gint       min;
    gchar     *str;
#ifdef HAVE_APP_INDICATOR
    GtkWidget *item;
#endif /* HAVE_APP_INDICATOR */

    if (!dr->enabled) {
#ifdef HAVE_APP_INDICATOR
        app_indicator_set_status (dr->indicator,
                                  APP_INDICATOR_STATUS_PASSIVE);
#else
        gtk_status_icon_set_tooltip_text (dr->icon,
                                          _("Disabled"));
#endif /* HAVE_APP_INDICATOR */
        return TRUE;
    }

    min = get_time_left (dr);

    if (min >= 1) {
#ifdef HAVE_APP_INDICATOR
        str = g_strdup_printf (_("Take a break now (next in %dm)"), min);
#else
        str = g_strdup_printf (ngettext("%d minute until the next break",
                                        "%d minutes until the next break",
                                        min), min);
#endif /* HAVE_APP_INDICATOR */
    } else {
#ifdef HAVE_APP_INDICATOR
        str = g_strdup_printf (_("Take a break now (next in less than one minute)"));
#else
        str = g_strdup_printf (_("Less than one minute until the next break"));
#endif /* HAVE_APP_INDICATOR */
    }

#ifdef HAVE_APP_INDICATOR
    item = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop/TakeABreak");
    gtk_menu_item_set_label (GTK_MENU_ITEM (item), str);
#else
    gtk_status_icon_set_tooltip_text (dr->icon, str);
#endif /* HAVE_APP_INDICATOR */

    g_free (str);

    return TRUE;
}
Exemplo n.º 7
0
/*创建系统托盘*/
void create_tray(GtkWidget *win)
{
	GtkStatusIcon *tray;
	GtkWidget *menu;
	GtkWidget *item;

	tray=gtk_status_icon_new_from_file("img/64x64/gtk_goagent.png");
	gtk_status_icon_set_tooltip_text(tray,"Gtk GoAgent");
	/*设置系统托盘可见*/
	gtk_status_icon_set_visible(tray,TRUE);
	g_signal_connect(G_OBJECT(tray),"activate",G_CALLBACK(tray_on_click),win);

	menu=gtk_menu_new();
	item=gtk_menu_item_new_with_mnemonic(_("_Show"));
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),item);
	g_signal_connect(G_OBJECT(item),"activate",G_CALLBACK(tray_on_click),win);
	item=gtk_menu_item_new_with_mnemonic(_("H_ide"));
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),item);
	g_signal_connect(G_OBJECT(item),"activate",G_CALLBACK(hide_win),win);
	item=gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT,NULL);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),item);
	g_signal_connect(G_OBJECT(item),"activate",G_CALLBACK(really_quit),NULL);
	gtk_widget_show_all(menu);

	g_signal_connect(G_OBJECT(tray),"popup_menu",G_CALLBACK(tray_on_menu),menu);
	g_signal_connect(G_OBJECT(win),"window_state_event",G_CALLBACK(hide_window),tray);
}
Exemplo n.º 8
0
/*
 Creates GtkStatusIcon and tooltip
*/
void
launcher_create_icon (launcher_core_s *launcher_core, char *image, char *text)
{
	launcher_core->icon = (GtkWidget *) gtk_status_icon_new_from_pixbuf (create_pixbuf(image));
	gtk_status_icon_set_tooltip_text(GTK_STATUS_ICON(launcher_core->icon), text);
	gtk_widget_set_has_tooltip(launcher_core->window, TRUE);
}
Exemplo n.º 9
0
/* Creates a new trayicon instance */
struct trayicon *trayicon_new(struct view *view, GCallback quit_cb)
{
	START_FUNC
	struct trayicon *trayicon;

	trayicon=g_malloc(sizeof(struct trayicon));
	memset(trayicon, 0, sizeof(struct trayicon));

	trayicon->trayicon_quit=quit_cb;
	trayicon->tray_icon=gtk_status_icon_new();
	trayicon->view=view;
	g_signal_connect(G_OBJECT(trayicon->tray_icon), "activate",
		G_CALLBACK(trayicon_on_click), (gpointer)trayicon);
	g_signal_connect(G_OBJECT(trayicon->tray_icon), "popup-menu",
		G_CALLBACK(trayicon_on_menu), (gpointer)trayicon);
	gtk_status_icon_set_from_icon_name(trayicon->tray_icon, "florence");
	gtk_status_icon_set_tooltip_text(trayicon->tray_icon, _("Florence Virtual Keyboard"));
	gtk_status_icon_set_visible(trayicon->tray_icon, TRUE);

#ifdef ENABLE_NOTIFICATION
	if (settings_get_bool(SETTINGS_STARTUP_NOTIFICATION))
		g_timeout_add(2000, trayicon_notification_start, (gpointer)trayicon);
#endif

	END_FUNC
	return trayicon;
}
Exemplo n.º 10
0
void gTrayIcon::updateTooltip()
{
	if (!plug)
		return;

	gtk_status_icon_set_tooltip_text(plug, buftext);
}
Exemplo n.º 11
0
void
tray_icon_set_title (gchar *title)
{
        if (tray_icon)
                gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (tray_icon),
                                                  title);
}
Exemplo n.º 12
0
static void
update_icon (void)
{
  GSList *l;
  gchar *icon_name;
  gchar *tooltip;

  if (status == TEST_STATUS_INFO)
    {
      icon_name = "dialog-information";
      tooltip = "Some Information ...";
    }
  else
    {
      icon_name = "dialog-question";
      tooltip = "Some Question ...";
    }

  for (l = icons; l; l = l->next)
    {
      GtkStatusIcon *status_icon = l->data;

      gtk_status_icon_set_from_icon_name (status_icon, icon_name);
      gtk_status_icon_set_tooltip_text (status_icon, tooltip);
    }
}
Exemplo n.º 13
0
/*
 Battery levels:
 0 .. 10		empty
 10 .. 20	0
 20 .. 40	1
 40 .. 60	2
 60 .. 80	3
 80 .. 100	4
 100			5
 */
void update_status_icon(int level, BATT_STATUS status)
{
	gchar *icon;
	static int old_level=-1;
	static BATT_STATUS old_status=BATT_NORMAL;

	if(level==old_level && status==old_status)
		return;

	old_level=level;
	old_status=status;

	if(level<10 && status==BATT_NORMAL){
		icon=g_strdup("_empty");
	}else if(level==100){
		icon=g_strdup("_5");
	}else if(status==BATT_CHARGING){
		icon=g_strdup_printf("_ch_%d",level/20);
	}else{
		icon=g_strdup_printf("_%d",level/20);
	}

	gchar *path=g_strdup_printf("%sbatt%s.png",ICONS_PATH,icon);
	if(!status_icon_batt_meter)
		status_icon_batt_meter=gtk_status_icon_new_from_file(ICONS_PATH "network-strength-none.png");
	else
		gtk_status_icon_set_from_file(status_icon_batt_meter,path);

	gchar *tip=g_strdup_printf("%d%%",level);
	gtk_status_icon_set_tooltip_text(status_icon_batt_meter,tip);

	g_free(tip);
	g_free(path);
	g_free(icon);
}
Exemplo n.º 14
0
static void
statusicon_activated_cb (G_GNUC_UNUSED GtkStatusIcon *icon,
                         gpointer data)
{
  StatusIcon *self = STATUSICON (data);

  // No unread messages => show ekiga
  if (!self->priv->unread_messages) {

    // FIXME: When the main_window will be a GtkFrontend component,
    // this signal will be useless
    g_signal_emit (self, signals, 0, NULL);
  }
  else {

    // Unread messages => show chat window
    boost::shared_ptr<GtkFrontend> frontend = self->priv->frontend.lock();

    if (frontend) {

      GtkWidget *w = GTK_WIDGET (frontend->get_chat_window ());
      gtk_widget_show (w);
      gtk_window_present (GTK_WINDOW (w));
    }
  }

  // Remove warnings from statusicon
  statusicon_set_status (STATUSICON (data), STATUSICON (data)->priv->status);
  gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), NULL);
}
Exemplo n.º 15
0
void create_status_icon()
{
  tray_icon = gtk_status_icon_new();
  g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(status_icon_activate), NULL);
  g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(_tray_callback), GINT_TO_POINTER(-1));
  gtk_status_icon_set_tooltip_text(tray_icon, tray_name);
  gtk_status_icon_set_visible(tray_icon, TRUE);
}
Exemplo n.º 16
0
void systray_create(menu_infos_t* mis)
{
    mis->icon = ui_statusicon();
    systray_menu_create(mis);
    g_signal_connect(mis->icon, "button-press-event", G_CALLBACK(systray_click_cb), mis);
    g_signal_connect(mis->icon, "scroll-event", G_CALLBACK(systray_scroll_cb), mis);
    gtk_status_icon_set_tooltip_text(mis->icon, "connecting to server...");
    gtk_status_icon_set_visible(mis->icon, TRUE);
}
Exemplo n.º 17
0
Arquivo: gicon.c Projeto: S010/test
void
on_tt_text_set_clicked(GtkWidget *widget, gpointer data)
{
	GtkEntry *entry = data;
	const char *text;

	text = gtk_entry_get_text(entry);
	if (text != NULL && strcmp(text, "") != 0)
		gtk_status_icon_set_tooltip_text(status_icon, text);
}
Exemplo n.º 18
0
static void
is_indicator_set_label(IsIndicator *self,
                       const gchar *label)
{
#if HAVE_APPINDICATOR
  app_indicator_set_label(APP_INDICATOR(self), label, label);
#else
  gtk_status_icon_set_tooltip_text(GTK_STATUS_ICON(self), label);
#endif
}
Exemplo n.º 19
0
static void
update_online(DHCPCD_CONNECTION *con, bool showif)
{
	bool ison, iscarrier;
	char *msg, *msgs, *tmp;
	DHCPCD_IF *ifs, *i;

	ison = iscarrier = false;
	msgs = NULL;
	ifs = dhcpcd_interfaces(con);
	for (i = ifs; i; i = i->next) {
		if (g_strcmp0(i->type, "link") == 0) {
			if (i->up)
				iscarrier = true;
		} else {
			if (i->up)
				ison = true;
		}
		msg = dhcpcd_if_message(i, NULL);
		if (msg) {
			if (showif)
				g_message("%s", msg);
			if (msgs) {
				tmp = g_strconcat(msgs, "\n", msg, NULL);
				g_free(msgs);
				g_free(msg);
				msgs = tmp;
			} else
				msgs = msg;
		} else if (showif)
			g_message("%s: %s", i->ifname, i->reason);
	}

	if (online != ison || carrier != iscarrier) {
		online = ison;
		carrier = iscarrier;
		if (ani_timer != 0) {
			g_source_remove(ani_timer);
			ani_timer = 0;
			ani_counter = 0;
		}
		if (ison) {
			animate_online(NULL);
			ani_timer = g_timeout_add(300, animate_online, NULL);
		} else if (iscarrier) {
			animate_carrier(NULL);
			ani_timer = g_timeout_add(500, animate_carrier, NULL);
		} else {
			gtk_status_icon_set_from_icon_name(status_icon,
			    "network-offline");
		}
	}
	gtk_status_icon_set_tooltip_text(status_icon, msgs);
	g_free(msgs);
}
Exemplo n.º 20
0
void remmina_icon_init(void)
{
	if (!remmina_icon.icon && !remmina_pref.disable_tray_icon)
	{
#ifdef HAVE_LIBAPPINDICATOR
		remmina_icon.icon = app_indicator_new ("remmina-icon", "remmina", APP_INDICATOR_CATEGORY_OTHER);
		app_indicator_set_icon_theme_path (remmina_icon.icon, REMMINA_DATADIR G_DIR_SEPARATOR_S "icons");

		app_indicator_set_status (remmina_icon.icon, APP_INDICATOR_STATUS_ACTIVE);
		app_indicator_set_title (remmina_icon.icon, "Remmina");
		remmina_icon_populate_menu ();
#else
		remmina_icon.icon = gtk_status_icon_new_from_icon_name("remmina");

		gtk_status_icon_set_title(remmina_icon.icon, _("Remmina Remote Desktop Client"));
		gtk_status_icon_set_tooltip_text(remmina_icon.icon, _("Remmina Remote Desktop Client"));

		g_signal_connect(G_OBJECT(remmina_icon.icon), "popup-menu", G_CALLBACK(remmina_icon_on_popup_menu), NULL);
		g_signal_connect(G_OBJECT(remmina_icon.icon), "activate", G_CALLBACK(remmina_icon_on_activate), NULL);
#endif
		remmina_widget_pool_hold(TRUE);
	}
	else
		if (remmina_icon.icon)
		{
#ifdef HAVE_LIBAPPINDICATOR
			app_indicator_set_status (remmina_icon.icon, remmina_pref.disable_tray_icon ?
					APP_INDICATOR_STATUS_PASSIVE : APP_INDICATOR_STATUS_ACTIVE);
#else
			gtk_status_icon_set_visible(remmina_icon.icon, !remmina_pref.disable_tray_icon);
#endif
			remmina_widget_pool_hold(!remmina_pref.disable_tray_icon);
		}
	if (!remmina_icon.avahi)
	{
		remmina_icon.avahi = remmina_avahi_new();
	}
	if (remmina_icon.avahi)
	{
		if (remmina_pref.applet_enable_avahi)
		{
			if (!remmina_icon.avahi->started)
				remmina_avahi_start(remmina_icon.avahi);
		}
		else
		{
			remmina_avahi_stop(remmina_icon.avahi);
		}
	}
	if (!remmina_icon.autostart_file)
	{
		remmina_icon.autostart_file = g_strdup_printf("%s/.config/autostart/remmina-applet.desktop", g_get_home_dir());
		remmina_icon_create_autostart_file();
	}
}
Exemplo n.º 21
0
static void create_tray_icon (void)
{
    GtkStatusIcon *tray_icon = gtk_status_icon_new ();

    gtk_status_icon_set_tooltip_text (tray_icon, "cbatticon");
    gtk_status_icon_set_visible (tray_icon, TRUE);

    update_tray_icon (tray_icon);
    g_timeout_add_seconds (configuration.update_interval, (GSourceFunc)update_tray_icon, (gpointer)tray_icon);
    g_signal_connect (G_OBJECT (tray_icon), "activate", G_CALLBACK (tray_icon_on_click), NULL);
}
Exemplo n.º 22
0
static void ccma_menu_show_cb(GtkWidget * menu, CCManagerApplet * applet)
{
    g_return_if_fail(menu != NULL);
    g_return_if_fail(applet != NULL);

    gtk_status_icon_set_tooltip_text(applet->status_icon, NULL);

    ccma_menu_add_item(menu, applet, "INFO");

    gtk_widget_show_all(menu);


}
Exemplo n.º 23
0
static void shoes_native_systray_old(char *title, char *message, char *path) {
    if (stsicon == NULL) {
        stsicon = gtk_status_icon_new_from_file(path);
        stspath = path;
    }
    // detect change of icon
    if (strcmp(path, stspath)) {
        stspath = path;
        gtk_status_icon_set_from_file (stsicon, stspath);
    }
    gtk_status_icon_set_title(stsicon, title);
    gtk_status_icon_set_tooltip_text(stsicon, message);
}
Exemplo n.º 24
0
void display_status_icon ()
{
    status_icon = gtk_status_icon_new_from_icon_name ("fortuner");
    gtk_status_icon_set_visible (status_icon, TRUE); 

    gtk_status_icon_set_tooltip_text (status_icon, "Fortuner");

    // Connect signals
    g_signal_connect (G_OBJECT (status_icon), "popup-menu",
              G_CALLBACK (popup_menu), NULL);

    g_signal_connect (G_OBJECT (status_icon), "activate",
              G_CALLBACK (activate), NULL);
}
Exemplo n.º 25
0
void create_status_icon()
{
    GError *error = NULL;
    GInputStream *stream = g_memory_input_stream_new_from_data(icon, iconSize, NULL);
    GdkPixbuf *pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, &error);
    if (error)
        fprintf(stderr, "Unable to create PixBuf: %s\n", error->message);


    GtkStatusIcon *tray_icon = gtk_status_icon_new_from_pixbuf(pixbuf);
    g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(tray_icon_on_menu), NULL);
    gtk_status_icon_set_tooltip_text(tray_icon, menu_title);
    gtk_status_icon_set_visible(tray_icon, TRUE);
}
Exemplo n.º 26
0
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);
}
Exemplo n.º 27
0
static void legacy_status_icon_real_update_progress (StatusIcon* base) {
	LegacyStatusIcon * self;
	gchar* _tmp0_;
	gchar* tooltip;
	const gchar* _tmp1_;
	gdouble _tmp4_;
	GtkStatusIcon* _tmp13_;
	const gchar* _tmp14_;
	self = (LegacyStatusIcon*) base;
	_tmp0_ = g_strdup ("");
	tooltip = _tmp0_;
	_tmp1_ = ((StatusIcon*) self)->action;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = ((StatusIcon*) self)->action;
		_tmp3_ = g_strdup (_tmp2_);
		_g_free0 (tooltip);
		tooltip = _tmp3_;
	}
	_tmp4_ = ((StatusIcon*) self)->progress;
	if (_tmp4_ > ((gdouble) 0)) {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_ = NULL;
		gdouble _tmp9_;
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp5_ = tooltip;
		_tmp6_ = g_strconcat (_tmp5_, "\n", NULL);
		_tmp7_ = _tmp6_;
		_tmp8_ = _ ("%.1f%% complete");
		_tmp9_ = ((StatusIcon*) self)->progress;
		_tmp10_ = g_strdup_printf (_tmp8_, _tmp9_ * 100);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strconcat (_tmp7_, _tmp11_, NULL);
		_g_free0 (tooltip);
		tooltip = _tmp12_;
		_g_free0 (_tmp11_);
		_g_free0 (_tmp7_);
	}
	_tmp13_ = self->priv->icon;
	_tmp14_ = tooltip;
	gtk_status_icon_set_tooltip_text (_tmp13_, _tmp14_);
	_g_free0 (tooltip);
}
Exemplo n.º 28
0
static GtkStatusIcon *create_tray_icon(unsigned char *imageData, unsigned int imageDataLen) {
    GtkStatusIcon *tray_icon;
    GError *error = NULL;
    GInputStream *stream = g_memory_input_stream_new_from_data(imageData, imageDataLen, NULL);
    GdkPixbuf *pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, &error);
    if (error)
        fprintf(stderr, "Unable to create PixBuf: %s\n", error->message);

    tray_icon = gtk_status_icon_new_from_pixbuf(pixbuf);
    g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(handle_open), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(tray_icon_on_menu), NULL);
    gtk_status_icon_set_tooltip_text(tray_icon, menu_title);
    gtk_status_icon_set_visible(tray_icon, TRUE);

    return tray_icon;
}
Exemplo n.º 29
0
/* Update the tray icon tooltip according to the current audio state. */
static void
update_status_icon_tooltip(GtkStatusIcon *status_icon,
                           const gchar *card, const gchar *channel,
                           gdouble volume, gboolean muted)
{
	char tooltip[64];

	if (!muted)
		snprintf(tooltip, sizeof tooltip, "%s (%s)\n%s: %ld %%",
		         card, channel, _("Volume"), lround(volume));
	else
		snprintf(tooltip, sizeof tooltip, "%s (%s)\n%s: %ld %%\n%s",
		         card, channel, _("Volume"), lround(volume), _("Muted"));

	gtk_status_icon_set_tooltip_text(status_icon, tooltip);
}
static void
progress_ui_handler_update_status_icon (NautilusProgressUIHandler *self)
{
	gchar *tooltip;

	progress_ui_handler_ensure_status_icon (self);

	tooltip = g_strdup_printf (ngettext ("%'d file operation active",
					     "%'d file operations active",
					     self->priv->active_infos),
				   self->priv->active_infos);
	gtk_status_icon_set_tooltip_text (self->priv->status_icon, tooltip);
	g_free (tooltip);

	gtk_status_icon_set_visible (self->priv->status_icon, TRUE);
}